diff --git a/live2d/node_modules/.bin/gh-pages b/live2d/node_modules/.bin/gh-pages new file mode 120000 index 0000000..2ed6e6e --- /dev/null +++ b/live2d/node_modules/.bin/gh-pages @@ -0,0 +1 @@ +../gh-pages/bin/gh-pages.js \ No newline at end of file diff --git a/live2d/node_modules/.bin/gh-pages-clean b/live2d/node_modules/.bin/gh-pages-clean new file mode 120000 index 0000000..9eea96b --- /dev/null +++ b/live2d/node_modules/.bin/gh-pages-clean @@ -0,0 +1 @@ +../gh-pages/bin/gh-pages-clean.js \ No newline at end of file diff --git a/live2d/node_modules/.bin/semver b/live2d/node_modules/.bin/semver new file mode 120000 index 0000000..5aaadf4 --- /dev/null +++ b/live2d/node_modules/.bin/semver @@ -0,0 +1 @@ +../semver/bin/semver.js \ No newline at end of file diff --git a/live2d/node_modules/.package-lock.json b/live2d/node_modules/.package-lock.json new file mode 100644 index 0000000..7398693 --- /dev/null +++ b/live2d/node_modules/.package-lock.json @@ -0,0 +1,877 @@ +{ + "name": "live2d", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@pixi/constants": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-6.5.10.tgz", + "integrity": "sha512-PUF2Y9YISRu5eVrVVHhHCWpc/KmxQTg3UH8rIUs8UI9dCK41/wsPd3pEahzf7H47v7x1HCohVZcFO3XQc1bUDw==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/core": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-6.5.10.tgz", + "integrity": "sha512-Gdzp5ENypyglvsh5Gv3teUZnZnmizo4xOsL+QqmWALdFlJXJwLJMVhKVThV/q/095XR6i4Ou54oshn+m4EkuFw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/offscreencanvas": "^2019.6.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/pixijs" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/extensions": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/runner": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/ticker": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/display": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-6.5.10.tgz", + "integrity": "sha512-NxFdDDxlbH5fQkzGHraLGoTMucW9pVgXqQm13TSmkA3NWIi/SItHL4qT2SI8nmclT9Vid1VDEBCJFAbdeuQw1Q==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/extensions": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/extensions/-/extensions-6.5.10.tgz", + "integrity": "sha512-EIUGza+E+sCy3dupuIjvRK/WyVyfSzHb5XsxRaxNrPwvG1iIUIqNqZ3owLYCo4h17fJWrj/yXVufNNtUKQccWQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/loaders": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/loaders/-/loaders-6.5.10.tgz", + "integrity": "sha512-AuK7mXBmyVsDFL9DDFPB8sqP8fwQ2NOktvu98bQuJl0/p/UeK/0OAQnF3wcf3FeBv5YGXfNHL21c2DCisjKfTg==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/math": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-6.5.10.tgz", + "integrity": "sha512-fxeu7ykVbMGxGV2S3qRTupHToeo1hdWBm8ihyURn3BMqJZe2SkZEECPd5RyvIuuNUtjRnmhkZRnF3Jsz2S+L0g==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/runner": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/runner/-/runner-6.5.10.tgz", + "integrity": "sha512-4HiHp6diCmigJT/DSbnqQP62OfWKmZB7zPWMdV1AEdr4YT1QxzXAW1wHg7dkoEfyTHqZKl0tm/zcqKq/iH7tMA==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/settings": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-6.5.10.tgz", + "integrity": "sha512-ypAS5L7pQ2Qb88yQK72bXtc7sD8OrtLWNXdZ/gnw5kwSWCFaOSoqhKqJCXrR5DQtN98+RQefwbEAmMvqobhFyw==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10" + } + }, + "node_modules/@pixi/sprite": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/sprite/-/sprite-6.5.10.tgz", + "integrity": "sha512-UiK+8LgM9XQ/SBDKjRgZ8WggdOSlFRXqiWjEZVmNkiyU8HvXeFzWPRhpc8RR1zDwAUhZWKtMhF8X/ba9m+z2lg==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/display": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/ticker": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/ticker/-/ticker-6.5.10.tgz", + "integrity": "sha512-UqX1XYtzqFSirmTOy8QAK4Ccg4KkIZztrBdRPKwFSOEiKAJoGDCSBmyQBo/9aYQKGObbNnrJ7Hxv3/ucg3/1GA==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/extensions": "6.5.10", + "@pixi/settings": "6.5.10" + } + }, + "node_modules/@pixi/utils": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-6.5.10.tgz", + "integrity": "sha512-4f4qDMmAz9IoSAe08G2LAxUcEtG9jSdudfsMQT2MG+OpfToirboE6cNoO0KnLCvLzDVE/mfisiQ9uJbVA9Ssdw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/earcut": "^2.1.0", + "earcut": "^2.2.4", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/settings": "6.5.10" + } + }, + "node_modules/@types/earcut": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@types/earcut/-/earcut-2.1.4.tgz", + "integrity": "sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/offscreencanvas": { + "version": "2019.7.3", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", + "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", + "license": "MIT", + "peer": true + }, + "node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "license": "MIT", + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", + "license": "ISC", + "peer": true + }, + "node_modules/email-addresses": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", + "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==", + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", + "license": "MIT", + "peer": true + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "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-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gh-pages": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-4.0.0.tgz", + "integrity": "sha512-p8S0T3aGJc68MtwOcZusul5qPSNZCalap3NWbhRUZYu1YOdp+EjZ+4kPmRM8h3NNRdqw00yuevRjlkuSzCn7iQ==", + "license": "MIT", + "dependencies": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^8.1.0", + "globby": "^6.1.0" + }, + "bin": { + "gh-pages": "bin/gh-pages.js", + "gh-pages-clean": "bin/gh-pages-clean.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", + "peer": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pixi-live2d-display": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/pixi-live2d-display/-/pixi-live2d-display-0.4.0.tgz", + "integrity": "sha512-xeYC6y4Y0Bxe9ksWNlGFZC1rII/MPrzPQK7t1c3ubA8RhkOISIqHJl38fNumXqhGEs+yItmgDOkFT+9dsyGDjA==", + "license": "MIT", + "dependencies": { + "gh-pages": "^4.0.0" + }, + "peerDependencies": { + "@pixi/core": "^6", + "@pixi/display": "^6", + "@pixi/loaders": "^6", + "@pixi/math": "^6", + "@pixi/sprite": "^6", + "@pixi/utils": "^6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "license": "MIT", + "peer": true + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "peer": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "license": "MIT", + "peer": true, + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/live2d/node_modules/@pixi/constants/LICENSE b/live2d/node_modules/@pixi/constants/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/constants/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/README.md b/live2d/node_modules/@pixi/constants/README.md new file mode 100644 index 0000000..7b0e9e3 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/README.md @@ -0,0 +1,13 @@ +# @pixi/constants + +## Installation + +```bash +npm install @pixi/constants +``` + +## Usage + +```js +import * as constants from '@pixi/constants'; +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/dist/browser/constants.js b/live2d/node_modules/@pixi/constants/dist/browser/constants.js new file mode 100644 index 0000000..90aaf79 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/browser/constants.js @@ -0,0 +1,525 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_constants = (function (exports) { + 'use strict'; + + /** + * Different types of environments for WebGL. + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ + exports.ENV = void 0; + (function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; + })(exports.ENV || (exports.ENV = {})); + /** + * Constant to identify the Renderer Type. + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ + 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 = {})); + /** + * Bitwise OR of masks that indicate the buffers to be cleared. + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ + exports.BUFFER_BITS = void 0; + (function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; + })(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); + /** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL - + * @property {number} ADD - + * @property {number} MULTIPLY - + * @property {number} SCREEN - + * @property {number} OVERLAY - + * @property {number} DARKEN - + * @property {number} LIGHTEN - + * @property {number} COLOR_DODGE - + * @property {number} COLOR_BURN - + * @property {number} HARD_LIGHT - + * @property {number} SOFT_LIGHT - + * @property {number} DIFFERENCE - + * @property {number} EXCLUSION - + * @property {number} HUE - + * @property {number} SATURATION - + * @property {number} COLOR - + * @property {number} LUMINOSITY - + * @property {number} NORMAL_NPM - + * @property {number} ADD_NPM - + * @property {number} SCREEN_NPM - + * @property {number} NONE - + * @property {number} SRC_IN - + * @property {number} SRC_OUT - + * @property {number} SRC_ATOP - + * @property {number} DST_OVER - + * @property {number} DST_IN - + * @property {number} DST_OUT - + * @property {number} DST_ATOP - + * @property {number} SUBTRACT - + * @property {number} SRC_OVER - + * @property {number} ERASE - + * @property {number} XOR - + */ + exports.BLEND_MODES = void 0; + (function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; + })(exports.BLEND_MODES || (exports.BLEND_MODES = {})); + /** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS - + * @property {number} LINES - + * @property {number} LINE_LOOP - + * @property {number} LINE_STRIP - + * @property {number} TRIANGLES - + * @property {number} TRIANGLE_STRIP - + * @property {number} TRIANGLE_FAN - + */ + exports.DRAW_MODES = void 0; + (function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; + })(exports.DRAW_MODES || (exports.DRAW_MODES = {})); + /** + * Various GL texture/resources formats. + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} [RGBA=6408] - + * @property {number} [RGB=6407] - + * @property {number} [RG=33319] - + * @property {number} [RED=6403] - + * @property {number} [RGBA_INTEGER=36249] - + * @property {number} [RGB_INTEGER=36248] - + * @property {number} [RG_INTEGER=33320] - + * @property {number} [RED_INTEGER=36244] - + * @property {number} [ALPHA=6406] - + * @property {number} [LUMINANCE=6409] - + * @property {number} [LUMINANCE_ALPHA=6410] - + * @property {number} [DEPTH_COMPONENT=6402] - + * @property {number} [DEPTH_STENCIL=34041] - + */ + exports.FORMATS = void 0; + (function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["RG"] = 33319] = "RG"; + FORMATS[FORMATS["RED"] = 6403] = "RED"; + FORMATS[FORMATS["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER"; + FORMATS[FORMATS["RGB_INTEGER"] = 36248] = "RGB_INTEGER"; + FORMATS[FORMATS["RG_INTEGER"] = 33320] = "RG_INTEGER"; + FORMATS[FORMATS["RED_INTEGER"] = 36244] = "RED_INTEGER"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; + })(exports.FORMATS || (exports.FORMATS = {})); + /** + * Various GL target types. + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} [TEXTURE_2D=3553] - + * @property {number} [TEXTURE_CUBE_MAP=34067] - + * @property {number} [TEXTURE_2D_ARRAY=35866] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] - + */ + exports.TARGETS = void 0; + (function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; + })(exports.TARGETS || (exports.TARGETS = {})); + /** + * Various GL data format types. + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} [UNSIGNED_BYTE=5121] - + * @property {number} [UNSIGNED_SHORT=5123] - + * @property {number} [UNSIGNED_SHORT_5_6_5=33635] - + * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] - + * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] - + * @property {number} [UNSIGNED_INT=5125] - + * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] - + * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] - + * @property {number} [UNSIGNED_INT_24_8=34042] - + * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] - + * @property {number} [BYTE=5120] - + * @property {number} [SHORT=5122] - + * @property {number} [INT=5124] - + * @property {number} [FLOAT=5126] - + * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] - + * @property {number} [HALF_FLOAT=36193] - + */ + exports.TYPES = void 0; + (function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; + TYPES[TYPES["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV"; + TYPES[TYPES["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV"; + TYPES[TYPES["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8"; + TYPES[TYPES["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV"; + TYPES[TYPES["BYTE"] = 5120] = "BYTE"; + TYPES[TYPES["SHORT"] = 5122] = "SHORT"; + TYPES[TYPES["INT"] = 5124] = "INT"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; + })(exports.TYPES || (exports.TYPES = {})); + /** + * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively. + * WebGL1 works only with FLOAT. + * @memberof PIXI + * @static + * @name SAMPLER_TYPES + * @enum {number} + * @property {number} [FLOAT=0] - + * @property {number} [INT=1] - + * @property {number} [UINT=2] - + */ + exports.SAMPLER_TYPES = void 0; + (function (SAMPLER_TYPES) { + SAMPLER_TYPES[SAMPLER_TYPES["FLOAT"] = 0] = "FLOAT"; + SAMPLER_TYPES[SAMPLER_TYPES["INT"] = 1] = "INT"; + SAMPLER_TYPES[SAMPLER_TYPES["UINT"] = 2] = "UINT"; + })(exports.SAMPLER_TYPES || (exports.SAMPLER_TYPES = {})); + /** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ + exports.SCALE_MODES = void 0; + (function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; + })(exports.SCALE_MODES || (exports.SCALE_MODES = {})); + /** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ + exports.WRAP_MODES = void 0; + (function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; + })(exports.WRAP_MODES || (exports.WRAP_MODES = {})); + /** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource + * that supports buffering each level-of-detail. + */ + exports.MIPMAP_MODES = void 0; + (function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + MIPMAP_MODES[MIPMAP_MODES["ON_MANUAL"] = 3] = "ON_MANUAL"; + })(exports.MIPMAP_MODES || (exports.MIPMAP_MODES = {})); + /** + * How to treat textures with premultiplied alpha + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ + exports.ALPHA_MODES = void 0; + (function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLIED_ALPHA"] = 2] = "PREMULTIPLIED_ALPHA"; + })(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); + /** + * Configure whether filter textures are cleared after binding. + * + * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect + * this and skip clearing as an optimization. + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture. + * @property {number} CLEAR - Always clear the filter texture. + * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending. + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ + exports.CLEAR_MODES = void 0; + (function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; + })(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); + /** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ + exports.GC_MODES = void 0; + (function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; + })(exports.GC_MODES || (exports.GC_MODES = {})); + /** + * Constants that specify float precision in shaders. + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} [LOW='lowp'] - + * @property {string} [MEDIUM='mediump'] - + * @property {string} [HIGH='highp'] - + */ + exports.PRECISION = void 0; + (function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; + })(exports.PRECISION || (exports.PRECISION = {})); + /** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + * @property {number} COLOR - Color mask (RGBA) + */ + exports.MASK_TYPES = void 0; + (function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + MASK_TYPES[MASK_TYPES["COLOR"] = 4] = "COLOR"; + })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); + /** + * Bitwise OR of masks that indicate the color channels that are rendered to. + * @static + * @memberof PIXI + * @name COLOR_MASK_BITS + * @enum {number} + * @property {number} RED - Red channel. + * @property {number} GREEN - Green channel + * @property {number} BLUE - Blue channel. + * @property {number} ALPHA - Alpha channel. + */ + exports.COLOR_MASK_BITS = void 0; + (function (COLOR_MASK_BITS) { + COLOR_MASK_BITS[COLOR_MASK_BITS["RED"] = 1] = "RED"; + COLOR_MASK_BITS[COLOR_MASK_BITS["GREEN"] = 2] = "GREEN"; + COLOR_MASK_BITS[COLOR_MASK_BITS["BLUE"] = 4] = "BLUE"; + COLOR_MASK_BITS[COLOR_MASK_BITS["ALPHA"] = 8] = "ALPHA"; + })(exports.COLOR_MASK_BITS || (exports.COLOR_MASK_BITS = {})); + /** + * Constants for multi-sampling antialiasing. + * @see PIXI.Framebuffer#multisample + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ + exports.MSAA_QUALITY = void 0; + (function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; + })(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); + /** + * Constants for various buffer types in Pixi + * @see PIXI.BUFFER_TYPE + * @name BUFFER_TYPE + * @memberof PIXI + * @static + * @enum {number} + * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer + * @property {number} ARRAY_BUFFER - buffer type for using attribute data + * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects + */ + exports.BUFFER_TYPE = void 0; + (function (BUFFER_TYPE) { + BUFFER_TYPE[BUFFER_TYPE["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER"; + BUFFER_TYPE[BUFFER_TYPE["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER"; + // NOT YET SUPPORTED + BUFFER_TYPE[BUFFER_TYPE["UNIFORM_BUFFER"] = 35345] = "UNIFORM_BUFFER"; + })(exports.BUFFER_TYPE || (exports.BUFFER_TYPE = {})); + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +Object.assign(this.PIXI, _pixi_constants); +//# sourceMappingURL=constants.js.map diff --git a/live2d/node_modules/@pixi/constants/dist/browser/constants.js.map b/live2d/node_modules/@pixi/constants/dist/browser/constants.js.map new file mode 100644 index 0000000..62ec7d3 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/browser/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":["ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","COLOR_MASK_BITS","MSAA_QUALITY","BUFFER_TYPE"],"mappings":";;;;;;;;;;;IAAA;;;;;;;;;;IAUG;AACSA,yBAMX;IAND,CAAA,UAAY,GAAG,EAAA;IAGX,IAAA,GAAA,CAAA,GAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;IACZ,IAAA,GAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;IACL,IAAA,GAAA,CAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;IACV,CAAC,EANWA,WAAG,KAAHA,WAAG,GAMd,EAAA,CAAA,CAAA,CAAA;IAED;;;;;;;;;IASG;AACSC,mCAMX;IAND,CAAA,UAA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/browser/constants.min.js b/live2d/node_modules/@pixi/constants/dist/browser/constants.min.js new file mode 100644 index 0000000..015ea16 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/browser/constants.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_constants=function(E){"use strict";var _,T,R,N,A,I,S,O,L,P,U,D,M,G,C,B,F,H,Y,i;return E.ENV=void 0,(_=E.ENV||(E.ENV={}))[_.WEBGL_LEGACY=0]="WEBGL_LEGACY",_[_.WEBGL=1]="WEBGL",_[_.WEBGL2=2]="WEBGL2",E.RENDERER_TYPE=void 0,(T=E.RENDERER_TYPE||(E.RENDERER_TYPE={}))[T.UNKNOWN=0]="UNKNOWN",T[T.WEBGL=1]="WEBGL",T[T.CANVAS=2]="CANVAS",E.BUFFER_BITS=void 0,(R=E.BUFFER_BITS||(E.BUFFER_BITS={}))[R.COLOR=16384]="COLOR",R[R.DEPTH=256]="DEPTH",R[R.STENCIL=1024]="STENCIL",E.BLEND_MODES=void 0,(N=E.BLEND_MODES||(E.BLEND_MODES={}))[N.NORMAL=0]="NORMAL",N[N.ADD=1]="ADD",N[N.MULTIPLY=2]="MULTIPLY",N[N.SCREEN=3]="SCREEN",N[N.OVERLAY=4]="OVERLAY",N[N.DARKEN=5]="DARKEN",N[N.LIGHTEN=6]="LIGHTEN",N[N.COLOR_DODGE=7]="COLOR_DODGE",N[N.COLOR_BURN=8]="COLOR_BURN",N[N.HARD_LIGHT=9]="HARD_LIGHT",N[N.SOFT_LIGHT=10]="SOFT_LIGHT",N[N.DIFFERENCE=11]="DIFFERENCE",N[N.EXCLUSION=12]="EXCLUSION",N[N.HUE=13]="HUE",N[N.SATURATION=14]="SATURATION",N[N.COLOR=15]="COLOR",N[N.LUMINOSITY=16]="LUMINOSITY",N[N.NORMAL_NPM=17]="NORMAL_NPM",N[N.ADD_NPM=18]="ADD_NPM",N[N.SCREEN_NPM=19]="SCREEN_NPM",N[N.NONE=20]="NONE",N[N.SRC_OVER=0]="SRC_OVER",N[N.SRC_IN=21]="SRC_IN",N[N.SRC_OUT=22]="SRC_OUT",N[N.SRC_ATOP=23]="SRC_ATOP",N[N.DST_OVER=24]="DST_OVER",N[N.DST_IN=25]="DST_IN",N[N.DST_OUT=26]="DST_OUT",N[N.DST_ATOP=27]="DST_ATOP",N[N.ERASE=26]="ERASE",N[N.SUBTRACT=28]="SUBTRACT",N[N.XOR=29]="XOR",E.DRAW_MODES=void 0,(A=E.DRAW_MODES||(E.DRAW_MODES={}))[A.POINTS=0]="POINTS",A[A.LINES=1]="LINES",A[A.LINE_LOOP=2]="LINE_LOOP",A[A.LINE_STRIP=3]="LINE_STRIP",A[A.TRIANGLES=4]="TRIANGLES",A[A.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",A[A.TRIANGLE_FAN=6]="TRIANGLE_FAN",E.FORMATS=void 0,(I=E.FORMATS||(E.FORMATS={}))[I.RGBA=6408]="RGBA",I[I.RGB=6407]="RGB",I[I.RG=33319]="RG",I[I.RED=6403]="RED",I[I.RGBA_INTEGER=36249]="RGBA_INTEGER",I[I.RGB_INTEGER=36248]="RGB_INTEGER",I[I.RG_INTEGER=33320]="RG_INTEGER",I[I.RED_INTEGER=36244]="RED_INTEGER",I[I.ALPHA=6406]="ALPHA",I[I.LUMINANCE=6409]="LUMINANCE",I[I.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",I[I.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",I[I.DEPTH_STENCIL=34041]="DEPTH_STENCIL",E.TARGETS=void 0,(S=E.TARGETS||(E.TARGETS={}))[S.TEXTURE_2D=3553]="TEXTURE_2D",S[S.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",S[S.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",S[S.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",S[S.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",S[S.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",S[S.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",S[S.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",S[S.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",E.TYPES=void 0,(O=E.TYPES||(E.TYPES={}))[O.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",O[O.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",O[O.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",O[O.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",O[O.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",O[O.UNSIGNED_INT=5125]="UNSIGNED_INT",O[O.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",O[O.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",O[O.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",O[O.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",O[O.BYTE=5120]="BYTE",O[O.SHORT=5122]="SHORT",O[O.INT=5124]="INT",O[O.FLOAT=5126]="FLOAT",O[O.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",O[O.HALF_FLOAT=36193]="HALF_FLOAT",E.SAMPLER_TYPES=void 0,(L=E.SAMPLER_TYPES||(E.SAMPLER_TYPES={}))[L.FLOAT=0]="FLOAT",L[L.INT=1]="INT",L[L.UINT=2]="UINT",E.SCALE_MODES=void 0,(P=E.SCALE_MODES||(E.SCALE_MODES={}))[P.NEAREST=0]="NEAREST",P[P.LINEAR=1]="LINEAR",E.WRAP_MODES=void 0,(U=E.WRAP_MODES||(E.WRAP_MODES={}))[U.CLAMP=33071]="CLAMP",U[U.REPEAT=10497]="REPEAT",U[U.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",E.MIPMAP_MODES=void 0,(D=E.MIPMAP_MODES||(E.MIPMAP_MODES={}))[D.OFF=0]="OFF",D[D.POW2=1]="POW2",D[D.ON=2]="ON",D[D.ON_MANUAL=3]="ON_MANUAL",E.ALPHA_MODES=void 0,(M=E.ALPHA_MODES||(E.ALPHA_MODES={}))[M.NPM=0]="NPM",M[M.UNPACK=1]="UNPACK",M[M.PMA=2]="PMA",M[M.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",M[M.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",M[M.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",M[M.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",E.CLEAR_MODES=void 0,(G=E.CLEAR_MODES||(E.CLEAR_MODES={}))[G.NO=0]="NO",G[G.YES=1]="YES",G[G.AUTO=2]="AUTO",G[G.BLEND=0]="BLEND",G[G.CLEAR=1]="CLEAR",G[G.BLIT=2]="BLIT",E.GC_MODES=void 0,(C=E.GC_MODES||(E.GC_MODES={}))[C.AUTO=0]="AUTO",C[C.MANUAL=1]="MANUAL",E.PRECISION=void 0,(B=E.PRECISION||(E.PRECISION={})).LOW="lowp",B.MEDIUM="mediump",B.HIGH="highp",E.MASK_TYPES=void 0,(F=E.MASK_TYPES||(E.MASK_TYPES={}))[F.NONE=0]="NONE",F[F.SCISSOR=1]="SCISSOR",F[F.STENCIL=2]="STENCIL",F[F.SPRITE=3]="SPRITE",F[F.COLOR=4]="COLOR",E.COLOR_MASK_BITS=void 0,(H=E.COLOR_MASK_BITS||(E.COLOR_MASK_BITS={}))[H.RED=1]="RED",H[H.GREEN=2]="GREEN",H[H.BLUE=4]="BLUE",H[H.ALPHA=8]="ALPHA",E.MSAA_QUALITY=void 0,(Y=E.MSAA_QUALITY||(E.MSAA_QUALITY={}))[Y.NONE=0]="NONE",Y[Y.LOW=2]="LOW",Y[Y.MEDIUM=4]="MEDIUM",Y[Y.HIGH=8]="HIGH",E.BUFFER_TYPE=void 0,(i=E.BUFFER_TYPE||(E.BUFFER_TYPE={}))[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",Object.defineProperty(E,"__esModule",{value:!0}),E}({});Object.assign(this.PIXI,_pixi_constants); +//# sourceMappingURL=constants.min.js.map diff --git a/live2d/node_modules/@pixi/constants/dist/browser/constants.min.js.map b/live2d/node_modules/@pixi/constants/dist/browser/constants.min.js.map new file mode 100644 index 0000000..63b8e17 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/browser/constants.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.min.js","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":["ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","COLOR_MASK_BITS","MSAA_QUALITY","BUFFER_TYPE","exports"],"mappings":";;;;;;;qEAWA,IAAYA,EAkBAC,EAkBAC,EAiDAC,EAqDAC,EAgCAC,EAkCAC,EAqCAC,EAgCAC,EAoBAC,EAwBAC,EA2BAC,EAyBAC,EA4BAC,EA6BAC,EAkBAC,EAqBAC,EAqBAC,EAqBAC,EAoBAC,SAzgBXC,EAAApB,SAAA,GANWA,EAAAA,QAAAA,EAA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AA,IAAA,GAAA,MACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,KAAA,GAAA,OAqBHE,EAAAD,iBAAA,GAPWA,EAAAA,EAAWA,cAAXA,cAOX,KAJGA,EAAA,qBAAA,OAAA,uBACAA,EAAAA,EAAA,aAAA,OAAA,eAEAA,EAAAA,EAAA,eAAA,OAAA"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/dist/cjs/constants.js b/live2d/node_modules/@pixi/constants/dist/cjs/constants.js new file mode 100644 index 0000000..bcf7815 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/cjs/constants.js @@ -0,0 +1,518 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * Different types of environments for WebGL. + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ +exports.ENV = void 0; +(function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; +})(exports.ENV || (exports.ENV = {})); +/** + * Constant to identify the Renderer Type. + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ +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 = {})); +/** + * Bitwise OR of masks that indicate the buffers to be cleared. + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ +exports.BUFFER_BITS = void 0; +(function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; +})(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); +/** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL - + * @property {number} ADD - + * @property {number} MULTIPLY - + * @property {number} SCREEN - + * @property {number} OVERLAY - + * @property {number} DARKEN - + * @property {number} LIGHTEN - + * @property {number} COLOR_DODGE - + * @property {number} COLOR_BURN - + * @property {number} HARD_LIGHT - + * @property {number} SOFT_LIGHT - + * @property {number} DIFFERENCE - + * @property {number} EXCLUSION - + * @property {number} HUE - + * @property {number} SATURATION - + * @property {number} COLOR - + * @property {number} LUMINOSITY - + * @property {number} NORMAL_NPM - + * @property {number} ADD_NPM - + * @property {number} SCREEN_NPM - + * @property {number} NONE - + * @property {number} SRC_IN - + * @property {number} SRC_OUT - + * @property {number} SRC_ATOP - + * @property {number} DST_OVER - + * @property {number} DST_IN - + * @property {number} DST_OUT - + * @property {number} DST_ATOP - + * @property {number} SUBTRACT - + * @property {number} SRC_OVER - + * @property {number} ERASE - + * @property {number} XOR - + */ +exports.BLEND_MODES = void 0; +(function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; +})(exports.BLEND_MODES || (exports.BLEND_MODES = {})); +/** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS - + * @property {number} LINES - + * @property {number} LINE_LOOP - + * @property {number} LINE_STRIP - + * @property {number} TRIANGLES - + * @property {number} TRIANGLE_STRIP - + * @property {number} TRIANGLE_FAN - + */ +exports.DRAW_MODES = void 0; +(function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; +})(exports.DRAW_MODES || (exports.DRAW_MODES = {})); +/** + * Various GL texture/resources formats. + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} [RGBA=6408] - + * @property {number} [RGB=6407] - + * @property {number} [RG=33319] - + * @property {number} [RED=6403] - + * @property {number} [RGBA_INTEGER=36249] - + * @property {number} [RGB_INTEGER=36248] - + * @property {number} [RG_INTEGER=33320] - + * @property {number} [RED_INTEGER=36244] - + * @property {number} [ALPHA=6406] - + * @property {number} [LUMINANCE=6409] - + * @property {number} [LUMINANCE_ALPHA=6410] - + * @property {number} [DEPTH_COMPONENT=6402] - + * @property {number} [DEPTH_STENCIL=34041] - + */ +exports.FORMATS = void 0; +(function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["RG"] = 33319] = "RG"; + FORMATS[FORMATS["RED"] = 6403] = "RED"; + FORMATS[FORMATS["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER"; + FORMATS[FORMATS["RGB_INTEGER"] = 36248] = "RGB_INTEGER"; + FORMATS[FORMATS["RG_INTEGER"] = 33320] = "RG_INTEGER"; + FORMATS[FORMATS["RED_INTEGER"] = 36244] = "RED_INTEGER"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; +})(exports.FORMATS || (exports.FORMATS = {})); +/** + * Various GL target types. + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} [TEXTURE_2D=3553] - + * @property {number} [TEXTURE_CUBE_MAP=34067] - + * @property {number} [TEXTURE_2D_ARRAY=35866] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] - + */ +exports.TARGETS = void 0; +(function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; +})(exports.TARGETS || (exports.TARGETS = {})); +/** + * Various GL data format types. + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} [UNSIGNED_BYTE=5121] - + * @property {number} [UNSIGNED_SHORT=5123] - + * @property {number} [UNSIGNED_SHORT_5_6_5=33635] - + * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] - + * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] - + * @property {number} [UNSIGNED_INT=5125] - + * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] - + * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] - + * @property {number} [UNSIGNED_INT_24_8=34042] - + * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] - + * @property {number} [BYTE=5120] - + * @property {number} [SHORT=5122] - + * @property {number} [INT=5124] - + * @property {number} [FLOAT=5126] - + * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] - + * @property {number} [HALF_FLOAT=36193] - + */ +exports.TYPES = void 0; +(function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; + TYPES[TYPES["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV"; + TYPES[TYPES["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV"; + TYPES[TYPES["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8"; + TYPES[TYPES["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV"; + TYPES[TYPES["BYTE"] = 5120] = "BYTE"; + TYPES[TYPES["SHORT"] = 5122] = "SHORT"; + TYPES[TYPES["INT"] = 5124] = "INT"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; +})(exports.TYPES || (exports.TYPES = {})); +/** + * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively. + * WebGL1 works only with FLOAT. + * @memberof PIXI + * @static + * @name SAMPLER_TYPES + * @enum {number} + * @property {number} [FLOAT=0] - + * @property {number} [INT=1] - + * @property {number} [UINT=2] - + */ +exports.SAMPLER_TYPES = void 0; +(function (SAMPLER_TYPES) { + SAMPLER_TYPES[SAMPLER_TYPES["FLOAT"] = 0] = "FLOAT"; + SAMPLER_TYPES[SAMPLER_TYPES["INT"] = 1] = "INT"; + SAMPLER_TYPES[SAMPLER_TYPES["UINT"] = 2] = "UINT"; +})(exports.SAMPLER_TYPES || (exports.SAMPLER_TYPES = {})); +/** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ +exports.SCALE_MODES = void 0; +(function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; +})(exports.SCALE_MODES || (exports.SCALE_MODES = {})); +/** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ +exports.WRAP_MODES = void 0; +(function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; +})(exports.WRAP_MODES || (exports.WRAP_MODES = {})); +/** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource + * that supports buffering each level-of-detail. + */ +exports.MIPMAP_MODES = void 0; +(function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + MIPMAP_MODES[MIPMAP_MODES["ON_MANUAL"] = 3] = "ON_MANUAL"; +})(exports.MIPMAP_MODES || (exports.MIPMAP_MODES = {})); +/** + * How to treat textures with premultiplied alpha + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ +exports.ALPHA_MODES = void 0; +(function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLIED_ALPHA"] = 2] = "PREMULTIPLIED_ALPHA"; +})(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); +/** + * Configure whether filter textures are cleared after binding. + * + * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect + * this and skip clearing as an optimization. + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture. + * @property {number} CLEAR - Always clear the filter texture. + * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending. + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ +exports.CLEAR_MODES = void 0; +(function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; +})(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); +/** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ +exports.GC_MODES = void 0; +(function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; +})(exports.GC_MODES || (exports.GC_MODES = {})); +/** + * Constants that specify float precision in shaders. + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} [LOW='lowp'] - + * @property {string} [MEDIUM='mediump'] - + * @property {string} [HIGH='highp'] - + */ +exports.PRECISION = void 0; +(function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; +})(exports.PRECISION || (exports.PRECISION = {})); +/** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + * @property {number} COLOR - Color mask (RGBA) + */ +exports.MASK_TYPES = void 0; +(function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + MASK_TYPES[MASK_TYPES["COLOR"] = 4] = "COLOR"; +})(exports.MASK_TYPES || (exports.MASK_TYPES = {})); +/** + * Bitwise OR of masks that indicate the color channels that are rendered to. + * @static + * @memberof PIXI + * @name COLOR_MASK_BITS + * @enum {number} + * @property {number} RED - Red channel. + * @property {number} GREEN - Green channel + * @property {number} BLUE - Blue channel. + * @property {number} ALPHA - Alpha channel. + */ +exports.COLOR_MASK_BITS = void 0; +(function (COLOR_MASK_BITS) { + COLOR_MASK_BITS[COLOR_MASK_BITS["RED"] = 1] = "RED"; + COLOR_MASK_BITS[COLOR_MASK_BITS["GREEN"] = 2] = "GREEN"; + COLOR_MASK_BITS[COLOR_MASK_BITS["BLUE"] = 4] = "BLUE"; + COLOR_MASK_BITS[COLOR_MASK_BITS["ALPHA"] = 8] = "ALPHA"; +})(exports.COLOR_MASK_BITS || (exports.COLOR_MASK_BITS = {})); +/** + * Constants for multi-sampling antialiasing. + * @see PIXI.Framebuffer#multisample + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ +exports.MSAA_QUALITY = void 0; +(function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; +})(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); +/** + * Constants for various buffer types in Pixi + * @see PIXI.BUFFER_TYPE + * @name BUFFER_TYPE + * @memberof PIXI + * @static + * @enum {number} + * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer + * @property {number} ARRAY_BUFFER - buffer type for using attribute data + * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects + */ +exports.BUFFER_TYPE = void 0; +(function (BUFFER_TYPE) { + BUFFER_TYPE[BUFFER_TYPE["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER"; + BUFFER_TYPE[BUFFER_TYPE["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER"; + // NOT YET SUPPORTED + BUFFER_TYPE[BUFFER_TYPE["UNIFORM_BUFFER"] = 35345] = "UNIFORM_BUFFER"; +})(exports.BUFFER_TYPE || (exports.BUFFER_TYPE = {})); +//# sourceMappingURL=constants.js.map diff --git a/live2d/node_modules/@pixi/constants/dist/cjs/constants.js.map b/live2d/node_modules/@pixi/constants/dist/cjs/constants.js.map new file mode 100644 index 0000000..23c90a8 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/cjs/constants.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.js","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":["ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","COLOR_MASK_BITS","MSAA_QUALITY","BUFFER_TYPE"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;AAUG;AACSA,qBAMX;AAND,CAAA,UAAY,GAAG,EAAA;AAGX,IAAA,GAAA,CAAA,GAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAY,CAAA;AACZ,IAAA,GAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL,IAAA,GAAA,CAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACV,CAAC,EANWA,WAAG,KAAHA,WAAG,GAMd,EAAA,CAAA,CAAA,CAAA;AAED;;;;;;;;;AASG;AACSC,+BAMX;AAND,CAAA,UAAY,aAAa,EAAA;AAGrB,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/dist/cjs/constants.min.js new file mode 100644 index 0000000..351cd90 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/cjs/constants.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";var E,_,T,R,N,A,I,S,O,L,P,U,D,M,o,G,C,e,p,r;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ENV=void 0,(E=exports.ENV||(exports.ENV={}))[E.WEBGL_LEGACY=0]="WEBGL_LEGACY",E[E.WEBGL=1]="WEBGL",E[E.WEBGL2=2]="WEBGL2",exports.RENDERER_TYPE=void 0,(_=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[_.UNKNOWN=0]="UNKNOWN",_[_.WEBGL=1]="WEBGL",_[_.CANVAS=2]="CANVAS",exports.BUFFER_BITS=void 0,(T=exports.BUFFER_BITS||(exports.BUFFER_BITS={}))[T.COLOR=16384]="COLOR",T[T.DEPTH=256]="DEPTH",T[T.STENCIL=1024]="STENCIL",exports.BLEND_MODES=void 0,(R=exports.BLEND_MODES||(exports.BLEND_MODES={}))[R.NORMAL=0]="NORMAL",R[R.ADD=1]="ADD",R[R.MULTIPLY=2]="MULTIPLY",R[R.SCREEN=3]="SCREEN",R[R.OVERLAY=4]="OVERLAY",R[R.DARKEN=5]="DARKEN",R[R.LIGHTEN=6]="LIGHTEN",R[R.COLOR_DODGE=7]="COLOR_DODGE",R[R.COLOR_BURN=8]="COLOR_BURN",R[R.HARD_LIGHT=9]="HARD_LIGHT",R[R.SOFT_LIGHT=10]="SOFT_LIGHT",R[R.DIFFERENCE=11]="DIFFERENCE",R[R.EXCLUSION=12]="EXCLUSION",R[R.HUE=13]="HUE",R[R.SATURATION=14]="SATURATION",R[R.COLOR=15]="COLOR",R[R.LUMINOSITY=16]="LUMINOSITY",R[R.NORMAL_NPM=17]="NORMAL_NPM",R[R.ADD_NPM=18]="ADD_NPM",R[R.SCREEN_NPM=19]="SCREEN_NPM",R[R.NONE=20]="NONE",R[R.SRC_OVER=0]="SRC_OVER",R[R.SRC_IN=21]="SRC_IN",R[R.SRC_OUT=22]="SRC_OUT",R[R.SRC_ATOP=23]="SRC_ATOP",R[R.DST_OVER=24]="DST_OVER",R[R.DST_IN=25]="DST_IN",R[R.DST_OUT=26]="DST_OUT",R[R.DST_ATOP=27]="DST_ATOP",R[R.ERASE=26]="ERASE",R[R.SUBTRACT=28]="SUBTRACT",R[R.XOR=29]="XOR",exports.DRAW_MODES=void 0,(N=exports.DRAW_MODES||(exports.DRAW_MODES={}))[N.POINTS=0]="POINTS",N[N.LINES=1]="LINES",N[N.LINE_LOOP=2]="LINE_LOOP",N[N.LINE_STRIP=3]="LINE_STRIP",N[N.TRIANGLES=4]="TRIANGLES",N[N.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",N[N.TRIANGLE_FAN=6]="TRIANGLE_FAN",exports.FORMATS=void 0,(A=exports.FORMATS||(exports.FORMATS={}))[A.RGBA=6408]="RGBA",A[A.RGB=6407]="RGB",A[A.RG=33319]="RG",A[A.RED=6403]="RED",A[A.RGBA_INTEGER=36249]="RGBA_INTEGER",A[A.RGB_INTEGER=36248]="RGB_INTEGER",A[A.RG_INTEGER=33320]="RG_INTEGER",A[A.RED_INTEGER=36244]="RED_INTEGER",A[A.ALPHA=6406]="ALPHA",A[A.LUMINANCE=6409]="LUMINANCE",A[A.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",A[A.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",A[A.DEPTH_STENCIL=34041]="DEPTH_STENCIL",exports.TARGETS=void 0,(I=exports.TARGETS||(exports.TARGETS={}))[I.TEXTURE_2D=3553]="TEXTURE_2D",I[I.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",I[I.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",I[I.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",I[I.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",I[I.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",I[I.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",I[I.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",I[I.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",exports.TYPES=void 0,(S=exports.TYPES||(exports.TYPES={}))[S.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",S[S.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",S[S.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",S[S.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",S[S.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",S[S.UNSIGNED_INT=5125]="UNSIGNED_INT",S[S.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",S[S.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",S[S.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",S[S.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",S[S.BYTE=5120]="BYTE",S[S.SHORT=5122]="SHORT",S[S.INT=5124]="INT",S[S.FLOAT=5126]="FLOAT",S[S.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",S[S.HALF_FLOAT=36193]="HALF_FLOAT",exports.SAMPLER_TYPES=void 0,(O=exports.SAMPLER_TYPES||(exports.SAMPLER_TYPES={}))[O.FLOAT=0]="FLOAT",O[O.INT=1]="INT",O[O.UINT=2]="UINT",exports.SCALE_MODES=void 0,(L=exports.SCALE_MODES||(exports.SCALE_MODES={}))[L.NEAREST=0]="NEAREST",L[L.LINEAR=1]="LINEAR",exports.WRAP_MODES=void 0,(P=exports.WRAP_MODES||(exports.WRAP_MODES={}))[P.CLAMP=33071]="CLAMP",P[P.REPEAT=10497]="REPEAT",P[P.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",exports.MIPMAP_MODES=void 0,(U=exports.MIPMAP_MODES||(exports.MIPMAP_MODES={}))[U.OFF=0]="OFF",U[U.POW2=1]="POW2",U[U.ON=2]="ON",U[U.ON_MANUAL=3]="ON_MANUAL",exports.ALPHA_MODES=void 0,(D=exports.ALPHA_MODES||(exports.ALPHA_MODES={}))[D.NPM=0]="NPM",D[D.UNPACK=1]="UNPACK",D[D.PMA=2]="PMA",D[D.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",D[D.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",D[D.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",D[D.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",exports.CLEAR_MODES=void 0,(M=exports.CLEAR_MODES||(exports.CLEAR_MODES={}))[M.NO=0]="NO",M[M.YES=1]="YES",M[M.AUTO=2]="AUTO",M[M.BLEND=0]="BLEND",M[M.CLEAR=1]="CLEAR",M[M.BLIT=2]="BLIT",exports.GC_MODES=void 0,(o=exports.GC_MODES||(exports.GC_MODES={}))[o.AUTO=0]="AUTO",o[o.MANUAL=1]="MANUAL",exports.PRECISION=void 0,(G=exports.PRECISION||(exports.PRECISION={})).LOW="lowp",G.MEDIUM="mediump",G.HIGH="highp",exports.MASK_TYPES=void 0,(C=exports.MASK_TYPES||(exports.MASK_TYPES={}))[C.NONE=0]="NONE",C[C.SCISSOR=1]="SCISSOR",C[C.STENCIL=2]="STENCIL",C[C.SPRITE=3]="SPRITE",C[C.COLOR=4]="COLOR",exports.COLOR_MASK_BITS=void 0,(e=exports.COLOR_MASK_BITS||(exports.COLOR_MASK_BITS={}))[e.RED=1]="RED",e[e.GREEN=2]="GREEN",e[e.BLUE=4]="BLUE",e[e.ALPHA=8]="ALPHA",exports.MSAA_QUALITY=void 0,(p=exports.MSAA_QUALITY||(exports.MSAA_QUALITY={}))[p.NONE=0]="NONE",p[p.LOW=2]="LOW",p[p.MEDIUM=4]="MEDIUM",p[p.HIGH=8]="HIGH",exports.BUFFER_TYPE=void 0,(r=exports.BUFFER_TYPE||(exports.BUFFER_TYPE={}))[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"; +//# sourceMappingURL=constants.min.js.map diff --git a/live2d/node_modules/@pixi/constants/dist/cjs/constants.min.js.map b/live2d/node_modules/@pixi/constants/dist/cjs/constants.min.js.map new file mode 100644 index 0000000..9d843ae --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/cjs/constants.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.min.js","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":["ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","COLOR_MASK_BITS","MSAA_QUALITY","BUFFER_TYPE"],"mappings":";;;;;;;aAWA,IAAYA,EAkBAC,EAkBAC,EAiDAC,EAqDAC,EAgCAC,EAkCAC,EAqCAC,EAgCAC,EAoBAC,EAwBAC,EA2BAC,EAyBAC,EA4BAC,EA6BAC,EAkBAC,EAqBAC,EAqBAC,EAqBAC,EAoBAC,yDA/gBAnB,QAMXA,SAAA,GANWA,EAAAA,cAAAA,QAAAA,IAMX,KAHGA,EAAA,aAAA,GAAA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A,SACAA,EAAAA,EAAA,KAAA,GAAA,OAcQC,QAOXA,iBAAA,GAPWA,EAAAA,QAAWA,cAAXA,oBAOX,KAJGA,EAAA,qBAAA,OAAA,uBACAA,EAAAA,EAAA,aAAA,OAAA,eAEAA,EAAAA,EAAA,eAAA,OAAA"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs b/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs new file mode 100644 index 0000000..65c0b26 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var E,_,N,T,R,I,A,L,O,U,S,P,D,G,C,M,B,H,F,n;!function(E){E[E.WEBGL_LEGACY=0]="WEBGL_LEGACY",E[E.WEBGL=1]="WEBGL",E[E.WEBGL2=2]="WEBGL2"}(E||(E={})),function(E){E[E.UNKNOWN=0]="UNKNOWN",E[E.WEBGL=1]="WEBGL",E[E.CANVAS=2]="CANVAS"}(_||(_={})),function(E){E[E.COLOR=16384]="COLOR",E[E.DEPTH=256]="DEPTH",E[E.STENCIL=1024]="STENCIL"}(N||(N={})),function(E){E[E.NORMAL=0]="NORMAL",E[E.ADD=1]="ADD",E[E.MULTIPLY=2]="MULTIPLY",E[E.SCREEN=3]="SCREEN",E[E.OVERLAY=4]="OVERLAY",E[E.DARKEN=5]="DARKEN",E[E.LIGHTEN=6]="LIGHTEN",E[E.COLOR_DODGE=7]="COLOR_DODGE",E[E.COLOR_BURN=8]="COLOR_BURN",E[E.HARD_LIGHT=9]="HARD_LIGHT",E[E.SOFT_LIGHT=10]="SOFT_LIGHT",E[E.DIFFERENCE=11]="DIFFERENCE",E[E.EXCLUSION=12]="EXCLUSION",E[E.HUE=13]="HUE",E[E.SATURATION=14]="SATURATION",E[E.COLOR=15]="COLOR",E[E.LUMINOSITY=16]="LUMINOSITY",E[E.NORMAL_NPM=17]="NORMAL_NPM",E[E.ADD_NPM=18]="ADD_NPM",E[E.SCREEN_NPM=19]="SCREEN_NPM",E[E.NONE=20]="NONE",E[E.SRC_OVER=0]="SRC_OVER",E[E.SRC_IN=21]="SRC_IN",E[E.SRC_OUT=22]="SRC_OUT",E[E.SRC_ATOP=23]="SRC_ATOP",E[E.DST_OVER=24]="DST_OVER",E[E.DST_IN=25]="DST_IN",E[E.DST_OUT=26]="DST_OUT",E[E.DST_ATOP=27]="DST_ATOP",E[E.ERASE=26]="ERASE",E[E.SUBTRACT=28]="SUBTRACT",E[E.XOR=29]="XOR"}(T||(T={})),function(E){E[E.POINTS=0]="POINTS",E[E.LINES=1]="LINES",E[E.LINE_LOOP=2]="LINE_LOOP",E[E.LINE_STRIP=3]="LINE_STRIP",E[E.TRIANGLES=4]="TRIANGLES",E[E.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",E[E.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(R||(R={})),function(E){E[E.RGBA=6408]="RGBA",E[E.RGB=6407]="RGB",E[E.RG=33319]="RG",E[E.RED=6403]="RED",E[E.RGBA_INTEGER=36249]="RGBA_INTEGER",E[E.RGB_INTEGER=36248]="RGB_INTEGER",E[E.RG_INTEGER=33320]="RG_INTEGER",E[E.RED_INTEGER=36244]="RED_INTEGER",E[E.ALPHA=6406]="ALPHA",E[E.LUMINANCE=6409]="LUMINANCE",E[E.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",E[E.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",E[E.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(I||(I={})),function(E){E[E.TEXTURE_2D=3553]="TEXTURE_2D",E[E.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",E[E.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",E[E.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",E[E.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",E[E.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",E[E.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",E[E.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(A||(A={})),function(E){E[E.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",E[E.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",E[E.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",E[E.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",E[E.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",E[E.UNSIGNED_INT=5125]="UNSIGNED_INT",E[E.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",E[E.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",E[E.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",E[E.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",E[E.BYTE=5120]="BYTE",E[E.SHORT=5122]="SHORT",E[E.INT=5124]="INT",E[E.FLOAT=5126]="FLOAT",E[E.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",E[E.HALF_FLOAT=36193]="HALF_FLOAT"}(L||(L={})),function(E){E[E.FLOAT=0]="FLOAT",E[E.INT=1]="INT",E[E.UINT=2]="UINT"}(O||(O={})),function(E){E[E.NEAREST=0]="NEAREST",E[E.LINEAR=1]="LINEAR"}(U||(U={})),function(E){E[E.CLAMP=33071]="CLAMP",E[E.REPEAT=10497]="REPEAT",E[E.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(S||(S={})),function(E){E[E.OFF=0]="OFF",E[E.POW2=1]="POW2",E[E.ON=2]="ON",E[E.ON_MANUAL=3]="ON_MANUAL"}(P||(P={})),function(E){E[E.NPM=0]="NPM",E[E.UNPACK=1]="UNPACK",E[E.PMA=2]="PMA",E[E.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",E[E.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",E[E.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",E[E.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(D||(D={})),function(E){E[E.NO=0]="NO",E[E.YES=1]="YES",E[E.AUTO=2]="AUTO",E[E.BLEND=0]="BLEND",E[E.CLEAR=1]="CLEAR",E[E.BLIT=2]="BLIT"}(G||(G={})),function(E){E[E.AUTO=0]="AUTO",E[E.MANUAL=1]="MANUAL"}(C||(C={})),function(E){E.LOW="lowp",E.MEDIUM="mediump",E.HIGH="highp"}(M||(M={})),function(E){E[E.NONE=0]="NONE",E[E.SCISSOR=1]="SCISSOR",E[E.STENCIL=2]="STENCIL",E[E.SPRITE=3]="SPRITE",E[E.COLOR=4]="COLOR"}(B||(B={})),function(E){E[E.RED=1]="RED",E[E.GREEN=2]="GREEN",E[E.BLUE=4]="BLUE",E[E.ALPHA=8]="ALPHA"}(H||(H={})),function(E){E[E.NONE=0]="NONE",E[E.LOW=2]="LOW",E[E.MEDIUM=4]="MEDIUM",E[E.HIGH=8]="HIGH"}(F||(F={})),function(E){E[E.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",E[E.ARRAY_BUFFER=34962]="ARRAY_BUFFER",E[E.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(n||(n={}));export{D as ALPHA_MODES,T as BLEND_MODES,N as BUFFER_BITS,n as BUFFER_TYPE,G as CLEAR_MODES,H as COLOR_MASK_BITS,R as DRAW_MODES,E as ENV,I as FORMATS,C as GC_MODES,B as MASK_TYPES,P as MIPMAP_MODES,F as MSAA_QUALITY,M as PRECISION,_ as RENDERER_TYPE,O as SAMPLER_TYPES,U as SCALE_MODES,A as TARGETS,L as TYPES,S as WRAP_MODES}; +//# sourceMappingURL=constants.min.mjs.map diff --git a/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs.map b/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs.map new file mode 100644 index 0000000..68d5c64 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/esm/constants.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.min.mjs","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":["ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","COLOR_MASK_BITS","MSAA_QUALITY","BUFFER_TYPE"],"mappings":";;;;;;;AAWA,IAAYA,EAkBAC,EAkBAC,EAiDAC,EAqDAC,EAgCAC,EAkCAC,EAqCAC,EAgCAC,EAoBAC,EAwBAC,EA2BAC,EAyBAC,EA4BAC,EA6BAC,EAkBAC,EAqBAC,EAqBAC,EAqBAC,EAoBAC,GA/gBZ,SAAYnB,GAGRA,EAAAA,EAAA,aAAA,GAAA,eACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,OAAA,GAAA,SALJ,CAAYA,IAAAA,EAMX,KAYD,SAAYC,GAGRA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,OAAA,GAAA,SALJ,CAAYA,IAAAA,EAMX,KAYD,SAAYC,GAGRA,EAAAA,EAAA,MAAA,OAAA,QACAA,EAAAA,EAAA,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AA,GAAA,QACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,KAAA,GAAA,OARJ,CAAYA,IAAAA,EASX,KAoBD,SAAYC,GAGRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,OAAA,GAAA,SAJJ,CAAYA,IAAAA,EAKX,KAaD,SAAYC,GAGRA,EAAA,IAAA,OACAA,EAAA,OAAA,UACAA,EAAA,KAAA,QALJ,CAAYA,IAAAA,EAMX,KAeD,SAAYC,GAGRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,MAAA,GAAA,QAPJ,CAAYA,IAAAA,EAQX,KAaD,SAAYC,GAGRA,EAAAA,EAAA,IAAA,GAAA,MACAA,EAAAA,EAAA,MAAA,GAAA,QACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,MAAA,GAAA,QANJ,CAAYA,IAAAA,EAOX,KAcD,SAAYC,GAGRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,IAAA,GAAA,MACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,KAAA,GAAA,OANJ,CAAYA,IAAAA,EAOX,KAaD,SAAYC,GAGRA,EAAAA,EAAA,qBAAA,OAAA,uBACAA,EAAAA,EAAA,aAAA,OAAA,eAEAA,EAAAA,EAAA,eAAA,OAAA,iBANJ,CAAYA,IAAAA,EAOX"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs b/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs new file mode 100644 index 0000000..6b5fc6c --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs @@ -0,0 +1,516 @@ +/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +/** + * Different types of environments for WebGL. + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ +var ENV; +(function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; +})(ENV || (ENV = {})); +/** + * Constant to identify the Renderer Type. + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ +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 = {})); +/** + * Bitwise OR of masks that indicate the buffers to be cleared. + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ +var BUFFER_BITS; +(function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; +})(BUFFER_BITS || (BUFFER_BITS = {})); +/** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL - + * @property {number} ADD - + * @property {number} MULTIPLY - + * @property {number} SCREEN - + * @property {number} OVERLAY - + * @property {number} DARKEN - + * @property {number} LIGHTEN - + * @property {number} COLOR_DODGE - + * @property {number} COLOR_BURN - + * @property {number} HARD_LIGHT - + * @property {number} SOFT_LIGHT - + * @property {number} DIFFERENCE - + * @property {number} EXCLUSION - + * @property {number} HUE - + * @property {number} SATURATION - + * @property {number} COLOR - + * @property {number} LUMINOSITY - + * @property {number} NORMAL_NPM - + * @property {number} ADD_NPM - + * @property {number} SCREEN_NPM - + * @property {number} NONE - + * @property {number} SRC_IN - + * @property {number} SRC_OUT - + * @property {number} SRC_ATOP - + * @property {number} DST_OVER - + * @property {number} DST_IN - + * @property {number} DST_OUT - + * @property {number} DST_ATOP - + * @property {number} SUBTRACT - + * @property {number} SRC_OVER - + * @property {number} ERASE - + * @property {number} XOR - + */ +var BLEND_MODES; +(function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; +})(BLEND_MODES || (BLEND_MODES = {})); +/** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS - + * @property {number} LINES - + * @property {number} LINE_LOOP - + * @property {number} LINE_STRIP - + * @property {number} TRIANGLES - + * @property {number} TRIANGLE_STRIP - + * @property {number} TRIANGLE_FAN - + */ +var DRAW_MODES; +(function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; +})(DRAW_MODES || (DRAW_MODES = {})); +/** + * Various GL texture/resources formats. + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} [RGBA=6408] - + * @property {number} [RGB=6407] - + * @property {number} [RG=33319] - + * @property {number} [RED=6403] - + * @property {number} [RGBA_INTEGER=36249] - + * @property {number} [RGB_INTEGER=36248] - + * @property {number} [RG_INTEGER=33320] - + * @property {number} [RED_INTEGER=36244] - + * @property {number} [ALPHA=6406] - + * @property {number} [LUMINANCE=6409] - + * @property {number} [LUMINANCE_ALPHA=6410] - + * @property {number} [DEPTH_COMPONENT=6402] - + * @property {number} [DEPTH_STENCIL=34041] - + */ +var FORMATS; +(function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["RG"] = 33319] = "RG"; + FORMATS[FORMATS["RED"] = 6403] = "RED"; + FORMATS[FORMATS["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER"; + FORMATS[FORMATS["RGB_INTEGER"] = 36248] = "RGB_INTEGER"; + FORMATS[FORMATS["RG_INTEGER"] = 33320] = "RG_INTEGER"; + FORMATS[FORMATS["RED_INTEGER"] = 36244] = "RED_INTEGER"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; +})(FORMATS || (FORMATS = {})); +/** + * Various GL target types. + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} [TEXTURE_2D=3553] - + * @property {number} [TEXTURE_CUBE_MAP=34067] - + * @property {number} [TEXTURE_2D_ARRAY=35866] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] - + */ +var TARGETS; +(function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; +})(TARGETS || (TARGETS = {})); +/** + * Various GL data format types. + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} [UNSIGNED_BYTE=5121] - + * @property {number} [UNSIGNED_SHORT=5123] - + * @property {number} [UNSIGNED_SHORT_5_6_5=33635] - + * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] - + * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] - + * @property {number} [UNSIGNED_INT=5125] - + * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] - + * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] - + * @property {number} [UNSIGNED_INT_24_8=34042] - + * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] - + * @property {number} [BYTE=5120] - + * @property {number} [SHORT=5122] - + * @property {number} [INT=5124] - + * @property {number} [FLOAT=5126] - + * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] - + * @property {number} [HALF_FLOAT=36193] - + */ +var TYPES; +(function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; + TYPES[TYPES["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV"; + TYPES[TYPES["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV"; + TYPES[TYPES["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8"; + TYPES[TYPES["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV"; + TYPES[TYPES["BYTE"] = 5120] = "BYTE"; + TYPES[TYPES["SHORT"] = 5122] = "SHORT"; + TYPES[TYPES["INT"] = 5124] = "INT"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; +})(TYPES || (TYPES = {})); +/** + * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively. + * WebGL1 works only with FLOAT. + * @memberof PIXI + * @static + * @name SAMPLER_TYPES + * @enum {number} + * @property {number} [FLOAT=0] - + * @property {number} [INT=1] - + * @property {number} [UINT=2] - + */ +var SAMPLER_TYPES; +(function (SAMPLER_TYPES) { + SAMPLER_TYPES[SAMPLER_TYPES["FLOAT"] = 0] = "FLOAT"; + SAMPLER_TYPES[SAMPLER_TYPES["INT"] = 1] = "INT"; + SAMPLER_TYPES[SAMPLER_TYPES["UINT"] = 2] = "UINT"; +})(SAMPLER_TYPES || (SAMPLER_TYPES = {})); +/** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ +var SCALE_MODES; +(function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; +})(SCALE_MODES || (SCALE_MODES = {})); +/** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ +var WRAP_MODES; +(function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; +})(WRAP_MODES || (WRAP_MODES = {})); +/** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource + * that supports buffering each level-of-detail. + */ +var MIPMAP_MODES; +(function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + MIPMAP_MODES[MIPMAP_MODES["ON_MANUAL"] = 3] = "ON_MANUAL"; +})(MIPMAP_MODES || (MIPMAP_MODES = {})); +/** + * How to treat textures with premultiplied alpha + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ +var ALPHA_MODES; +(function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLIED_ALPHA"] = 2] = "PREMULTIPLIED_ALPHA"; +})(ALPHA_MODES || (ALPHA_MODES = {})); +/** + * Configure whether filter textures are cleared after binding. + * + * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect + * this and skip clearing as an optimization. + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture. + * @property {number} CLEAR - Always clear the filter texture. + * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending. + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ +var CLEAR_MODES; +(function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; +})(CLEAR_MODES || (CLEAR_MODES = {})); +/** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ +var GC_MODES; +(function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; +})(GC_MODES || (GC_MODES = {})); +/** + * Constants that specify float precision in shaders. + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} [LOW='lowp'] - + * @property {string} [MEDIUM='mediump'] - + * @property {string} [HIGH='highp'] - + */ +var PRECISION; +(function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; +})(PRECISION || (PRECISION = {})); +/** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + * @property {number} COLOR - Color mask (RGBA) + */ +var MASK_TYPES; +(function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + MASK_TYPES[MASK_TYPES["COLOR"] = 4] = "COLOR"; +})(MASK_TYPES || (MASK_TYPES = {})); +/** + * Bitwise OR of masks that indicate the color channels that are rendered to. + * @static + * @memberof PIXI + * @name COLOR_MASK_BITS + * @enum {number} + * @property {number} RED - Red channel. + * @property {number} GREEN - Green channel + * @property {number} BLUE - Blue channel. + * @property {number} ALPHA - Alpha channel. + */ +var COLOR_MASK_BITS; +(function (COLOR_MASK_BITS) { + COLOR_MASK_BITS[COLOR_MASK_BITS["RED"] = 1] = "RED"; + COLOR_MASK_BITS[COLOR_MASK_BITS["GREEN"] = 2] = "GREEN"; + COLOR_MASK_BITS[COLOR_MASK_BITS["BLUE"] = 4] = "BLUE"; + COLOR_MASK_BITS[COLOR_MASK_BITS["ALPHA"] = 8] = "ALPHA"; +})(COLOR_MASK_BITS || (COLOR_MASK_BITS = {})); +/** + * Constants for multi-sampling antialiasing. + * @see PIXI.Framebuffer#multisample + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ +var MSAA_QUALITY; +(function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; +})(MSAA_QUALITY || (MSAA_QUALITY = {})); +/** + * Constants for various buffer types in Pixi + * @see PIXI.BUFFER_TYPE + * @name BUFFER_TYPE + * @memberof PIXI + * @static + * @enum {number} + * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer + * @property {number} ARRAY_BUFFER - buffer type for using attribute data + * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects + */ +var BUFFER_TYPE; +(function (BUFFER_TYPE) { + BUFFER_TYPE[BUFFER_TYPE["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER"; + BUFFER_TYPE[BUFFER_TYPE["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER"; + // NOT YET SUPPORTED + BUFFER_TYPE[BUFFER_TYPE["UNIFORM_BUFFER"] = 35345] = "UNIFORM_BUFFER"; +})(BUFFER_TYPE || (BUFFER_TYPE = {})); + +export { ALPHA_MODES, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, CLEAR_MODES, COLOR_MASK_BITS, DRAW_MODES, ENV, FORMATS, GC_MODES, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, RENDERER_TYPE, SAMPLER_TYPES, SCALE_MODES, TARGETS, TYPES, WRAP_MODES }; +//# sourceMappingURL=constants.mjs.map diff --git a/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs.map b/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs.map new file mode 100644 index 0000000..a69efc1 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/dist/esm/constants.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.mjs","sources":["../../src/index.ts"],"sourcesContent":["/**\n * Different types of environments for WebGL.\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nexport enum ENV\n// eslint-disable-next-line @typescript-eslint/indent\n{\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\n/**\n * Constant to identify the Renderer Type.\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nexport enum RENDERER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nexport enum BUFFER_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL -\n * @property {number} ADD -\n * @property {number} MULTIPLY -\n * @property {number} SCREEN -\n * @property {number} OVERLAY -\n * @property {number} DARKEN -\n * @property {number} LIGHTEN -\n * @property {number} COLOR_DODGE -\n * @property {number} COLOR_BURN -\n * @property {number} HARD_LIGHT -\n * @property {number} SOFT_LIGHT -\n * @property {number} DIFFERENCE -\n * @property {number} EXCLUSION -\n * @property {number} HUE -\n * @property {number} SATURATION -\n * @property {number} COLOR -\n * @property {number} LUMINOSITY -\n * @property {number} NORMAL_NPM -\n * @property {number} ADD_NPM -\n * @property {number} SCREEN_NPM -\n * @property {number} NONE -\n * @property {number} SRC_IN -\n * @property {number} SRC_OUT -\n * @property {number} SRC_ATOP -\n * @property {number} DST_OVER -\n * @property {number} DST_IN -\n * @property {number} DST_OUT -\n * @property {number} DST_ATOP -\n * @property {number} SUBTRACT -\n * @property {number} SRC_OVER -\n * @property {number} ERASE -\n * @property {number} XOR -\n */\nexport enum BLEND_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS -\n * @property {number} LINES -\n * @property {number} LINE_LOOP -\n * @property {number} LINE_STRIP -\n * @property {number} TRIANGLES -\n * @property {number} TRIANGLE_STRIP -\n * @property {number} TRIANGLE_FAN -\n */\nexport enum DRAW_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\n/**\n * Various GL texture/resources formats.\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} [RGBA=6408] -\n * @property {number} [RGB=6407] -\n * @property {number} [RG=33319] -\n * @property {number} [RED=6403] -\n * @property {number} [RGBA_INTEGER=36249] -\n * @property {number} [RGB_INTEGER=36248] -\n * @property {number} [RG_INTEGER=33320] -\n * @property {number} [RED_INTEGER=36244] -\n * @property {number} [ALPHA=6406] -\n * @property {number} [LUMINANCE=6409] -\n * @property {number} [LUMINANCE_ALPHA=6410] -\n * @property {number} [DEPTH_COMPONENT=6402] -\n * @property {number} [DEPTH_STENCIL=34041] -\n */\nexport enum FORMATS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\n/**\n * Various GL target types.\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} [TEXTURE_2D=3553] -\n * @property {number} [TEXTURE_CUBE_MAP=34067] -\n * @property {number} [TEXTURE_2D_ARRAY=35866] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] -\n * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] -\n * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] -\n */\nexport enum TARGETS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\n/**\n * Various GL data format types.\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} [UNSIGNED_BYTE=5121] -\n * @property {number} [UNSIGNED_SHORT=5123] -\n * @property {number} [UNSIGNED_SHORT_5_6_5=33635] -\n * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] -\n * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] -\n * @property {number} [UNSIGNED_INT=5125] -\n * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] -\n * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] -\n * @property {number} [UNSIGNED_INT_24_8=34042] -\n * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] -\n * @property {number} [BYTE=5120] -\n * @property {number} [SHORT=5122] -\n * @property {number} [INT=5124] -\n * @property {number} [FLOAT=5126] -\n * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] -\n * @property {number} [HALF_FLOAT=36193] -\n */\nexport enum TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} [FLOAT=0] -\n * @property {number} [INT=1] -\n * @property {number} [UINT=2] -\n */\nexport enum SAMPLER_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nexport enum SCALE_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NEAREST,\n LINEAR,\n}\n\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nexport enum WRAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nexport enum MIPMAP_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\n/**\n * How to treat textures with premultiplied alpha\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nexport enum ALPHA_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nexport enum CLEAR_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nexport enum GC_MODES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n AUTO,\n MANUAL,\n}\n\n/**\n * Constants that specify float precision in shaders.\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} [LOW='lowp'] -\n * @property {string} [MEDIUM='mediump'] -\n * @property {string} [HIGH='highp'] -\n */\nexport enum PRECISION\n// eslint-disable-next-line @typescript-eslint/indent\n{\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n * @property {number} COLOR - Color mask (RGBA)\n */\nexport enum MASK_TYPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n COLOR = 4,\n}\n\n/**\n * Bitwise OR of masks that indicate the color channels that are rendered to.\n * @static\n * @memberof PIXI\n * @name COLOR_MASK_BITS\n * @enum {number}\n * @property {number} RED - Red channel.\n * @property {number} GREEN - Green channel\n * @property {number} BLUE - Blue channel.\n * @property {number} ALPHA - Alpha channel.\n */\nexport enum COLOR_MASK_BITS\n// eslint-disable-next-line @typescript-eslint/indent\n{\n RED = 0x1,\n GREEN = 0x2,\n BLUE = 0x4,\n ALPHA = 0x8\n}\n\n/**\n * Constants for multi-sampling antialiasing.\n * @see PIXI.Framebuffer#multisample\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nexport enum MSAA_QUALITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\n/**\n * Constants for various buffer types in Pixi\n * @see PIXI.BUFFER_TYPE\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nexport enum BUFFER_TYPE\n// eslint-disable-next-line @typescript-eslint/indent\n{\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;AAUG;AAC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AAW,EAAA;AAGnB,IAAA,WAAA,CAAA,WAAA,CAAA,sBAAA,CAAA,GAAA,KAAA,CAAA,GAAA,sBAA4B,CAAA;AAC5B,IAAA,WAAA,CAAA,WAAA,CAAA,cAAA,CAAA,GAAA,KAAA,CAAA,GAAA,cAAoB,CAAA;;AAEpB,IAAA,WAAA,CAAA,WAAA,CAAA,gBAAA,CAAA,GAAA,KAAA,CAAA,GAAA,gBAAsB,CAAA;AAC1B,CAAC,EAPW,WAAW,KAAX,WAAW,GAOtB,EAAA,CAAA,CAAA;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/constants/index.d.ts b/live2d/node_modules/@pixi/constants/index.d.ts new file mode 100644 index 0000000..30391d8 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/index.d.ts @@ -0,0 +1,506 @@ +/** + * How to treat textures with premultiplied alpha + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ +export declare enum ALPHA_MODES { + NPM = 0, + UNPACK = 1, + PMA = 2, + NO_PREMULTIPLIED_ALPHA = 0, + PREMULTIPLY_ON_UPLOAD = 1, + PREMULTIPLY_ALPHA = 2, + PREMULTIPLIED_ALPHA = 2 +} + +/** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL - + * @property {number} ADD - + * @property {number} MULTIPLY - + * @property {number} SCREEN - + * @property {number} OVERLAY - + * @property {number} DARKEN - + * @property {number} LIGHTEN - + * @property {number} COLOR_DODGE - + * @property {number} COLOR_BURN - + * @property {number} HARD_LIGHT - + * @property {number} SOFT_LIGHT - + * @property {number} DIFFERENCE - + * @property {number} EXCLUSION - + * @property {number} HUE - + * @property {number} SATURATION - + * @property {number} COLOR - + * @property {number} LUMINOSITY - + * @property {number} NORMAL_NPM - + * @property {number} ADD_NPM - + * @property {number} SCREEN_NPM - + * @property {number} NONE - + * @property {number} SRC_IN - + * @property {number} SRC_OUT - + * @property {number} SRC_ATOP - + * @property {number} DST_OVER - + * @property {number} DST_IN - + * @property {number} DST_OUT - + * @property {number} DST_ATOP - + * @property {number} SUBTRACT - + * @property {number} SRC_OVER - + * @property {number} ERASE - + * @property {number} XOR - + */ +export declare enum BLEND_MODES { + NORMAL = 0, + ADD = 1, + MULTIPLY = 2, + SCREEN = 3, + OVERLAY = 4, + DARKEN = 5, + LIGHTEN = 6, + COLOR_DODGE = 7, + COLOR_BURN = 8, + HARD_LIGHT = 9, + SOFT_LIGHT = 10, + DIFFERENCE = 11, + EXCLUSION = 12, + HUE = 13, + SATURATION = 14, + COLOR = 15, + LUMINOSITY = 16, + NORMAL_NPM = 17, + ADD_NPM = 18, + SCREEN_NPM = 19, + NONE = 20, + SRC_OVER = 0, + SRC_IN = 21, + SRC_OUT = 22, + SRC_ATOP = 23, + DST_OVER = 24, + DST_IN = 25, + DST_OUT = 26, + DST_ATOP = 27, + ERASE = 26, + SUBTRACT = 28, + XOR = 29 +} + +/** + * Bitwise OR of masks that indicate the buffers to be cleared. + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ +export declare enum BUFFER_BITS { + COLOR = 16384, + DEPTH = 256, + STENCIL = 1024 +} + +/** + * Constants for various buffer types in Pixi + * @see PIXI.BUFFER_TYPE + * @name BUFFER_TYPE + * @memberof PIXI + * @static + * @enum {number} + * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer + * @property {number} ARRAY_BUFFER - buffer type for using attribute data + * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects + */ +export declare enum BUFFER_TYPE { + ELEMENT_ARRAY_BUFFER = 34963, + ARRAY_BUFFER = 34962, + UNIFORM_BUFFER = 35345 +} + +/** + * Configure whether filter textures are cleared after binding. + * + * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect + * this and skip clearing as an optimization. + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture. + * @property {number} CLEAR - Always clear the filter texture. + * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending. + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ +export declare enum CLEAR_MODES { + NO = 0, + YES = 1, + AUTO = 2, + BLEND = 0, + CLEAR = 1, + BLIT = 2 +} + +/** + * Bitwise OR of masks that indicate the color channels that are rendered to. + * @static + * @memberof PIXI + * @name COLOR_MASK_BITS + * @enum {number} + * @property {number} RED - Red channel. + * @property {number} GREEN - Green channel + * @property {number} BLUE - Blue channel. + * @property {number} ALPHA - Alpha channel. + */ +export declare enum COLOR_MASK_BITS { + RED = 1, + GREEN = 2, + BLUE = 4, + ALPHA = 8 +} + +/** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS - + * @property {number} LINES - + * @property {number} LINE_LOOP - + * @property {number} LINE_STRIP - + * @property {number} TRIANGLES - + * @property {number} TRIANGLE_STRIP - + * @property {number} TRIANGLE_FAN - + */ +export declare enum DRAW_MODES { + POINTS = 0, + LINES = 1, + LINE_LOOP = 2, + LINE_STRIP = 3, + TRIANGLES = 4, + TRIANGLE_STRIP = 5, + TRIANGLE_FAN = 6 +} + +/** + * Different types of environments for WebGL. + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ +export declare enum ENV { + WEBGL_LEGACY = 0, + WEBGL = 1, + WEBGL2 = 2 +} + +/** + * Various GL texture/resources formats. + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} [RGBA=6408] - + * @property {number} [RGB=6407] - + * @property {number} [RG=33319] - + * @property {number} [RED=6403] - + * @property {number} [RGBA_INTEGER=36249] - + * @property {number} [RGB_INTEGER=36248] - + * @property {number} [RG_INTEGER=33320] - + * @property {number} [RED_INTEGER=36244] - + * @property {number} [ALPHA=6406] - + * @property {number} [LUMINANCE=6409] - + * @property {number} [LUMINANCE_ALPHA=6410] - + * @property {number} [DEPTH_COMPONENT=6402] - + * @property {number} [DEPTH_STENCIL=34041] - + */ +export declare enum FORMATS { + RGBA = 6408, + RGB = 6407, + RG = 33319, + RED = 6403, + RGBA_INTEGER = 36249, + RGB_INTEGER = 36248, + RG_INTEGER = 33320, + RED_INTEGER = 36244, + ALPHA = 6406, + LUMINANCE = 6409, + LUMINANCE_ALPHA = 6410, + DEPTH_COMPONENT = 6402, + DEPTH_STENCIL = 34041 +} + +/** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ +export declare enum GC_MODES { + AUTO = 0, + MANUAL = 1 +} + +/** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + * @property {number} COLOR - Color mask (RGBA) + */ +export declare enum MASK_TYPES { + NONE = 0, + SCISSOR = 1, + STENCIL = 2, + SPRITE = 3, + COLOR = 4 +} + +/** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource + * that supports buffering each level-of-detail. + */ +export declare enum MIPMAP_MODES { + OFF = 0, + POW2 = 1, + ON = 2, + ON_MANUAL = 3 +} + +/** + * Constants for multi-sampling antialiasing. + * @see PIXI.Framebuffer#multisample + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ +export declare enum MSAA_QUALITY { + NONE = 0, + LOW = 2, + MEDIUM = 4, + HIGH = 8 +} + +/** + * Constants that specify float precision in shaders. + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} [LOW='lowp'] - + * @property {string} [MEDIUM='mediump'] - + * @property {string} [HIGH='highp'] - + */ +export declare enum PRECISION { + LOW = "lowp", + MEDIUM = "mediump", + HIGH = "highp" +} + +/** + * Constant to identify the Renderer Type. + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ +export declare enum RENDERER_TYPE { + UNKNOWN = 0, + WEBGL = 1, + CANVAS = 2 +} + +/** + * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively. + * WebGL1 works only with FLOAT. + * @memberof PIXI + * @static + * @name SAMPLER_TYPES + * @enum {number} + * @property {number} [FLOAT=0] - + * @property {number} [INT=1] - + * @property {number} [UINT=2] - + */ +export declare enum SAMPLER_TYPES { + FLOAT = 0, + INT = 1, + UINT = 2 +} + +/** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ +export declare enum SCALE_MODES { + NEAREST = 0, + LINEAR = 1 +} + +/** + * Various GL target types. + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} [TEXTURE_2D=3553] - + * @property {number} [TEXTURE_CUBE_MAP=34067] - + * @property {number} [TEXTURE_2D_ARRAY=35866] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_X=34069] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_X=34070] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Y=34071] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Y=34072] - + * @property {number} [TEXTURE_CUBE_MAP_POSITIVE_Z=34073] - + * @property {number} [TEXTURE_CUBE_MAP_NEGATIVE_Z=34074] - + */ +export declare enum TARGETS { + TEXTURE_2D = 3553, + TEXTURE_CUBE_MAP = 34067, + TEXTURE_2D_ARRAY = 35866, + TEXTURE_CUBE_MAP_POSITIVE_X = 34069, + TEXTURE_CUBE_MAP_NEGATIVE_X = 34070, + TEXTURE_CUBE_MAP_POSITIVE_Y = 34071, + TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072, + TEXTURE_CUBE_MAP_POSITIVE_Z = 34073, + TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074 +} + +/** + * Various GL data format types. + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} [UNSIGNED_BYTE=5121] - + * @property {number} [UNSIGNED_SHORT=5123] - + * @property {number} [UNSIGNED_SHORT_5_6_5=33635] - + * @property {number} [UNSIGNED_SHORT_4_4_4_4=32819] - + * @property {number} [UNSIGNED_SHORT_5_5_5_1=32820] - + * @property {number} [UNSIGNED_INT=5125] - + * @property {number} [UNSIGNED_INT_10F_11F_11F_REV=35899] - + * @property {number} [UNSIGNED_INT_2_10_10_10_REV=33640] - + * @property {number} [UNSIGNED_INT_24_8=34042] - + * @property {number} [UNSIGNED_INT_5_9_9_9_REV=35902] - + * @property {number} [BYTE=5120] - + * @property {number} [SHORT=5122] - + * @property {number} [INT=5124] - + * @property {number} [FLOAT=5126] - + * @property {number} [FLOAT_32_UNSIGNED_INT_24_8_REV=36269] - + * @property {number} [HALF_FLOAT=36193] - + */ +export declare enum TYPES { + UNSIGNED_BYTE = 5121, + UNSIGNED_SHORT = 5123, + UNSIGNED_SHORT_5_6_5 = 33635, + UNSIGNED_SHORT_4_4_4_4 = 32819, + UNSIGNED_SHORT_5_5_5_1 = 32820, + UNSIGNED_INT = 5125, + UNSIGNED_INT_10F_11F_11F_REV = 35899, + UNSIGNED_INT_2_10_10_10_REV = 33640, + UNSIGNED_INT_24_8 = 34042, + UNSIGNED_INT_5_9_9_9_REV = 35902, + BYTE = 5120, + SHORT = 5122, + INT = 5124, + FLOAT = 5126, + FLOAT_32_UNSIGNED_INT_24_8_REV = 36269, + HALF_FLOAT = 36193 +} + +/** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ +export declare enum WRAP_MODES { + CLAMP = 33071, + REPEAT = 10497, + MIRRORED_REPEAT = 33648 +} + +export { } diff --git a/live2d/node_modules/@pixi/constants/package.json b/live2d/node_modules/@pixi/constants/package.json new file mode 100644 index 0000000..f46e0b6 --- /dev/null +++ b/live2d/node_modules/@pixi/constants/package.json @@ -0,0 +1,41 @@ +{ + "name": "@pixi/constants", + "version": "6.5.10", + "main": "dist/cjs/constants.js", + "module": "dist/esm/constants.mjs", + "bundle": "dist/browser/constants.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/constants.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/constants.js" + } + } + }, + "description": "Constants used across PixiJS", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/core/LICENSE b/live2d/node_modules/@pixi/core/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/core/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/README.md b/live2d/node_modules/@pixi/core/README.md new file mode 100644 index 0000000..7a551bb --- /dev/null +++ b/live2d/node_modules/@pixi/core/README.md @@ -0,0 +1,13 @@ +# @pixi/core + +## Installation + +```bash +npm install @pixi/core +``` + +## Usage + +```js +import * as core from '@pixi/core'; +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/dist/browser/core.js b/live2d/node_modules/@pixi/core/dist/browser/core.js new file mode 100644 index 0000000..5e3f5e4 --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/browser/core.js @@ -0,0 +1,10641 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_core = (function (exports, settings, constants, utils, extensions, runner, ticker, math) { + 'use strict'; + + /** + * The maximum support for using WebGL. If a device does not + * support WebGL version, for instance WebGL 2, it will still + * attempt to fallback support to WebGL 1. If you want to + * explicitly remove feature support to target a more stable + * baseline, prefer a lower environment. + * + * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} + * we disable webgl2 by default for all non-apple mobile devices. + * @static + * @name PREFER_ENV + * @memberof PIXI.settings + * @type {number} + * @default PIXI.ENV.WEBGL2 + */ + settings.settings.PREFER_ENV = utils.isMobile.any ? constants.ENV.WEBGL : constants.ENV.WEBGL2; + /** + * If set to `true`, *only* Textures and BaseTexture objects stored + * in the caches ({@link PIXI.utils.TextureCache TextureCache} and + * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be + * used when calling {@link PIXI.Texture.from Texture.from} or + * {@link PIXI.BaseTexture.from BaseTexture.from}. + * Otherwise, these `from` calls throw an exception. Using this property + * can be useful if you want to enforce preloading all assets with + * {@link PIXI.Loader Loader}. + * @static + * @name STRICT_TEXTURE_CACHE + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + settings.settings.STRICT_TEXTURE_CACHE = false; + + /** + * Collection of installed resource types, class must extend {@link PIXI.Resource}. + * @example + * class CustomResource extends PIXI.Resource { + * // MUST have source, options constructor signature + * // for auto-detected resources to be created. + * constructor(source, options) { + * super(); + * } + * upload(renderer, baseTexture, glTexture) { + * // upload with GL + * return true; + * } + * // used to auto-detect resource + * static test(source, extension) { + * return extension === 'xyz'|| source instanceof SomeClass; + * } + * } + * // Install the new resource type + * PIXI.INSTALLED.push(CustomResource); + * @memberof PIXI + * @type {Array} + * @static + * @readonly + */ + var INSTALLED = []; + /** + * Create a resource element from a single source element. This + * auto-detects which type of resource to create. All resources that + * are auto-detectable must have a static `test` method and a constructor + * with the arguments `(source, options?)`. Currently, the supported + * resources for auto-detection include: + * - {@link PIXI.ImageResource} + * - {@link PIXI.CanvasResource} + * - {@link PIXI.VideoResource} + * - {@link PIXI.SVGResource} + * - {@link PIXI.BufferResource} + * @static + * @memberof PIXI + * @function autoDetectResource + * @param {string|*} source - Resource source, this can be the URL to the resource, + * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri + * or any other resource that can be auto-detected. If not resource is + * detected, it's assumed to be an ImageResource. + * @param {object} [options] - Pass-through options to use for Resource + * @param {number} [options.width] - Width of BufferResource or SVG rasterization + * @param {number} [options.height] - Height of BufferResource or SVG rasterization + * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading + * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object + * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin + * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately + * @param {number} [options.updateFPS=0] - Video option to update how many times a second the + * texture should be updated from the video. Leave at 0 to update at every render + * @returns {PIXI.Resource} The created resource. + */ + function autoDetectResource(source, options) { + if (!source) { + return null; + } + var extension = ''; + if (typeof source === 'string') { + // search for file extension: period, 3-4 chars, then ?, # or EOL + var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); + if (result) { + extension = result[1].toLowerCase(); + } + } + for (var i = INSTALLED.length - 1; i >= 0; --i) { + var ResourcePlugin = INSTALLED[i]; + if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { + return new ResourcePlugin(source, options); + } + } + throw new Error('Unrecognized source type to auto-detect Resource'); + } + + /*! ***************************************************************************** + 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 __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + 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 __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + 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 __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __createBinding(o, m, k, k2) { + if (k2 === undefined) { k2 = k; } + o[k2] = m[k]; + } + + function __exportStar(m, exports) { + for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + 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."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __spreadArrays() { + var arguments$1 = arguments; + + for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[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 __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + + function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + } + + function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + } + + /** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * @memberof PIXI + */ + var Resource = /** @class */ (function () { + /** + * @param width - Width of the resource + * @param height - Height of the resource + */ + function Resource(width, height) { + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this._width = width; + this._height = height; + this.destroyed = false; + this.internal = false; + this.onResize = new runner.Runner('setRealSize'); + this.onUpdate = new runner.Runner('update'); + this.onError = new runner.Runner('onError'); + } + /** + * Bind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.bind = function (baseTexture) { + this.onResize.add(baseTexture); + this.onUpdate.add(baseTexture); + this.onError.add(baseTexture); + // Call a resize immediate if we already + // have the width and height of the resource + if (this._width || this._height) { + this.onResize.emit(this._width, this._height); + } + }; + /** + * Unbind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.unbind = function (baseTexture) { + this.onResize.remove(baseTexture); + this.onUpdate.remove(baseTexture); + this.onError.remove(baseTexture); + }; + /** + * Trigger a resize event + * @param width - X dimension + * @param height - Y dimension + */ + Resource.prototype.resize = function (width, height) { + if (width !== this._width || height !== this._height) { + this._width = width; + this._height = height; + this.onResize.emit(width, height); + } + }; + Object.defineProperty(Resource.prototype, "valid", { + /** + * Has been validated + * @readonly + */ + get: function () { + return !!this._width && !!this._height; + }, + enumerable: false, + configurable: true + }); + /** Has been updated trigger event. */ + Resource.prototype.update = function () { + if (!this.destroyed) { + this.onUpdate.emit(); + } + }; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @returns Handle the validate event + */ + Resource.prototype.load = function () { + return Promise.resolve(this); + }; + Object.defineProperty(Resource.prototype, "width", { + /** + * The width of the resource. + * @readonly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resource.prototype, "height", { + /** + * The height of the resource. + * @readonly + */ + get: function () { + return this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Set the style, optional to override + * @param _renderer - yeah, renderer! + * @param _baseTexture - the texture + * @param _glTexture - texture instance for this webgl context + * @returns - `true` is success + */ + Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { + return false; + }; + /** Clean up anything, this happens when destroying is ready. */ + Resource.prototype.dispose = function () { + // override + }; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + Resource.prototype.destroy = function () { + if (!this.destroyed) { + this.destroyed = true; + this.dispose(); + this.onError.removeAll(); + this.onError = null; + this.onResize.removeAll(); + this.onResize = null; + this.onUpdate.removeAll(); + this.onUpdate = null; + } + }; + /** + * Abstract, used to auto-detect resource type. + * @param {*} _source - The source object + * @param {string} _extension - The extension of source, if set + */ + Resource.test = function (_source, _extension) { + return false; + }; + return Resource; + }()); + + /** + * @interface SharedArrayBuffer + */ + /** + * Buffer resource with data of typed array. + * @memberof PIXI + */ + var BufferResource = /** @class */ (function (_super) { + __extends(BufferResource, _super); + /** + * @param source - Source buffer + * @param options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + function BufferResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + if (!width || !height) { + throw new Error('BufferResource width or height invalid'); + } + _this = _super.call(this, width, height) || this; + _this.data = source; + return _this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + /** Destroy and don't use after this. */ + BufferResource.prototype.dispose = function () { + this.data = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if + */ + BufferResource.test = function (source) { + return source instanceof Float32Array + || source instanceof Uint8Array + || source instanceof Uint32Array; + }; + return BufferResource; + }(Resource)); + + var defaultBufferOptions = { + scaleMode: constants.SCALE_MODES.NEAREST, + format: constants.FORMATS.RGBA, + alphaMode: constants.ALPHA_MODES.NPM, + }; + /** + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + * @typeParam RO - The options for constructing resource. + */ + var BaseTexture = /** @class */ (function (_super) { + __extends(BaseTexture, _super); + /** + * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - + * The current resource to use, for things that aren't Resource objects, will be converted + * into a Resource. + * @param options - Collection of options + * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture + * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture + * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type + * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha + * @param {number} [options.width=0] - Width of the texture + * @param {number} [options.height=0] - Height of the texture + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture + * @param {object} [options.resourceOptions] - Optional resource options, + * see {@link PIXI.autoDetectResource autoDetectResource} + */ + function BaseTexture(resource, options) { + if (resource === void 0) { resource = null; } + if (options === void 0) { options = null; } + var _this = _super.call(this) || this; + options = options || {}; + var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; + // Convert the resource to a Resource object + if (resource && !(resource instanceof Resource)) { + resource = autoDetectResource(resource, resourceOptions); + resource.internal = true; + } + _this.resolution = resolution || settings.settings.RESOLUTION; + _this.width = Math.round((width || 0) * _this.resolution) / _this.resolution; + _this.height = Math.round((height || 0) * _this.resolution) / _this.resolution; + _this._mipmap = mipmap !== undefined ? mipmap : settings.settings.MIPMAP_TEXTURES; + _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.settings.ANISOTROPIC_LEVEL; + _this._wrapMode = wrapMode || settings.settings.WRAP_MODE; + _this._scaleMode = scaleMode !== undefined ? scaleMode : settings.settings.SCALE_MODE; + _this.format = format || constants.FORMATS.RGBA; + _this.type = type || constants.TYPES.UNSIGNED_BYTE; + _this.target = target || constants.TARGETS.TEXTURE_2D; + _this.alphaMode = alphaMode !== undefined ? alphaMode : constants.ALPHA_MODES.UNPACK; + _this.uid = utils.uid(); + _this.touched = 0; + _this.isPowerOfTwo = false; + _this._refreshPOT(); + _this._glTextures = {}; + _this.dirtyId = 0; + _this.dirtyStyleId = 0; + _this.cacheId = null; + _this.valid = width > 0 && height > 0; + _this.textureCacheIds = []; + _this.destroyed = false; + _this.resource = null; + _this._batchEnabled = 0; + _this._batchLocation = 0; + _this.parentTextureArray = null; + /** + * Fired when a not-immediately-available source finishes loading. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when a not-immediately-available source fails to load. + * @protected + * @event PIXI.BaseTexture#error + * @param {PIXI.BaseTexture} baseTexture - Resource errored. + * @param {ErrorEvent} event - Load error event. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#update + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. + */ + /** + * Fired when BaseTexture is destroyed. + * @protected + * @event PIXI.BaseTexture#dispose + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. + */ + // Set the resource + _this.setResource(resource); + return _this; + } + Object.defineProperty(BaseTexture.prototype, "realWidth", { + /** + * Pixel width of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.width * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "realHeight", { + /** + * Pixel height of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.height * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "mipmap", { + /** + * Mipmap mode of the texture, affects downscaled images + * @default PIXI.settings.MIPMAP_TEXTURES + */ + get: function () { + return this._mipmap; + }, + set: function (value) { + if (this._mipmap !== value) { + this._mipmap = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "scaleMode", { + /** + * The scale mode to apply when scaling this texture + * @default PIXI.settings.SCALE_MODE + */ + get: function () { + return this._scaleMode; + }, + set: function (value) { + if (this._scaleMode !== value) { + this._scaleMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "wrapMode", { + /** + * How the texture wraps + * @default PIXI.settings.WRAP_MODE + */ + get: function () { + return this._wrapMode; + }, + set: function (value) { + if (this._wrapMode !== value) { + this._wrapMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + /** + * Changes style options of BaseTexture + * @param scaleMode - Pixi scalemode + * @param mipmap - enable mipmaps + * @returns - this + */ + BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { + var dirty; + if (scaleMode !== undefined && scaleMode !== this.scaleMode) { + this.scaleMode = scaleMode; + dirty = true; + } + if (mipmap !== undefined && mipmap !== this.mipmap) { + this.mipmap = mipmap; + dirty = true; + } + if (dirty) { + this.dirtyStyleId++; + } + return this; + }; + /** + * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. + * @param desiredWidth - Desired visual width + * @param desiredHeight - Desired visual height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setSize = function (desiredWidth, desiredHeight, resolution) { + resolution = resolution || this.resolution; + return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution); + }; + /** + * Sets real size of baseTexture, preserves current resolution. + * @param realWidth - Full rendered width + * @param realHeight - Full rendered height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { + this.resolution = resolution || this.resolution; + this.width = Math.round(realWidth) / this.resolution; + this.height = Math.round(realHeight) / this.resolution; + this._refreshPOT(); + this.update(); + return this; + }; + /** + * Refresh check for isPowerOfTwo texture based on size + * @private + */ + BaseTexture.prototype._refreshPOT = function () { + this.isPowerOfTwo = utils.isPow2(this.realWidth) && utils.isPow2(this.realHeight); + }; + /** + * Changes resolution + * @param resolution - res + * @returns - this + */ + BaseTexture.prototype.setResolution = function (resolution) { + var oldResolution = this.resolution; + if (oldResolution === resolution) { + return this; + } + this.resolution = resolution; + if (this.valid) { + this.width = Math.round(this.width * oldResolution) / resolution; + this.height = Math.round(this.height * oldResolution) / resolution; + this.emit('update', this); + } + this._refreshPOT(); + return this; + }; + /** + * Sets the resource if it wasn't set. Throws error if resource already present + * @param resource - that is managing this BaseTexture + * @returns - this + */ + BaseTexture.prototype.setResource = function (resource) { + if (this.resource === resource) { + return this; + } + if (this.resource) { + throw new Error('Resource can be set only once'); + } + resource.bind(this); + this.resource = resource; + return this; + }; + /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */ + BaseTexture.prototype.update = function () { + if (!this.valid) { + if (this.width > 0 && this.height > 0) { + this.valid = true; + this.emit('loaded', this); + this.emit('update', this); + } + } + else { + this.dirtyId++; + this.dirtyStyleId++; + this.emit('update', this); + } + }; + /** + * Handle errors with resources. + * @private + * @param event - Error event emitted. + */ + BaseTexture.prototype.onError = function (event) { + this.emit('error', this, event); + }; + /** + * Destroys this base texture. + * The method stops if resource doesn't want this texture to be destroyed. + * Removes texture from all caches. + */ + BaseTexture.prototype.destroy = function () { + // remove and destroy the resource + if (this.resource) { + this.resource.unbind(this); + // only destroy resourced created internally + if (this.resource.internal) { + this.resource.destroy(); + } + this.resource = null; + } + if (this.cacheId) { + delete utils.BaseTextureCache[this.cacheId]; + delete utils.TextureCache[this.cacheId]; + this.cacheId = null; + } + // finally let the WebGL renderer know.. + this.dispose(); + BaseTexture.removeFromCache(this); + this.textureCacheIds = null; + this.destroyed = true; + }; + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseTexture.prototype.dispose = function () { + this.emit('dispose', this); + }; + /** Utility function for BaseTexture|Texture cast. */ + BaseTexture.prototype.castToBaseTexture = function () { + return this; + }; + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * @static + * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The + * source to create base texture from. + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.BaseTexture} The new base texture. + */ + BaseTexture.from = function (source, options, strict) { + if (strict === void 0) { strict = settings.settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + utils.uid(); + } + cacheId = source._pixiId; + } + var baseTexture = utils.BaseTextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !baseTexture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); + } + if (!baseTexture) { + baseTexture = new BaseTexture(source, options); + baseTexture.cacheId = cacheId; + BaseTexture.addToCache(baseTexture, cacheId); + } + return baseTexture; + }; + /** + * Create a new BaseTexture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * Default properties are different from the constructor's defaults. + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default + * @returns - The resulting new BaseTexture + */ + BaseTexture.fromBuffer = function (buffer, width, height, options) { + buffer = buffer || new Float32Array(width * height * 4); + var resource = new BufferResource(buffer, { width: width, height: height }); + var type = buffer instanceof Float32Array ? constants.TYPES.FLOAT : constants.TYPES.UNSIGNED_BYTE; + return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width: width, height: height, type: type })); + }; + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + BaseTexture.addToCache = function (baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { + baseTexture.textureCacheIds.push(id); + } + if (utils.BaseTextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); + } + utils.BaseTextureCache[id] = baseTexture; + } + }; + /** + * Remove a BaseTexture from the global BaseTextureCache. + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + BaseTexture.removeFromCache = function (baseTexture) { + if (typeof baseTexture === 'string') { + var baseTextureFromCache = utils.BaseTextureCache[baseTexture]; + if (baseTextureFromCache) { + var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); + if (index > -1) { + baseTextureFromCache.textureCacheIds.splice(index, 1); + } + delete utils.BaseTextureCache[baseTexture]; + return baseTextureFromCache; + } + } + else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { + delete utils.BaseTextureCache[baseTexture.textureCacheIds[i]]; + } + baseTexture.textureCacheIds.length = 0; + return baseTexture; + } + return null; + }; + /** Global number of the texture batch, used by multi-texture renderers. */ + BaseTexture._globalBatch = 0; + return BaseTexture; + }(utils.EventEmitter)); + + /** + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource + * @memberof PIXI + */ + var AbstractMultiResource = /** @class */ (function (_super) { + __extends(AbstractMultiResource, _super); + /** + * @param length + * @param options - Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function AbstractMultiResource(length, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + _this = _super.call(this, width, height) || this; + _this.items = []; + _this.itemDirtyIds = []; + for (var i = 0; i < length; i++) { + var partTexture = new BaseTexture(); + _this.items.push(partTexture); + // -2 - first run of texture array upload + // -1 - texture item was allocated + // >=0 - texture item uploaded , in sync with items[i].dirtyId + _this.itemDirtyIds.push(-2); + } + _this.length = length; + _this._load = null; + _this.baseTexture = null; + return _this; + } + /** + * Used from ArrayResource and CubeResource constructors. + * @param resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param options - Detect options for resources + */ + AbstractMultiResource.prototype.initFromArray = function (resources, options) { + for (var i = 0; i < this.length; i++) { + if (!resources[i]) { + continue; + } + if (resources[i].castToBaseTexture) { + this.addBaseTextureAt(resources[i].castToBaseTexture(), i); + } + else if (resources[i] instanceof Resource) { + this.addResourceAt(resources[i], i); + } + else { + this.addResourceAt(autoDetectResource(resources[i], options), i); + } + } + }; + /** Destroy this BaseImageResource. */ + AbstractMultiResource.prototype.dispose = function () { + for (var i = 0, len = this.length; i < len; i++) { + this.items[i].destroy(); + } + this.items = null; + this.itemDirtyIds = null; + this._load = null; + }; + /** + * Set a resource by ID + * @param resource + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + AbstractMultiResource.prototype.addResourceAt = function (resource, index) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + // Inherit the first resource dimensions + if (resource.valid && !this.valid) { + this.resize(resource.width, resource.height); + } + this.items[index].setResource(resource); + return this; + }; + /** + * Set the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.bind = function (baseTexture) { + if (this.baseTexture !== null) { + throw new Error('Only one base texture per TextureArray is allowed'); + } + _super.prototype.bind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = baseTexture; + this.items[i].on('update', baseTexture.update, baseTexture); + } + }; + /** + * Unset the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.unbind = function (baseTexture) { + _super.prototype.unbind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = null; + this.items[i].off('update', baseTexture.update, baseTexture); + } + }; + /** + * Load all the resources simultaneously + * @returns - When load is resolved + */ + AbstractMultiResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); + // TODO: also implement load part-by-part strategy + var promises = resources.map(function (item) { return item.load(); }); + this._load = Promise.all(promises) + .then(function () { + var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; + _this.resize(realWidth, realHeight); + return Promise.resolve(_this); + }); + return this._load; + }; + return AbstractMultiResource; + }(Resource)); + + /** + * A resource that contains a number of sources. + * @memberof PIXI + */ + var ArrayResource = /** @class */ (function (_super) { + __extends(ArrayResource, _super); + /** + * @param source - Number of items in array or the collection + * of image URLs to use. Can also be resources, image elements, canvas, etc. + * @param options - Options to apply to {@link PIXI.autoDetectResource} + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function ArrayResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + var urls; + var length; + if (Array.isArray(source)) { + urls = source; + length = source.length; + } + else { + length = source; + } + _this = _super.call(this, length, { width: width, height: height }) || this; + if (urls) { + _this.initFromArray(urls, options); + } + return _this; + } + /** + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more + * @param baseTexture + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error('ArrayResource does not support RenderTexture'); + } + return this; + }; + /** + * Add binding + * @param baseTexture + */ + ArrayResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = constants.TARGETS.TEXTURE_2D_ARRAY; + }; + /** + * Upload the resources to the GPU. + * @param renderer + * @param texture + * @param glTexture + * @returns - whether texture was uploaded + */ + ArrayResource.prototype.upload = function (renderer, texture, glTexture) { + var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; + var gl = renderer.gl; + if (glTexture.dirtyId < 0) { + gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, glTexture.internalFormat, this._width, this._height, length, 0, texture.format, glTexture.type, null); + } + for (var i = 0; i < length; i++) { + var item = items[i]; + if (itemDirtyIds[i] < item.dirtyId) { + itemDirtyIds[i] = item.dirtyId; + if (item.valid) { + gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset + 0, // yoffset + i, // zoffset + item.resource.width, item.resource.height, 1, texture.format, glTexture.type, item.resource.source); + } + } + } + return true; + }; + return ArrayResource; + }(AbstractMultiResource)); + + /** + * Base for all the image/canvas resources. + * @memberof PIXI + */ + var BaseImageResource = /** @class */ (function (_super) { + __extends(BaseImageResource, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + function BaseImageResource(source) { + var _this = this; + var sourceAny = source; + var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; + var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; + _this = _super.call(this, width, height) || this; + _this.source = source; + _this.noSubImage = false; + return _this; + } + /** + * Set cross origin based detecting the url and the crossorigin + * @param element - Element to apply crossOrigin + * @param url - URL to check + * @param crossorigin - Cross origin value to use + */ + BaseImageResource.crossOrigin = function (element, url, crossorigin) { + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + element.crossOrigin = utils.determineCrossOrigin(url); + } + else if (crossorigin !== false) { + element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + }; + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional) + * @returns - true is success + */ + BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { + var gl = renderer.gl; + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + source = source || this.source; + if (source instanceof HTMLImageElement) { + if (!source.complete || source.naturalWidth === 0) { + return false; + } + } + else if (source instanceof HTMLVideoElement) { + if (source.readyState <= 1) { + return false; + } + } + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + if (!this.noSubImage + && baseTexture.target === gl.TEXTURE_2D + && glTexture.width === width + && glTexture.height === height) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source); + } + return true; + }; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + BaseImageResource.prototype.update = function () { + if (this.destroyed) { + return; + } + var source = this.source; + var width = source.naturalWidth || source.videoWidth || source.width; + var height = source.naturalHeight || source.videoHeight || source.height; + this.resize(width, height); + _super.prototype.update.call(this); + }; + /** Destroy this {@link BaseImageResource} */ + BaseImageResource.prototype.dispose = function () { + this.source = null; + }; + return BaseImageResource; + }(Resource)); + + /** + * @interface OffscreenCanvas + */ + /** + * Resource type for HTMLCanvasElement. + * @memberof PIXI + */ + var CanvasResource = /** @class */ (function (_super) { + __extends(CanvasResource, _super); + /** + * @param source - Canvas element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function CanvasResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + CanvasResource.test = function (source) { + var OffscreenCanvas = globalThis.OffscreenCanvas; + // Check for browsers that don't yet support OffscreenCanvas + if (OffscreenCanvas && source instanceof OffscreenCanvas) { + return true; + } + return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement; + }; + return CanvasResource; + }(BaseImageResource)); + + /** + * Resource for a CubeTexture which contains six resources. + * @memberof PIXI + */ + var CubeResource = /** @class */ (function (_super) { + __extends(CubeResource, _super); + /** + * @param {Array} [source] - Collection of URLs or resources + * to use as the sides of the cube. + * @param options - ImageResource options + * @param {number} [options.width] - Width of resource + * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use + */ + function CubeResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; + if (source && source.length !== CubeResource.SIDES) { + throw new Error("Invalid length. Got " + source.length + ", expected 6"); + } + _this = _super.call(this, 6, { width: width, height: height }) || this; + for (var i = 0; i < CubeResource.SIDES; i++) { + _this.items[i].target = constants.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; + } + _this.linkBaseTexture = linkBaseTexture !== false; + if (source) { + _this.initFromArray(source, options); + } + if (autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Add binding. + * @param baseTexture - parent base texture + */ + CubeResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = constants.TARGETS.TEXTURE_CUBE_MAP; + }; + CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { + if (linkBaseTexture === undefined) { + linkBaseTexture = this.linkBaseTexture; + } + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + if (!this.linkBaseTexture + || baseTexture.parentTextureArray + || Object.keys(baseTexture._glTextures).length > 0) { + // copy mode + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error("CubeResource does not support copying of renderTexture."); + } + } + else { + // link mode, the difficult one! + baseTexture.target = constants.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; + baseTexture.parentTextureArray = this.baseTexture; + this.items[index] = baseTexture; + } + if (baseTexture.valid && !this.valid) { + this.resize(baseTexture.realWidth, baseTexture.realHeight); + } + this.items[index] = baseTexture; + return this; + }; + /** + * Upload the resource + * @param renderer + * @param _baseTexture + * @param glTexture + * @returns {boolean} true is success + */ + CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { + var dirty = this.itemDirtyIds; + for (var i = 0; i < CubeResource.SIDES; i++) { + var side = this.items[i]; + if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId) { + if (side.valid && side.resource) { + side.resource.upload(renderer, side, glTexture); + dirty[i] = side.dirtyId; + } + else if (dirty[i] < -1) { + // either item is not valid yet, either its a renderTexture + // allocate the memory + renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); + dirty[i] = -1; + } + } + } + return true; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an array of 6 elements + */ + CubeResource.test = function (source) { + return Array.isArray(source) && source.length === CubeResource.SIDES; + }; + /** Number of texture sides to store for CubeResources. */ + CubeResource.SIDES = 6; + return CubeResource; + }(AbstractMultiResource)); + + /** + * Resource type for HTMLImageElement. + * @memberof PIXI + */ + var ImageResource = /** @class */ (function (_super) { + __extends(ImageResource, _super); + /** + * @param source - image source or URL + * @param options + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + function ImageResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLImageElement)) { + var imageElement = new Image(); + BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); + imageElement.src = source; + source = imageElement; + } + _this = _super.call(this, source) || this; + // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height + // to non-zero values before its loading completes if images are in a cache. + // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. + // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). + if (!source.complete && !!_this._width && !!_this._height) { + _this._width = 0; + _this._height = 0; + } + _this.url = source.src; + _this._process = null; + _this.preserveBitmap = false; + _this.createBitmap = (options.createBitmap !== undefined + ? options.createBitmap : settings.settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap; + _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; + _this.bitmap = null; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Returns a promise when image will be loaded and processed. + * @param createBitmap - whether process image into bitmap + */ + ImageResource.prototype.load = function (createBitmap) { + var _this = this; + if (this._load) { + return this._load; + } + if (createBitmap !== undefined) { + this.createBitmap = createBitmap; + } + this._load = new Promise(function (resolve, reject) { + var source = _this.source; + _this.url = source.src; + var completed = function () { + if (_this.destroyed) { + return; + } + source.onload = null; + source.onerror = null; + _this.resize(source.width, source.height); + _this._load = null; + if (_this.createBitmap) { + resolve(_this.process()); + } + else { + resolve(_this); + } + }; + if (source.complete && source.src) { + completed(); + } + else { + source.onload = completed; + source.onerror = function (event) { + // Avoids Promise freezing when resource broken + reject(event); + _this.onError.emit(event); + }; + } + }); + return this._load; + }; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * @returns - Cached promise to fill that bitmap + */ + ImageResource.prototype.process = function () { + var _this = this; + var source = this.source; + if (this._process !== null) { + return this._process; + } + if (this.bitmap !== null || !globalThis.createImageBitmap) { + return Promise.resolve(this); + } + var createImageBitmap = globalThis.createImageBitmap; + var cors = !source.crossOrigin || source.crossOrigin === 'anonymous'; + this._process = fetch(source.src, { + mode: cors ? 'cors' : 'no-cors' + }) + .then(function (r) { return r.blob(); }) + .then(function (blob) { return createImageBitmap(blob, 0, 0, source.width, source.height, { + premultiplyAlpha: _this.alphaMode === null || _this.alphaMode === constants.ALPHA_MODES.UNPACK + ? 'premultiply' : 'none', + }); }) + .then(function (bitmap) { + if (_this.destroyed) { + return Promise.reject(); + } + _this.bitmap = bitmap; + _this.update(); + _this._process = null; + return Promise.resolve(_this); + }); + return this._process; + }; + /** + * Upload the image resource to GPU. + * @param renderer - Renderer to upload to + * @param baseTexture - BaseTexture for this resource + * @param glTexture - GLTexture to use + * @returns {boolean} true is success + */ + ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { + if (typeof this.alphaMode === 'number') { + // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it + baseTexture.alphaMode = this.alphaMode; + } + if (!this.createBitmap) { + return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); + } + if (!this.bitmap) { + // yeah, ignore the output + this.process(); + if (!this.bitmap) { + return false; + } + } + _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); + if (!this.preserveBitmap) { + // checks if there are other renderers that possibly need this bitmap + var flag = true; + var glTextures = baseTexture._glTextures; + for (var key in glTextures) { + var otherTex = glTextures[key]; + if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { + flag = false; + break; + } + } + if (flag) { + if (this.bitmap.close) { + this.bitmap.close(); + } + this.bitmap = null; + } + } + return true; + }; + /** Destroys this resource. */ + ImageResource.prototype.dispose = function () { + this.source.onload = null; + this.source.onerror = null; + _super.prototype.dispose.call(this); + if (this.bitmap) { + this.bitmap.close(); + this.bitmap = null; + } + this._process = null; + this._load = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is string or HTMLImageElement + */ + ImageResource.test = function (source) { + return typeof source === 'string' || source instanceof HTMLImageElement; + }; + return ImageResource; + }(BaseImageResource)); + + /** + * Resource type for SVG elements and graphics. + * @memberof PIXI + */ + var SVGResource = /** @class */ (function (_super) { + __extends(SVGResource, _super); + /** + * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file. + * @param {object} [options] - Options to use + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. + */ + function SVGResource(sourceBase64, options) { + var _this = this; + options = options || {}; + _this = _super.call(this, settings.settings.ADAPTER.createCanvas()) || this; + _this._width = 0; + _this._height = 0; + _this.svg = sourceBase64; + _this.scale = options.scale || 1; + _this._overrideWidth = options.width; + _this._overrideHeight = options.height; + _this._resolve = null; + _this._crossorigin = options.crossorigin; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + SVGResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + this._load = new Promise(function (resolve) { + // Save this until after load is finished + _this._resolve = function () { + _this.resize(_this.source.width, _this.source.height); + resolve(_this); + }; + // Convert SVG inline string to data-uri + if (SVGResource.SVG_XML.test(_this.svg.trim())) { + if (!btoa) { + throw new Error('Your browser doesn\'t support base64 conversions.'); + } + _this.svg = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(_this.svg))); + } + _this._loadSvg(); + }); + return this._load; + }; + /** Loads an SVG image from `imageUrl` or `data URL`. */ + SVGResource.prototype._loadSvg = function () { + var _this = this; + var tempImage = new Image(); + BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin); + tempImage.src = this.svg; + tempImage.onerror = function (event) { + if (!_this._resolve) { + return; + } + tempImage.onerror = null; + _this.onError.emit(event); + }; + tempImage.onload = function () { + if (!_this._resolve) { + return; + } + var svgWidth = tempImage.width; + var svgHeight = tempImage.height; + if (!svgWidth || !svgHeight) { + throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.'); + } + // Set render size + var width = svgWidth * _this.scale; + var height = svgHeight * _this.scale; + if (_this._overrideWidth || _this._overrideHeight) { + width = _this._overrideWidth || _this._overrideHeight / svgHeight * svgWidth; + height = _this._overrideHeight || _this._overrideWidth / svgWidth * svgHeight; + } + width = Math.round(width); + height = Math.round(height); + // Create a canvas element + var canvas = _this.source; + canvas.width = width; + canvas.height = height; + canvas._pixiId = "canvas_" + utils.uid(); + // Draw the Svg to the canvas + canvas + .getContext('2d') + .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height); + _this._resolve(); + _this._resolve = null; + }; + }; + /** + * Get size from an svg string using a regular expression. + * @param svgString - a serialized svg element + * @returns - image extension + */ + SVGResource.getSize = function (svgString) { + var sizeMatch = SVGResource.SVG_SIZE.exec(svgString); + var size = {}; + if (sizeMatch) { + size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3])); + size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7])); + } + return size; + }; + /** Destroys this texture. */ + SVGResource.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this._resolve = null; + this._crossorigin = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} - If the source is a SVG source or data file + */ + SVGResource.test = function (source, extension) { + // url file extension is SVG + return extension === 'svg' + // source is SVG data-uri + || (typeof source === 'string' && source.startsWith('data:image/svg+xml')) + // source is SVG inline + || (typeof source === 'string' && SVGResource.SVG_XML.test(source)); + }; + /** + * Regular expression for SVG XML document. + * @example <?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg + * @readonly + */ + SVGResource.SVG_XML = /^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len + return SVGResource; + }(BaseImageResource)); + + /** + * Resource type for {@code HTMLVideoElement}. + * @memberof PIXI + */ + var VideoResource = /** @class */ (function (_super) { + __extends(VideoResource, _super); + /** + * @param {HTMLVideoElement|object|string|Array} source - Video element to use. + * @param {object} [options] - Options to use + * @param {boolean} [options.autoLoad=true] - Start loading the video immediately + * @param {boolean} [options.autoPlay=true] - Start playing video immediately + * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. + * Leave at 0 to update at every render. + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + */ + function VideoResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLVideoElement)) { + var videoElement = document.createElement('video'); + // workaround for https://github.com/pixijs/pixi.js/issues/5996 + videoElement.setAttribute('preload', 'auto'); + videoElement.setAttribute('webkit-playsinline', ''); + videoElement.setAttribute('playsinline', ''); + if (typeof source === 'string') { + source = [source]; + } + var firstSrc = source[0].src || source[0]; + BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); + // array of objects or strings + for (var i = 0; i < source.length; ++i) { + var sourceElement = document.createElement('source'); + var _a = source[i], src = _a.src, mime = _a.mime; + src = src || source[i]; + var baseSrc = src.split('?').shift().toLowerCase(); + var ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1); + mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; + sourceElement.src = src; + sourceElement.type = mime; + videoElement.appendChild(sourceElement); + } + // Override the source + source = videoElement; + } + _this = _super.call(this, source) || this; + _this.noSubImage = true; + _this._autoUpdate = true; + _this._isConnectedToTicker = false; + _this._updateFPS = options.updateFPS || 0; + _this._msToNextUpdate = 0; + _this.autoPlay = options.autoPlay !== false; + _this._load = null; + _this._resolve = null; + // Bind for listeners + _this._onCanPlay = _this._onCanPlay.bind(_this); + _this._onError = _this._onError.bind(_this); + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Trigger updating of the texture. + * @param _deltaTime - time delta since last tick + */ + VideoResource.prototype.update = function (_deltaTime) { + if (_deltaTime === void 0) { _deltaTime = 0; } + if (!this.destroyed) { + // account for if video has had its playbackRate changed + var elapsedMS = ticker.Ticker.shared.elapsedMS * this.source.playbackRate; + this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); + if (!this._updateFPS || this._msToNextUpdate <= 0) { + _super.prototype.update.call(this); + this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; + } + } + }; + /** + * Start preloading the video resource. + * @returns {Promise} Handle the validate event + */ + VideoResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var source = this.source; + if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) + && source.width && source.height) { + source.complete = true; + } + source.addEventListener('play', this._onPlayStart.bind(this)); + source.addEventListener('pause', this._onPlayStop.bind(this)); + if (!this._isSourceReady()) { + source.addEventListener('canplay', this._onCanPlay); + source.addEventListener('canplaythrough', this._onCanPlay); + source.addEventListener('error', this._onError, true); + } + else { + this._onCanPlay(); + } + this._load = new Promise(function (resolve) { + if (_this.valid) { + resolve(_this); + } + else { + _this._resolve = resolve; + source.load(); + } + }); + return this._load; + }; + /** + * Handle video error events. + * @param event + */ + VideoResource.prototype._onError = function (event) { + this.source.removeEventListener('error', this._onError, true); + this.onError.emit(event); + }; + /** + * Returns true if the underlying source is playing. + * @returns - True if playing. + */ + VideoResource.prototype._isSourcePlaying = function () { + var source = this.source; + return (!source.paused && !source.ended && this._isSourceReady()); + }; + /** + * Returns true if the underlying source is ready for playing. + * @returns - True if ready. + */ + VideoResource.prototype._isSourceReady = function () { + var source = this.source; + return source.readyState > 2; + }; + /** Runs the update loop when the video is ready to play. */ + VideoResource.prototype._onPlayStart = function () { + // Just in case the video has not received its can play even yet.. + if (!this.valid) { + this._onCanPlay(); + } + if (this.autoUpdate && !this._isConnectedToTicker) { + ticker.Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + }; + /** Fired when a pause event is triggered, stops the update loop. */ + VideoResource.prototype._onPlayStop = function () { + if (this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + }; + /** Fired when the video is loaded and ready to play. */ + VideoResource.prototype._onCanPlay = function () { + var source = this.source; + source.removeEventListener('canplay', this._onCanPlay); + source.removeEventListener('canplaythrough', this._onCanPlay); + var valid = this.valid; + this.resize(source.videoWidth, source.videoHeight); + // prevent multiple loaded dispatches.. + if (!valid && this._resolve) { + this._resolve(this); + this._resolve = null; + } + if (this._isSourcePlaying()) { + this._onPlayStart(); + } + else if (this.autoPlay) { + source.play(); + } + }; + /** Destroys this texture. */ + VideoResource.prototype.dispose = function () { + if (this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + var source = this.source; + if (source) { + source.removeEventListener('error', this._onError, true); + source.pause(); + source.src = ''; + source.load(); + } + _super.prototype.dispose.call(this); + }; + Object.defineProperty(VideoResource.prototype, "autoUpdate", { + /** Should the base texture automatically update itself, set to true by default. */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { + ticker.Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VideoResource.prototype, "updateFPS", { + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + */ + get: function () { + return this._updateFPS; + }, + set: function (value) { + if (value !== this._updateFPS) { + this._updateFPS = value; + } + }, + enumerable: false, + configurable: true + }); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} `true` if video source + */ + VideoResource.test = function (source, extension) { + return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement) + || VideoResource.TYPES.indexOf(extension) > -1; + }; + /** + * List of common video file extensions supported by VideoResource. + * @readonly + */ + VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @readonly + */ + VideoResource.MIME_TYPES = { + ogv: 'video/ogg', + mov: 'video/quicktime', + m4v: 'video/mp4', + }; + return VideoResource; + }(BaseImageResource)); + + /** + * Resource type for ImageBitmap. + * @memberof PIXI + */ + var ImageBitmapResource = /** @class */ (function (_super) { + __extends(ImageBitmapResource, _super); + /** + * @param source - Image element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function ImageBitmapResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an ImageBitmap + */ + ImageBitmapResource.test = function (source) { + return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap; + }; + return ImageBitmapResource; + }(BaseImageResource)); + + INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); + + var _resources = { + __proto__: null, + Resource: Resource, + BaseImageResource: BaseImageResource, + INSTALLED: INSTALLED, + autoDetectResource: autoDetectResource, + AbstractMultiResource: AbstractMultiResource, + ArrayResource: ArrayResource, + BufferResource: BufferResource, + CanvasResource: CanvasResource, + CubeResource: CubeResource, + ImageResource: ImageResource, + SVGResource: SVGResource, + VideoResource: VideoResource, + ImageBitmapResource: ImageBitmapResource + }; + + /** + * Resource type for DepthTexture. + * @memberof PIXI + */ + var DepthResource = /** @class */ (function (_super) { + __extends(DepthResource, _super); + function DepthResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + return DepthResource; + }(BufferResource)); + + /** + * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses + * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer. + * + * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES. + * @memberof PIXI + */ + var Framebuffer = /** @class */ (function () { + /** + * @param width - Width of the frame buffer + * @param height - Height of the frame buffer + */ + function Framebuffer(width, height) { + this.width = Math.round(width || 100); + this.height = Math.round(height || 100); + this.stencil = false; + this.depth = false; + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + this.depthTexture = null; + this.colorTextures = []; + this.glFramebuffers = {}; + this.disposeRunner = new runner.Runner('disposeFramebuffer'); + this.multisample = constants.MSAA_QUALITY.NONE; + } + Object.defineProperty(Framebuffer.prototype, "colorTexture", { + /** + * Reference to the colorTexture. + * @readonly + */ + get: function () { + return this.colorTextures[0]; + }, + enumerable: false, + configurable: true + }); + /** + * Add texture to the colorTexture array. + * @param index - Index of the array to add the texture to + * @param texture - Texture to add to the array + */ + Framebuffer.prototype.addColorTexture = function (index, texture) { + if (index === void 0) { index = 0; } + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index] = texture || new BaseTexture(null, { + scaleMode: constants.SCALE_MODES.NEAREST, + resolution: 1, + mipmap: constants.MIPMAP_MODES.OFF, + width: this.width, + height: this.height, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Add a depth texture to the frame buffer. + * @param texture - Texture to add. + */ + Framebuffer.prototype.addDepthTexture = function (texture) { + /* eslint-disable max-len */ + this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { + scaleMode: constants.SCALE_MODES.NEAREST, + resolution: 1, + width: this.width, + height: this.height, + mipmap: constants.MIPMAP_MODES.OFF, + format: constants.FORMATS.DEPTH_COMPONENT, + type: constants.TYPES.UNSIGNED_SHORT, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable depth on the frame buffer. */ + Framebuffer.prototype.enableDepth = function () { + this.depth = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable stencil on the frame buffer. */ + Framebuffer.prototype.enableStencil = function () { + this.stencil = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Resize the frame buffer + * @param width - Width of the frame buffer to resize to + * @param height - Height of the frame buffer to resize to + */ + Framebuffer.prototype.resize = function (width, height) { + width = Math.round(width); + height = Math.round(height); + if (width === this.width && height === this.height) + { return; } + this.width = width; + this.height = height; + this.dirtyId++; + this.dirtySize++; + for (var i = 0; i < this.colorTextures.length; i++) { + var texture = this.colorTextures[i]; + var resolution = texture.resolution; + // take into account the fact the texture may have a different resolution.. + texture.setSize(width / resolution, height / resolution); + } + if (this.depthTexture) { + var resolution = this.depthTexture.resolution; + this.depthTexture.setSize(width / resolution, height / resolution); + } + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Framebuffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys and removes the depth texture added to this framebuffer. */ + Framebuffer.prototype.destroyDepthTexture = function () { + if (this.depthTexture) { + this.depthTexture.destroy(); + this.depthTexture = null; + ++this.dirtyId; + ++this.dirtyFormat; + } + }; + return Framebuffer; + }()); + + /** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ + var BaseRenderTexture = /** @class */ (function (_super) { + __extends(BaseRenderTexture, _super); + /** + * @param options + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} + * for possible values. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio + * of the texture being generated. + * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer. + */ + function BaseRenderTexture(options) { + if (options === void 0) { options = {}; } + var _this = this; + if (typeof options === 'number') { + /* eslint-disable prefer-rest-params */ + // Backward compatibility of signature + var width = arguments[0]; + var height = arguments[1]; + var scaleMode = arguments[2]; + var resolution = arguments[3]; + options = { width: width, height: height, scaleMode: scaleMode, resolution: resolution }; + /* eslint-enable prefer-rest-params */ + } + options.width = options.width || 100; + options.height = options.height || 100; + options.multisample = options.multisample !== undefined ? options.multisample : constants.MSAA_QUALITY.NONE; + _this = _super.call(this, null, options) || this; + // Set defaults + _this.mipmap = constants.MIPMAP_MODES.OFF; + _this.valid = true; + _this.clearColor = [0, 0, 0, 0]; + _this.framebuffer = new Framebuffer(_this.realWidth, _this.realHeight) + .addColorTexture(0, _this); + _this.framebuffer.multisample = options.multisample; + // TODO - could this be added the systems? + _this.maskStack = []; + _this.filterStack = [{}]; + return _this; + } + /** + * Resizes the BaseRenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + */ + BaseRenderTexture.prototype.resize = function (desiredWidth, desiredHeight) { + this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution); + this.setRealSize(this.framebuffer.width, this.framebuffer.height); + }; + /** + * Frees the texture and framebuffer from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseRenderTexture.prototype.dispose = function () { + this.framebuffer.dispose(); + _super.prototype.dispose.call(this); + }; + /** Destroys this texture. */ + BaseRenderTexture.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.framebuffer.destroyDepthTexture(); + this.framebuffer = null; + }; + return BaseRenderTexture; + }(BaseTexture)); + + /** + * Stores a texture's frame in UV coordinates, in + * which everything lies in the rectangle `[(0,0), (1,0), + * (1,1), (0,1)]`. + * + * | Corner | Coordinates | + * |--------------|-------------| + * | Top-Left | `(x0,y0)` | + * | Top-Right | `(x1,y1)` | + * | Bottom-Right | `(x2,y2)` | + * | Bottom-Left | `(x3,y3)` | + * @protected + * @memberof PIXI + */ + var TextureUvs = /** @class */ (function () { + function TextureUvs() { + this.x0 = 0; + this.y0 = 0; + this.x1 = 1; + this.y1 = 0; + this.x2 = 1; + this.y2 = 1; + this.x3 = 0; + this.y3 = 1; + this.uvsFloat32 = new Float32Array(8); + } + /** + * Sets the texture Uvs based on the given frame information. + * @protected + * @param frame - The frame of the texture + * @param baseFrame - The base frame of the texture + * @param rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + TextureUvs.prototype.set = function (frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + // coordinates of center + var cX = (frame.x / tw) + w2; + var cY = (frame.y / th) + h2; + rotate = math.groupD8.add(rotate, math.groupD8.NW); // NW is top-left corner + this.x0 = cX + (w2 * math.groupD8.uX(rotate)); + this.y0 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + (w2 * math.groupD8.uX(rotate)); + this.y1 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + this.x2 = cX + (w2 * math.groupD8.uX(rotate)); + this.y2 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + this.x3 = cX + (w2 * math.groupD8.uX(rotate)); + this.y3 = cY + (h2 * math.groupD8.uY(rotate)); + } + else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + this.uvsFloat32[0] = this.x0; + this.uvsFloat32[1] = this.y0; + this.uvsFloat32[2] = this.x1; + this.uvsFloat32[3] = this.y1; + this.uvsFloat32[4] = this.x2; + this.uvsFloat32[5] = this.y2; + this.uvsFloat32[6] = this.x3; + this.uvsFloat32[7] = this.y3; + }; + TextureUvs.prototype.toString = function () { + return "[@pixi/core:TextureUvs " + + ("x0=" + this.x0 + " y0=" + this.y0 + " ") + + ("x1=" + this.x1 + " y1=" + this.y1 + " x2=" + this.x2 + " ") + + ("y2=" + this.y2 + " x3=" + this.x3 + " y3=" + this.y3) + + "]"; + }; + return TextureUvs; + }()); + + var DEFAULT_UVS = new TextureUvs(); + /** + * Used to remove listeners from WHITE and EMPTY Textures + * @ignore + */ + function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() { }; + tex.on = function _emptyOn() { }; + tex.once = function _emptyOnce() { }; + tex.emit = function _emptyEmit() { }; + } + /** + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.from('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: + * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.from('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + */ + var Texture = /** @class */ (function (_super) { + __extends(Texture, _super); + /** + * @param baseTexture - The base texture source to create the texture from + * @param frame - The rectangle frame of the texture to show + * @param orig - The area of original texture + * @param trim - Trimmed rectangle of original texture + * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param anchor - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + var _this = _super.call(this) || this; + _this.noFrame = false; + if (!frame) { + _this.noFrame = true; + frame = new math.Rectangle(0, 0, 1, 1); + } + if (baseTexture instanceof Texture) { + baseTexture = baseTexture.baseTexture; + } + _this.baseTexture = baseTexture; + _this._frame = frame; + _this.trim = trim; + _this.valid = false; + _this._uvs = DEFAULT_UVS; + _this.uvMatrix = null; + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + _this._rotate = Number(rotate || 0); + if (rotate === true) { + // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures + _this._rotate = 2; + } + else if (_this._rotate % 2 !== 0) { + throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); + } + _this.defaultAnchor = anchor ? new math.Point(anchor.x, anchor.y) : new math.Point(0, 0); + _this._updateID = 0; + _this.textureCacheIds = []; + if (!baseTexture.valid) { + baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); + } + else if (_this.noFrame) { + // if there is no frame we should monitor for any base texture changes.. + if (baseTexture.valid) { + _this.onBaseTextureUpdated(baseTexture); + } + } + else { + _this.frame = frame; + } + if (_this.noFrame) { + baseTexture.on('update', _this.onBaseTextureUpdated, _this); + } + return _this; + } + /** + * Updates this texture on the gpu. + * + * Calls the TextureResource update. + * + * If you adjusted `frame` manually, please call `updateUvs()` instead. + */ + Texture.prototype.update = function () { + if (this.baseTexture.resource) { + this.baseTexture.resource.update(); + } + }; + /** + * Called when the base texture is updated + * @protected + * @param baseTexture - The base texture. + */ + Texture.prototype.onBaseTextureUpdated = function (baseTexture) { + if (this.noFrame) { + if (!this.baseTexture.valid) { + return; + } + this._frame.width = baseTexture.width; + this._frame.height = baseTexture.height; + this.valid = true; + this.updateUvs(); + } + else { + // TODO this code looks confusing.. boo to abusing getters and setters! + // if user gave us frame that has bigger size than resized texture it can be a problem + this.frame = this._frame; + } + this.emit('update', this); + }; + /** + * Destroys this texture + * @param [destroyBase=false] - Whether to destroy the base texture as well + */ + Texture.prototype.destroy = function (destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + var resource = this.baseTexture.resource; + // delete the texture if it exists in the texture cache.. + // this only needs to be removed if the base texture is actually destroyed too.. + if (resource && resource.url && utils.TextureCache[resource.url]) { + Texture.removeFromCache(resource.url); + } + this.baseTexture.destroy(); + } + this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); + this.baseTexture.off('update', this.onBaseTextureUpdated, this); + this.baseTexture = null; + } + this._frame = null; + this._uvs = null; + this.trim = null; + this.orig = null; + this.valid = false; + Texture.removeFromCache(this); + this.textureCacheIds = null; + }; + /** + * Creates a new texture object that acts the same as this one. + * @returns - The new texture + */ + Texture.prototype.clone = function () { + var clonedFrame = this._frame.clone(); + var clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone(); + var clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); + if (this.noFrame) { + clonedTexture._frame = clonedFrame; + } + return clonedTexture; + }; + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + * Call it after changing the frame + */ + Texture.prototype.updateUvs = function () { + if (this._uvs === DEFAULT_UVS) { + this._uvs = new TextureUvs(); + } + this._uvs.set(this._frame, this.baseTexture, this.rotate); + this._updateID++; + }; + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - + * Source or array of sources to create texture from + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.Texture} The newly created texture + */ + Texture.from = function (source, options, strict) { + if (options === void 0) { options = {}; } + if (strict === void 0) { strict = settings.settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else if (source instanceof BaseTexture) { + if (!source.cacheId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source.cacheId = prefix + "-" + utils.uid(); + BaseTexture.addToCache(source, source.cacheId); + } + cacheId = source.cacheId; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + utils.uid(); + } + cacheId = source._pixiId; + } + var texture = utils.TextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !texture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); + } + if (!texture && !(source instanceof BaseTexture)) { + if (!options.resolution) { + options.resolution = utils.getResolutionOfUrl(source); + } + texture = new Texture(new BaseTexture(source, options)); + texture.baseTexture.cacheId = cacheId; + BaseTexture.addToCache(texture.baseTexture, cacheId); + Texture.addToCache(texture, cacheId); + } + else if (!texture && (source instanceof BaseTexture)) { + texture = new Texture(source); + Texture.addToCache(texture, cacheId); + } + // lets assume its a base texture! + return texture; + }; + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param url - The remote URL or array of URLs to load. + * @param options - Optional options to include + * @returns - A Promise that resolves to a Texture. + */ + Texture.fromURL = function (url, options) { + var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); + var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); + var resource = texture.baseTexture.resource; + // The texture was already loaded + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // Manually load the texture, this should allow users to handle load errors + return resource.load().then(function () { return Promise.resolve(texture); }); + }; + /** + * Create a new Texture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns - The resulting new BaseTexture + */ + Texture.fromBuffer = function (buffer, width, height, options) { + return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); + }; + /** + * Create a texture from a source and add to the cache. + * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source. + * @param imageUrl - File name of texture, for cache and resolving resolution. + * @param name - Human readable name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @param options + * @returns - Output texture + */ + Texture.fromLoader = function (source, imageUrl, name, options) { + var baseTexture = new BaseTexture(source, Object.assign({ + scaleMode: settings.settings.SCALE_MODE, + resolution: utils.getResolutionOfUrl(imageUrl), + }, options)); + var resource = baseTexture.resource; + if (resource instanceof ImageResource) { + resource.url = imageUrl; + } + var texture = new Texture(baseTexture); + // No name, use imageUrl instead + if (!name) { + name = imageUrl; + } + // lets also add the frame to pixi's global cache for 'fromLoader' function + BaseTexture.addToCache(texture.baseTexture, name); + Texture.addToCache(texture, name); + // also add references by url if they are different. + if (name !== imageUrl) { + BaseTexture.addToCache(texture.baseTexture, imageUrl); + Texture.addToCache(texture, imageUrl); + } + // Generally images are valid right away + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // SVG assets need to be parsed async, let's wait + return new Promise(function (resolve) { + texture.baseTexture.once('loaded', function () { return resolve(texture); }); + }); + }; + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * @param texture - The Texture to add to the cache. + * @param id - The id that the Texture will be stored against. + */ + Texture.addToCache = function (texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { + texture.textureCacheIds.push(id); + } + if (utils.TextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); + } + utils.TextureCache[id] = texture; + } + }; + /** + * Remove a Texture from the global TextureCache. + * @param texture - id of a Texture to be removed, or a Texture instance itself + * @returns - The Texture that was removed + */ + Texture.removeFromCache = function (texture) { + if (typeof texture === 'string') { + var textureFromCache = utils.TextureCache[texture]; + if (textureFromCache) { + var index = textureFromCache.textureCacheIds.indexOf(texture); + if (index > -1) { + textureFromCache.textureCacheIds.splice(index, 1); + } + delete utils.TextureCache[texture]; + return textureFromCache; + } + } + else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { + // Check that texture matches the one being passed in before deleting it from the cache. + if (utils.TextureCache[texture.textureCacheIds[i]] === texture) { + delete utils.TextureCache[texture.textureCacheIds[i]]; + } + } + texture.textureCacheIds.length = 0; + return texture; + } + return null; + }; + Object.defineProperty(Texture.prototype, "resolution", { + /** + * Returns resolution of baseTexture + * @readonly + */ + get: function () { + return this.baseTexture.resolution; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "frame", { + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + */ + get: function () { + return this._frame; + }, + set: function (frame) { + this._frame = frame; + this.noFrame = false; + var x = frame.x, y = frame.y, width = frame.width, height = frame.height; + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; + var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + + (errorX + " " + relationship + " " + errorY)); + } + this.valid = width && height && this.baseTexture.valid; + if (!this.trim && !this.rotate) { + this.orig = frame; + } + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "rotate", { + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + */ + get: function () { + return this._rotate; + }, + set: function (rotate) { + this._rotate = rotate; + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "width", { + /** The width of the Texture in pixels. */ + get: function () { + return this.orig.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "height", { + /** The height of the Texture in pixels. */ + get: function () { + return this.orig.height; + }, + enumerable: false, + configurable: true + }); + /** Utility function for BaseTexture|Texture cast. */ + Texture.prototype.castToBaseTexture = function () { + return this.baseTexture; + }; + Object.defineProperty(Texture, "EMPTY", { + /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */ + get: function () { + if (!Texture._EMPTY) { + Texture._EMPTY = new Texture(new BaseTexture()); + removeAllHandlers(Texture._EMPTY); + removeAllHandlers(Texture._EMPTY.baseTexture); + } + return Texture._EMPTY; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture, "WHITE", { + /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */ + get: function () { + if (!Texture._WHITE) { + var canvas = settings.settings.ADAPTER.createCanvas(16, 16); + var context = canvas.getContext('2d'); + canvas.width = 16; + canvas.height = 16; + context.fillStyle = 'white'; + context.fillRect(0, 0, 16, 16); + Texture._WHITE = new Texture(BaseTexture.from(canvas)); + removeAllHandlers(Texture._WHITE); + removeAllHandlers(Texture._WHITE.baseTexture); + } + return Texture._WHITE; + }, + enumerable: false, + configurable: true + }); + return Texture; + }(utils.EventEmitter)); + + /** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * __Hint-2__: The actual memory allocation will happen on first render. + * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * Note that you should not create a new renderer, but reuse the same one as the rest of the application. + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 }); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ + var RenderTexture = /** @class */ (function (_super) { + __extends(RenderTexture, _super); + /** + * @param baseRenderTexture - The base texture object that this texture uses. + * @param frame - The rectangle frame of the texture to show. + */ + function RenderTexture(baseRenderTexture, frame) { + var _this = _super.call(this, baseRenderTexture, frame) || this; + _this.valid = true; + _this.filterFrame = null; + _this.filterPoolKey = null; + _this.updateUvs(); + return _this; + } + Object.defineProperty(RenderTexture.prototype, "framebuffer", { + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @readonly + */ + get: function () { + return this.baseTexture.framebuffer; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(RenderTexture.prototype, "multisample", { + /** + * Shortcut to `this.framebuffer.multisample`. + * @default PIXI.MSAA_QUALITY.NONE + */ + get: function () { + return this.framebuffer.multisample; + }, + set: function (value) { + this.framebuffer.multisample = value; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the RenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well? + */ + RenderTexture.prototype.resize = function (desiredWidth, desiredHeight, resizeBaseTexture) { + if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } + var resolution = this.baseTexture.resolution; + var width = Math.round(desiredWidth * resolution) / resolution; + var height = Math.round(desiredHeight * resolution) / resolution; + // TODO - could be not required.. + this.valid = (width > 0 && height > 0); + this._frame.width = this.orig.width = width; + this._frame.height = this.orig.height = height; + if (resizeBaseTexture) { + this.baseTexture.resize(width, height); + } + this.updateUvs(); + }; + /** + * Changes the resolution of baseTexture, but does not change framebuffer size. + * @param resolution - The new resolution to apply to RenderTexture + */ + RenderTexture.prototype.setResolution = function (resolution) { + var baseTexture = this.baseTexture; + if (baseTexture.resolution === resolution) { + return; + } + baseTexture.setResolution(resolution); + this.resize(baseTexture.width, baseTexture.height, false); + }; + RenderTexture.create = function (options) { + var arguments$1 = arguments; + + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments$1[_i]; + } + // @deprecated fallback, old-style: create(width, height, scaleMode, resolution) + if (typeof options === 'number') { + utils.deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.'); + /* eslint-disable prefer-rest-params */ + options = { + width: options, + height: rest[0], + scaleMode: rest[1], + resolution: rest[2], + }; + /* eslint-enable prefer-rest-params */ + } + return new RenderTexture(new BaseRenderTexture(options)); + }; + return RenderTexture; + }(Texture)); + + /** + * Texture pool, used by FilterSystem and plugins. + * + * Stores collection of temporary pow2 or screen-sized renderTextures + * + * If you use custom RenderTexturePool for your filters, you can use methods + * `getFilterTexture` and `returnFilterTexture` same as in + * @memberof PIXI + */ + var RenderTexturePool = /** @class */ (function () { + /** + * @param textureOptions - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + */ + function RenderTexturePool(textureOptions) { + this.texturePool = {}; + this.textureOptions = textureOptions || {}; + this.enableFullScreen = false; + this._pixelsWidth = 0; + this._pixelsHeight = 0; + } + /** + * Creates texture with params that were specified in pool constructor. + * @param realWidth - Width of texture in pixels. + * @param realHeight - Height of texture in pixels. + * @param multisample - Number of samples of the framebuffer. + */ + RenderTexturePool.prototype.createTexture = function (realWidth, realHeight, multisample) { + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + var baseRenderTexture = new BaseRenderTexture(Object.assign({ + width: realWidth, + height: realHeight, + resolution: 1, + multisample: multisample, + }, this.textureOptions)); + return new RenderTexture(baseRenderTexture); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture. + * @param minHeight - The minimum height of the render texture. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns The new render texture. + */ + RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + var key; + minWidth = Math.ceil((minWidth * resolution) - 1e-6); + minHeight = Math.ceil((minHeight * resolution) - 1e-6); + if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { + minWidth = utils.nextPow2(minWidth); + minHeight = utils.nextPow2(minHeight); + key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0; + if (multisample > 1) { + key += multisample * 0x100000000; + } + } + else { + key = multisample > 1 ? -multisample : -1; + } + if (!this.texturePool[key]) { + this.texturePool[key] = []; + } + var renderTexture = this.texturePool[key].pop(); + if (!renderTexture) { + renderTexture = this.createTexture(minWidth, minHeight, multisample); + } + renderTexture.filterPoolKey = key; + renderTexture.setResolution(resolution); + return renderTexture; + }; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * It overrides, it does not multiply + * @param multisample - number of samples of the renderTexture + */ + RenderTexturePool.prototype.getFilterTexture = function (input, resolution, multisample) { + var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || constants.MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Place a render texture back into the pool. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnTexture = function (renderTexture) { + var key = renderTexture.filterPoolKey; + renderTexture.filterFrame = null; + this.texturePool[key].push(renderTexture); + }; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { + this.returnTexture(renderTexture); + }; + /** + * Clears the pool. + * @param destroyTextures - Destroy all stored textures. + */ + RenderTexturePool.prototype.clear = function (destroyTextures) { + destroyTextures = destroyTextures !== false; + if (destroyTextures) { + for (var i in this.texturePool) { + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + } + } + this.texturePool = {}; + }; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * @param size - Initial size of screen. + */ + RenderTexturePool.prototype.setScreenSize = function (size) { + if (size.width === this._pixelsWidth + && size.height === this._pixelsHeight) { + return; + } + this.enableFullScreen = size.width > 0 && size.height > 0; + for (var i in this.texturePool) { + if (!(Number(i) < 0)) { + continue; + } + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.texturePool[i] = []; + } + this._pixelsWidth = size.width; + this._pixelsHeight = size.height; + }; + /** + * Key that is used to store fullscreen renderTextures in a pool + * @constant + */ + RenderTexturePool.SCREEN_KEY = -1; + return RenderTexturePool; + }()); + + /* eslint-disable max-len */ + /** + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. + * @memberof PIXI + */ + var Attribute = /** @class */ (function () { + /** + * @param buffer - the id of the buffer that this attribute will look for + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param normalized - should the data be normalized. + * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param [instance=false] - Whether the geometry is instanced. + */ + function Attribute(buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (type === void 0) { type = constants.TYPES.FLOAT; } + this.buffer = buffer; + this.size = size; + this.normalized = normalized; + this.type = type; + this.stride = stride; + this.start = start; + this.instance = instance; + } + /** Destroys the Attribute. */ + Attribute.prototype.destroy = function () { + this.buffer = null; + }; + /** + * Helper function that creates an Attribute based on the information provided + * @param buffer - the id of the buffer that this attribute will look for + * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param [normalized=false] - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @returns - A new {@link PIXI.Attribute} based on the information provided + */ + Attribute.from = function (buffer, size, normalized, type, stride) { + return new Attribute(buffer, size, normalized, type, stride); + }; + return Attribute; + }()); + + var UID$4 = 0; + /** + * A wrapper for data so that it can be used and uploaded by WebGL + * @memberof PIXI + */ + var Buffer = /** @class */ (function () { + /** + * @param {PIXI.IArrayBuffer} data - the data to store in the buffer. + * @param _static - `true` for static buffer + * @param index - `true` for index buffer + */ + function Buffer(data, _static, index) { + if (_static === void 0) { _static = true; } + if (index === void 0) { index = false; } + this.data = (data || new Float32Array(1)); + this._glBuffers = {}; + this._updateID = 0; + this.index = index; + this.static = _static; + this.id = UID$4++; + this.disposeRunner = new runner.Runner('disposeBuffer'); + } + // TODO could explore flagging only a partial upload? + /** + * Flags this buffer as requiring an upload to the GPU. + * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer. + */ + Buffer.prototype.update = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + this.data = data || this.data; + this._updateID++; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Buffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the buffer. */ + Buffer.prototype.destroy = function () { + this.dispose(); + this.data = null; + }; + Object.defineProperty(Buffer.prototype, "index", { + get: function () { + return this.type === constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + }, + /** + * Flags whether this is an index buffer. + * + * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make + * the buffer of type `ARRAY_BUFFER`. + * + * For backwards compatibility. + */ + set: function (value) { + this.type = value ? constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : constants.BUFFER_TYPE.ARRAY_BUFFER; + }, + enumerable: false, + configurable: true + }); + /** + * Helper function that creates a buffer based on an array or TypedArray + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @returns - A new Buffer based on the data provided. + */ + Buffer.from = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + return new Buffer(data); + }; + return Buffer; + }()); + + /* eslint-disable object-shorthand */ + var map$1 = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + }; + function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + var type = utils.getBufferType(array); + if (!views[type]) { + views[type] = new map$1[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); + } + + var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; + var UID$3 = 0; + /* eslint-disable object-shorthand */ + var map = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + Uint16Array: Uint16Array, + }; + /* eslint-disable max-len */ + /** + * The Geometry represents a model. It consists of two components: + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. + * + * Geometry can be defined without passing in a style or data if required (thats how I prefer!) + * + * ```js + * let geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) + * geometry.addIndex([0,1,2,1,3,2]) + * ``` + * @memberof PIXI + */ + var Geometry = /** @class */ (function () { + /** + * @param buffers - An array of buffers. optional. + * @param attributes - Of the geometry, optional structure of the attributes layout + */ + function Geometry(buffers, attributes) { + if (buffers === void 0) { buffers = []; } + if (attributes === void 0) { attributes = {}; } + this.buffers = buffers; + this.indexBuffer = null; + this.attributes = attributes; + this.glVertexArrayObjects = {}; + this.id = UID$3++; + this.instanced = false; + this.instanceCount = 1; + this.disposeRunner = new runner.Runner('disposeGeometry'); + this.refCount = 0; + } + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * @param id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param normalized - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param instance - Instancing flag + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (instance === void 0) { instance = false; } + if (!buffer) { + throw new Error('You must pass a buffer when creating an attribute'); + } + // check if this is a buffer! + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Float32Array(buffer); + } + buffer = new Buffer(buffer); + } + var ids = id.split('|'); + if (ids.length > 1) { + for (var i = 0; i < ids.length; i++) { + this.addAttribute(ids[i], buffer, size, normalized, type); + } + return this; + } + var bufferIndex = this.buffers.indexOf(buffer); + if (bufferIndex === -1) { + this.buffers.push(buffer); + bufferIndex = this.buffers.length - 1; + } + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); + // assuming that if there is instanced data then this will be drawn with instancing! + this.instanced = this.instanced || instance; + return this; + }; + /** + * Returns the requested attribute. + * @param id - The name of the attribute required + * @returns - The attribute requested. + */ + Geometry.prototype.getAttribute = function (id) { + return this.attributes[id]; + }; + /** + * Returns the requested buffer. + * @param id - The name of the buffer required. + * @returns - The buffer requested. + */ + Geometry.prototype.getBuffer = function (id) { + return this.buffers[this.getAttribute(id).buffer]; + }; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addIndex = function (buffer) { + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Uint16Array(buffer); + } + buffer = new Buffer(buffer); + } + buffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + this.indexBuffer = buffer; + if (this.buffers.indexOf(buffer) === -1) { + this.buffers.push(buffer); + } + return this; + }; + /** + * Returns the index buffer + * @returns - The index buffer. + */ + Geometry.prototype.getIndex = function () { + return this.indexBuffer; + }; + /** + * This function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.interleave = function () { + // a simple check to see if buffers are already interleaved.. + if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) + { return this; } + // assume already that no buffers are interleaved + var arrays = []; + var sizes = []; + var interleavedBuffer = new Buffer(); + var i; + for (i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + arrays.push(buffer.data); + sizes.push((attribute.size * byteSizeMap$1[attribute.type]) / 4); + attribute.buffer = 0; + } + interleavedBuffer.data = interleaveTypedArrays(arrays, sizes); + for (i = 0; i < this.buffers.length; i++) { + if (this.buffers[i] !== this.indexBuffer) { + this.buffers[i].destroy(); + } + } + this.buffers = [interleavedBuffer]; + if (this.indexBuffer) { + this.buffers.push(this.indexBuffer); + } + return this; + }; + /** Get the size of the geometries, in vertices. */ + Geometry.prototype.getSize = function () { + for (var i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + return buffer.data.length / ((attribute.stride / 4) || attribute.size); + } + return 0; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Geometry.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the geometry. */ + Geometry.prototype.destroy = function () { + this.dispose(); + this.buffers = null; + this.indexBuffer = null; + this.attributes = null; + }; + /** + * Returns a clone of the geometry. + * @returns - A new clone of this geometry. + */ + Geometry.prototype.clone = function () { + var geometry = new Geometry(); + for (var i = 0; i < this.buffers.length; i++) { + geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); + } + for (var i in this.attributes) { + var attrib = this.attributes[i]; + geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); + } + if (this.indexBuffer) { + geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; + geometry.indexBuffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + } + return geometry; + }; + /** + * Merges an array of geometries into a new single one. + * + * Geometry attribute styles must match for this operation to work. + * @param geometries - array of geometries to merge + * @returns - Shiny new geometry! + */ + Geometry.merge = function (geometries) { + // todo add a geometry check! + // also a size check.. cant be too big!] + var geometryOut = new Geometry(); + var arrays = []; + var sizes = []; + var offsets = []; + var geometry; + // pass one.. get sizes.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + sizes[j] = sizes[j] || 0; + sizes[j] += geometry.buffers[j].data.length; + offsets[j] = 0; + } + } + // build the correct size arrays.. + for (var i = 0; i < geometry.buffers.length; i++) { + // TODO types! + arrays[i] = new map[utils.getBufferType(geometry.buffers[i].data)](sizes[i]); + geometryOut.buffers[i] = new Buffer(arrays[i]); + } + // pass to set data.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + arrays[j].set(geometry.buffers[j].data, offsets[j]); + offsets[j] += geometry.buffers[j].data.length; + } + } + geometryOut.attributes = geometry.attributes; + if (geometry.indexBuffer) { + geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; + geometryOut.indexBuffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + var offset = 0; + var stride = 0; + var offset2 = 0; + var bufferIndexToCount = 0; + // get a buffer + for (var i = 0; i < geometry.buffers.length; i++) { + if (geometry.buffers[i] !== geometry.indexBuffer) { + bufferIndexToCount = i; + break; + } + } + // figure out the stride of one buffer.. + for (var i in geometry.attributes) { + var attribute = geometry.attributes[i]; + if ((attribute.buffer | 0) === bufferIndexToCount) { + stride += ((attribute.size * byteSizeMap$1[attribute.type]) / 4); + } + } + // time to off set all indexes.. + for (var i = 0; i < geometries.length; i++) { + var indexBufferData = geometries[i].indexBuffer.data; + for (var j = 0; j < indexBufferData.length; j++) { + geometryOut.indexBuffer.data[j + offset2] += offset; + } + offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride); + offset2 += indexBufferData.length; + } + } + return geometryOut; + }; + return Geometry; + }()); + + /** + * Helper class to create a quad + * @memberof PIXI + */ + var Quad = /** @class */ (function (_super) { + __extends(Quad, _super); + function Quad() { + var _this = _super.call(this) || this; + _this.addAttribute('aVertexPosition', new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ])) + .addIndex([0, 1, 3, 2]); + return _this; + } + return Quad; + }(Geometry)); + + /** + * Helper class to create a quad with uvs like in v4 + * @memberof PIXI + */ + var QuadUv = /** @class */ (function (_super) { + __extends(QuadUv, _super); + function QuadUv() { + var _this = _super.call(this) || this; + _this.vertices = new Float32Array([ + -1, -1, + 1, -1, + 1, 1, + -1, 1 ]); + _this.uvs = new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ]); + _this.vertexBuffer = new Buffer(_this.vertices); + _this.uvBuffer = new Buffer(_this.uvs); + _this.addAttribute('aVertexPosition', _this.vertexBuffer) + .addAttribute('aTextureCoord', _this.uvBuffer) + .addIndex([0, 1, 2, 0, 2, 3]); + return _this; + } + /** + * Maps two Rectangle to the quad. + * @param targetTextureFrame - The first rectangle + * @param destinationFrame - The second rectangle + * @returns - Returns itself. + */ + QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { + var x = 0; // destinationFrame.x / targetTextureFrame.width; + var y = 0; // destinationFrame.y / targetTextureFrame.height; + this.uvs[0] = x; + this.uvs[1] = y; + this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[3] = y; + this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); + this.uvs[6] = x; + this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); + x = destinationFrame.x; + y = destinationFrame.y; + this.vertices[0] = x; + this.vertices[1] = y; + this.vertices[2] = x + destinationFrame.width; + this.vertices[3] = y; + this.vertices[4] = x + destinationFrame.width; + this.vertices[5] = y + destinationFrame.height; + this.vertices[6] = x; + this.vertices[7] = y + destinationFrame.height; + this.invalidate(); + return this; + }; + /** + * Legacy upload method, just marks buffers dirty. + * @returns - Returns itself. + */ + QuadUv.prototype.invalidate = function () { + this.vertexBuffer._updateID++; + this.uvBuffer._updateID++; + return this; + }; + return QuadUv; + }(Geometry)); + + var UID$2 = 0; + /** + * Uniform group holds uniform map and some ID's for work + * + * `UniformGroup` has two modes: + * + * 1: Normal mode + * Normal mode will upload the uniforms with individual function calls as required + * + * 2: Uniform buffer mode + * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or + * or a generic object that PixiJS will automatically map to a buffer for you. + * For maximum benefits, make Ubo UniformGroups static, and only update them each frame. + * + * Rules of UBOs: + * - UBOs only work with WebGL2, so make sure you have a fallback! + * - Only floats are supported (including vec[2,3,4], mat[2,3,4]) + * - Samplers cannot be used in ubo's (a GPU limitation) + * - You must ensure that the object you pass in exactly matches in the shader ubo structure. + * Otherwise, weirdness will ensue! + * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader. + * + * ``` + * // ubo in shader: + * uniform myCoolData { // declaring a ubo.. + * mat4 uCoolMatrix; + * float uFloatyMcFloatFace + * + * + * // a new uniform buffer object.. + * const myCoolData = new UniformBufferGroup({ + * uCoolMatrix: new Matrix(), + * uFloatyMcFloatFace: 23, + * }} + * + * // build a shader... + * const shader = Shader.from(srcVert, srcFrag, { + * myCoolData // name matches the ubo name in the shader. will be processed accordingly. + * }) + * + * ``` + * @memberof PIXI + */ + var UniformGroup = /** @class */ (function () { + /** + * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer. + * @param isStatic - Uniforms wont be changed after creation. + * @param isUbo - If true, will treat this uniform group as a uniform buffer object. + */ + function UniformGroup(uniforms, isStatic, isUbo) { + this.group = true; + // lets generate this when the shader ? + this.syncUniforms = {}; + this.dirtyId = 0; + this.id = UID$2++; + this.static = !!isStatic; + this.ubo = !!isUbo; + if (uniforms instanceof Buffer) { + this.buffer = uniforms; + this.buffer.type = constants.BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = false; + this.ubo = true; + } + else { + this.uniforms = uniforms; + if (this.ubo) { + this.buffer = new Buffer(new Float32Array(1)); + this.buffer.type = constants.BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = true; + } + } + } + UniformGroup.prototype.update = function () { + this.dirtyId++; + if (!this.autoManage && this.buffer) { + this.buffer.update(); + } + }; + UniformGroup.prototype.add = function (name, uniforms, _static) { + if (!this.ubo) { + this.uniforms[name] = new UniformGroup(uniforms, _static); + } + else { + // eslint-disable-next-line max-len + throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them'); + } + }; + UniformGroup.from = function (uniforms, _static, _ubo) { + return new UniformGroup(uniforms, _static, _ubo); + }; + /** + * A short hand function for creating a static UBO UniformGroup. + * @param uniforms - the ubo item + * @param _static - should this be updated each time it is used? defaults to true here! + */ + UniformGroup.uboFrom = function (uniforms, _static) { + return new UniformGroup(uniforms, _static !== null && _static !== void 0 ? _static : true, true); + }; + return UniformGroup; + }()); + + /** + * System plugin to the renderer to manage filter states. + * @ignore + */ + var FilterState = /** @class */ (function () { + function FilterState() { + this.renderTexture = null; + this.target = null; + this.legacy = false; + this.resolution = 1; + this.multisample = constants.MSAA_QUALITY.NONE; + // next three fields are created only for root + // re-assigned for everything else + this.sourceFrame = new math.Rectangle(); + this.destinationFrame = new math.Rectangle(); + this.bindingSourceFrame = new math.Rectangle(); + this.bindingDestinationFrame = new math.Rectangle(); + this.filters = []; + this.transform = null; + } + /** Clears the state */ + FilterState.prototype.clear = function () { + this.target = null; + this.filters = null; + this.renderTexture = null; + }; + return FilterState; + }()); + + var tempPoints = [new math.Point(), new math.Point(), new math.Point(), new math.Point()]; + var tempMatrix$2 = new math.Matrix(); + /** + * System plugin to the renderer to manage filters. + * + * ## Pipeline + * + * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its + * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target. + * + * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into + * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called + * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame` + * in the final render-target. + * + * ## Usage + * + * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process: + * + * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target. + * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents + * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is + * illegal during an existing render cycle, and it may reset the filter system. + * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them + * serially and output to the bounds of the filter-target. + * @memberof PIXI + */ + var FilterSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FilterSystem(renderer) { + this.renderer = renderer; + this.defaultFilterStack = [{}]; + this.texturePool = new RenderTexturePool(); + this.texturePool.setScreenSize(renderer.view); + this.statePool = []; + this.quad = new Quad(); + this.quadUv = new QuadUv(); + this.tempRect = new math.Rectangle(); + this.activeState = {}; + this.globalUniforms = new UniformGroup({ + outputFrame: new math.Rectangle(), + inputSize: new Float32Array(4), + inputPixel: new Float32Array(4), + inputClamp: new Float32Array(4), + resolution: 1, + // legacy variables + filterArea: new Float32Array(4), + filterClamp: new Float32Array(4), + }, true); + this.forceClear = false; + this.useMaxPadding = false; + } + /** + * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an + * input render-texture for the rest of the filtering pipeline. + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param filters - The filters to apply. + */ + FilterSystem.prototype.push = function (target, filters) { + var _a, _b; + var renderer = this.renderer; + var filterStack = this.defaultFilterStack; + var state = this.statePool.pop() || new FilterState(); + var renderTextureSystem = this.renderer.renderTexture; + var resolution = filters[0].resolution; + var multisample = filters[0].multisample; + var padding = filters[0].padding; + var autoFit = filters[0].autoFit; + // We don't know whether it's a legacy filter until it was bound for the first time, + // therefore we have to assume that it is if legacy is undefined. + var legacy = (_a = filters[0].legacy) !== null && _a !== void 0 ? _a : true; + for (var i = 1; i < filters.length; i++) { + var filter = filters[i]; + // let's use the lowest resolution + resolution = Math.min(resolution, filter.resolution); + // let's use the lowest number of samples + multisample = Math.min(multisample, filter.multisample); + // figure out the padding required for filters + padding = this.useMaxPadding + // old behavior: use largest amount of padding! + ? Math.max(padding, filter.padding) + // new behavior: sum the padding + : padding + filter.padding; + // only auto fit if all filters are autofit + autoFit = autoFit && filter.autoFit; + legacy = legacy || ((_b = filter.legacy) !== null && _b !== void 0 ? _b : true); + } + if (filterStack.length === 1) { + this.defaultFilterStack[0].renderTexture = renderTextureSystem.current; + } + filterStack.push(state); + state.resolution = resolution; + state.multisample = multisample; + state.legacy = legacy; + state.target = target; + state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); + state.sourceFrame.pad(padding); + var sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame); + // Project source frame into world space (if projection is applied) + if (renderer.projection.transform) { + this.transformAABB(tempMatrix$2.copyFrom(renderer.projection.transform).invert(), sourceFrameProjected); + } + if (autoFit) { + state.sourceFrame.fit(sourceFrameProjected); + if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + } + else if (!state.sourceFrame.intersects(sourceFrameProjected)) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + // Round sourceFrame in screen space based on render-texture. + this.roundFrame(state.sourceFrame, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution, multisample); + state.filters = filters; + state.destinationFrame.width = state.renderTexture.width; + state.destinationFrame.height = state.renderTexture.height; + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = state.sourceFrame.width; + destinationFrame.height = state.sourceFrame.height; + state.renderTexture.filterFrame = state.sourceFrame; + state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame); + state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame); + state.transform = renderer.projection.transform; + renderer.projection.transform = null; + renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame); + renderer.framebuffer.clear(0, 0, 0, 0); + }; + /** Pops off the filter and applies it. */ + FilterSystem.prototype.pop = function () { + var filterStack = this.defaultFilterStack; + var state = filterStack.pop(); + var filters = state.filters; + this.activeState = state; + var globalUniforms = this.globalUniforms.uniforms; + globalUniforms.outputFrame = state.sourceFrame; + globalUniforms.resolution = state.resolution; + var inputSize = globalUniforms.inputSize; + var inputPixel = globalUniforms.inputPixel; + var inputClamp = globalUniforms.inputClamp; + inputSize[0] = state.destinationFrame.width; + inputSize[1] = state.destinationFrame.height; + inputSize[2] = 1.0 / inputSize[0]; + inputSize[3] = 1.0 / inputSize[1]; + inputPixel[0] = Math.round(inputSize[0] * state.resolution); + inputPixel[1] = Math.round(inputSize[1] * state.resolution); + inputPixel[2] = 1.0 / inputPixel[0]; + inputPixel[3] = 1.0 / inputPixel[1]; + inputClamp[0] = 0.5 * inputPixel[2]; + inputClamp[1] = 0.5 * inputPixel[3]; + inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); + inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); + // only update the rect if its legacy.. + if (state.legacy) { + var filterArea = globalUniforms.filterArea; + filterArea[0] = state.destinationFrame.width; + filterArea[1] = state.destinationFrame.height; + filterArea[2] = state.sourceFrame.x; + filterArea[3] = state.sourceFrame.y; + globalUniforms.filterClamp = globalUniforms.inputClamp; + } + this.globalUniforms.update(); + var lastState = filterStack[filterStack.length - 1]; + this.renderer.framebuffer.blit(); + if (filters.length === 1) { + filters[0].apply(this, state.renderTexture, lastState.renderTexture, constants.CLEAR_MODES.BLEND, state); + this.returnFilterTexture(state.renderTexture); + } + else { + var flip = state.renderTexture; + var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + var i = 0; + for (i = 0; i < filters.length - 1; ++i) { + if (i === 1 && state.multisample > 1) { + flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + } + filters[i].apply(this, flip, flop, constants.CLEAR_MODES.CLEAR, state); + var t = flip; + flip = flop; + flop = t; + } + filters[i].apply(this, flip, lastState.renderTexture, constants.CLEAR_MODES.BLEND, state); + if (i > 1 && state.multisample > 1) { + this.returnFilterTexture(state.renderTexture); + } + this.returnFilterTexture(flip); + this.returnFilterTexture(flop); + } + // lastState.renderTexture is blitted when lastState is popped + state.clear(); + this.statePool.push(state); + }; + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { + if (clearMode === void 0) { clearMode = constants.CLEAR_MODES.CLEAR; } + var _a = this.renderer, renderTextureSystem = _a.renderTexture, stateSystem = _a.state; + if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + // Restore projection transform if rendering into the output render-target. + this.renderer.projection.transform = this.activeState.transform; + } + else { + // Prevent projection within filtering pipeline. + this.renderer.projection.transform = null; + } + if (filterTexture && filterTexture.filterFrame) { + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = filterTexture.filterFrame.width; + destinationFrame.height = filterTexture.filterFrame.height; + renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame); + } + else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + renderTextureSystem.bind(filterTexture); + } + else { + // Restore binding for output render-target. + this.renderer.renderTexture.bind(filterTexture, this.activeState.bindingSourceFrame, this.activeState.bindingDestinationFrame); + } + // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending + // is stored in the 0th bit of the state. + var autoClear = (stateSystem.stateId & 1) || this.forceClear; + if (clearMode === constants.CLEAR_MODES.CLEAR + || (clearMode === constants.CLEAR_MODES.BLIT && autoClear)) { + // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering + // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur) + // instead of clamping their arithmetic. + this.renderer.framebuffer.clear(0, 0, 0, 0); + } + }; + /** + * Draws a filter using the default rendering process. + * + * This should be called only by {@link Filter#apply}. + * @param filter - The filter to draw. + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it + */ + FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { + var renderer = this.renderer; + // Set state before binding, so bindAndClear gets the blend mode. + renderer.state.set(filter.state); + this.bindAndClear(output, clearMode); + // set the uniforms.. + filter.uniforms.uSampler = input; + filter.uniforms.filterGlobals = this.globalUniforms; + // TODO make it so that the order of this does not matter.. + // because it does at the moment cos of global uniforms. + // they need to get resynced + renderer.shader.bind(filter); + // check to see if the filter is a legacy one.. + filter.legacy = !!filter.program.attributeData.aTextureCoord; + if (filter.legacy) { + this.quadUv.map(input._frame, input.filterFrame); + renderer.geometry.bind(this.quadUv); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES); + } + else { + renderer.geometry.bind(this.quad); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLE_STRIP); + } + }; + /** + * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. + * + * Use `outputMatrix * vTextureCoord` in the shader. + * @param outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @returns The mapped matrix. + */ + FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); + var worldTransform = sprite.worldTransform.copyTo(math.Matrix.TEMP_MATRIX); + worldTransform.invert(); + mappedMatrix.prepend(worldTransform); + mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); + mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); + return mappedMatrix; + }; + /** Destroys this Filter System. */ + FilterSystem.prototype.destroy = function () { + this.renderer = null; + // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem + this.texturePool.clear(false); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture in real pixels. + * @param minHeight - The minimum height of the render texture in real pixels. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns - The new render texture. + */ + FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample); + }; + /** + * Gets extra render texture to use inside current filter + * To be compliant with older filters, you can use params in any order + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * @param multisample - number of samples of the renderTexture + */ + FilterSystem.prototype.getFilterTexture = function (input, resolution, multisample) { + if (typeof input === 'number') { + var swap = input; + input = resolution; + resolution = swap; + } + input = input || this.activeState.renderTexture; + var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || constants.MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Frees a render texture back into the pool. + * @param renderTexture - The renderTarget to free + */ + FilterSystem.prototype.returnFilterTexture = function (renderTexture) { + this.texturePool.returnTexture(renderTexture); + }; + /** Empties the texture pool. */ + FilterSystem.prototype.emptyPool = function () { + this.texturePool.clear(true); + }; + /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */ + FilterSystem.prototype.resize = function () { + this.texturePool.setScreenSize(this.renderer.view); + }; + /** + * @param matrix - first param + * @param rect - second param + */ + FilterSystem.prototype.transformAABB = function (matrix, rect) { + var lt = tempPoints[0]; + var lb = tempPoints[1]; + var rt = tempPoints[2]; + var rb = tempPoints[3]; + lt.set(rect.left, rect.top); + lb.set(rect.left, rect.bottom); + rt.set(rect.right, rect.top); + rb.set(rect.right, rect.bottom); + matrix.apply(lt, lt); + matrix.apply(lb, lb); + matrix.apply(rt, rt); + matrix.apply(rb, rb); + var x0 = Math.min(lt.x, lb.x, rt.x, rb.x); + var y0 = Math.min(lt.y, lb.y, rt.y, rb.y); + var x1 = Math.max(lt.x, lb.x, rt.x, rb.x); + var y1 = Math.max(lt.y, lb.y, rt.y, rb.y); + rect.x = x0; + rect.y = y0; + rect.width = x1 - x0; + rect.height = y1 - y0; + }; + FilterSystem.prototype.roundFrame = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0) { + return; + } + if (transform) { + var a = transform.a, b = transform.b, c = transform.c, d = transform.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)) { + return; + } + } + transform = transform ? tempMatrix$2.copyFrom(transform) : tempMatrix$2.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.transformAABB(transform, frame); + // Round frame in screen space + frame.ceil(resolution); + // Project back into world space. + this.transformAABB(transform.invert(), frame); + }; + return FilterSystem; + }()); + + /** + * Base for a common object renderer that can be used as a + * system renderer plugin. + * @memberof PIXI + */ + var ObjectRenderer = /** @class */ (function () { + /** + * @param renderer - The renderer this manager works for. + */ + function ObjectRenderer(renderer) { + this.renderer = renderer; + } + /** Stub method that should be used to empty the current batch by rendering objects now. */ + ObjectRenderer.prototype.flush = function () { + // flush! + }; + /** Generic destruction method that frees all resources. This should be called by subclasses. */ + ObjectRenderer.prototype.destroy = function () { + this.renderer = null; + }; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + ObjectRenderer.prototype.start = function () { + // set the shader.. + }; + /** Stops the renderer. It should free up any state and become dormant. */ + ObjectRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * @param {PIXI.DisplayObject} _object - The object to render. + */ + ObjectRenderer.prototype.render = function (_object) { + // render the object + }; + return ObjectRenderer; + }()); + + /** + * System plugin to the renderer to manage batching. + * @memberof PIXI + */ + var BatchSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function BatchSystem(renderer) { + this.renderer = renderer; + this.emptyRenderer = new ObjectRenderer(renderer); + this.currentRenderer = this.emptyRenderer; + } + /** + * Changes the current renderer to the one given in parameter + * @param objectRenderer - The object renderer to use. + */ + BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { + if (this.currentRenderer === objectRenderer) { + return; + } + this.currentRenderer.stop(); + this.currentRenderer = objectRenderer; + this.currentRenderer.start(); + }; + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + */ + BatchSystem.prototype.flush = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** Reset the system to an empty renderer */ + BatchSystem.prototype.reset = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** + * Handy function for batch renderers: copies bound textures in first maxTextures locations to array + * sets actual _batchLocation for them + * @param arr - arr copy destination + * @param maxTextures - number of copied elements + */ + BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { + var boundTextures = this.renderer.texture.boundTextures; + for (var i = maxTextures - 1; i >= 0; --i) { + arr[i] = boundTextures[i] || null; + if (arr[i]) { + arr[i]._batchLocation = i; + } + } + }; + /** + * Assigns batch locations to textures in array based on boundTextures state. + * All textures in texArray should have `_batchEnabled = _batchId`, + * and their count should be less than `maxTextures`. + * @param texArray - textures to bound + * @param boundTextures - current state of bound textures + * @param batchId - marker for _batchEnabled param of textures in texArray + * @param maxTextures - number of texture locations to manipulate + */ + BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { + var elements = texArray.elements, ids = texArray.ids, count = texArray.count; + var j = 0; + for (var i = 0; i < count; i++) { + var tex = elements[i]; + var loc = tex._batchLocation; + if (loc >= 0 && loc < maxTextures + && boundTextures[loc] === tex) { + ids[i] = loc; + continue; + } + while (j < maxTextures) { + var bound = boundTextures[j]; + if (bound && bound._batchEnabled === batchId + && bound._batchLocation === j) { + j++; + continue; + } + ids[i] = j; + tex._batchLocation = j; + boundTextures[j] = tex; + break; + } + } + }; + /** + * @ignore + */ + BatchSystem.prototype.destroy = function () { + this.renderer = null; + }; + return BatchSystem; + }()); + + var CONTEXT_UID_COUNTER = 0; + /** + * System plugin to the renderer to manage the context. + * @memberof PIXI + */ + var ContextSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ContextSystem(renderer) { + this.renderer = renderer; + this.webGLVersion = 1; + this.extensions = {}; + this.supports = { + uint32Indices: false, + }; + // Bind functions + this.handleContextLost = this.handleContextLost.bind(this); + this.handleContextRestored = this.handleContextRestored.bind(this); + renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false); + renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); + } + Object.defineProperty(ContextSystem.prototype, "isLost", { + /** + * `true` if the context is lost + * @readonly + */ + get: function () { + return (!this.gl || this.gl.isContextLost()); + }, + enumerable: false, + configurable: true + }); + /** + * Handles the context change event. + * @param {WebGLRenderingContext} gl - New WebGL context. + */ + ContextSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + }; + /** + * Initializes the context. + * @protected + * @param {WebGLRenderingContext} gl - WebGL context + */ + ContextSystem.prototype.initFromContext = function (gl) { + this.gl = gl; + this.validateContext(gl); + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + this.renderer.runners.contextChange.emit(gl); + }; + /** + * Initialize from context options + * @protected + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext + * @param {object} options - context attributes + */ + ContextSystem.prototype.initFromOptions = function (options) { + var gl = this.createContext(this.renderer.view, options); + this.initFromContext(gl); + }; + /** + * Helper class to create a WebGL Context + * @param canvas - the canvas element that we will get the context from + * @param options - An options object that gets passed in to the canvas element containing the + * context attributes + * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext + * @returns {WebGLRenderingContext} the WebGL context + */ + ContextSystem.prototype.createContext = function (canvas, options) { + var gl; + if (settings.settings.PREFER_ENV >= constants.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', options); + } + if (gl) { + this.webGLVersion = 2; + } + else { + this.webGLVersion = 1; + gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options); + if (!gl) { + // fail, not able to get a context + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); + } + } + this.gl = gl; + this.getExtensions(); + return this.gl; + }; + /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */ + ContextSystem.prototype.getExtensions = function () { + // time to set up default extensions that Pixi uses. + var gl = this.gl; + var common = { + loseContext: gl.getExtension('WEBGL_lose_context'), + anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'), + s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), + etc: gl.getExtension('WEBGL_compressed_texture_etc'), + etc1: gl.getExtension('WEBGL_compressed_texture_etc1'), + pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc') + || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'), + atc: gl.getExtension('WEBGL_compressed_texture_atc'), + astc: gl.getExtension('WEBGL_compressed_texture_astc') + }; + if (this.webGLVersion === 1) { + Object.assign(this.extensions, common, { + drawBuffers: gl.getExtension('WEBGL_draw_buffers'), + depthTexture: gl.getExtension('WEBGL_depth_texture'), + vertexArrayObject: gl.getExtension('OES_vertex_array_object') + || gl.getExtension('MOZ_OES_vertex_array_object') + || gl.getExtension('WEBKIT_OES_vertex_array_object'), + uint32ElementIndex: gl.getExtension('OES_element_index_uint'), + // Floats and half-floats + floatTexture: gl.getExtension('OES_texture_float'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + textureHalfFloat: gl.getExtension('OES_texture_half_float'), + textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), + }); + } + else if (this.webGLVersion === 2) { + Object.assign(this.extensions, common, { + // Floats and half-floats + colorBufferFloat: gl.getExtension('EXT_color_buffer_float') + }); + } + }; + /** + * Handles a lost webgl context + * @param {WebGLContextEvent} event - The context lost event. + */ + ContextSystem.prototype.handleContextLost = function (event) { + var _this = this; + // Prevent default to be able to restore the context + event.preventDefault(); + // Restore the context after this event has exited + setTimeout(function () { + if (_this.gl.isContextLost() && _this.extensions.loseContext) { + _this.extensions.loseContext.restoreContext(); + } + }, 0); + }; + /** Handles a restored webgl context. */ + ContextSystem.prototype.handleContextRestored = function () { + this.renderer.runners.contextChange.emit(this.gl); + }; + ContextSystem.prototype.destroy = function () { + var view = this.renderer.view; + this.renderer = null; + // remove listeners + view.removeEventListener('webglcontextlost', this.handleContextLost); + view.removeEventListener('webglcontextrestored', this.handleContextRestored); + this.gl.useProgram(null); + if (this.extensions.loseContext) { + this.extensions.loseContext.loseContext(); + } + }; + /** Handle the post-render runner event. */ + ContextSystem.prototype.postrender = function () { + if (this.renderer.renderingToScreen) { + this.gl.flush(); + } + }; + /** + * Validate context. + * @param {WebGLRenderingContext} gl - Render context. + */ + ContextSystem.prototype.validateContext = function (gl) { + var attributes = gl.getContextAttributes(); + var isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext; + if (isWebGl2) { + this.webGLVersion = 2; + } + // this is going to be fairly simple for now.. but at least we have room to grow! + if (attributes && !attributes.stencil) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); + /* eslint-enable max-len, no-console */ + } + var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); + this.supports.uint32Indices = hasuint32; + if (!hasuint32) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); + /* eslint-enable max-len, no-console */ + } + }; + return ContextSystem; + }()); + + /** + * Internal framebuffer for WebGL context. + * @memberof PIXI + */ + var GLFramebuffer = /** @class */ (function () { + function GLFramebuffer(framebuffer) { + this.framebuffer = framebuffer; + this.stencil = null; + this.dirtyId = -1; + this.dirtyFormat = -1; + this.dirtySize = -1; + this.multisample = constants.MSAA_QUALITY.NONE; + this.msaaBuffer = null; + this.blitFramebuffer = null; + this.mipLevel = 0; + } + return GLFramebuffer; + }()); + + var tempRectangle = new math.Rectangle(); + /** + * System plugin to the renderer to manage framebuffers. + * @memberof PIXI + */ + var FramebufferSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FramebufferSystem(renderer) { + this.renderer = renderer; + this.managedFramebuffers = []; + this.unknownFramebuffer = new Framebuffer(10, 10); + this.msaaSamples = null; + } + /** Sets up the renderer context and necessary buffers. */ + FramebufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.current = this.unknownFramebuffer; + this.viewport = new math.Rectangle(); + this.hasMRT = true; + this.writeDepthTexture = true; + // webgl2 + if (this.renderer.context.webGLVersion === 1) { + // webgl 1! + var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; + var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + nativeDrawBuffersExtension_1 = null; + nativeDepthTextureExtension = null; + } + if (nativeDrawBuffersExtension_1) { + gl.drawBuffers = function (activeTextures) { + return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); + }; + } + else { + this.hasMRT = false; + gl.drawBuffers = function () { + // empty + }; + } + if (!nativeDepthTextureExtension) { + this.writeDepthTexture = false; + } + } + else { + // WebGL2 + // cache possible MSAA samples + this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); + } + }; + /** + * Bind a framebuffer. + * @param framebuffer + * @param frame - frame, default is framebuffer size + * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0 + */ + FramebufferSystem.prototype.bind = function (framebuffer, frame, mipLevel) { + if (mipLevel === void 0) { mipLevel = 0; } + var gl = this.gl; + if (framebuffer) { + // TODO caching layer! + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + if (this.current !== framebuffer) { + this.current = framebuffer; + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); + } + // make sure all textures are unbound.. + if (fbo.mipLevel !== mipLevel) { + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + fbo.mipLevel = mipLevel; + } + // now check for updates... + if (fbo.dirtyId !== framebuffer.dirtyId) { + fbo.dirtyId = framebuffer.dirtyId; + if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { + fbo.dirtyFormat = framebuffer.dirtyFormat; + fbo.dirtySize = framebuffer.dirtySize; + this.updateFramebuffer(framebuffer, mipLevel); + } + else if (fbo.dirtySize !== framebuffer.dirtySize) { + fbo.dirtySize = framebuffer.dirtySize; + this.resizeFramebuffer(framebuffer); + } + } + for (var i = 0; i < framebuffer.colorTextures.length; i++) { + var tex = framebuffer.colorTextures[i]; + this.renderer.texture.unbind(tex.parentTextureArray || tex); + } + if (framebuffer.depthTexture) { + this.renderer.texture.unbind(framebuffer.depthTexture); + } + if (frame) { + var mipWidth = (frame.width >> mipLevel); + var mipHeight = (frame.height >> mipLevel); + var scale = mipWidth / frame.width; + this.setViewport(frame.x * scale, frame.y * scale, mipWidth, mipHeight); + } + else { + var mipWidth = (framebuffer.width >> mipLevel); + var mipHeight = (framebuffer.height >> mipLevel); + this.setViewport(0, 0, mipWidth, mipHeight); + } + } + else { + if (this.current) { + this.current = null; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + if (frame) { + this.setViewport(frame.x, frame.y, frame.width, frame.height); + } + else { + this.setViewport(0, 0, this.renderer.width, this.renderer.height); + } + } + }; + /** + * Set the WebGLRenderingContext's viewport. + * @param x - X position of viewport + * @param y - Y position of viewport + * @param width - Width of viewport + * @param height - Height of viewport + */ + FramebufferSystem.prototype.setViewport = function (x, y, width, height) { + var v = this.viewport; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { + v.x = x; + v.y = y; + v.width = width; + v.height = height; + this.gl.viewport(x, y, width, height); + } + }; + Object.defineProperty(FramebufferSystem.prototype, "size", { + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * @readonly + */ + get: function () { + if (this.current) { + // TODO store temp + return { x: 0, y: 0, width: this.current.width, height: this.current.height }; + } + return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; + }, + enumerable: false, + configurable: true + }); + /** + * Clear the color of the context + * @param r - Red value from 0 to 1 + * @param g - Green value from 0 to 1 + * @param b - Blue value from 0 to 1 + * @param a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { + if (mask === void 0) { mask = constants.BUFFER_BITS.COLOR | constants.BUFFER_BITS.DEPTH; } + var gl = this.gl; + // TODO clear color can be set only one right? + gl.clearColor(r, g, b, a); + gl.clear(mask); + }; + /** + * Initialize framebuffer for this context + * @protected + * @param framebuffer + * @returns - created GLFramebuffer + */ + FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = new GLFramebuffer(gl.createFramebuffer()); + fbo.multisample = this.detectSamples(framebuffer.multisample); + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; + this.managedFramebuffers.push(framebuffer); + framebuffer.disposeRunner.add(this); + return fbo; + }; + /** + * Resize the framebuffer + * @param framebuffer + * @protected + */ + FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (fbo.msaaBuffer) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + } + if (fbo.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + } + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + } + if (framebuffer.depthTexture && this.writeDepthTexture) { + this.renderer.texture.bind(framebuffer.depthTexture, 0); + } + }; + /** + * Update the framebuffer + * @param framebuffer + * @param mipLevel + * @protected + */ + FramebufferSystem.prototype.updateFramebuffer = function (framebuffer, mipLevel) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + // bind the color texture + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer)) { + fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); + } + else if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + fbo.msaaBuffer = null; + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + fbo.blitFramebuffer = null; + } + } + var activeTextures = []; + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + if (i === 0 && fbo.msaaBuffer) { + continue; + } + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + activeTextures.push(gl.COLOR_ATTACHMENT0 + i); + } + if (activeTextures.length > 1) { + gl.drawBuffers(activeTextures); + } + if (framebuffer.depthTexture) { + var writeDepthTexture = this.writeDepthTexture; + if (writeDepthTexture) { + var depthTexture = framebuffer.depthTexture; + this.renderer.texture.bind(depthTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + } + } + if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture)) { + fbo.stencil = fbo.stencil || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); + } + else if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + fbo.stencil = null; + } + }; + /** + * Returns true if the frame buffer can be multisampled. + * @param framebuffer + */ + FramebufferSystem.prototype.canMultisampleFramebuffer = function (framebuffer) { + return this.renderer.context.webGLVersion !== 1 + && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture; + }; + /** + * Detects number of samples that is not more than a param but as close to it as possible + * @param samples - number of samples + * @returns - recommended number of samples + */ + FramebufferSystem.prototype.detectSamples = function (samples) { + var msaaSamples = this.msaaSamples; + var res = constants.MSAA_QUALITY.NONE; + if (samples <= 1 || msaaSamples === null) { + return res; + } + for (var i = 0; i < msaaSamples.length; i++) { + if (msaaSamples[i] <= samples) { + res = msaaSamples[i]; + break; + } + } + if (res === 1) { + res = constants.MSAA_QUALITY.NONE; + } + return res; + }; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * @param framebuffer - by default it blits "into itself", from renderBuffer to texture. + * @param sourcePixels - source rectangle in pixels + * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { + var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (renderer.context.webGLVersion !== 2) { + return; + } + if (!current) { + return; + } + var fbo = current.glFramebuffers[CONTEXT_UID]; + if (!fbo) { + return; + } + if (!framebuffer) { + if (!fbo.msaaBuffer) { + return; + } + var colorTexture = current.colorTextures[0]; + if (!colorTexture) { + return; + } + if (!fbo.blitFramebuffer) { + fbo.blitFramebuffer = new Framebuffer(current.width, current.height); + fbo.blitFramebuffer.addColorTexture(0, colorTexture); + } + framebuffer = fbo.blitFramebuffer; + if (framebuffer.colorTextures[0] !== colorTexture) { + framebuffer.colorTextures[0] = colorTexture; + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + } + if (framebuffer.width !== current.width || framebuffer.height !== current.height) { + framebuffer.width = current.width; + framebuffer.height = current.height; + framebuffer.dirtyId++; + framebuffer.dirtySize++; + } + } + if (!sourcePixels) { + sourcePixels = tempRectangle; + sourcePixels.width = current.width; + sourcePixels.height = current.height; + } + if (!destPixels) { + destPixels = sourcePixels; + } + var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; + this.bind(framebuffer); + gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); + gl.blitFramebuffer(sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom, destPixels.left, destPixels.top, destPixels.right, destPixels.bottom, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); + }; + /** + * Disposes framebuffer. + * @param framebuffer - framebuffer that has to be disposed of + * @param contextLost - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + var gl = this.gl; + if (!fbo) { + return; + } + delete framebuffer.glFramebuffers[this.CONTEXT_UID]; + var index = this.managedFramebuffers.indexOf(framebuffer); + if (index >= 0) { + this.managedFramebuffers.splice(index, 1); + } + framebuffer.disposeRunner.remove(this); + if (!contextLost) { + gl.deleteFramebuffer(fbo.framebuffer); + if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + } + if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + } + } + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + } + }; + /** + * Disposes all framebuffers, but not textures bound to them. + * @param [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeAll = function (contextLost) { + var list = this.managedFramebuffers; + this.managedFramebuffers = []; + for (var i = 0; i < list.length; i++) { + this.disposeFramebuffer(list[i], contextLost); + } + }; + /** + * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. + * Used by MaskSystem, when its time to use stencil mask for Graphics element. + * + * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. + * @private + */ + FramebufferSystem.prototype.forceStencil = function () { + var framebuffer = this.current; + if (!framebuffer) { + return; + } + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (!fbo || fbo.stencil) { + return; + } + framebuffer.stencil = true; + var w = framebuffer.width; + var h = framebuffer.height; + var gl = this.gl; + var stencil = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); + } + fbo.stencil = stencil; + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); + }; + /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */ + FramebufferSystem.prototype.reset = function () { + this.current = this.unknownFramebuffer; + this.viewport = new math.Rectangle(); + }; + FramebufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + return FramebufferSystem; + }()); + + var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; + /** + * System plugin to the renderer to manage geometry. + * @memberof PIXI + */ + var GeometrySystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function GeometrySystem(renderer) { + this.renderer = renderer; + this._activeGeometry = null; + this._activeVao = null; + this.hasVao = true; + this.hasInstance = true; + this.canUseUInt32ElementIndex = false; + this.managedGeometries = {}; + } + /** Sets up the renderer context and necessary buffers. */ + GeometrySystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + var context = this.renderer.context; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + // webgl2 + if (context.webGLVersion !== 2) { + // webgl 1! + var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + nativeVaoExtension_1 = null; + } + if (nativeVaoExtension_1) { + gl.createVertexArray = function () { + return nativeVaoExtension_1.createVertexArrayOES(); + }; + gl.bindVertexArray = function (vao) { + return nativeVaoExtension_1.bindVertexArrayOES(vao); + }; + gl.deleteVertexArray = function (vao) { + return nativeVaoExtension_1.deleteVertexArrayOES(vao); + }; + } + else { + this.hasVao = false; + gl.createVertexArray = function () { + return null; + }; + gl.bindVertexArray = function () { + return null; + }; + gl.deleteVertexArray = function () { + return null; + }; + } + } + if (context.webGLVersion !== 2) { + var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); + if (instanceExt_1) { + gl.vertexAttribDivisor = function (a, b) { + return instanceExt_1.vertexAttribDivisorANGLE(a, b); + }; + gl.drawElementsInstanced = function (a, b, c, d, e) { + return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); + }; + gl.drawArraysInstanced = function (a, b, c, d) { + return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); + }; + } + else { + this.hasInstance = false; + } + } + this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; + }; + /** + * Binds geometry so that is can be drawn. Creating a Vao if required + * @param geometry - Instance of geometry to bind. + * @param shader - Instance of shader to use vao for. + */ + GeometrySystem.prototype.bind = function (geometry, shader) { + shader = shader || this.renderer.shader.shader; + var gl = this.gl; + // not sure the best way to address this.. + // currently different shaders require different VAOs for the same geometry + // Still mulling over the best way to solve this one.. + // will likely need to modify the shader attribute locations at run time! + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var incRefCount = false; + if (!vaos) { + this.managedGeometries[geometry.id] = geometry; + geometry.disposeRunner.add(this); + geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; + incRefCount = true; + } + var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount); + this._activeGeometry = geometry; + if (this._activeVao !== vao) { + this._activeVao = vao; + if (this.hasVao) { + gl.bindVertexArray(vao); + } + else { + this.activateVao(geometry, shader.program); + } + } + // TODO - optimise later! + // don't need to loop through if nothing changed! + // maybe look to add an 'autoupdate' to geometry? + this.updateBuffers(); + }; + /** Reset and unbind any active VAO and geometry. */ + GeometrySystem.prototype.reset = function () { + this.unbind(); + }; + /** Update buffers of the currently bound geometry. */ + GeometrySystem.prototype.updateBuffers = function () { + var geometry = this._activeGeometry; + var bufferSystem = this.renderer.buffer; + for (var i = 0; i < geometry.buffers.length; i++) { + var buffer = geometry.buffers[i]; + bufferSystem.update(buffer); + } + }; + /** + * Check compatibility between a geometry and a program + * @param geometry - Geometry instance. + * @param program - Program instance. + */ + GeometrySystem.prototype.checkCompatibility = function (geometry, program) { + // geometry must have at least all the attributes that the shader requires. + var geometryAttributes = geometry.attributes; + var shaderAttributes = program.attributeData; + for (var j in shaderAttributes) { + if (!geometryAttributes[j]) { + throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); + } + } + }; + /** + * Takes a geometry and program and generates a unique signature for them. + * @param geometry - To get signature from. + * @param program - To test geometry against. + * @returns - Unique signature of the geometry and program + */ + GeometrySystem.prototype.getSignature = function (geometry, program) { + var attribs = geometry.attributes; + var shaderAttributes = program.attributeData; + var strings = ['g', geometry.id]; + for (var i in attribs) { + if (shaderAttributes[i]) { + strings.push(i, shaderAttributes[i].location); + } + } + return strings.join('-'); + }; + /** + * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. + * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the + * attribute locations. + * @param geometry - Instance of geometry to to generate Vao for. + * @param shader - Instance of the shader. + * @param incRefCount - Increment refCount of all geometry buffers. + */ + GeometrySystem.prototype.initGeometryVao = function (geometry, shader, incRefCount) { + if (incRefCount === void 0) { incRefCount = true; } + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var program = shader.program; + if (!program.glPrograms[CONTEXT_UID]) { + this.renderer.shader.generateProgram(shader); + } + this.checkCompatibility(geometry, program); + var signature = this.getSignature(geometry, program); + var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var vao = vaoObjectHash[signature]; + if (vao) { + // this will give us easy access to the vao + vaoObjectHash[program.id] = vao; + return vao; + } + var buffers = geometry.buffers; + var attributes = geometry.attributes; + var tempStride = {}; + var tempStart = {}; + for (var j in buffers) { + tempStride[j] = 0; + tempStart[j] = 0; + } + for (var j in attributes) { + if (!attributes[j].size && program.attributeData[j]) { + attributes[j].size = program.attributeData[j].size; + } + else if (!attributes[j].size) { + console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line + } + tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type]; + } + for (var j in attributes) { + var attribute = attributes[j]; + var attribSize = attribute.size; + if (attribute.stride === undefined) { + if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type]) { + attribute.stride = 0; + } + else { + attribute.stride = tempStride[attribute.buffer]; + } + } + if (attribute.start === undefined) { + attribute.start = tempStart[attribute.buffer]; + tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type]; + } + } + vao = gl.createVertexArray(); + gl.bindVertexArray(vao); + // first update - and create the buffers! + // only create a gl buffer if it actually gets + for (var i = 0; i < buffers.length; i++) { + var buffer = buffers[i]; + bufferSystem.bind(buffer); + if (incRefCount) { + buffer._glBuffers[CONTEXT_UID].refCount++; + } + } + // TODO - maybe make this a data object? + // lets wait to see if we need to first! + this.activateVao(geometry, program); + this._activeVao = vao; + // add it to the cache! + vaoObjectHash[program.id] = vao; + vaoObjectHash[signature] = vao; + return vao; + }; + /** + * Disposes geometry. + * @param geometry - Geometry with buffers. Only VAO will be disposed + * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { + var _a; + if (!this.managedGeometries[geometry.id]) { + return; + } + delete this.managedGeometries[geometry.id]; + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var gl = this.gl; + var buffers = geometry.buffers; + var bufferSystem = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.buffer; + geometry.disposeRunner.remove(this); + if (!vaos) { + return; + } + // bufferSystem may have already been destroyed.. + // if this is the case, there is no need to destroy the geometry buffers... + // they already have been! + if (bufferSystem) { + for (var i = 0; i < buffers.length; i++) { + var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; + // my be null as context may have changed right before the dispose is called + if (buf) { + buf.refCount--; + if (buf.refCount === 0 && !contextLost) { + bufferSystem.dispose(buffers[i], contextLost); + } + } + } + } + if (!contextLost) { + for (var vaoId in vaos) { + // delete only signatures, everything else are copies + if (vaoId[0] === 'g') { + var vao = vaos[vaoId]; + if (this._activeVao === vao) { + this.unbind(); + } + gl.deleteVertexArray(vao); + } + } + } + delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; + }; + /** + * Dispose all WebGL resources of all managed geometries. + * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + GeometrySystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedGeometries); + for (var i = 0; i < all.length; i++) { + this.disposeGeometry(this.managedGeometries[all[i]], contextLost); + } + }; + /** + * Activate vertex array object. + * @param geometry - Geometry instance. + * @param program - Shader program instance. + */ + GeometrySystem.prototype.activateVao = function (geometry, program) { + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var buffers = geometry.buffers; + var attributes = geometry.attributes; + if (geometry.indexBuffer) { + // first update the index buffer if we have one.. + bufferSystem.bind(geometry.indexBuffer); + } + var lastBuffer = null; + // add a new one! + for (var j in attributes) { + var attribute = attributes[j]; + var buffer = buffers[attribute.buffer]; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (program.attributeData[j]) { + if (lastBuffer !== glBuffer) { + bufferSystem.bind(buffer); + lastBuffer = glBuffer; + } + var location = program.attributeData[j].location; + // TODO introduce state again + // we can optimise this for older devices that have no VAOs + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); + if (attribute.instance) { + // TODO calculate instance count based of this... + if (this.hasInstance) { + gl.vertexAttribDivisor(location, 1); + } + else { + throw new Error('geometry error, GPU Instancing is not supported on this device'); + } + } + } + } + }; + /** + * Draws the currently bound geometry. + * @param type - The type primitive to render. + * @param size - The number of elements to be rendered. If not specified, all vertices after the + * starting vertex will be drawn. + * @param start - The starting vertex in the geometry to start drawing from. If not specified, + * drawing will start from the first vertex. + * @param instanceCount - The number of instances of the set of elements to execute. If not specified, + * all instances will be drawn. + */ + GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { + var gl = this.gl; + var geometry = this._activeGeometry; + // TODO.. this should not change so maybe cache the function? + if (geometry.indexBuffer) { + var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; + var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; + if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { + if (geometry.instanced) { + /* eslint-disable max-len */ + gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); + /* eslint-enable max-len */ + } + else { + /* eslint-disable max-len */ + gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); + /* eslint-enable max-len */ + } + } + else { + console.warn('unsupported index buffer type: uint32'); + } + } + else if (geometry.instanced) { + // TODO need a better way to calculate size.. + gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); + } + else { + gl.drawArrays(type, start, size || geometry.getSize()); + } + return this; + }; + /** Unbind/reset everything. */ + GeometrySystem.prototype.unbind = function () { + this.gl.bindVertexArray(null); + this._activeVao = null; + this._activeGeometry = null; + }; + GeometrySystem.prototype.destroy = function () { + this.renderer = null; + }; + return GeometrySystem; + }()); + + /** + * Component for masked elements. + * + * Holds mask mode and temporary data about current mask. + * @memberof PIXI + */ + var MaskData = /** @class */ (function () { + /** + * Create MaskData + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask + */ + function MaskData(maskObject) { + if (maskObject === void 0) { maskObject = null; } + this.type = constants.MASK_TYPES.NONE; + this.autoDetect = true; + this.maskObject = maskObject || null; + this.pooled = false; + this.isMaskData = true; + this.resolution = null; + this.multisample = settings.settings.FILTER_MULTISAMPLE; + this.enabled = true; + this.colorMask = 0xf; + this._filters = null; + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + this._scissorRectLocal = null; + this._colorMask = 0xf; + this._target = null; + } + Object.defineProperty(MaskData.prototype, "filter", { + /** + * The sprite mask filter. + * If set to `null`, the default sprite mask filter is used. + * @default null + */ + get: function () { + return this._filters ? this._filters[0] : null; + }, + set: function (value) { + if (value) { + if (this._filters) { + this._filters[0] = value; + } + else { + this._filters = [value]; + } + } + else { + this._filters = null; + } + }, + enumerable: false, + configurable: true + }); + /** Resets the mask data after popMask(). */ + MaskData.prototype.reset = function () { + if (this.pooled) { + this.maskObject = null; + this.type = constants.MASK_TYPES.NONE; + this.autoDetect = true; + } + this._target = null; + this._scissorRectLocal = null; + }; + /** + * Copies counters from maskData above, called from pushMask(). + * @param maskAbove + */ + MaskData.prototype.copyCountersOrReset = function (maskAbove) { + if (maskAbove) { + this._stencilCounter = maskAbove._stencilCounter; + this._scissorCounter = maskAbove._scissorCounter; + this._scissorRect = maskAbove._scissorRect; + } + else { + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + } + }; + return MaskData; + }()); + + /** + * @private + * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram} + * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param {string} src - The vertex shader source as an array of strings. + * @returns {WebGLShader} the shader + */ + function compileShader(gl, type, src) { + var shader = gl.createShader(type); + gl.shaderSource(shader, src); + gl.compileShader(shader); + return shader; + } + + /** + * will log a shader error highlighting the lines with the error + * also will add numbers along the side. + * @param gl - the WebGLContext + * @param shader - the shader to log errors for + */ + function logPrettyShaderError(gl, shader) { + var shaderSrc = gl.getShaderSource(shader) + .split('\n') + .map(function (line, index) { return index + ": " + line; }); + var shaderLog = gl.getShaderInfoLog(shader); + var splitShader = shaderLog.split('\n'); + var dedupe = {}; + var lineNumbers = splitShader.map(function (line) { return parseFloat(line.replace(/^ERROR\: 0\:([\d]+)\:.*$/, '$1')); }) + .filter(function (n) { + if (n && !dedupe[n]) { + dedupe[n] = true; + return true; + } + return false; + }); + var logArgs = ['']; + lineNumbers.forEach(function (number) { + shaderSrc[number - 1] = "%c" + shaderSrc[number - 1] + "%c"; + logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px'); + }); + var fragmentSourceToLog = shaderSrc + .join('\n'); + logArgs[0] = fragmentSourceToLog; + console.error(shaderLog); + // eslint-disable-next-line no-console + console.groupCollapsed('click to view full shader code'); + console.warn.apply(console, logArgs); + // eslint-disable-next-line no-console + console.groupEnd(); + } + /** + * + * logs out any program errors + * @param gl - The current WebGL context + * @param program - the WebGL program to display errors for + * @param vertexShader - the fragment WebGL shader program + * @param fragmentShader - the vertex WebGL shader program + */ + function logProgramError(gl, program, vertexShader, fragmentShader) { + // if linking fails, then log and cleanup + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, vertexShader); + } + if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, fragmentShader); + } + console.error('PixiJS Error: Could not initialize shader.'); + // if there is a program info log, log it + if (gl.getProgramInfoLog(program) !== '') { + console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); + } + } + } + + function booleanArray(size) { + var array = new Array(size); + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + return array; + } + /** + * @method defaultValue + * @memberof PIXI.glCore.shader + * @param {string} type - Type of value + * @param {number} size + * @private + */ + function defaultValue(type, size) { + switch (type) { + case 'float': + return 0; + case 'vec2': + return new Float32Array(2 * size); + case 'vec3': + return new Float32Array(3 * size); + case 'vec4': + return new Float32Array(4 * size); + case 'int': + case 'uint': + case 'sampler2D': + case 'sampler2DArray': + return 0; + case 'ivec2': + return new Int32Array(2 * size); + case 'ivec3': + return new Int32Array(3 * size); + case 'ivec4': + return new Int32Array(4 * size); + case 'uvec2': + return new Uint32Array(2 * size); + case 'uvec3': + return new Uint32Array(3 * size); + case 'uvec4': + return new Uint32Array(4 * size); + case 'bool': + return false; + case 'bvec2': + return booleanArray(2 * size); + case 'bvec3': + return booleanArray(3 * size); + case 'bvec4': + return booleanArray(4 * size); + case 'mat2': + return new Float32Array([1, 0, + 0, 1]); + case 'mat3': + return new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + case 'mat4': + return new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + } + return null; + } + + var unknownContext = {}; + var context = unknownContext; + /** + * returns a little WebGL context to use for program inspection. + * @static + * @private + * @returns {WebGLRenderingContext} a gl context to test with + */ + function getTestContext() { + if (context === unknownContext || (context && context.isContextLost())) { + var canvas = settings.settings.ADAPTER.createCanvas(); + var gl = void 0; + if (settings.settings.PREFER_ENV >= constants.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', {}); + } + if (!gl) { + gl = (canvas.getContext('webgl', {}) + || canvas.getContext('experimental-webgl', {})); + if (!gl) { + // fail, not able to get a context + gl = null; + } + else { + // for shader testing.. + gl.getExtension('WEBGL_draw_buffers'); + } + } + context = gl; + } + return context; + } + + var maxFragmentPrecision; + function getMaxFragmentPrecision() { + if (!maxFragmentPrecision) { + maxFragmentPrecision = constants.PRECISION.MEDIUM; + var gl = getTestContext(); + if (gl) { + if (gl.getShaderPrecisionFormat) { + var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); + maxFragmentPrecision = shaderFragment.precision ? constants.PRECISION.HIGH : constants.PRECISION.MEDIUM; + } + } + } + return maxFragmentPrecision; + } + + /** + * Sets the float precision on the shader, ensuring the device supports the request precision. + * If the precision is already present, it just ensures that the device is able to handle it. + * @private + * @param {string} src - The shader source + * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader. + * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports. + * @returns {string} modified shader source + */ + function setPrecision(src, requestedPrecision, maxSupportedPrecision) { + if (src.substring(0, 9) !== 'precision') { + // no precision supplied, so PixiJS will add the requested level. + var precision = requestedPrecision; + // If highp is requested but not supported, downgrade precision to a level all devices support. + if (requestedPrecision === constants.PRECISION.HIGH && maxSupportedPrecision !== constants.PRECISION.HIGH) { + precision = constants.PRECISION.MEDIUM; + } + return "precision " + precision + " float;\n" + src; + } + else if (maxSupportedPrecision !== constants.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { + // precision was supplied, but at a level this device does not support, so downgrading to mediump. + return src.replace('precision highp', 'precision mediump'); + } + return src; + } + + var GLSL_TO_SIZE = { + float: 1, + vec2: 2, + vec3: 3, + vec4: 4, + int: 1, + ivec2: 2, + ivec3: 3, + ivec4: 4, + uint: 1, + uvec2: 2, + uvec3: 3, + uvec4: 4, + bool: 1, + bvec2: 2, + bvec3: 3, + bvec4: 4, + mat2: 4, + mat3: 9, + mat4: 16, + sampler2D: 1, + }; + /** + * @private + * @method mapSize + * @memberof PIXI.glCore.shader + * @param {string} type + */ + function mapSize(type) { + return GLSL_TO_SIZE[type]; + } + + var GL_TABLE = null; + var GL_TO_GLSL_TYPES = { + FLOAT: 'float', + FLOAT_VEC2: 'vec2', + FLOAT_VEC3: 'vec3', + FLOAT_VEC4: 'vec4', + INT: 'int', + INT_VEC2: 'ivec2', + INT_VEC3: 'ivec3', + INT_VEC4: 'ivec4', + UNSIGNED_INT: 'uint', + UNSIGNED_INT_VEC2: 'uvec2', + UNSIGNED_INT_VEC3: 'uvec3', + UNSIGNED_INT_VEC4: 'uvec4', + BOOL: 'bool', + BOOL_VEC2: 'bvec2', + BOOL_VEC3: 'bvec3', + BOOL_VEC4: 'bvec4', + FLOAT_MAT2: 'mat2', + FLOAT_MAT3: 'mat3', + FLOAT_MAT4: 'mat4', + SAMPLER_2D: 'sampler2D', + INT_SAMPLER_2D: 'sampler2D', + UNSIGNED_INT_SAMPLER_2D: 'sampler2D', + SAMPLER_CUBE: 'samplerCube', + INT_SAMPLER_CUBE: 'samplerCube', + UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', + SAMPLER_2D_ARRAY: 'sampler2DArray', + INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + }; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function mapType(gl, type) { + if (!GL_TABLE) { + var typeNames = Object.keys(GL_TO_GLSL_TYPES); + GL_TABLE = {}; + for (var i = 0; i < typeNames.length; ++i) { + var tn = typeNames[i]; + GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; + } + } + return GL_TABLE[type]; + } + + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + // Parsers, each one of these will take a look at the type of shader property and uniform. + // if they pass the test function then the code function is called that returns a the shader upload code for that uniform. + // Shader upload code is automagically generated with these parsers. + // If no parser is valid then the default upload functions are used. + // exposing Parsers means that custom upload logic can be added to pixi's shaders. + // A good example would be a pixi rectangle can be directly set on a uniform. + // If the shader sees it it knows how to upload the rectangle structure as a vec4 + // format is as follows: + // + // { + // test: (data, uniform) => {} <--- test is this code should be used for this uniform + // code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform + // codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the + // uniform to a uniform buffer + // } + var uniformParsers = [ + // a float cache layer + { + test: function (data) { + return data.type === 'float' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; + }, + }, + // handling samplers + { + test: function (data, uniform) { + // eslint-disable-next-line max-len,no-eq-null,eqeqeq + return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined); + }, + code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, + }, + // uploading pixi matrix object to mat3 + { + test: function (data, uniform) { + return data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined; + }, + code: function (name) { + // TODO and some smart caching dirty ids here! + return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; + }, + codeUbo: function (name) { + return "\n var " + name + "_matrix = uv." + name + ".toArray(true);\n\n data[offset] = " + name + "_matrix[0];\n data[offset+1] = " + name + "_matrix[1];\n data[offset+2] = " + name + "_matrix[2];\n \n data[offset + 4] = " + name + "_matrix[3];\n data[offset + 5] = " + name + "_matrix[4];\n data[offset + 6] = " + name + "_matrix[5];\n \n data[offset + 8] = " + name + "_matrix[6];\n data[offset + 9] = " + name + "_matrix[7];\n data[offset + 10] = " + name + "_matrix[8];\n "; + }, + }, + // uploading a pixi point as a vec2 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "; + } + }, + // caching layer for a vec2 + { + test: function (data) { + return data.type === 'vec2' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; + }, + }, + // upload a pixi rectangle as a vec4 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "; + } + }, + // a caching layer for vec4 uploading + { + test: function (data) { + return data.type === 'vec4' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; + }, + } ]; + + // cu = Cached value's uniform data field + // cv = Cached value + // v = value to upload + // ud = uniformData + // uv = uniformValue + // l = location + var GLSL_TO_SINGLE_SETTERS_CACHED = { + float: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }", + vec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }", + vec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", + vec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }", + int: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + ivec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + ivec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + ivec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + uint: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }", + uvec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }", + uvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }", + uvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }", + bool: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }", + bvec2: "\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + bvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + bvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + mat2: 'gl.uniformMatrix2fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + sampler2D: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + samplerCube: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + sampler2DArray: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + }; + var GLSL_TO_ARRAY_SETTERS = { + float: "gl.uniform1fv(location, v)", + vec2: "gl.uniform2fv(location, v)", + vec3: "gl.uniform3fv(location, v)", + vec4: 'gl.uniform4fv(location, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + int: 'gl.uniform1iv(location, v)', + ivec2: 'gl.uniform2iv(location, v)', + ivec3: 'gl.uniform3iv(location, v)', + ivec4: 'gl.uniform4iv(location, v)', + uint: 'gl.uniform1uiv(location, v)', + uvec2: 'gl.uniform2uiv(location, v)', + uvec3: 'gl.uniform3uiv(location, v)', + uvec4: 'gl.uniform4uiv(location, v)', + bool: 'gl.uniform1iv(location, v)', + bvec2: 'gl.uniform2iv(location, v)', + bvec3: 'gl.uniform3iv(location, v)', + bvec4: 'gl.uniform4iv(location, v)', + sampler2D: 'gl.uniform1iv(location, v)', + samplerCube: 'gl.uniform1iv(location, v)', + sampler2DArray: 'gl.uniform1iv(location, v)', + }; + function generateUniformsSync(group, uniformData) { + var _a; + var funcFragments = ["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "]; + for (var i in group.uniforms) { + var data = uniformData[i]; + if (!data) { + if ((_a = group.uniforms[i]) === null || _a === void 0 ? void 0 : _a.group) { + if (group.uniforms[i].ubo) { + funcFragments.push("\n renderer.shader.syncUniformBufferGroup(uv." + i + ", '" + i + "');\n "); + } + else { + funcFragments.push("\n renderer.shader.syncUniformGroup(uv." + i + ", syncData);\n "); + } + } + continue; + } + var uniform = group.uniforms[i]; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + if (uniformParsers[j].test(data, uniform)) { + funcFragments.push(uniformParsers[j].code(i, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + var templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; + var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); + funcFragments.push("\n cu = ud[\"" + i + "\"];\n cv = cu.value;\n v = uv[\"" + i + "\"];\n " + template + ";"); + } + } + /* + * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly + * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used + * no matter which group is being used + * + */ + // eslint-disable-next-line no-new-func + return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); + } + + var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' ].join('\n'); + function generateIfTestSrc(maxIfs) { + var src = ''; + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxIfs - 1) { + src += "if(test == " + i + ".0){}"; + } + } + return src; + } + function checkMaxIfStatementsInShader(maxIfs, gl) { + if (maxIfs === 0) { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + var shader = gl.createShader(gl.FRAGMENT_SHADER); + while (true) // eslint-disable-line no-constant-condition + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + maxIfs = (maxIfs / 2) | 0; + } + else { + // valid! + break; + } + } + return maxIfs; + } + + // Cache the result to prevent running this over and over + var unsafeEval; + /** + * Not all platforms allow to generate function code (e.g., `new Function`). + * this provides the platform-level detection. + * @private + * @returns {boolean} `true` if `new Function` is supported. + */ + function unsafeEvalSupported() { + if (typeof unsafeEval === 'boolean') { + return unsafeEval; + } + try { + /* eslint-disable no-new-func */ + var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); + /* eslint-enable no-new-func */ + unsafeEval = func({ a: 'b' }, 'a', 'b') === true; + } + catch (e) { + unsafeEval = false; + } + return unsafeEval; + } + + /** + * @namespace PIXI.glCore + * @private + */ + + var defaultFragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; + + var defaultVertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; + + var UID$1 = 0; + var nameCache = {}; + /** + * Helper class to create a shader program. + * @memberof PIXI + */ + var Program = /** @class */ (function () { + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + */ + function Program(vertexSrc, fragmentSrc, name) { + if (name === void 0) { name = 'pixi-shader'; } + this.id = UID$1++; + this.vertexSrc = vertexSrc || Program.defaultVertexSrc; + this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; + this.vertexSrc = this.vertexSrc.trim(); + this.fragmentSrc = this.fragmentSrc.trim(); + if (this.vertexSrc.substring(0, 8) !== '#version') { + name = name.replace(/\s+/g, '-'); + if (nameCache[name]) { + nameCache[name]++; + name += "-" + nameCache[name]; + } + else { + nameCache[name] = 1; + } + this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; + this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; + this.vertexSrc = setPrecision(this.vertexSrc, settings.settings.PRECISION_VERTEX, constants.PRECISION.HIGH); + this.fragmentSrc = setPrecision(this.fragmentSrc, settings.settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); + } + // currently this does not extract structs only default types + // this is where we store shader references.. + this.glPrograms = {}; + this.syncUniforms = null; + } + Object.defineProperty(Program, "defaultVertexSrc", { + /** + * The default vertex shader source. + * @constant + */ + get: function () { + return defaultVertex$3; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Program, "defaultFragmentSrc", { + /** + * The default fragment shader source. + * @constant + */ + get: function () { + return defaultFragment$2; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a program based of a vertex and fragment shader. + * + * This method will also check to see if there is a cached program. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + * @returns A shiny new PixiJS shader program! + */ + Program.from = function (vertexSrc, fragmentSrc, name) { + var key = vertexSrc + fragmentSrc; + var program = utils.ProgramCache[key]; + if (!program) { + utils.ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); + } + return program; + }; + return Program; + }()); + + /** + * A helper class for shaders. + * @memberof PIXI + */ + var Shader = /** @class */ (function () { + /** + * @param program - The program the shader will use. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Shader(program, uniforms) { + /** + * Used internally to bind uniform buffer objects. + * @ignore + */ + this.uniformBindCount = 0; + this.program = program; + // lets see whats been passed in + // uniforms should be converted to a uniform group + if (uniforms) { + if (uniforms instanceof UniformGroup) { + this.uniformGroup = uniforms; + } + else { + this.uniformGroup = new UniformGroup(uniforms); + } + } + else { + this.uniformGroup = new UniformGroup({}); + } + this.disposeRunner = new runner.Runner('disposeShader'); + } + // TODO move to shader system.. + Shader.prototype.checkUniformExists = function (name, group) { + if (group.uniforms[name]) { + return true; + } + for (var i in group.uniforms) { + var uniform = group.uniforms[i]; + if (uniform.group) { + if (this.checkUniformExists(name, uniform)) { + return true; + } + } + } + return false; + }; + Shader.prototype.destroy = function () { + // usage count on programs? + // remove if not used! + this.uniformGroup = null; + this.disposeRunner.emit(this); + this.disposeRunner.destroy(); + }; + Object.defineProperty(Shader.prototype, "uniforms", { + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms`. + * @readonly + */ + get: function () { + return this.uniformGroup.uniforms; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a shader based of a vertex and fragment shader. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + * @returns A shiny new PixiJS shader! + */ + Shader.from = function (vertexSrc, fragmentSrc, uniforms) { + var program = Program.from(vertexSrc, fragmentSrc); + return new Shader(program, uniforms); + }; + return Shader; + }()); + + /* eslint-disable max-len */ + var BLEND$1 = 0; + var OFFSET$1 = 1; + var CULLING$1 = 2; + var DEPTH_TEST$1 = 3; + var WINDING$1 = 4; + var DEPTH_MASK$1 = 5; + /** + * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}. + * + * Each mesh rendered may require WebGL to be in a different state. + * For example you may want different blend mode or to enable polygon offsets + * @memberof PIXI + */ + var State = /** @class */ (function () { + function State() { + this.data = 0; + this.blendMode = constants.BLEND_MODES.NORMAL; + this.polygonOffset = 0; + this.blend = true; + this.depthMask = true; + // this.depthTest = true; + } + Object.defineProperty(State.prototype, "blend", { + /** + * Activates blending of the computed fragment color values. + * @default true + */ + get: function () { + return !!(this.data & (1 << BLEND$1)); + }, + set: function (value) { + if (!!(this.data & (1 << BLEND$1)) !== value) { + this.data ^= (1 << BLEND$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "offsets", { + /** + * Activates adding an offset to depth values of polygon's fragments + * @default false + */ + get: function () { + return !!(this.data & (1 << OFFSET$1)); + }, + set: function (value) { + if (!!(this.data & (1 << OFFSET$1)) !== value) { + this.data ^= (1 << OFFSET$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "culling", { + /** + * Activates culling of polygons. + * @default false + */ + get: function () { + return !!(this.data & (1 << CULLING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << CULLING$1)) !== value) { + this.data ^= (1 << CULLING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthTest", { + /** + * Activates depth comparisons and updates to the depth buffer. + * @default false + */ + get: function () { + return !!(this.data & (1 << DEPTH_TEST$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_TEST$1)) !== value) { + this.data ^= (1 << DEPTH_TEST$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthMask", { + /** + * Enables or disables writing to the depth buffer. + * @default true + */ + get: function () { + return !!(this.data & (1 << DEPTH_MASK$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_MASK$1)) !== value) { + this.data ^= (1 << DEPTH_MASK$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "clockwiseFrontFace", { + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @default false + */ + get: function () { + return !!(this.data & (1 << WINDING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << WINDING$1)) !== value) { + this.data ^= (1 << WINDING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "blendMode", { + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this._blendMode; + }, + set: function (value) { + this.blend = (value !== constants.BLEND_MODES.NONE); + this._blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "polygonOffset", { + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * @default 0 + */ + get: function () { + return this._polygonOffset; + }, + set: function (value) { + this.offsets = !!value; + this._polygonOffset = value; + }, + enumerable: false, + configurable: true + }); + State.prototype.toString = function () { + return "[@pixi/core:State " + + ("blendMode=" + this.blendMode + " ") + + ("clockwiseFrontFace=" + this.clockwiseFrontFace + " ") + + ("culling=" + this.culling + " ") + + ("depthMask=" + this.depthMask + " ") + + ("polygonOffset=" + this.polygonOffset) + + "]"; + }; + State.for2d = function () { + var state = new State(); + state.depthTest = false; + state.blend = true; + return state; + }; + return State; + }()); + + var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; + + var defaultVertex$2 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + + /** + * A filter is a special shader that applies post-processing effects to an input texture and writes into an output + * render-target. + * + * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the + * {@link PIXI.filters.BlurFilter BlurFilter}. + * + * ### Usage + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. + * + * ``` + * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); + * const container = new PIXI.Container(); + * container.filters = [filter]; + * ``` + * + * ### Previous Version Differences + * + * In PixiJS **v3**, a filter was always applied to _whole screen_. + * + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers had to create a set of uniforms to deal with coordinates. + * + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. + * + * Also be aware that we have changed default vertex shader, please consult + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * ### Frames + * + * The following table summarizes the coordinate spaces used in the filtering pipeline: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Coordinate SpaceDescription
Texture Coordinates + * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along + * both axes. + *
World Space + * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space). + *
Physical Pixels + * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture + * coordinates by the dimensions of the texture. + *
+ * + * ### Built-in Uniforms + * + * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, + * and `projectionMatrix` uniform maps it to the gl viewport. + * + * **uSampler** + * + * The most important uniform is the input texture that container was rendered into. + * _Important note: as with all Framebuffers in PixiJS, both input and output are + * premultiplied by alpha._ + * + * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. + * Use it to sample the input. + * + * ``` + * const fragment = ` + * varying vec2 vTextureCoord; + * uniform sampler2D uSampler; + * void main(void) + * { + * gl_FragColor = texture2D(uSampler, vTextureCoord); + * } + * `; + * + * const myFilter = new PIXI.Filter(null, fragment); + * ``` + * + * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. + * + * **outputFrame** + * + * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. + * It's the same as `renderer.screen` for a fullscreen filter. + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, + * `(0, 0, outputFrame.width, outputFrame.height)`, + * + * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. + * To calculate vertex position in screen space using normalized (0-1) space: + * + * ``` + * vec4 filterVertexPosition( void ) + * { + * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + * } + * ``` + * + * **inputSize** + * + * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary framebuffer that holds input. + * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. + * + * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. + * + * To calculate input normalized coordinate, you have to map it to filter normalized space. + * Multiply by `outputFrame.zw` to get input coordinate. + * Divide by `inputSize.xy` to get input normalized coordinate. + * + * ``` + * vec2 filterTextureCoord( void ) + * { + * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy + * } + * ``` + * **resolution** + * + * The `resolution` is the ratio of screen (CSS) pixels to real pixels. + * + * **inputPixel** + * + * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` + * `inputPixel.zw` is inverted `inputPixel.xy`. + * + * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. + * + * **inputClamp** + * + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. + * For displacements, coordinates has to be clamped. + * + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer + * `inputClamp.zw` is bottom-right pixel center. + * + * ``` + * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw)) + * ``` + * OR + * ``` + * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) + * ``` + * + * ### Additional Information + * + * Complete documentation on Filter usage is located in the + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. + * @memberof PIXI + */ + var Filter = /** @class */ (function (_super) { + __extends(Filter, _super); + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); + _this = _super.call(this, program, uniforms) || this; + _this.padding = 0; + _this.resolution = settings.settings.FILTER_RESOLUTION; + _this.multisample = settings.settings.FILTER_MULTISAMPLE; + _this.enabled = true; + _this.autoFit = true; + _this.state = new State(); + return _this; + } + /** + * Applies the filter + * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it. + * @param {object} [_currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { + // do as you please! + filterManager.applyFilter(this, input, output, clearMode); + // or just do a regular render.. + }; + Object.defineProperty(Filter.prototype, "blendMode", { + /** + * Sets the blend mode of the filter. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.state.blendMode; + }, + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter.prototype, "resolution", { + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + */ + get: function () { + return this._resolution; + }, + set: function (value) { + this._resolution = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultVertexSrc", { + /** + * The default vertex shader source + * @constant + */ + get: function () { + return defaultVertex$2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultFragmentSrc", { + /** + * The default fragment shader source + * @constant + */ + get: function () { + return defaultFragment$1; + }, + enumerable: false, + configurable: true + }); + return Filter; + }(Shader)); + + var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; + + var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; + + var tempMat = new math.Matrix(); + /** + * Class controls uv mapping from Texture normal space to BaseTexture normal space. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. + * + * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * Takes track of Texture changes through `_lastTextureID` private field. + * Use `update()` method call to track it from outside. + * @see PIXI.Texture + * @see PIXI.Mesh + * @see PIXI.TilingSprite + * @memberof PIXI + */ + var TextureMatrix = /** @class */ (function () { + /** + * @param texture - observed texture + * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + */ + function TextureMatrix(texture, clampMargin) { + this._texture = texture; + this.mapCoord = new math.Matrix(); + this.uClampFrame = new Float32Array(4); + this.uClampOffset = new Float32Array(2); + this._textureID = -1; + this._updateID = 0; + this.clampOffset = 0; + this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; + this.isSimple = false; + } + Object.defineProperty(TextureMatrix.prototype, "texture", { + /** Texture property. */ + get: function () { + return this._texture; + }, + set: function (value) { + this._texture = value; + this._textureID = -1; + }, + enumerable: false, + configurable: true + }); + /** + * Multiplies uvs array to transform + * @param uvs - mesh uvs + * @param [out=uvs] - output + * @returns - output + */ + TextureMatrix.prototype.multiplyUvs = function (uvs, out) { + if (out === undefined) { + out = uvs; + } + var mat = this.mapCoord; + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + out[i] = (x * mat.a) + (y * mat.c) + mat.tx; + out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; + } + return out; + }; + /** + * Updates matrices if texture was changed. + * @param [forceUpdate=false] - if true, matrices will be updated any case + * @returns - Whether or not it was updated + */ + TextureMatrix.prototype.update = function (forceUpdate) { + var tex = this._texture; + if (!tex || !tex.valid) { + return false; + } + if (!forceUpdate + && this._textureID === tex._updateID) { + return false; + } + this._textureID = tex._updateID; + this._updateID++; + var uvs = tex._uvs; + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + var orig = tex.orig; + var trim = tex.trim; + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + this.isSimple = tex._frame.width === texBase.width + && tex._frame.height === texBase.height + && tex.rotate === 0; + return true; + }; + return TextureMatrix; + }()); + + /** + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. + * @memberof PIXI + */ + var SpriteMaskFilter = /** @class */ (function (_super) { + __extends(SpriteMaskFilter, _super); + /** @ignore */ + function SpriteMaskFilter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var sprite = null; + if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined) { + sprite = vertexSrc; + vertexSrc = undefined; + fragmentSrc = undefined; + uniforms = undefined; + } + _this = _super.call(this, vertexSrc || vertex, fragmentSrc || fragment, uniforms) || this; + _this.maskSprite = sprite; + _this.maskMatrix = new math.Matrix(); + return _this; + } + Object.defineProperty(SpriteMaskFilter.prototype, "maskSprite", { + /** + * Sprite mask + * @type {PIXI.DisplayObject} + */ + get: function () { + return this._maskSprite; + }, + set: function (value) { + this._maskSprite = value; + if (this._maskSprite) { + this._maskSprite.renderable = false; + } + }, + enumerable: false, + configurable: true + }); + /** + * Applies the filter + * @param filterManager - The renderer to retrieve the filter from + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it. + */ + SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { + var maskSprite = this._maskSprite; + var tex = maskSprite._texture; + if (!tex.valid) { + return; + } + if (!tex.uvMatrix) { + // margin = 0.0, let it bleed a bit, shader code becomes easier + // assuming that atlas textures were made with 1-pixel padding + tex.uvMatrix = new TextureMatrix(tex, 0.0); + } + tex.uvMatrix.update(); + this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; + this.uniforms.mask = tex; + // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` + this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) + .prepend(tex.uvMatrix.mapCoord); + this.uniforms.alpha = maskSprite.worldAlpha; + this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; + filterManager.applyFilter(this, input, output, clearMode); + }; + return SpriteMaskFilter; + }(Filter)); + + /** + * System plugin to the renderer to manage masks. + * + * There are three built-in types of masking: + * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is + * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular. + * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil + * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does + * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks. + * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's + * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this + * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins. + * + * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics` + * object with just a rectangle drawn. + * + * ## Mask Stacks + * + * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask + * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e. + * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target. + * @memberof PIXI + */ + var MaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function MaskSystem(renderer) { + this.renderer = renderer; + this.enableScissor = true; + this.alphaMaskPool = []; + this.maskDataPool = []; + this.maskStack = []; + this.alphaMaskIndex = 0; + } + /** + * Changes the mask stack that is used by this System. + * @param maskStack - The mask stack + */ + MaskSystem.prototype.setMaskStack = function (maskStack) { + this.maskStack = maskStack; + this.renderer.scissor.setMaskStack(maskStack); + this.renderer.stencil.setMaskStack(maskStack); + }; + /** + * Enables the mask and appends it to the current mask stack. + * + * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked. + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data. + */ + MaskSystem.prototype.push = function (target, maskDataOrTarget) { + var maskData = maskDataOrTarget; + if (!maskData.isMaskData) { + var d = this.maskDataPool.pop() || new MaskData(); + d.pooled = true; + d.maskObject = maskDataOrTarget; + maskData = d; + } + var maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + maskData.copyCountersOrReset(maskAbove); + maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf; + if (maskData.autoDetect) { + this.detect(maskData); + } + maskData._target = target; + if (maskData.type !== constants.MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + if (maskData.enabled) { + switch (maskData.type) { + case constants.MASK_TYPES.SCISSOR: + this.renderer.scissor.push(maskData); + break; + case constants.MASK_TYPES.STENCIL: + this.renderer.stencil.push(maskData); + break; + case constants.MASK_TYPES.SPRITE: + maskData.copyCountersOrReset(null); + this.pushSpriteMask(maskData); + break; + case constants.MASK_TYPES.COLOR: + this.pushColorMask(maskData); + break; + default: + break; + } + } + if (maskData.type === constants.MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + }; + /** + * Removes the last mask from the mask stack and doesn't return it. + * + * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed. + * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from + */ + MaskSystem.prototype.pop = function (target) { + var maskData = this.maskStack.pop(); + if (!maskData || maskData._target !== target) { + // TODO: add an assert when we have it + return; + } + if (maskData.enabled) { + switch (maskData.type) { + case constants.MASK_TYPES.SCISSOR: + this.renderer.scissor.pop(maskData); + break; + case constants.MASK_TYPES.STENCIL: + this.renderer.stencil.pop(maskData.maskObject); + break; + case constants.MASK_TYPES.SPRITE: + this.popSpriteMask(maskData); + break; + case constants.MASK_TYPES.COLOR: + this.popColorMask(maskData); + break; + default: + break; + } + } + maskData.reset(); + if (maskData.pooled) { + this.maskDataPool.push(maskData); + } + if (this.maskStack.length !== 0) { + var maskCurrent = this.maskStack[this.maskStack.length - 1]; + if (maskCurrent.type === constants.MASK_TYPES.SPRITE && maskCurrent._filters) { + maskCurrent._filters[0].maskSprite = maskCurrent.maskObject; + } + } + }; + /** + * Sets type of MaskData based on its maskObject. + * @param maskData + */ + MaskSystem.prototype.detect = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject) { + maskData.type = constants.MASK_TYPES.COLOR; + } + else if (maskObject.isSprite) { + maskData.type = constants.MASK_TYPES.SPRITE; + } + else if (this.enableScissor && this.renderer.scissor.testScissor(maskData)) { + maskData.type = constants.MASK_TYPES.SCISSOR; + } + else { + maskData.type = constants.MASK_TYPES.STENCIL; + } + }; + /** + * Applies the Mask and adds it to the current filter stack. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.pushSpriteMask = function (maskData) { + var _a, _b; + var maskObject = maskData.maskObject; + var target = maskData._target; + var alphaMaskFilter = maskData._filters; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()]; + } + } + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var resolution; + var multisample; + if (renderTextureSystem.current) { + var renderTexture = renderTextureSystem.current; + resolution = maskData.resolution || renderTexture.resolution; + multisample = (_a = maskData.multisample) !== null && _a !== void 0 ? _a : renderTexture.multisample; + } + else { + resolution = maskData.resolution || renderer.resolution; + multisample = (_b = maskData.multisample) !== null && _b !== void 0 ? _b : renderer.multisample; + } + alphaMaskFilter[0].resolution = resolution; + alphaMaskFilter[0].multisample = multisample; + alphaMaskFilter[0].maskSprite = maskObject; + var stashFilterArea = target.filterArea; + target.filterArea = maskObject.getBounds(true); + renderer.filter.push(target, alphaMaskFilter); + target.filterArea = stashFilterArea; + if (!maskData._filters) { + this.alphaMaskIndex++; + } + }; + /** + * Removes the last filter from the filter stack and doesn't return it. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.popSpriteMask = function (maskData) { + this.renderer.filter.pop(); + if (maskData._filters) { + maskData._filters[0].maskSprite = null; + } + else { + this.alphaMaskIndex--; + this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null; + } + }; + /** + * Pushes the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.pushColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + /** + * Pops the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.popColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = this.maskStack.length > 0 + ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + MaskSystem.prototype.destroy = function () { + this.renderer = null; + }; + return MaskSystem; + }()); + + /** + * System plugin to the renderer to manage specific types of masking operations. + * @memberof PIXI + */ + var AbstractMaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function AbstractMaskSystem(renderer) { + this.renderer = renderer; + this.maskStack = []; + this.glConst = 0; + } + /** Gets count of masks of certain type. */ + AbstractMaskSystem.prototype.getStackLength = function () { + return this.maskStack.length; + }; + /** + * Changes the mask stack that is used by this System. + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { + var gl = this.renderer.gl; + var curStackLen = this.getStackLength(); + this.maskStack = maskStack; + var newStackLen = this.getStackLength(); + if (newStackLen !== curStackLen) { + if (newStackLen === 0) { + gl.disable(this.glConst); + } + else { + gl.enable(this.glConst); + this._useCurrent(); + } + } + }; + /** + * Setup renderer to use the current mask data. + * @private + */ + AbstractMaskSystem.prototype._useCurrent = function () { + // OVERWRITE; + }; + /** Destroys the mask stack. */ + AbstractMaskSystem.prototype.destroy = function () { + this.renderer = null; + this.maskStack = null; + }; + return AbstractMaskSystem; + }()); + + var tempMatrix$1 = new math.Matrix(); + var rectPool = []; + /** + * System plugin to the renderer to manage scissor masking. + * + * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer + * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically + * by this system. + * @memberof PIXI + */ + var ScissorSystem = /** @class */ (function (_super) { + __extends(ScissorSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ScissorSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST; + return _this; + } + ScissorSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._scissorCounter; + } + return 0; + }; + /** + * evaluates _boundsTransformed, _scissorRect for MaskData + * @param maskData + */ + ScissorSystem.prototype.calcScissorRect = function (maskData) { + var _a; + if (maskData._scissorRectLocal) { + return; + } + var prevData = maskData._scissorRect; + var maskObject = maskData.maskObject; + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var rect = maskObject.getBounds(true, (_a = rectPool.pop()) !== null && _a !== void 0 ? _a : new math.Rectangle()); + this.roundFrameToPixels(rect, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + if (prevData) { + rect.fit(prevData); + } + maskData._scissorRectLocal = rect; + }; + ScissorSystem.isMatrixRotated = function (matrix) { + if (!matrix) { + return false; + } + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)); + }; + /** + * Test, whether the object can be scissor mask with current renderer projection. + * Calls "calcScissorRect()" if its true. + * @param maskData - mask data + * @returns whether Whether the object can be scissor mask + */ + ScissorSystem.prototype.testScissor = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject.isFastRect || !maskObject.isFastRect()) { + return false; + } + if (ScissorSystem.isMatrixRotated(maskObject.worldTransform)) { + return false; + } + if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform)) { + return false; + } + this.calcScissorRect(maskData); + var rect = maskData._scissorRectLocal; + return rect.width > 0 && rect.height > 0; + }; + ScissorSystem.prototype.roundFrameToPixels = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (ScissorSystem.isMatrixRotated(transform)) { + return; + } + transform = transform ? tempMatrix$1.copyFrom(transform) : tempMatrix$1.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.renderer.filter.transformAABB(transform, frame); + frame.fit(bindingDestinationFrame); + frame.x = Math.round(frame.x * resolution); + frame.y = Math.round(frame.y * resolution); + frame.width = Math.round(frame.width * resolution); + frame.height = Math.round(frame.height * resolution); + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @author alvin + * @param maskData - The mask data. + */ + ScissorSystem.prototype.push = function (maskData) { + if (!maskData._scissorRectLocal) { + this.calcScissorRect(maskData); + } + var gl = this.renderer.gl; + if (!maskData._scissorRect) { + gl.enable(gl.SCISSOR_TEST); + } + maskData._scissorCounter++; + maskData._scissorRect = maskData._scissorRectLocal; + this._useCurrent(); + }; + /** + * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the + * last mask in the stack. + * + * This can also be called when you directly modify the scissor box and want to restore PixiJS state. + * @param maskData - The mask data. + */ + ScissorSystem.prototype.pop = function (maskData) { + var gl = this.renderer.gl; + if (maskData) { + rectPool.push(maskData._scissorRectLocal); + } + if (this.getStackLength() > 0) { + this._useCurrent(); + } + else { + gl.disable(gl.SCISSOR_TEST); + } + }; + /** + * Setup renderer to use the current scissor data. + * @private + */ + ScissorSystem.prototype._useCurrent = function () { + var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; + var y; + if (this.renderer.renderTexture.current) { + y = rect.y; + } + else { + // flipY. In future we'll have it over renderTextures as an option + y = this.renderer.height - rect.height - rect.y; + } + this.renderer.gl.scissor(rect.x, y, rect.width, rect.height); + }; + return ScissorSystem; + }(AbstractMaskSystem)); + + /** + * System plugin to the renderer to manage stencils (used for masks). + * @memberof PIXI + */ + var StencilSystem = /** @class */ (function (_super) { + __extends(StencilSystem, _super); + /** + * @param renderer - The renderer this System works for. + */ + function StencilSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST; + return _this; + } + StencilSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._stencilCounter; + } + return 0; + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @param maskData - The mask data + */ + StencilSystem.prototype.push = function (maskData) { + var maskObject = maskData.maskObject; + var gl = this.renderer.gl; + var prevMaskCount = maskData._stencilCounter; + if (prevMaskCount === 0) { + // force use stencil texture in current framebuffer + this.renderer.framebuffer.forceStencil(); + gl.clearStencil(0); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.enable(gl.STENCIL_TEST); + } + maskData._stencilCounter++; + var colorMask = maskData._colorMask; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Increment the reference stencil value where the new mask overlaps with the old ones. + gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 1) !== 0, (colorMask & 2) !== 0, (colorMask & 4) !== 0, (colorMask & 8) !== 0); + } + this._useCurrent(); + }; + /** + * Pops stencil mask. MaskData is already removed from stack + * @param {PIXI.DisplayObject} maskObject - object of popped mask data + */ + StencilSystem.prototype.pop = function (maskObject) { + var gl = this.renderer.gl; + if (this.getStackLength() === 0) { + // the stack is empty! + gl.disable(gl.STENCIL_TEST); + } + else { + var maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + var colorMask = maskData ? maskData._colorMask : 0xf; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Decrement the reference stencil value where the popped mask overlaps with the other ones + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 0x1) !== 0, (colorMask & 0x2) !== 0, (colorMask & 0x4) !== 0, (colorMask & 0x8) !== 0); + } + this._useCurrent(); + } + }; + /** + * Setup renderer to use the current stencil data. + * @private + */ + StencilSystem.prototype._useCurrent = function () { + var gl = this.renderer.gl; + gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + }; + return StencilSystem; + }(AbstractMaskSystem)); + + /** + * System plugin to the renderer to manage the projection matrix. + * + * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to + * normalized device coordinates. + * @memberof PIXI + */ + var ProjectionSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ProjectionSystem(renderer) { + this.renderer = renderer; + this.destinationFrame = null; + this.sourceFrame = null; + this.defaultFrame = null; + this.projectionMatrix = new math.Matrix(); + this.transform = null; + } + /** + * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided. + * + * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because + * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates. + * + * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected + * that you dirty the current bindings when calling this manually. + * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas, + * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left. + * @param sourceFrame - The rectangle in world space that contains the contents being rendered. + * @param resolution - The resolution of the render-target, which is the ratio of + * world-space (or CSS) pixels to physical pixels. + * @param root - Whether the render-target is the screen. This is required because rendering to textures + * is y-flipped (i.e. upside down relative to the screen). + */ + ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { + this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; + this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; + // Calculate object-space to clip-space projection + this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); + if (this.transform) { + this.projectionMatrix.append(this.transform); + } + var renderer = this.renderer; + renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; + renderer.globalUniforms.update(); + // this will work for now + // but would be sweet to stick and even on the global uniforms.. + if (renderer.shader.shader) { + renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); + } + }; + /** + * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`. + * @param _destinationFrame - The destination frame in the render-target. + * @param sourceFrame - The source frame in world space. + * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels. + * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection + * is y-flipped. + */ + ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { + var pm = this.projectionMatrix; + var sign = !root ? 1 : -1; + pm.identity(); + pm.a = (1 / sourceFrame.width * 2); + pm.d = sign * (1 / sourceFrame.height * 2); + pm.tx = -1 - (sourceFrame.x * pm.a); + pm.ty = -sign - (sourceFrame.y * pm.d); + }; + /** + * Sets the transform of the active render target to the given matrix. + * @param _matrix - The transformation matrix + */ + ProjectionSystem.prototype.setTransform = function (_matrix) { + // this._activeRenderTarget.transform = matrix; + }; + ProjectionSystem.prototype.destroy = function () { + this.renderer = null; + }; + return ProjectionSystem; + }()); + + // Temporary rectangle for assigned sourceFrame or destinationFrame + var tempRect = new math.Rectangle(); + // Temporary rectangle for renderTexture destinationFrame + var tempRect2 = new math.Rectangle(); + /* eslint-disable max-len */ + /** + * System plugin to the renderer to manage render textures. + * + * Should be added after FramebufferSystem + * + * ### Frames + * + * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different + * coordinate spaces used: + * + * | Frame | Description | Coordinate System | + * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- | + * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left | + * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. | + * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. | + * @memberof PIXI + */ + var RenderTextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function RenderTextureSystem(renderer) { + this.renderer = renderer; + this.clearColor = renderer._backgroundColorRgba; + this.defaultMaskStack = []; + this.current = null; + this.sourceFrame = new math.Rectangle(); + this.destinationFrame = new math.Rectangle(); + this.viewportFrame = new math.Rectangle(); + } + /** + * Bind the current render texture. + * @param renderTexture - RenderTexture to bind, by default its `null` - the screen. + * @param sourceFrame - Part of world that is mapped to the renderTexture. + * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame. + */ + RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { + if (renderTexture === void 0) { renderTexture = null; } + var renderer = this.renderer; + this.current = renderTexture; + var baseTexture; + var framebuffer; + var resolution; + if (renderTexture) { + baseTexture = renderTexture.baseTexture; + resolution = baseTexture.resolution; + if (!sourceFrame) { + tempRect.width = renderTexture.frame.width; + tempRect.height = renderTexture.frame.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + tempRect2.x = renderTexture.frame.x; + tempRect2.y = renderTexture.frame.y; + tempRect2.width = sourceFrame.width; + tempRect2.height = sourceFrame.height; + destinationFrame = tempRect2; + } + framebuffer = baseTexture.framebuffer; + } + else { + resolution = renderer.resolution; + if (!sourceFrame) { + tempRect.width = renderer.screen.width; + tempRect.height = renderer.screen.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + destinationFrame = tempRect; + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + } + } + var viewportFrame = this.viewportFrame; + viewportFrame.x = destinationFrame.x * resolution; + viewportFrame.y = destinationFrame.y * resolution; + viewportFrame.width = destinationFrame.width * resolution; + viewportFrame.height = destinationFrame.height * resolution; + if (!renderTexture) { + viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height); + } + viewportFrame.ceil(); + this.renderer.framebuffer.bind(framebuffer, viewportFrame); + this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); + if (renderTexture) { + this.renderer.mask.setMaskStack(baseTexture.maskStack); + } + else { + this.renderer.mask.setMaskStack(this.defaultMaskStack); + } + this.sourceFrame.copyFrom(sourceFrame); + this.destinationFrame.copyFrom(destinationFrame); + }; + /** + * Erases the render texture and fills the drawing area with a colour. + * @param clearColor - The color as rgba, default to use the renderer backgroundColor + * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + RenderTextureSystem.prototype.clear = function (clearColor, mask) { + if (this.current) { + clearColor = clearColor || this.current.baseTexture.clearColor; + } + else { + clearColor = clearColor || this.clearColor; + } + var destinationFrame = this.destinationFrame; + var baseFrame = this.current ? this.current.baseTexture : this.renderer.screen; + var clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height; + if (clearMask) { + var _a = this.viewportFrame, x = _a.x, y = _a.y, width = _a.width, height = _a.height; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + // TODO: ScissorSystem should cache whether the scissor test is enabled or not. + this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST); + this.renderer.gl.scissor(x, y, width, height); + } + this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); + if (clearMask) { + // Restore the scissor box + this.renderer.scissor.pop(); + } + }; + RenderTextureSystem.prototype.resize = function () { + // resize the root only! + this.bind(null); + }; + /** Resets render-texture state. */ + RenderTextureSystem.prototype.reset = function () { + this.bind(null); + }; + RenderTextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return RenderTextureSystem; + }()); + + function uboUpdate(_ud, _uv, _renderer, _syncData, buffer) { + _renderer.buffer.update(buffer); + } + // cv = CachedValue + // v = value + // ud = uniformData + // uv = uniformValue + // l = location + var UBO_TO_SINGLE_SETTERS = { + float: "\n data[offset] = v;\n ", + vec2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n ", + vec3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ", + vec4: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ", + mat2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ", + mat3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ", + mat4: "\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n " + }; + var GLSL_TO_STD40_SIZE = { + float: 4, + vec2: 8, + vec3: 12, + vec4: 16, + int: 4, + ivec2: 8, + ivec3: 12, + ivec4: 16, + uint: 4, + uvec2: 8, + uvec3: 12, + uvec4: 16, + bool: 4, + bvec2: 8, + bvec3: 12, + bvec4: 16, + mat2: 16 * 2, + mat3: 16 * 3, + mat4: 16 * 4, + }; + /** + * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js + * rewrote it, but this was a great starting point to get a solid understanding of whats going on :) + * @ignore + * @param uniformData + */ + function createUBOElements(uniformData) { + var uboElements = uniformData.map(function (data) { + return ({ + data: data, + offset: 0, + dataLen: 0, + dirty: 0 + }); + }); + var size = 0; + var chunkSize = 0; + var offset = 0; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + size = GLSL_TO_STD40_SIZE[uboElement.data.type]; + if (uboElement.data.size > 1) { + size = Math.max(size, 16) * uboElement.data.size; + } + uboElement.dataLen = size; + // add some size offset.. + // must align to the nearest 16 bytes or internally nearest round size + if (chunkSize % size !== 0 && chunkSize < 16) { + // diff required to line up.. + var lineUpValue = (chunkSize % size) % 16; + chunkSize += lineUpValue; + offset += lineUpValue; + } + if ((chunkSize + size) > 16) { + offset = Math.ceil(offset / 16) * 16; + uboElement.offset = offset; + offset += size; + chunkSize = size; + } + else { + uboElement.offset = offset; + chunkSize += size; + offset += size; + } + } + offset = Math.ceil(offset / 16) * 16; + return { uboElements: uboElements, size: offset }; + } + function getUBOData(uniforms, uniformData) { + var usedUniformDatas = []; + // build.. + for (var i in uniforms) { + if (uniformData[i]) { + usedUniformDatas.push(uniformData[i]); + } + } + // sort them out by index! + usedUniformDatas.sort(function (a, b) { return a.index - b.index; }); + return usedUniformDatas; + } + function generateUniformBufferSync(group, uniformData) { + if (!group.autoManage) { + // if the group is nott automatically managed, we don't need to generate a special function for it... + return { size: 0, syncFunc: uboUpdate }; + } + var usedUniformDatas = getUBOData(group.uniforms, uniformData); + var _a = createUBOElements(usedUniformDatas), uboElements = _a.uboElements, size = _a.size; + var funcFragments = ["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "]; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + var uniform = group.uniforms[uboElement.data.name]; + var name = uboElement.data.name; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + var uniformParser = uniformParsers[j]; + if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform)) { + funcFragments.push("offset = " + uboElement.offset / 4 + ";", uniformParsers[j].codeUbo(uboElement.data.name, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + if (uboElement.data.size > 1) { + var size_1 = mapSize(uboElement.data.type); + var rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1); + var elementSize = size_1 / rowSize; + var remainder = (4 - (elementSize % 4)) % 4; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n\n t = 0;\n\n for(var i=0; i < " + uboElement.data.size * rowSize + "; i++)\n {\n for(var j = 0; j < " + elementSize + "; j++)\n {\n data[offset++] = v[t++];\n }\n offset += " + remainder + ";\n }\n\n "); + } + else { + var template = UBO_TO_SINGLE_SETTERS[uboElement.data.type]; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n " + template + ";\n "); + } + } + } + funcFragments.push("\n renderer.buffer.update(buffer);\n "); + return { + size: size, + // eslint-disable-next-line no-new-func + syncFunc: new Function('ud', 'uv', 'renderer', 'syncData', 'buffer', funcFragments.join('\n')) + }; + } + + /** + * @private + */ + var IGLUniformData = /** @class */ (function () { + function IGLUniformData() { + } + return IGLUniformData; + }()); + /** + * Helper class to create a WebGL Program + * @memberof PIXI + */ + var GLProgram = /** @class */ (function () { + /** + * Makes a new Pixi program. + * @param program - webgl program + * @param uniformData - uniforms + */ + function GLProgram(program, uniformData) { + this.program = program; + this.uniformData = uniformData; + this.uniformGroups = {}; + this.uniformDirtyGroups = {}; + this.uniformBufferBindings = {}; + } + /** Destroys this program. */ + GLProgram.prototype.destroy = function () { + this.uniformData = null; + this.uniformGroups = null; + this.uniformDirtyGroups = null; + this.uniformBufferBindings = null; + this.program = null; + }; + return GLProgram; + }()); + + /** + * returns the attribute data from the program + * @private + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context + * @returns {object} the attribute data for this program + */ + function getAttributeData(program, gl) { + var attributes = {}; + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + if (attribData.name.indexOf('gl_') === 0) { + continue; + } + var type = mapType(gl, attribData.type); + var data = { + type: type, + name: attribData.name, + size: mapSize(type), + location: gl.getAttribLocation(program, attribData.name), + }; + attributes[attribData.name] = data; + } + return attributes; + } + + /** + * returns the uniform data from the program + * @private + * @param program - the webgl program + * @param gl - the WebGL context + * @returns {object} the uniform data for this program + */ + function getUniformData(program, gl) { + var uniforms = {}; + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]$/, ''); + var isArray = !!(uniformData.name.match(/\[.*?\]$/)); + var type = mapType(gl, uniformData.type); + uniforms[name] = { + name: name, + index: i, + type: type, + size: uniformData.size, + isArray: isArray, + value: defaultValue(type, uniformData.size), + }; + } + return uniforms; + } + + /** + * generates a WebGL Program object from a high level Pixi Program. + * @param gl - a rendering context on which to generate the program + * @param program - the high level Pixi Program. + */ + function generateProgram(gl, program) { + var glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc); + var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc); + var webGLProgram = gl.createProgram(); + gl.attachShader(webGLProgram, glVertShader); + gl.attachShader(webGLProgram, glFragShader); + gl.linkProgram(webGLProgram); + if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) { + logProgramError(gl, webGLProgram, glVertShader, glFragShader); + } + program.attributeData = getAttributeData(webGLProgram, gl); + program.uniformData = getUniformData(webGLProgram, gl); + // GLSL 1.00: bind attributes sorted by name in ascending order + // GLSL 3.00: don't change the attribute locations that where chosen by the compiler + // or assigned by the layout specifier in the shader source code + if (!(/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m).test(program.vertexSrc)) { + var keys = Object.keys(program.attributeData); + keys.sort(function (a, b) { return (a > b) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow + for (var i = 0; i < keys.length; i++) { + program.attributeData[keys[i]].location = i; + gl.bindAttribLocation(webGLProgram, i, keys[i]); + } + gl.linkProgram(webGLProgram); + } + gl.deleteShader(glVertShader); + gl.deleteShader(glFragShader); + var uniformData = {}; + for (var i in program.uniformData) { + var data = program.uniformData[i]; + uniformData[i] = { + location: gl.getUniformLocation(webGLProgram, i), + value: defaultValue(data.type, data.size), + }; + } + var glProgram = new GLProgram(webGLProgram, uniformData); + return glProgram; + } + + var UID = 0; + // default sync data so we don't create a new one each time! + var defaultSyncData = { textureCount: 0, uboCount: 0 }; + /** + * System plugin to the renderer to manage shaders. + * @memberof PIXI + */ + var ShaderSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ShaderSystem(renderer) { + this.destroyed = false; + this.renderer = renderer; + // Validation check that this environment support `new Function` + this.systemCheck(); + this.gl = null; + this.shader = null; + this.program = null; + this.cache = {}; + this._uboCache = {}; + this.id = UID++; + } + /** + * Overrideable function by `@pixi/unsafe-eval` to silence + * throwing an error if platform doesn't support unsafe-evals. + * @private + */ + ShaderSystem.prototype.systemCheck = function () { + if (!unsafeEvalSupported()) { + throw new Error('Current environment does not allow unsafe-eval, ' + + 'please use @pixi/unsafe-eval module to enable support.'); + } + }; + ShaderSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.reset(); + }; + /** + * Changes the current shader to the one given in parameter. + * @param shader - the new shader + * @param dontSync - false if the shader should automatically sync its uniforms. + * @returns the glProgram that belongs to the shader. + */ + ShaderSystem.prototype.bind = function (shader, dontSync) { + shader.disposeRunner.add(this); + shader.uniforms.globals = this.renderer.globalUniforms; + var program = shader.program; + var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader); + this.shader = shader; + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. + if (this.program !== program) { + this.program = program; + this.gl.useProgram(glProgram.program); + } + if (!dontSync) { + defaultSyncData.textureCount = 0; + defaultSyncData.uboCount = 0; + this.syncUniformGroup(shader.uniformGroup, defaultSyncData); + } + return glProgram; + }; + /** + * Uploads the uniforms values to the currently bound shader. + * @param uniforms - the uniforms values that be applied to the current shader + */ + ShaderSystem.prototype.setUniforms = function (uniforms) { + var shader = this.shader.program; + var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; + shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); + }; + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /** + * Syncs uniforms on the group + * @param group - the uniform group to sync + * @param syncData - this is data that is passed to the sync function and any nested sync functions + */ + ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id]) { + glProgram.uniformDirtyGroups[group.id] = group.dirtyId; + this.syncUniforms(group, glProgram, syncData); + } + }; + /** + * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead. + * @param group + * @param glProgram + * @param syncData + */ + ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { + var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); + }; + ShaderSystem.prototype.createSyncGroups = function (group) { + var id = this.getSignature(group, this.shader.program.uniformData, 'u'); + if (!this.cache[id]) { + this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); + } + group.syncUniforms[this.shader.program.id] = this.cache[id]; + return group.syncUniforms[this.shader.program.id]; + }; + /** + * Syncs uniform buffers + * @param group - the uniform buffer group to sync + * @param name - the name of the uniform buffer + */ + ShaderSystem.prototype.syncUniformBufferGroup = function (group, name) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id]) { + group.dirtyId = 0; + var syncFunc = glProgram.uniformGroups[group.id] + || this.createSyncBufferGroup(group, glProgram, name); + // TODO wrap update in a cache?? + group.buffer.update(); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, defaultSyncData, group.buffer); + } + this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]); + }; + /** + * Will create a function that uploads a uniform buffer using the STD140 standard. + * The upload function will then be cached for future calls + * If a group is manually managed, then a simple upload function is generated + * @param group - the uniform buffer group to sync + * @param glProgram - the gl program to attach the uniform bindings to + * @param name - the name of the uniform buffer (must exist on the shader) + */ + ShaderSystem.prototype.createSyncBufferGroup = function (group, glProgram, name) { + var gl = this.renderer.gl; + this.renderer.buffer.bind(group.buffer); + // bind them... + var uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name); + glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount; + gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount); + this.shader.uniformBindCount++; + var id = this.getSignature(group, this.shader.program.uniformData, 'ubo'); + var uboData = this._uboCache[id]; + if (!uboData) { + uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData); + } + if (group.autoManage) { + var data = new Float32Array(uboData.size / 4); + group.buffer.update(data); + } + glProgram.uniformGroups[group.id] = uboData.syncFunc; + return glProgram.uniformGroups[group.id]; + }; + /** + * Takes a uniform group and data and generates a unique signature for them. + * @param group - The uniform group to get signature of + * @param group.uniforms + * @param uniformData - Uniform information generated by the shader + * @param preFix + * @returns Unique signature of the uniform group + */ + ShaderSystem.prototype.getSignature = function (group, uniformData, preFix) { + var uniforms = group.uniforms; + var strings = [preFix + "-"]; + for (var i in uniforms) { + strings.push(i); + if (uniformData[i]) { + strings.push(uniformData[i].type); + } + } + return strings.join('-'); + }; + /** + * Returns the underlying GLShade rof the currently bound shader. + * + * This can be handy for when you to have a little more control over the setting of your uniforms. + * @returns The glProgram for the currently bound Shader for this context + */ + ShaderSystem.prototype.getGlProgram = function () { + if (this.shader) { + return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; + } + return null; + }; + /** + * Generates a glProgram version of the Shader provided. + * @param shader - The shader that the glProgram will be based on. + * @returns A shiny new glProgram! + */ + ShaderSystem.prototype.generateProgram = function (shader) { + var gl = this.gl; + var program = shader.program; + var glProgram = generateProgram(gl, program); + program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; + return glProgram; + }; + /** Resets ShaderSystem state, does not affect WebGL state. */ + ShaderSystem.prototype.reset = function () { + this.program = null; + this.shader = null; + }; + /** + * Disposes shader. + * If disposing one equals with current shader, set current as null. + * @param shader - Shader object + */ + ShaderSystem.prototype.disposeShader = function (shader) { + if (this.shader === shader) { + this.shader = null; + } + }; + /** Destroys this System and removes all its textures. */ + ShaderSystem.prototype.destroy = function () { + this.renderer = null; + // TODO implement destroy method for ShaderSystem + this.destroyed = true; + }; + return ShaderSystem; + }()); + + /** + * Maps gl blend combinations to WebGL. + * @memberof PIXI + * @function mapWebGLBlendModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {number[][]} [array=[]] - The array to output into. + * @returns {number[][]} Mapped modes. + */ + function mapWebGLBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } + // TODO - premultiply alpha would be different. + // add a boolean for that! + array[constants.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; + array[constants.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.NONE] = [0, 0]; + // not-premultiplied blend modes + array[constants.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; + array[constants.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + // composite operations + array[constants.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; + array[constants.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; + array[constants.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; + array[constants.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; + array[constants.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; + array[constants.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + // SUBTRACT from flash + array[constants.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; + return array; + } + + var BLEND = 0; + var OFFSET = 1; + var CULLING = 2; + var DEPTH_TEST = 3; + var WINDING = 4; + var DEPTH_MASK = 5; + /** + * System plugin to the renderer to manage WebGL state machines. + * @memberof PIXI + */ + var StateSystem = /** @class */ (function () { + function StateSystem() { + this.gl = null; + this.stateId = 0; + this.polygonOffset = 0; + this.blendMode = constants.BLEND_MODES.NONE; + this._blendEq = false; + // map functions for when we set state.. + this.map = []; + this.map[BLEND] = this.setBlend; + this.map[OFFSET] = this.setOffset; + this.map[CULLING] = this.setCullFace; + this.map[DEPTH_TEST] = this.setDepthTest; + this.map[WINDING] = this.setFrontFace; + this.map[DEPTH_MASK] = this.setDepthMask; + this.checks = []; + this.defaultState = new State(); + this.defaultState.blend = true; + } + StateSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.blendModes = mapWebGLBlendModesToPixi(gl); + this.set(this.defaultState); + this.reset(); + }; + /** + * Sets the current state + * @param {*} state - The state to set. + */ + StateSystem.prototype.set = function (state) { + state = state || this.defaultState; + // TODO maybe to an object check? ( this.state === state )? + if (this.stateId !== state.data) { + var diff = this.stateId ^ state.data; + var i = 0; + // order from least to most common + while (diff) { + if (diff & 1) { + // state change! + this.map[i].call(this, !!(state.data & (1 << i))); + } + diff = diff >> 1; + i++; + } + this.stateId = state.data; + } + // based on the above settings we check for specific modes.. + // for example if blend is active we check and set the blend modes + // or of polygon offset is active we check the poly depth. + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + }; + /** + * Sets the state, when previous state is unknown. + * @param {*} state - The state to set + */ + StateSystem.prototype.forceState = function (state) { + state = state || this.defaultState; + for (var i = 0; i < this.map.length; i++) { + this.map[i].call(this, !!(state.data & (1 << i))); + } + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + this.stateId = state.data; + }; + /** + * Sets whether to enable or disable blending. + * @param value - Turn on or off WebGl blending. + */ + StateSystem.prototype.setBlend = function (value) { + this.updateCheck(StateSystem.checkBlendMode, value); + this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); + }; + /** + * Sets whether to enable or disable polygon offset fill. + * @param value - Turn on or off webgl polygon offset testing. + */ + StateSystem.prototype.setOffset = function (value) { + this.updateCheck(StateSystem.checkPolygonOffset, value); + this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); + }; + /** + * Sets whether to enable or disable depth test. + * @param value - Turn on or off webgl depth testing. + */ + StateSystem.prototype.setDepthTest = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); + }; + /** + * Sets whether to enable or disable depth mask. + * @param value - Turn on or off webgl depth mask. + */ + StateSystem.prototype.setDepthMask = function (value) { + this.gl.depthMask(value); + }; + /** + * Sets whether to enable or disable cull face. + * @param {boolean} value - Turn on or off webgl cull face. + */ + StateSystem.prototype.setCullFace = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); + }; + /** + * Sets the gl front face. + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + StateSystem.prototype.setFrontFace = function (value) { + this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); + }; + /** + * Sets the blend mode. + * @param {number} value - The blend mode to set to. + */ + StateSystem.prototype.setBlendMode = function (value) { + if (value === this.blendMode) { + return; + } + this.blendMode = value; + var mode = this.blendModes[value]; + var gl = this.gl; + if (mode.length === 2) { + gl.blendFunc(mode[0], mode[1]); + } + else { + gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); + } + if (mode.length === 6) { + this._blendEq = true; + gl.blendEquationSeparate(mode[4], mode[5]); + } + else if (this._blendEq) { + this._blendEq = false; + gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); + } + }; + /** + * Sets the polygon offset. + * @param {number} value - the polygon offset + * @param {number} scale - the polygon offset scale + */ + StateSystem.prototype.setPolygonOffset = function (value, scale) { + this.gl.polygonOffset(value, scale); + }; + // used + /** Resets all the logic and disables the VAOs. */ + StateSystem.prototype.reset = function () { + this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); + this.forceState(this.defaultState); + this._blendEq = true; + this.blendMode = -1; + this.setBlendMode(0); + }; + /** + * Checks to see which updates should be checked based on which settings have been activated. + * + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. + * The idea is that we only check what we have too. + * @param func - the checking function to add or remove + * @param value - should the check function be added or removed. + */ + StateSystem.prototype.updateCheck = function (func, value) { + var index = this.checks.indexOf(func); + if (value && index === -1) { + this.checks.push(func); + } + else if (!value && index !== -1) { + this.checks.splice(index, 1); + } + }; + /** + * A private little wrapper function that we call to check the blend mode. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkBlendMode = function (system, state) { + system.setBlendMode(state.blendMode); + }; + /** + * A private little wrapper function that we call to check the polygon offset. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkPolygonOffset = function (system, state) { + system.setPolygonOffset(1, state.polygonOffset); + }; + /** + * @ignore + */ + StateSystem.prototype.destroy = function () { + this.gl = null; + }; + return StateSystem; + }()); + + /** + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. + * @memberof PIXI + */ + var TextureGCSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function TextureGCSystem(renderer) { + this.renderer = renderer; + this.count = 0; + this.checkCount = 0; + this.maxIdle = settings.settings.GC_MAX_IDLE; + this.checkCountMax = settings.settings.GC_MAX_CHECK_COUNT; + this.mode = settings.settings.GC_MODE; + } + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.postrender = function () { + if (!this.renderer.renderingToScreen) { + return; + } + this.count++; + if (this.mode === constants.GC_MODES.MANUAL) { + return; + } + this.checkCount++; + if (this.checkCount > this.checkCountMax) { + this.checkCount = 0; + this.run(); + } + }; + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.run = function () { + var tm = this.renderer.texture; + var managedTextures = tm.managedTextures; + var wasRemoved = false; + for (var i = 0; i < managedTextures.length; i++) { + var texture = managedTextures[i]; + // only supports non generated textures at the moment! + if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { + tm.destroyTexture(texture, true); + managedTextures[i] = null; + wasRemoved = true; + } + } + if (wasRemoved) { + var j = 0; + for (var i = 0; i < managedTextures.length; i++) { + if (managedTextures[i] !== null) { + managedTextures[j++] = managedTextures[i]; + } + } + managedTextures.length = j; + } + }; + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + TextureGCSystem.prototype.unload = function (displayObject) { + var tm = this.renderer.texture; + var texture = displayObject._texture; + // only destroy non generated textures + if (texture && !texture.framebuffer) { + tm.destroyTexture(texture); + } + for (var i = displayObject.children.length - 1; i >= 0; i--) { + this.unload(displayObject.children[i]); + } + }; + TextureGCSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureGCSystem; + }()); + + /** + * Returns a lookup table that maps each type-format pair to a compatible internal format. + * @memberof PIXI + * @function mapTypeAndFormatToInternalFormat + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @returns Lookup table. + */ + function mapTypeAndFormatToInternalFormat(gl) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; + var table; + if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext) { + table = (_a = {}, + _a[constants.TYPES.UNSIGNED_BYTE] = (_b = {}, + _b[constants.FORMATS.RGBA] = gl.RGBA8, + _b[constants.FORMATS.RGB] = gl.RGB8, + _b[constants.FORMATS.RG] = gl.RG8, + _b[constants.FORMATS.RED] = gl.R8, + _b[constants.FORMATS.RGBA_INTEGER] = gl.RGBA8UI, + _b[constants.FORMATS.RGB_INTEGER] = gl.RGB8UI, + _b[constants.FORMATS.RG_INTEGER] = gl.RG8UI, + _b[constants.FORMATS.RED_INTEGER] = gl.R8UI, + _b[constants.FORMATS.ALPHA] = gl.ALPHA, + _b[constants.FORMATS.LUMINANCE] = gl.LUMINANCE, + _b[constants.FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _b), + _a[constants.TYPES.BYTE] = (_c = {}, + _c[constants.FORMATS.RGBA] = gl.RGBA8_SNORM, + _c[constants.FORMATS.RGB] = gl.RGB8_SNORM, + _c[constants.FORMATS.RG] = gl.RG8_SNORM, + _c[constants.FORMATS.RED] = gl.R8_SNORM, + _c[constants.FORMATS.RGBA_INTEGER] = gl.RGBA8I, + _c[constants.FORMATS.RGB_INTEGER] = gl.RGB8I, + _c[constants.FORMATS.RG_INTEGER] = gl.RG8I, + _c[constants.FORMATS.RED_INTEGER] = gl.R8I, + _c), + _a[constants.TYPES.UNSIGNED_SHORT] = (_d = {}, + _d[constants.FORMATS.RGBA_INTEGER] = gl.RGBA16UI, + _d[constants.FORMATS.RGB_INTEGER] = gl.RGB16UI, + _d[constants.FORMATS.RG_INTEGER] = gl.RG16UI, + _d[constants.FORMATS.RED_INTEGER] = gl.R16UI, + _d[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT16, + _d), + _a[constants.TYPES.SHORT] = (_e = {}, + _e[constants.FORMATS.RGBA_INTEGER] = gl.RGBA16I, + _e[constants.FORMATS.RGB_INTEGER] = gl.RGB16I, + _e[constants.FORMATS.RG_INTEGER] = gl.RG16I, + _e[constants.FORMATS.RED_INTEGER] = gl.R16I, + _e), + _a[constants.TYPES.UNSIGNED_INT] = (_f = {}, + _f[constants.FORMATS.RGBA_INTEGER] = gl.RGBA32UI, + _f[constants.FORMATS.RGB_INTEGER] = gl.RGB32UI, + _f[constants.FORMATS.RG_INTEGER] = gl.RG32UI, + _f[constants.FORMATS.RED_INTEGER] = gl.R32UI, + _f[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT24, + _f), + _a[constants.TYPES.INT] = (_g = {}, + _g[constants.FORMATS.RGBA_INTEGER] = gl.RGBA32I, + _g[constants.FORMATS.RGB_INTEGER] = gl.RGB32I, + _g[constants.FORMATS.RG_INTEGER] = gl.RG32I, + _g[constants.FORMATS.RED_INTEGER] = gl.R32I, + _g), + _a[constants.TYPES.FLOAT] = (_h = {}, + _h[constants.FORMATS.RGBA] = gl.RGBA32F, + _h[constants.FORMATS.RGB] = gl.RGB32F, + _h[constants.FORMATS.RG] = gl.RG32F, + _h[constants.FORMATS.RED] = gl.R32F, + _h[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT32F, + _h), + _a[constants.TYPES.HALF_FLOAT] = (_j = {}, + _j[constants.FORMATS.RGBA] = gl.RGBA16F, + _j[constants.FORMATS.RGB] = gl.RGB16F, + _j[constants.FORMATS.RG] = gl.RG16F, + _j[constants.FORMATS.RED] = gl.R16F, + _j), + _a[constants.TYPES.UNSIGNED_SHORT_5_6_5] = (_k = {}, + _k[constants.FORMATS.RGB] = gl.RGB565, + _k), + _a[constants.TYPES.UNSIGNED_SHORT_4_4_4_4] = (_l = {}, + _l[constants.FORMATS.RGBA] = gl.RGBA4, + _l), + _a[constants.TYPES.UNSIGNED_SHORT_5_5_5_1] = (_m = {}, + _m[constants.FORMATS.RGBA] = gl.RGB5_A1, + _m), + _a[constants.TYPES.UNSIGNED_INT_2_10_10_10_REV] = (_o = {}, + _o[constants.FORMATS.RGBA] = gl.RGB10_A2, + _o[constants.FORMATS.RGBA_INTEGER] = gl.RGB10_A2UI, + _o), + _a[constants.TYPES.UNSIGNED_INT_10F_11F_11F_REV] = (_p = {}, + _p[constants.FORMATS.RGB] = gl.R11F_G11F_B10F, + _p), + _a[constants.TYPES.UNSIGNED_INT_5_9_9_9_REV] = (_q = {}, + _q[constants.FORMATS.RGB] = gl.RGB9_E5, + _q), + _a[constants.TYPES.UNSIGNED_INT_24_8] = (_r = {}, + _r[constants.FORMATS.DEPTH_STENCIL] = gl.DEPTH24_STENCIL8, + _r), + _a[constants.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV] = (_s = {}, + _s[constants.FORMATS.DEPTH_STENCIL] = gl.DEPTH32F_STENCIL8, + _s), + _a); + } + else { + table = (_t = {}, + _t[constants.TYPES.UNSIGNED_BYTE] = (_u = {}, + _u[constants.FORMATS.RGBA] = gl.RGBA, + _u[constants.FORMATS.RGB] = gl.RGB, + _u[constants.FORMATS.ALPHA] = gl.ALPHA, + _u[constants.FORMATS.LUMINANCE] = gl.LUMINANCE, + _u[constants.FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _u), + _t[constants.TYPES.UNSIGNED_SHORT_5_6_5] = (_v = {}, + _v[constants.FORMATS.RGB] = gl.RGB, + _v), + _t[constants.TYPES.UNSIGNED_SHORT_4_4_4_4] = (_w = {}, + _w[constants.FORMATS.RGBA] = gl.RGBA, + _w), + _t[constants.TYPES.UNSIGNED_SHORT_5_5_5_1] = (_x = {}, + _x[constants.FORMATS.RGBA] = gl.RGBA, + _x), + _t); + } + return table; + } + + /** + * Internal texture for WebGL context. + * @memberof PIXI + */ + var GLTexture = /** @class */ (function () { + function GLTexture(texture) { + this.texture = texture; + this.width = -1; + this.height = -1; + this.dirtyId = -1; + this.dirtyStyleId = -1; + this.mipmap = false; + this.wrapMode = 33071; + this.type = constants.TYPES.UNSIGNED_BYTE; + this.internalFormat = constants.FORMATS.RGBA; + this.samplerType = 0; + } + return GLTexture; + }()); + + /** + * System plugin to the renderer to manage textures. + * @memberof PIXI + */ + var TextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this system works for. + */ + function TextureSystem(renderer) { + this.renderer = renderer; + // TODO set to max textures... + this.boundTextures = []; + this.currentLocation = -1; + this.managedTextures = []; + this._unknownBoundTextures = false; + this.unknownTexture = new BaseTexture(); + this.hasIntegerTextures = false; + } + /** Sets up the renderer context and necessary buffers. */ + TextureSystem.prototype.contextChange = function () { + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.webGLVersion = this.renderer.context.webGLVersion; + this.internalFormats = mapTypeAndFormatToInternalFormat(gl); + var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + this.boundTextures.length = maxTextures; + for (var i = 0; i < maxTextures; i++) { + this.boundTextures[i] = null; + } + // TODO move this.. to a nice make empty textures class.. + this.emptyTextures = {}; + var emptyTexture2D = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); + this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; + this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); + for (var i = 0; i < 6; i++) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + for (var i = 0; i < this.boundTextures.length; i++) { + this.bind(null, i); + } + }; + /** + * Bind a texture to a specific location + * + * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` + * @param texture - Texture to bind + * @param [location=0] - Location to bind at + */ + TextureSystem.prototype.bind = function (texture, location) { + if (location === void 0) { location = 0; } + var gl = this.gl; + texture = texture === null || texture === void 0 ? void 0 : texture.castToBaseTexture(); + // cannot bind partial texture + // TODO: report a warning + if (texture && texture.valid && !texture.parentTextureArray) { + texture.touched = this.renderer.textureGC.count; + var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); + if (this.boundTextures[location] !== texture) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(texture.target, glTexture.texture); + } + if (glTexture.dirtyId !== texture.dirtyId) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + this.updateTexture(texture); + } + else if (glTexture.dirtyStyleId !== texture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + this.boundTextures[location] = texture; + } + else { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); + this.boundTextures[location] = null; + } + }; + /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */ + TextureSystem.prototype.reset = function () { + this._unknownBoundTextures = true; + this.hasIntegerTextures = false; + this.currentLocation = -1; + for (var i = 0; i < this.boundTextures.length; i++) { + this.boundTextures[i] = this.unknownTexture; + } + }; + /** + * Unbind a texture. + * @param texture - Texture to bind + */ + TextureSystem.prototype.unbind = function (texture) { + var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; + if (this._unknownBoundTextures) { + this._unknownBoundTextures = false; + // someone changed webGL state, + // we have to be sure that our texture does not appear in multi-texture renderer samplers + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === this.unknownTexture) { + this.bind(null, i); + } + } + } + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === texture) { + if (this.currentLocation !== i) { + gl.activeTexture(gl.TEXTURE0 + i); + this.currentLocation = i; + } + gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); + boundTextures[i] = null; + } + } + }; + /** + * Ensures that current boundTextures all have FLOAT sampler type, + * see {@link PIXI.SAMPLER_TYPES} for explanation. + * @param maxTextures - number of locations to check + */ + TextureSystem.prototype.ensureSamplerType = function (maxTextures) { + var _a = this, boundTextures = _a.boundTextures, hasIntegerTextures = _a.hasIntegerTextures, CONTEXT_UID = _a.CONTEXT_UID; + if (!hasIntegerTextures) { + return; + } + for (var i = maxTextures - 1; i >= 0; --i) { + var tex = boundTextures[i]; + if (tex) { + var glTexture = tex._glTextures[CONTEXT_UID]; + if (glTexture.samplerType !== constants.SAMPLER_TYPES.FLOAT) { + this.renderer.texture.unbind(tex); + } + } + } + }; + /** + * Initialize a texture + * @private + * @param texture - Texture to initialize + */ + TextureSystem.prototype.initTexture = function (texture) { + var glTexture = new GLTexture(this.gl.createTexture()); + // guarantee an update.. + glTexture.dirtyId = -1; + texture._glTextures[this.CONTEXT_UID] = glTexture; + this.managedTextures.push(texture); + texture.on('dispose', this.destroyTexture, this); + return glTexture; + }; + TextureSystem.prototype.initTextureType = function (texture, glTexture) { + var _a, _b; + glTexture.internalFormat = (_b = (_a = this.internalFormats[texture.type]) === null || _a === void 0 ? void 0 : _a[texture.format]) !== null && _b !== void 0 ? _b : texture.format; + if (this.webGLVersion === 2 && texture.type === constants.TYPES.HALF_FLOAT) { + // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES + // we have to convert it to WebGL HALF_FLOAT + glTexture.type = this.gl.HALF_FLOAT; + } + else { + glTexture.type = texture.type; + } + }; + /** + * Update a texture + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + TextureSystem.prototype.updateTexture = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + var renderer = this.renderer; + this.initTextureType(texture, glTexture); + if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { + // texture is uploaded, dont do anything! + if (glTexture.samplerType !== constants.SAMPLER_TYPES.FLOAT) { + this.hasIntegerTextures = true; + } + } + else { + // default, renderTexture-like logic + var width = texture.realWidth; + var height = texture.realHeight; + var gl = renderer.gl; + if (glTexture.width !== width + || glTexture.height !== height + || glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); + } + } + // lets only update what changes.. + if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + glTexture.dirtyId = texture.dirtyId; + }; + /** + * Deletes the texture from WebGL + * @private + * @param texture - the texture to destroy + * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { + var gl = this.gl; + texture = texture.castToBaseTexture(); + if (texture._glTextures[this.CONTEXT_UID]) { + this.unbind(texture); + gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); + texture.off('dispose', this.destroyTexture, this); + delete texture._glTextures[this.CONTEXT_UID]; + if (!skipRemove) { + var i = this.managedTextures.indexOf(texture); + if (i !== -1) { + utils.removeItems(this.managedTextures, i, 1); + } + } + } + }; + /** + * Update texture style such as mipmap flag + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + */ + TextureSystem.prototype.updateTextureStyle = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + if ((texture.mipmap === constants.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { + glTexture.mipmap = false; + } + else { + glTexture.mipmap = texture.mipmap >= 1; + } + if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { + glTexture.wrapMode = constants.WRAP_MODES.CLAMP; + } + else { + glTexture.wrapMode = texture.wrapMode; + } + if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) { + // style is set, dont do anything! + } + else { + this.setStyle(texture, glTexture); + } + glTexture.dirtyStyleId = texture.dirtyStyleId; + }; + /** + * Set style for texture + * @private + * @param texture - Texture to update + * @param glTexture + */ + TextureSystem.prototype.setStyle = function (texture, glTexture) { + var gl = this.gl; + if (glTexture.mipmap && texture.mipmap !== constants.MIPMAP_MODES.ON_MANUAL) { + gl.generateMipmap(texture.target); + } + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); + if (glTexture.mipmap) { + /* eslint-disable max-len */ + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + /* eslint-disable max-len */ + var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; + if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === constants.SCALE_MODES.LINEAR) { + var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); + gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); + } + } + else { + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + } + gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + }; + TextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureSystem; + }()); + + var _systems = { + __proto__: null, + FilterSystem: FilterSystem, + BatchSystem: BatchSystem, + ContextSystem: ContextSystem, + FramebufferSystem: FramebufferSystem, + GeometrySystem: GeometrySystem, + MaskSystem: MaskSystem, + ScissorSystem: ScissorSystem, + StencilSystem: StencilSystem, + ProjectionSystem: ProjectionSystem, + RenderTextureSystem: RenderTextureSystem, + ShaderSystem: ShaderSystem, + StateSystem: StateSystem, + TextureGCSystem: TextureGCSystem, + TextureSystem: TextureSystem + }; + + var tempMatrix = new math.Matrix(); + /** + * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. + * @abstract + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ + var AbstractRenderer = /** @class */ (function (_super) { + __extends(AbstractRenderer, _super); + /** + * @param type - The renderer type. + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function AbstractRenderer(type, options) { + if (type === void 0) { type = constants.RENDERER_TYPE.UNKNOWN; } + var _this = _super.call(this) || this; + // Add the default render options + options = Object.assign({}, settings.settings.RENDER_OPTIONS, options); + /** + * The supplied constructor options. + * @member {object} + * @readonly + */ + _this.options = options; + /** + * The type of the renderer. + * @member {number} + * @default PIXI.RENDERER_TYPE.UNKNOWN + * @see PIXI.RENDERER_TYPE + */ + _this.type = type; + /** + * Measurements of the screen. (0, 0, screenWidth, screenHeight). + * + * Its safe to use as filterArea or hitArea for the whole stage. + * @member {PIXI.Rectangle} + */ + _this.screen = new math.Rectangle(0, 0, options.width, options.height); + /** + * The canvas element that everything is drawn to. + * @member {HTMLCanvasElement} + */ + _this.view = options.view || settings.settings.ADAPTER.createCanvas(); + /** + * The resolution / device pixel ratio of the renderer. + * @member {number} + * @default PIXI.settings.RESOLUTION + */ + _this.resolution = options.resolution || settings.settings.RESOLUTION; + /** + * Pass-thru setting for the canvas' context `alpha` property. This is typically + * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`. + * @member {boolean} + */ + _this.useContextAlpha = options.useContextAlpha; + /** + * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. + * @member {boolean} + */ + _this.autoDensity = !!options.autoDensity; + /** + * The value of the preserveDrawingBuffer flag affects whether or not the contents of + * the stencil buffer is retained after rendering. + * @member {boolean} + */ + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; + /** + * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. + * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every + * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect + * to clear the canvas every frame. Disable this by setting this to false. For example, if + * your game has a canvas filling background image you often don't need this set. + * @member {boolean} + * @default + */ + _this.clearBeforeRender = options.clearBeforeRender; + /** + * The background color as a number. + * @member {number} + * @protected + */ + _this._backgroundColor = 0x000000; + /** + * The background color as an [R, G, B, A] array. + * @member {number[]} + * @protected + */ + _this._backgroundColorRgba = [0, 0, 0, 1]; + /** + * The background color as a string. + * @member {string} + * @protected + */ + _this._backgroundColorString = '#000000'; + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter + _this.backgroundAlpha = options.backgroundAlpha; + // @deprecated + if (options.transparent !== undefined) { + utils.deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.'); + _this.useContextAlpha = options.transparent; + _this.backgroundAlpha = options.transparent ? 0 : 1; + } + /** + * The last root object that the renderer tried to render. + * @member {PIXI.DisplayObject} + * @protected + */ + _this._lastObjectRendered = null; + /** + * Collection of plugins. + * @readonly + * @member {object} + */ + _this.plugins = {}; + return _this; + } + /** + * Initialize the plugins. + * @protected + * @param {object} staticMap - The dictionary of statically saved plugins. + */ + AbstractRenderer.prototype.initPlugins = function (staticMap) { + for (var o in staticMap) { + this.plugins[o] = new (staticMap[o])(this); + } + }; + Object.defineProperty(AbstractRenderer.prototype, "width", { + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * @member {number} + * @readonly + * @default 800 + */ + get: function () { + return this.view.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "height", { + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * @member {number} + * @readonly + * @default 600 + */ + get: function () { + return this.view.height; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the screen and canvas as close as possible to the specified width and height. + * Canvas dimensions are multiplied by resolution and rounded to the nearest integers. + * The new canvas dimensions divided by the resolution become the new screen dimensions. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + AbstractRenderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + this.view.width = Math.round(desiredScreenWidth * this.resolution); + this.view.height = Math.round(desiredScreenHeight * this.resolution); + var screenWidth = this.view.width / this.resolution; + var screenHeight = this.view.height / this.resolution; + this.screen.width = screenWidth; + this.screen.height = screenHeight; + if (this.autoDensity) { + this.view.style.width = screenWidth + "px"; + this.view.style.height = screenHeight + "px"; + } + /** + * Fired after view has been resized. + * @event PIXI.Renderer#resize + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + this.emit('resize', screenWidth, screenHeight); + }; + /** + * @ignore + */ + AbstractRenderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + // @deprecated parameters spread, use options instead + if (typeof options === 'number') { + utils.deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.'); + options = { scaleMode: options, resolution: resolution, region: region }; + } + var manualRegion = options.region, textureOptions = __rest(options, ["region"]); + region = manualRegion || displayObject.getLocalBounds(null, true); + // minimum texture size is 1x1, 0x0 will throw an error + if (region.width === 0) + { region.width = 1; } + if (region.height === 0) + { region.height = 1; } + var renderTexture = RenderTexture.create(__assign({ width: region.width, height: region.height }, textureOptions)); + tempMatrix.tx = -region.x; + tempMatrix.ty = -region.y; + this.render(displayObject, { + renderTexture: renderTexture, + clear: false, + transform: tempMatrix, + skipUpdateTransform: !!displayObject.parent + }); + return renderTexture; + }; + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * @param [removeView=false] - Removes the Canvas element from the DOM. + */ + AbstractRenderer.prototype.destroy = function (removeView) { + for (var o in this.plugins) { + this.plugins[o].destroy(); + this.plugins[o] = null; + } + if (removeView && this.view.parentNode) { + this.view.parentNode.removeChild(this.view); + } + var thisAny = this; + // null-ing all objects, that's a tradition! + thisAny.plugins = null; + thisAny.type = constants.RENDERER_TYPE.UNKNOWN; + thisAny.view = null; + thisAny.screen = null; + thisAny._tempDisplayObjectParent = null; + thisAny.options = null; + this._backgroundColorRgba = null; + this._backgroundColorString = null; + this._lastObjectRendered = null; + }; + Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { + /** + * The background color to fill if not transparent + * @member {number} + */ + get: function () { + return this._backgroundColor; + }, + set: function (value) { + this._backgroundColor = value; + this._backgroundColorString = utils.hex2string(value); + utils.hex2rgb(value, this._backgroundColorRgba); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "backgroundAlpha", { + /** + * The background color alpha. Setting this to 0 will make the canvas transparent. + * @member {number} + */ + get: function () { + return this._backgroundColorRgba[3]; + }, + set: function (value) { + this._backgroundColorRgba[3] = value; + }, + enumerable: false, + configurable: true + }); + return AbstractRenderer; + }(utils.EventEmitter)); + + var GLBuffer = /** @class */ (function () { + function GLBuffer(buffer) { + this.buffer = buffer || null; + this.updateID = -1; + this.byteLength = -1; + this.refCount = 0; + } + return GLBuffer; + }()); + + /** + * System plugin to the renderer to manage buffers. + * + * WebGL uses Buffers as a way to store objects to the GPU. + * This system makes working with them a lot easier. + * + * Buffers are used in three main places in WebGL + * - geometry information + * - Uniform information (via uniform buffer objects - a WebGL 2 only feature) + * - Transform feedback information. (WebGL 2 only feature) + * + * This system will handle the binding of buffers to the GPU as well as uploading + * them. With this system, you never need to work directly with GPU buffers, but instead work with + * the PIXI.Buffer class. + * @class + * @memberof PIXI + */ + var BufferSystem = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function BufferSystem(renderer) { + this.renderer = renderer; + this.managedBuffers = {}; + this.boundBufferBases = {}; + } + /** + * @ignore + */ + BufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + /** Sets up the renderer context and necessary buffers. */ + BufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + this.gl = this.renderer.gl; + // TODO fill out... + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + }; + /** + * This binds specified buffer. On first run, it will create the webGL buffers for the context too + * @param buffer - the buffer to bind to the renderer + */ + BufferSystem.prototype.bind = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBuffer(buffer.type, glBuffer.buffer); + }; + /** + * Binds an uniform buffer to at the given index. + * + * A cache is used so a buffer will not be bound again if already bound. + * @param buffer - the buffer to bind + * @param index - the base index to bind it to. + */ + BufferSystem.prototype.bindBufferBase = function (buffer, index) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (this.boundBufferBases[index] !== buffer) { + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + this.boundBufferBases[index] = buffer; + gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer); + } + }; + /** + * Binds a buffer whilst also binding its range. + * This will make the buffer start from the offset supplied rather than 0 when it is read. + * @param buffer - the buffer to bind + * @param index - the base index to bind at, defaults to 0 + * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc + */ + BufferSystem.prototype.bindBufferRange = function (buffer, index, offset) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + offset = offset || 0; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256); + }; + /** + * Will ensure the data in the buffer is uploaded to the GPU. + * @param {PIXI.Buffer} buffer - the buffer to update + */ + BufferSystem.prototype.update = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (buffer._updateID === glBuffer.updateID) { + return; + } + glBuffer.updateID = buffer._updateID; + gl.bindBuffer(buffer.type, glBuffer.buffer); + if (glBuffer.byteLength >= buffer.data.byteLength) { + // offset is always zero for now! + gl.bufferSubData(buffer.type, 0, buffer.data); + } + else { + var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; + glBuffer.byteLength = buffer.data.byteLength; + gl.bufferData(buffer.type, buffer.data, drawType); + } + }; + /** + * Disposes buffer + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + BufferSystem.prototype.dispose = function (buffer, contextLost) { + if (!this.managedBuffers[buffer.id]) { + return; + } + delete this.managedBuffers[buffer.id]; + var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; + var gl = this.gl; + buffer.disposeRunner.remove(this); + if (!glBuffer) { + return; + } + if (!contextLost) { + gl.deleteBuffer(glBuffer.buffer); + } + delete buffer._glBuffers[this.CONTEXT_UID]; + }; + /** + * dispose all WebGL resources of all managed buffers + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + BufferSystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedBuffers); + for (var i = 0; i < all.length; i++) { + this.dispose(this.managedBuffers[all[i]], contextLost); + } + }; + /** + * creates and attaches a GLBuffer object tied to the current context. + * @param buffer + * @protected + */ + BufferSystem.prototype.createGLBuffer = function (buffer) { + var _a = this, CONTEXT_UID = _a.CONTEXT_UID, gl = _a.gl; + buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); + this.managedBuffers[buffer.id] = buffer; + buffer.disposeRunner.add(this); + return buffer._glBuffers[CONTEXT_UID]; + }; + return BufferSystem; + }()); + + /** + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! + * + * Renderer is composed of systems that manage specific tasks. The following systems are added by default + * whenever you create a renderer: + * + * | System | Description | + * | ------------------------------------ | ----------------------------------------------------------------------------- | + * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. | + * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. | + * | {@link PIXI.EventSystem} | This manages UI events. | + * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. | + * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. | + * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. | + * | {@link PIXI.MaskSystem} | This manages masking operations. | + * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. | + * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. | + * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. | + * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. | + * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. | + * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. | + * + * The breadth of the API surface provided by the renderer is contained within these systems. + * @memberof PIXI + */ + var Renderer = /** @class */ (function (_super) { + __extends(Renderer, _super); + /** + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function Renderer(options) { + var _this = _super.call(this, constants.RENDERER_TYPE.WEBGL, options) || this; + // the options will have been modified here in the super constructor with pixi's default settings.. + options = _this.options; + _this.gl = null; + _this.CONTEXT_UID = 0; + _this.runners = { + destroy: new runner.Runner('destroy'), + contextChange: new runner.Runner('contextChange'), + reset: new runner.Runner('reset'), + update: new runner.Runner('update'), + postrender: new runner.Runner('postrender'), + prerender: new runner.Runner('prerender'), + resize: new runner.Runner('resize'), + }; + _this.runners.contextChange.add(_this); + _this.globalUniforms = new UniformGroup({ + projectionMatrix: new math.Matrix(), + }, true); + _this.addSystem(MaskSystem, 'mask') + .addSystem(ContextSystem, 'context') + .addSystem(StateSystem, 'state') + .addSystem(ShaderSystem, 'shader') + .addSystem(TextureSystem, 'texture') + .addSystem(BufferSystem, 'buffer') + .addSystem(GeometrySystem, 'geometry') + .addSystem(FramebufferSystem, 'framebuffer') + .addSystem(ScissorSystem, 'scissor') + .addSystem(StencilSystem, 'stencil') + .addSystem(ProjectionSystem, 'projection') + .addSystem(TextureGCSystem, 'textureGC') + .addSystem(FilterSystem, 'filter') + .addSystem(RenderTextureSystem, 'renderTexture') + .addSystem(BatchSystem, 'batch'); + _this.initPlugins(Renderer.__plugins); + _this.multisample = undefined; + /* + * The options passed in to create a new WebGL context. + */ + if (options.context) { + _this.context.initFromContext(options.context); + } + else { + _this.context.initFromOptions({ + alpha: !!_this.useContextAlpha, + antialias: options.antialias, + premultipliedAlpha: _this.useContextAlpha && _this.useContextAlpha !== 'notMultiplied', + stencil: true, + preserveDrawingBuffer: options.preserveDrawingBuffer, + powerPreference: _this.options.powerPreference, + }); + } + _this.renderingToScreen = true; + utils.sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); + _this.resize(_this.options.width, _this.options.height); + return _this; + } + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @param options + * @private + */ + Renderer.create = function (options) { + if (utils.isWebGLSupported()) { + return new Renderer(options); + } + throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); + }; + Renderer.prototype.contextChange = function () { + var gl = this.gl; + var samples; + if (this.context.webGLVersion === 1) { + var framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + else { + var framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer); + } + if (samples >= constants.MSAA_QUALITY.HIGH) { + this.multisample = constants.MSAA_QUALITY.HIGH; + } + else if (samples >= constants.MSAA_QUALITY.MEDIUM) { + this.multisample = constants.MSAA_QUALITY.MEDIUM; + } + else if (samples >= constants.MSAA_QUALITY.LOW) { + this.multisample = constants.MSAA_QUALITY.LOW; + } + else { + this.multisample = constants.MSAA_QUALITY.NONE; + } + }; + /** + * Add a new system to the renderer. + * @param ClassRef - Class reference + * @param name - Property name for system, if not specified + * will use a static `name` property on the class itself. This + * name will be assigned as s property on the Renderer so make + * sure it doesn't collide with properties on Renderer. + * @returns Return instance of renderer + */ + Renderer.prototype.addSystem = function (ClassRef, name) { + var system = new ClassRef(this); + if (this[name]) { + throw new Error("Whoops! The name \"" + name + "\" is already in use"); + } + this[name] = system; + for (var i in this.runners) { + this.runners[i].add(system); + } + /** + * Fired after rendering finishes. + * @event PIXI.Renderer#postrender + */ + /** + * Fired before rendering starts. + * @event PIXI.Renderer#prerender + */ + /** + * Fired when the WebGL context is set. + * @event PIXI.Renderer#context + * @param {WebGLRenderingContext} gl - WebGL context. + */ + return this; + }; + /** + * @ignore + */ + Renderer.prototype.render = function (displayObject, options) { + var renderTexture; + var clear; + var transform; + var skipUpdateTransform; + if (options) { + if (options instanceof RenderTexture) { + utils.deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.'); + /* eslint-disable prefer-rest-params */ + renderTexture = options; + clear = arguments[2]; + transform = arguments[3]; + skipUpdateTransform = arguments[4]; + /* eslint-enable prefer-rest-params */ + } + else { + renderTexture = options.renderTexture; + clear = options.clear; + transform = options.transform; + skipUpdateTransform = options.skipUpdateTransform; + } + } + // can be handy to know! + this.renderingToScreen = !renderTexture; + this.runners.prerender.emit(); + this.emit('prerender'); + // apply a transform at a GPU level + this.projection.transform = transform; + // no point rendering if our context has been blown up! + if (this.context.isLost) { + return; + } + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.enableTempParent(); + displayObject.updateTransform(); + displayObject.disableTempParent(cacheParent); + // displayObject.hitArea = //TODO add a temp hit area + } + this.renderTexture.bind(renderTexture); + this.batch.currentRenderer.start(); + if (clear !== undefined ? clear : this.clearBeforeRender) { + this.renderTexture.clear(); + } + displayObject.render(this); + // apply transform.. + this.batch.currentRenderer.flush(); + if (renderTexture) { + renderTexture.baseTexture.update(); + } + this.runners.postrender.emit(); + // reset transform after render + this.projection.transform = null; + this.emit('postrender'); + }; + /** + * @override + * @ignore + */ + Renderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + var renderTexture = _super.prototype.generateTexture.call(this, displayObject, options, resolution, region); + this.framebuffer.blit(); + return renderTexture; + }; + /** + * Resizes the WebGL view to the specified width and height. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + Renderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + _super.prototype.resize.call(this, desiredScreenWidth, desiredScreenHeight); + this.runners.resize.emit(this.screen.height, this.screen.width); + }; + /** + * Resets the WebGL state so you can render things however you fancy! + * @returns Returns itself. + */ + Renderer.prototype.reset = function () { + this.runners.reset.emit(); + return this; + }; + /** Clear the frame buffer. */ + Renderer.prototype.clear = function () { + this.renderTexture.bind(); + this.renderTexture.clear(); + }; + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * @param [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + Renderer.prototype.destroy = function (removeView) { + this.runners.destroy.emit(); + for (var r in this.runners) { + this.runners[r].destroy(); + } + // call base destroy + _super.prototype.destroy.call(this, removeView); + // TODO nullify all the managers.. + this.gl = null; + }; + Object.defineProperty(Renderer.prototype, "extract", { + /** + * Please use `plugins.extract` instead. + * @member {PIXI.Extract} extract + * @deprecated since 6.0.0 + * @readonly + */ + get: function () { + utils.deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.'); + return this.plugins.extract; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param pluginName - The name of the plugin. + * @param ctor - The constructor function or class for the plugin. + */ + Renderer.registerPlugin = function (pluginName, ctor) { + utils.deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.'); + extensions.extensions.add({ + name: pluginName, + type: extensions.ExtensionType.RendererPlugin, + ref: ctor, + }); + }; + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @readonly + * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.Extract} extract Extract image data from renderer. + * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects. + * @property {PIXI.Prepare} prepare Pre-render display objects. + * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects. + * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects. + */ + Renderer.__plugins = {}; + return Renderer; + }(AbstractRenderer)); + // Handle registration of extensions + extensions.extensions.handleByMap(extensions.ExtensionType.RendererPlugin, Renderer.__plugins); + + /** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by + * the browser then this function will return a canvas renderer. + * @memberof PIXI + * @function autoDetectRenderer + * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {boolean} [options.forceCanvas=false] - + * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when + * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + * @returns {PIXI.Renderer|PIXI.CanvasRenderer} + * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}. + */ + function autoDetectRenderer(options) { + return Renderer.create(options); + } + + var $defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; + + var $defaultFilterVertex = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + + /** + * Default vertex shader + * @memberof PIXI + * @member {string} defaultVertex + */ + /** + * Default filter vertex shader + * @memberof PIXI + * @member {string} defaultFilterVertex + */ + // NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types + // of defaultVertex, defaultFilterVertex. + var defaultVertex$1 = $defaultVertex; + var defaultFilterVertex = $defaultFilterVertex; + + /** + * Use the ISystem interface instead. + * @deprecated since 6.1.0 + * @memberof PIXI + */ + var System = /** @class */ (function () { + /** + * @param renderer - Reference to Renderer + */ + function System(renderer) { + utils.deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.'); + this.renderer = renderer; + } + /** Destroy and don't use after this. */ + System.prototype.destroy = function () { + this.renderer = null; + }; + return System; + }()); + + /** + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. + * @memberof PIXI + */ + var BatchDrawCall = /** @class */ (function () { + function BatchDrawCall() { + this.texArray = null; + this.blend = 0; + this.type = constants.DRAW_MODES.TRIANGLES; + this.start = 0; + this.size = 0; + this.data = null; + } + return BatchDrawCall; + }()); + + /** + * Used by the batcher to build texture batches. + * Holds list of textures and their respective locations. + * @memberof PIXI + */ + var BatchTextureArray = /** @class */ (function () { + function BatchTextureArray() { + this.elements = []; + this.ids = []; + this.count = 0; + } + BatchTextureArray.prototype.clear = function () { + for (var i = 0; i < this.count; i++) { + this.elements[i] = null; + } + this.count = 0; + }; + return BatchTextureArray; + }()); + + /** + * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand. + * @memberof PIXI + */ + var ViewableBuffer = /** @class */ (function () { + function ViewableBuffer(sizeOrBuffer) { + if (typeof sizeOrBuffer === 'number') { + this.rawBinaryData = new ArrayBuffer(sizeOrBuffer); + } + else if (sizeOrBuffer instanceof Uint8Array) { + this.rawBinaryData = sizeOrBuffer.buffer; + } + else { + this.rawBinaryData = sizeOrBuffer; + } + this.uint32View = new Uint32Array(this.rawBinaryData); + this.float32View = new Float32Array(this.rawBinaryData); + } + Object.defineProperty(ViewableBuffer.prototype, "int8View", { + /** View on the raw binary data as a `Int8Array`. */ + get: function () { + if (!this._int8View) { + this._int8View = new Int8Array(this.rawBinaryData); + } + return this._int8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint8View", { + /** View on the raw binary data as a `Uint8Array`. */ + get: function () { + if (!this._uint8View) { + this._uint8View = new Uint8Array(this.rawBinaryData); + } + return this._uint8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int16View", { + /** View on the raw binary data as a `Int16Array`. */ + get: function () { + if (!this._int16View) { + this._int16View = new Int16Array(this.rawBinaryData); + } + return this._int16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint16View", { + /** View on the raw binary data as a `Uint16Array`. */ + get: function () { + if (!this._uint16View) { + this._uint16View = new Uint16Array(this.rawBinaryData); + } + return this._uint16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int32View", { + /** View on the raw binary data as a `Int32Array`. */ + get: function () { + if (!this._int32View) { + this._int32View = new Int32Array(this.rawBinaryData); + } + return this._int32View; + }, + enumerable: false, + configurable: true + }); + /** + * Returns the view of the given type. + * @param type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @returns - typed array of given type + */ + ViewableBuffer.prototype.view = function (type) { + return this[type + "View"]; + }; + /** Destroys all buffer references. Do not use after calling this. */ + ViewableBuffer.prototype.destroy = function () { + this.rawBinaryData = null; + this._int8View = null; + this._uint8View = null; + this._int16View = null; + this._uint16View = null; + this._int32View = null; + this.uint32View = null; + this.float32View = null; + }; + ViewableBuffer.sizeOf = function (type) { + switch (type) { + case 'int8': + case 'uint8': + return 1; + case 'int16': + case 'uint16': + return 2; + case 'int32': + case 'uint32': + case 'float32': + return 4; + default: + throw new Error(type + " isn't a valid view type"); + } + }; + return ViewableBuffer; + }()); + + /** + * Renderer dedicated to drawing and batching sprites. + * + * This is the default batch renderer. It buffers objects + * with texture-based geometries and renders them in + * batches. It uploads multiple textures to the GPU to + * reduce to the number of draw calls. + * @memberof PIXI + */ + var AbstractBatchRenderer = /** @class */ (function (_super) { + __extends(AbstractBatchRenderer, _super); + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + function AbstractBatchRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = null; + _this.geometryClass = null; + _this.vertexSize = null; + _this.state = State.for2d(); + _this.size = settings.settings.SPRITE_BATCH_SIZE * 4; + _this._vertexCount = 0; + _this._indexCount = 0; + _this._bufferedElements = []; + _this._bufferedTextures = []; + _this._bufferSize = 0; + _this._shader = null; + _this._packedGeometries = []; + _this._packedGeometryPoolSize = 2; + _this._flushId = 0; + _this._aBuffers = {}; + _this._iBuffers = {}; + _this.MAX_TEXTURES = 1; + _this.renderer.on('prerender', _this.onPrerender, _this); + renderer.runners.contextChange.add(_this); + _this._dcIndex = 0; + _this._aIndex = 0; + _this._iIndex = 0; + _this._attributeBuffer = null; + _this._indexBuffer = null; + _this._tempBoundTextures = []; + return _this; + } + /** + * Handles the `contextChange` signal. + * + * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool. + */ + AbstractBatchRenderer.prototype.contextChange = function () { + var gl = this.renderer.gl; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + this.MAX_TEXTURES = 1; + } + else { + // step 1: first check max textures the GPU can handle. + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.settings.SPRITE_MAX_TEXTURES); + // step 2: check the maximum number of if statements the shader can have too.. + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); + } + this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); + // we use the second shader as the first one depending on your browser + // may omit aTextureId as it is not used by the shader so is optimized out. + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + /* eslint-disable max-len */ + this._packedGeometries[i] = new (this.geometryClass)(); + } + this.initFlushBuffers(); + }; + /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */ + AbstractBatchRenderer.prototype.initFlushBuffers = function () { + var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; + // max draw calls + var MAX_SPRITES = this.size / 4; + // max texture arrays + var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; + while (_drawCallPool.length < MAX_SPRITES) { + _drawCallPool.push(new BatchDrawCall()); + } + while (_textureArrayPool.length < MAX_TA) { + _textureArrayPool.push(new BatchTextureArray()); + } + for (var i = 0; i < this.MAX_TEXTURES; i++) { + this._tempBoundTextures[i] = null; + } + }; + /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */ + AbstractBatchRenderer.prototype.onPrerender = function () { + this._flushId = 0; + }; + /** + * Buffers the "batchable" object. It need not be rendered immediately. + * @param {PIXI.DisplayObject} element - the element to render when + * using this renderer + */ + AbstractBatchRenderer.prototype.render = function (element) { + if (!element._texture.valid) { + return; + } + if (this._vertexCount + (element.vertexData.length / 2) > this.size) { + this.flush(); + } + this._vertexCount += element.vertexData.length / 2; + this._indexCount += element.indices.length; + this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; + this._bufferedElements[this._bufferSize++] = element; + }; + AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { + var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; + var textureArrays = AbstractBatchRenderer._textureArrayPool; + var batch = this.renderer.batch; + var boundTextures = this._tempBoundTextures; + var touch = this.renderer.textureGC.count; + var TICK = ++BaseTexture._globalBatch; + var countTexArrays = 0; + var texArray = textureArrays[0]; + var start = 0; + batch.copyBoundTextures(boundTextures, MAX_TEXTURES); + for (var i = 0; i < this._bufferSize; ++i) { + var tex = textures[i]; + textures[i] = null; + if (tex._batchEnabled === TICK) { + continue; + } + if (texArray.count >= MAX_TEXTURES) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, i); + start = i; + texArray = textureArrays[++countTexArrays]; + ++TICK; + } + tex._batchEnabled = TICK; + tex.touched = touch; + texArray.elements[texArray.count++] = tex; + } + if (texArray.count > 0) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, this._bufferSize); + ++countTexArrays; + ++TICK; + } + // Clean-up + for (var i = 0; i < boundTextures.length; i++) { + boundTextures[i] = null; + } + BaseTexture._globalBatch = TICK; + }; + /** + * Populating drawcalls for rendering + * @param texArray + * @param start + * @param finish + */ + AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { + var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var dcIndex = this._dcIndex; + var aIndex = this._aIndex; + var iIndex = this._iIndex; + var drawCall = drawCalls[dcIndex]; + drawCall.start = this._iIndex; + drawCall.texArray = texArray; + for (var i = start; i < finish; ++i) { + var sprite = elements[i]; + var tex = sprite._texture.baseTexture; + var spriteBlendMode = utils.premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; + elements[i] = null; + if (start < i && drawCall.blend !== spriteBlendMode) { + drawCall.size = iIndex - drawCall.start; + start = i; + drawCall = drawCalls[++dcIndex]; + drawCall.texArray = texArray; + drawCall.start = iIndex; + } + this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); + aIndex += sprite.vertexData.length / 2 * vertexSize; + iIndex += sprite.indices.length; + drawCall.blend = spriteBlendMode; + } + if (start < finish) { + drawCall.size = iIndex - drawCall.start; + ++dcIndex; + } + this._dcIndex = dcIndex; + this._aIndex = aIndex; + this._iIndex = iIndex; + }; + /** + * Bind textures for current rendering + * @param texArray + */ + AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { + var textureSystem = this.renderer.texture; + for (var j = 0; j < texArray.count; j++) { + textureSystem.bind(texArray.elements[j], texArray.ids[j]); + texArray.elements[j] = null; + } + texArray.count = 0; + }; + AbstractBatchRenderer.prototype.updateGeometry = function () { + var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; + if (!settings.settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't + like uploads to the same buffer in a single frame. */ + if (this._packedGeometryPoolSize <= this._flushId) { + this._packedGeometryPoolSize++; + packedGeometries[this._flushId] = new (this.geometryClass)(); + } + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.bind(packedGeometries[this._flushId]); + this.renderer.geometry.updateBuffers(); + this._flushId++; + } + else { + // lets use the faster option, always use buffer number 0 + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.updateBuffers(); + } + }; + AbstractBatchRenderer.prototype.drawBatches = function () { + var dcCount = this._dcIndex; + var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var curTexArray = null; + // Upload textures and do the draw calls + for (var i = 0; i < dcCount; i++) { + var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; + if (curTexArray !== texArray) { + curTexArray = texArray; + this.bindAndClearTexArray(texArray); + } + this.state.blendMode = blend; + stateSystem.set(this.state); + gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); + } + }; + /** Renders the content _now_ and empties the current batch. */ + AbstractBatchRenderer.prototype.flush = function () { + if (this._vertexCount === 0) { + return; + } + this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); + this._indexBuffer = this.getIndexBuffer(this._indexCount); + this._aIndex = 0; + this._iIndex = 0; + this._dcIndex = 0; + this.buildTexturesAndDrawCalls(); + this.updateGeometry(); + this.drawBatches(); + // reset elements buffer for the next flush + this._bufferSize = 0; + this._vertexCount = 0; + this._indexCount = 0; + }; + /** Starts a new sprite batch. */ + AbstractBatchRenderer.prototype.start = function () { + this.renderer.state.set(this.state); + this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES); + this.renderer.shader.bind(this._shader); + if (settings.settings.CAN_UPLOAD_SAME_BUFFER) { + // bind buffer #0, we don't need others + this.renderer.geometry.bind(this._packedGeometries[this._flushId]); + } + }; + /** Stops and flushes the current batch. */ + AbstractBatchRenderer.prototype.stop = function () { + this.flush(); + }; + /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */ + AbstractBatchRenderer.prototype.destroy = function () { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + if (this._packedGeometries[i]) { + this._packedGeometries[i].destroy(); + } + } + this.renderer.off('prerender', this.onPrerender, this); + this._aBuffers = null; + this._iBuffers = null; + this._packedGeometries = null; + this._attributeBuffer = null; + this._indexBuffer = null; + if (this._shader) { + this._shader.destroy(); + this._shader = null; + } + _super.prototype.destroy.call(this); + }; + /** + * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats. + * @param size - minimum capacity required + * @returns - buffer than can hold atleast `size` floats + */ + AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { + // 8 vertices is enough for 2 quads + var roundedP2 = utils.nextPow2(Math.ceil(size / 8)); + var roundedSizeIndex = utils.log2(roundedP2); + var roundedSize = roundedP2 * 8; + if (this._aBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._aBuffers[roundedSize]; + if (!buffer) { + this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); + } + return buffer; + }; + /** + * Fetches an index buffer from `this._iBuffers` that can + * have at least `size` capacity. + * @param size - minimum required capacity + * @returns - buffer that can fit `size` indices. + */ + AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { + // 12 indices is enough for 2 quads + var roundedP2 = utils.nextPow2(Math.ceil(size / 12)); + var roundedSizeIndex = utils.log2(roundedP2); + var roundedSize = roundedP2 * 12; + if (this._iBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._iBuffers[roundedSizeIndex]; + if (!buffer) { + this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); + } + return buffer; + }; + /** + * Takes the four batching parameters of `element`, interleaves + * and pushes them into the batching attribute/index buffers given. + * + * It uses these properties: `vertexData` `uvs`, `textureId` and + * `indicies`. It also uses the "tint" of the base-texture, if + * present. + * @param {PIXI.DisplayObject} element - element being rendered + * @param attributeBuffer - attribute buffer. + * @param indexBuffer - index buffer + * @param aIndex - number of floats already in the attribute buffer + * @param iIndex - number of indices already in `indexBuffer` + */ + AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { + var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; + var packedVertices = aIndex / this.vertexSize; + var uvs = element.uvs; + var indicies = element.indices; + var vertexData = element.vertexData; + var textureId = element._texture.baseTexture._batchLocation; + var alpha = Math.min(element.worldAlpha, 1.0); + var argb = (alpha < 1.0 + && element._texture.baseTexture.alphaMode) + ? utils.premultiplyTint(element._tintRGB, alpha) + : element._tintRGB + (alpha * 255 << 24); + // lets not worry about tint! for now.. + for (var i = 0; i < vertexData.length; i += 2) { + float32View[aIndex++] = vertexData[i]; + float32View[aIndex++] = vertexData[i + 1]; + float32View[aIndex++] = uvs[i]; + float32View[aIndex++] = uvs[i + 1]; + uint32View[aIndex++] = argb; + float32View[aIndex++] = textureId; + } + for (var i = 0; i < indicies.length; i++) { + indexBuffer[iIndex++] = packedVertices + indicies[i]; + } + }; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchDrawCall[]} + */ + AbstractBatchRenderer._drawCallPool = []; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchTextureArray[]} + */ + AbstractBatchRenderer._textureArrayPool = []; + return AbstractBatchRenderer; + }(ObjectRenderer)); + + /** + * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer + * @memberof PIXI + */ + var BatchShaderGenerator = /** @class */ (function () { + /** + * @param vertexSrc - Vertex shader + * @param fragTemplate - Fragment shader template + */ + function BatchShaderGenerator(vertexSrc, fragTemplate) { + this.vertexSrc = vertexSrc; + this.fragTemplate = fragTemplate; + this.programCache = {}; + this.defaultGroupCache = {}; + if (fragTemplate.indexOf('%count%') < 0) { + throw new Error('Fragment template must contain "%count%".'); + } + if (fragTemplate.indexOf('%forloop%') < 0) { + throw new Error('Fragment template must contain "%forloop%".'); + } + } + BatchShaderGenerator.prototype.generateShader = function (maxTextures) { + if (!this.programCache[maxTextures]) { + var sampleValues = new Int32Array(maxTextures); + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); + var fragmentSrc = this.fragTemplate; + fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new math.Matrix(), + default: this.defaultGroupCache[maxTextures], + }; + return new Shader(this.programCache[maxTextures], uniforms); + }; + BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxTextures - 1) { + src += "if(vTextureId < " + i + ".5)"; + } + src += '\n{'; + src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + }; + return BatchShaderGenerator; + }()); + + /** + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * @memberof PIXI + */ + var BatchGeometry = /** @class */ (function (_super) { + __extends(BatchGeometry, _super); + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + function BatchGeometry(_static) { + if (_static === void 0) { _static = false; } + var _this = _super.call(this) || this; + _this._buffer = new Buffer(null, _static, false); + _this._indexBuffer = new Buffer(null, _static, true); + _this.addAttribute('aVertexPosition', _this._buffer, 2, false, constants.TYPES.FLOAT) + .addAttribute('aTextureCoord', _this._buffer, 2, false, constants.TYPES.FLOAT) + .addAttribute('aColor', _this._buffer, 4, true, constants.TYPES.UNSIGNED_BYTE) + .addAttribute('aTextureId', _this._buffer, 1, true, constants.TYPES.FLOAT) + .addIndex(_this._indexBuffer); + return _this; + } + return BatchGeometry; + }(Geometry)); + + var defaultVertex = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; + + var defaultFragment = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; + + /** @memberof PIXI */ + var BatchPluginFactory = /** @class */ (function () { + function BatchPluginFactory() { + } + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.extensions.add({ + * name: 'invert', + * ref: InvertBatchRenderer, + * type: PIXI.ExtensionType.RendererPlugin, + * }); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @returns {*} New batch renderer plugin + */ + BatchPluginFactory.create = function (options) { + var _a = Object.assign({ + vertex: defaultVertex, + fragment: defaultFragment, + geometryClass: BatchGeometry, + vertexSize: 6, + }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; + return /** @class */ (function (_super) { + __extends(BatchPlugin, _super); + function BatchPlugin(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); + _this.geometryClass = geometryClass; + _this.vertexSize = vertexSize; + return _this; + } + return BatchPlugin; + }(AbstractBatchRenderer)); + }; + Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { + /** + * The default vertex shader source + * @readonly + */ + get: function () { + return defaultVertex; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { + /** + * The default fragment shader source + * @readonly + */ + get: function () { + return defaultFragment; + }, + enumerable: false, + configurable: true + }); + return BatchPluginFactory; + }()); + // Setup the default BatchRenderer plugin, this is what + // we'll actually export at the root level + var BatchRenderer = BatchPluginFactory.create(); + Object.assign(BatchRenderer, { + extension: { + name: 'batch', + type: extensions.ExtensionType.RendererPlugin, + }, + }); + + /** + * @memberof PIXI + * @namespace resources + * @see PIXI + * @deprecated since 6.0.0 + */ + var resources = {}; + var _loop_1 = function (name) { + Object.defineProperty(resources, name, { + get: function () { + utils.deprecation('6.0.0', "PIXI.systems." + name + " has moved to PIXI." + name); + return _resources[name]; + }, + }); + }; + for (var name in _resources) { + _loop_1(name); + } + /** + * @memberof PIXI + * @namespace systems + * @see PIXI + * @deprecated since 6.0.0 + */ + var systems = {}; + var _loop_2 = function (name) { + Object.defineProperty(systems, name, { + get: function () { + utils.deprecation('6.0.0', "PIXI.resources." + name + " has moved to PIXI." + name); + return _systems[name]; + }, + }); + }; + for (var name in _systems) { + _loop_2(name); + } + + /** + * @namespace PIXI + */ + /** + * String of the current PIXI version. + * @memberof PIXI + */ + var VERSION = '6.5.10'; + + exports.AbstractBatchRenderer = AbstractBatchRenderer; + exports.AbstractMultiResource = AbstractMultiResource; + exports.AbstractRenderer = AbstractRenderer; + exports.ArrayResource = ArrayResource; + exports.Attribute = Attribute; + exports.BaseImageResource = BaseImageResource; + exports.BaseRenderTexture = BaseRenderTexture; + exports.BaseTexture = BaseTexture; + exports.BatchDrawCall = BatchDrawCall; + exports.BatchGeometry = BatchGeometry; + exports.BatchPluginFactory = BatchPluginFactory; + exports.BatchRenderer = BatchRenderer; + exports.BatchShaderGenerator = BatchShaderGenerator; + exports.BatchSystem = BatchSystem; + exports.BatchTextureArray = BatchTextureArray; + exports.Buffer = Buffer; + exports.BufferResource = BufferResource; + exports.CanvasResource = CanvasResource; + exports.ContextSystem = ContextSystem; + exports.CubeResource = CubeResource; + exports.Filter = Filter; + exports.FilterState = FilterState; + exports.FilterSystem = FilterSystem; + exports.Framebuffer = Framebuffer; + exports.FramebufferSystem = FramebufferSystem; + exports.GLFramebuffer = GLFramebuffer; + exports.GLProgram = GLProgram; + exports.GLTexture = GLTexture; + exports.Geometry = Geometry; + exports.GeometrySystem = GeometrySystem; + exports.IGLUniformData = IGLUniformData; + exports.INSTALLED = INSTALLED; + exports.ImageBitmapResource = ImageBitmapResource; + exports.ImageResource = ImageResource; + exports.MaskData = MaskData; + exports.MaskSystem = MaskSystem; + exports.ObjectRenderer = ObjectRenderer; + exports.Program = Program; + exports.ProjectionSystem = ProjectionSystem; + exports.Quad = Quad; + exports.QuadUv = QuadUv; + exports.RenderTexture = RenderTexture; + exports.RenderTexturePool = RenderTexturePool; + exports.RenderTextureSystem = RenderTextureSystem; + exports.Renderer = Renderer; + exports.Resource = Resource; + exports.SVGResource = SVGResource; + exports.ScissorSystem = ScissorSystem; + exports.Shader = Shader; + exports.ShaderSystem = ShaderSystem; + exports.SpriteMaskFilter = SpriteMaskFilter; + exports.State = State; + exports.StateSystem = StateSystem; + exports.StencilSystem = StencilSystem; + exports.System = System; + exports.Texture = Texture; + exports.TextureGCSystem = TextureGCSystem; + exports.TextureMatrix = TextureMatrix; + exports.TextureSystem = TextureSystem; + exports.TextureUvs = TextureUvs; + exports.UniformGroup = UniformGroup; + exports.VERSION = VERSION; + exports.VideoResource = VideoResource; + exports.ViewableBuffer = ViewableBuffer; + exports.autoDetectRenderer = autoDetectRenderer; + exports.autoDetectResource = autoDetectResource; + exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; + exports.createUBOElements = createUBOElements; + exports.defaultFilterVertex = defaultFilterVertex; + exports.defaultVertex = defaultVertex$1; + exports.generateProgram = generateProgram; + exports.generateUniformBufferSync = generateUniformBufferSync; + exports.getTestContext = getTestContext; + exports.getUBOData = getUBOData; + exports.resources = resources; + exports.systems = systems; + exports.uniformParsers = uniformParsers; + Object.keys(extensions).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return extensions[k]; } + }); + }); + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI, PIXI.utils, PIXI, PIXI, PIXI, PIXI); +Object.assign(this.PIXI, _pixi_core); +//# sourceMappingURL=core.js.map diff --git a/live2d/node_modules/@pixi/core/dist/browser/core.js.map b/live2d/node_modules/@pixi/core/dist/browser/core.js.map new file mode 100644 index 0000000..187525a --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/browser/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sources":["../../src/settings.ts","../../src/textures/resources/autoDetectResource.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/textures/resources/Resource.ts","../../src/textures/resources/BufferResource.ts","../../src/textures/BaseTexture.ts","../../src/textures/resources/AbstractMultiResource.ts","../../src/textures/resources/ArrayResource.ts","../../src/textures/resources/BaseImageResource.ts","../../src/textures/resources/CanvasResource.ts","../../src/textures/resources/CubeResource.ts","../../src/textures/resources/ImageResource.ts","../../src/textures/resources/SVGResource.ts","../../src/textures/resources/VideoResource.ts","../../src/textures/resources/ImageBitmapResource.ts","../../src/textures/resources/index.ts","../../src/textures/resources/DepthResource.ts","../../src/framebuffer/Framebuffer.ts","../../src/renderTexture/BaseRenderTexture.ts","../../src/textures/TextureUvs.ts","../../src/textures/Texture.ts","../../src/renderTexture/RenderTexture.ts","../../src/renderTexture/RenderTexturePool.ts","../../src/geometry/Attribute.ts","../../src/geometry/Buffer.ts","../../src/geometry/utils/interleaveTypedArrays.ts","../../src/geometry/Geometry.ts","../../src/utils/Quad.ts","../../src/utils/QuadUv.ts","../../src/shader/UniformGroup.ts","../../src/filters/FilterState.ts","../../src/filters/FilterSystem.ts","../../src/batch/ObjectRenderer.ts","../../src/batch/BatchSystem.ts","../../src/context/ContextSystem.ts","../../src/framebuffer/GLFramebuffer.ts","../../src/framebuffer/FramebufferSystem.ts","../../src/geometry/GeometrySystem.ts","../../src/mask/MaskData.ts","../../src/shader/utils/compileShader.ts","../../src/shader/utils/logProgramError.ts","../../src/shader/utils/defaultValue.ts","../../src/shader/utils/getTestContext.ts","../../src/shader/utils/getMaxFragmentPrecision.ts","../../src/shader/utils/setPrecision.ts","../../src/shader/utils/mapSize.ts","../../src/shader/utils/mapType.ts","../../src/shader/utils/uniformParsers.ts","../../src/shader/utils/generateUniformsSync.ts","../../src/shader/utils/checkMaxIfStatementsInShader.ts","../../src/shader/utils/unsafeEvalSupported.ts","../../src/shader/utils/index.ts","../../src/shader/Program.ts","../../src/shader/Shader.ts","../../src/state/State.ts","../../src/filters/Filter.ts","../../src/textures/TextureMatrix.ts","../../src/filters/spriteMask/SpriteMaskFilter.ts","../../src/mask/MaskSystem.ts","../../src/mask/AbstractMaskSystem.ts","../../src/mask/ScissorSystem.ts","../../src/mask/StencilSystem.ts","../../src/projection/ProjectionSystem.ts","../../src/renderTexture/RenderTextureSystem.ts","../../src/shader/utils/generateUniformBufferSync.ts","../../src/shader/GLProgram.ts","../../src/shader/utils/getAttributeData.ts","../../src/shader/utils/getUniformData.ts","../../src/shader/utils/generateProgram.ts","../../src/shader/ShaderSystem.ts","../../src/state/utils/mapWebGLBlendModesToPixi.ts","../../src/state/StateSystem.ts","../../src/textures/TextureGCSystem.ts","../../src/textures/utils/mapTypeAndFormatToInternalFormat.ts","../../src/textures/GLTexture.ts","../../src/textures/TextureSystem.ts","../../src/AbstractRenderer.ts","../../src/geometry/GLBuffer.ts","../../src/geometry/BufferSystem.ts","../../src/Renderer.ts","../../src/autoDetectRenderer.ts","../../src/fragments/index.ts","../../src/ISystem.ts","../../src/batch/BatchDrawCall.ts","../../src/batch/BatchTextureArray.ts","../../src/geometry/ViewableBuffer.ts","../../src/batch/AbstractBatchRenderer.ts","../../src/batch/BatchShaderGenerator.ts","../../src/batch/BatchGeometry.ts","../../src/batch/BatchPluginFactory.ts","../../src/deprecations.ts","../../src/index.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import type { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n| ICubeResourceOptions\n| IImageResourceOptions\n| ISVGResourceOptions\n| IVideoResourceOptions\n| IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","/**\n * @namespace PIXI.glCore\n * @private\n */\n/**\n * @namespace PIXI.glCore.shader\n * @private\n */\nexport * from './compileShader';\nexport * from './logProgramError';\nexport * from './defaultValue';\nexport * from './getMaxFragmentPrecision';\nexport * from './setPrecision';\nexport * from './mapSize';\nexport * from './mapType';\nexport * from './generateUniformsSync';\nexport * from './uniformParsers';\nexport * from './getTestContext';\nexport * from './checkMaxIfStatementsInShader';\nexport * from './unsafeEvalSupported';\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import $defaultVertex from './default.vert';\nimport $defaultFilterVertex from './defaultFilter.vert';\n\n/**\n * Default vertex shader\n * @memberof PIXI\n * @member {string} defaultVertex\n */\n\n/**\n * Default filter vertex shader\n * @memberof PIXI\n * @member {string} defaultFilterVertex\n */\n\n// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types\n// of defaultVertex, defaultFilterVertex.\nconst defaultVertex: string = $defaultVertex;\nconst defaultFilterVertex: string = $defaultFilterVertex;\n\nexport { defaultVertex, defaultFilterVertex };\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n"],"names":["settings","isMobile","ENV","arguments","Runner","ALPHA_MODES","SCALE_MODES","FORMATS","TYPES","TARGETS","uid","isPow2","BaseTextureCache","TextureCache","EventEmitter","determineCrossOrigin","Ticker","MSAA_QUALITY","MIPMAP_MODES","groupD8","Rectangle","Point","getResolutionOfUrl","deprecation","nextPow2","UID","BUFFER_TYPE","map","getBufferType","byteSizeMap","tempMatrix","Matrix","CLEAR_MODES","DRAW_MODES","BUFFER_BITS","MASK_TYPES","PRECISION","defaultVertex","defaultFragment","ProgramCache","BLEND","OFFSET","CULLING","DEPTH_TEST","WINDING","DEPTH_MASK","BLEND_MODES","GC_MODES","SAMPLER_TYPES","removeItems","WRAP_MODES","RENDERER_TYPE","hex2string","hex2rgb","sayHello","isWebGLSupported","extensions","ExtensionType","premultiplyBlendMode","log2","premultiplyTint"],"mappings":";;;;;;;;;;;IAIA;;;;;;;;;;;;;;IAcG;AACHA,qBAAQ,CAAC,UAAU,GAAGC,cAAQ,CAAC,GAAG,GAAGC,aAAG,CAAC,KAAK,GAAGA,aAAG,CAAC,MAAM,CAAC;IAE5D;;;;;;;;;;;;;;IAcG;AACHF,qBAAQ,CAAC,oBAAoB,GAAG,KAAK;;ICHrC;;;;;;;;;;;;;;;;;;;;;;;;IAwBG;AACU,QAAA,SAAS,GAAqC,GAAG;IAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BG;IACa,SAAA,kBAAkB,CAAyB,MAAe,EAAE,OAAY,EAAA;QAEpF,IAAI,CAAC,MAAM,EACX;IACI,QAAA,OAAO,IAAI,CAAC;IACf,KAAA;QAED,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAC9B;;YAEI,IAAM,MAAM,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvD,QAAA,IAAI,MAAM,EACV;gBACI,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,SAAA;IACJ,KAAA;IAED,IAAA,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAA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GAAG,EAAH,YAAA;gBAGIA,iBAAW,CAAC,OAAO,EAAE,iBAAA,GAAkB,IAAI,GAAsB,qBAAA,GAAA,IAAM,CAAC,CAAC;IAGzE,YAAA,OAAQ,QAAgB,CAAC,IAAI,CAAC,CAAC;aAClC;IACJ,KAAA,CAAC,CAAC;;IAZX,KAAK,IAAM,IAAI,IAAI,QAAQ,EAAA;gBAAhB,IAAI,CAAA,CAAA;IAad;;IC9CD;;IAEG;IAEH;;;IAGG;AACU,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/dist/browser/core.min.js b/live2d/node_modules/@pixi/core/dist/browser/core.min.js new file mode 100644 index 0000000..074c14c --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/browser/core.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_core=function(e,t,r,i,n,o,s,a){"use strict";t.settings.PREFER_ENV=i.isMobile.any?r.ENV.WEBGL:r.ENV.WEBGL2,t.settings.STRICT_TEXTURE_CACHE=!1;var u=[];function h(e,t){if(!e)return null;var r="";if("string"==typeof e){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(e);i&&(r=i[1].toLowerCase())}for(var n=u.length-1;n>=0;--n){var o=u[n];if(o.test&&o.test(e,r))return new o(e,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},l(e,t)};function f(e,t){function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var d=function(){return d=Object.assign||function(e){for(var t,r=arguments,i=1,n=arguments.length;i0&&p>0,s.textureCacheIds=[],s.destroyed=!1,s.resource=null,s._batchEnabled=0,s._batchLocation=0,s.parentTextureArray=null,s.setResource(n),s}return f(n,e),Object.defineProperty(n.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),n.prototype.setStyle=function(e,t){var r;return void 0!==e&&e!==this.scaleMode&&(this.scaleMode=e,r=!0),void 0!==t&&t!==this.mipmap&&(this.mipmap=t,r=!0),r&&this.dirtyStyleId++,this},n.prototype.setSize=function(e,t,r){return r=r||this.resolution,this.setRealSize(e*r,t*r,r)},n.prototype.setRealSize=function(e,t,r){return this.resolution=r||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this},n.prototype._refreshPOT=function(){this.isPowerOfTwo=i.isPow2(this.realWidth)&&i.isPow2(this.realHeight)},n.prototype.setResolution=function(e){var t=this.resolution;return t===e||(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT()),this},n.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},n.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},n.prototype.onError=function(e){this.emit("error",this,e)},n.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete i.BaseTextureCache[this.cacheId],delete i.TextureCache[this.cacheId],this.cacheId=null),this.dispose(),n.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},n.prototype.dispose=function(){this.emit("dispose",this)},n.prototype.castToBaseTexture=function(){return this},n.from=function(e,r,o){void 0===o&&(o=t.settings.STRICT_TEXTURE_CACHE);var s="string"==typeof e,a=null;if(s)a=e;else{if(!e._pixiId){var u=r&&r.pixiIdPrefix||"pixiid";e._pixiId=u+"_"+i.uid()}a=e._pixiId}var h=i.BaseTextureCache[a];if(s&&o&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||((h=new n(e,r)).cacheId=a,n.addToCache(h,a)),h},n.fromBuffer=function(e,t,i,o){e=e||new Float32Array(t*i*4);var s=new p(e,{width:t,height:i}),a=e instanceof Float32Array?r.TYPES.FLOAT:r.TYPES.UNSIGNED_BYTE;return new n(s,Object.assign({},v,o||{width:t,height:i,type:a}))},n.addToCache=function(e,t){t&&(-1===e.textureCacheIds.indexOf(t)&&e.textureCacheIds.push(t),i.BaseTextureCache[t]&&console.warn("BaseTexture added to the cache with an id ["+t+"] that already had an entry"),i.BaseTextureCache[t]=e)},n.removeFromCache=function(e){if("string"==typeof e){var t=i.BaseTextureCache[e];if(t){var r=t.textureCacheIds.indexOf(e);return r>-1&&t.textureCacheIds.splice(r,1),delete i.BaseTextureCache[e],t}}else if(e&&e.textureCacheIds){for(var n=0;n0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,t)}else e.target=r.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this},t.prototype.upload=function(e,r,i){for(var n=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,r}(y),S=function(e){function t(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];y.crossOrigin(o,s,i.crossorigin);for(var a=0;a2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(s.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(s.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(s.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(s.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(s.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(r)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(y),R=function(e){function t(t){return e.call(this,t)||this}return f(t,e),t.test=function(e){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap},t}(y);u.push(x,R,E,S,b,p,T,_);var A={__proto__:null,Resource:c,BaseImageResource:y,INSTALLED:u,autoDetectResource:h,AbstractMultiResource:g,ArrayResource:_,BufferResource:p,CanvasResource:E,CubeResource:T,ImageResource:x,SVGResource:b,VideoResource:S,ImageBitmapResource:R},I=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.upload=function(e,t,i){var n=e.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===r.ALPHA_MODES.UNPACK);var o=t.realWidth,s=t.realHeight;return i.width===o&&i.height===s?n.texSubImage2D(t.target,0,0,0,o,s,t.format,i.type,this.data):(i.width=o,i.height=s,n.texImage2D(t.target,0,i.internalFormat,o,s,0,t.format,i.type,this.data)),!0},t}(p),M=function(){function e(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new o.Runner("disposeFramebuffer"),this.multisample=r.MSAA_QUALITY.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,t){return void 0===e&&(e=0),this.colorTextures[e]=t||new m(null,{scaleMode:r.SCALE_MODES.NEAREST,resolution:1,mipmap:r.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new m(new I(null,{width:this.width,height:this.height}),{scaleMode:r.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:r.MIPMAP_MODES.OFF,format:r.FORMATS.DEPTH_COMPONENT,type:r.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),e!==this.width||t!==this.height){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&t.textureCacheIds.splice(r,1),delete i.TextureCache[e],t}}else if(e&&e.textureCacheIds){for(var n=0;nthis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",u="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,h="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+a+" "+h)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),r.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(r,"EMPTY",{get:function(){return r._EMPTY||(r._EMPTY=new r(new m),F(r._EMPTY),F(r._EMPTY.baseTexture)),r._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(r,"WHITE",{get:function(){if(!r._WHITE){var e=t.settings.ADAPTER.createCanvas(16,16),i=e.getContext("2d");e.width=16,e.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),r._WHITE=new r(m.from(e)),F(r._WHITE),F(r._WHITE.baseTexture)}return r._WHITE},enumerable:!1,configurable:!0}),r}(i.EventEmitter),N=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return f(t,e),Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t,r){void 0===r&&(r=!0);var i=this.baseTexture.resolution,n=Math.round(e*i)/i,o=Math.round(t*i)/i;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,r&&this.baseTexture.resize(n,o),this.updateUvs()},t.prototype.setResolution=function(e){var t=this.baseTexture;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))},t.create=function(e){for(var r=arguments,i=[],n=1;n1?-o:-1:(s=((65535&(e=i.nextPow2(e)))<<16|65535&(t=i.nextPow2(t)))>>>0,o>1&&(s+=4294967296*o)),this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(e,t,o)),a.filterPoolKey=s,a.setResolution(n),a},e.prototype.getFilterTexture=function(e,t,i){var n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||r.MSAA_QUALITY.NONE);return n.filterFrame=e.filterFrame,n},e.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},e.prototype.returnFilterTexture=function(e){this.returnTexture(e)},e.prototype.clear=function(e){if(e=!1!==e)for(var t in this.texturePool){var r=this.texturePool[t];if(r)for(var i=0;i0&&e.height>0,this.texturePool)if(Number(t)<0){var r=this.texturePool[t];if(r)for(var i=0;i1){for(var h=0;h1&&((f=this.getOptimalFilterTexture(l.width,l.height,t.resolution)).filterFrame=l.filterFrame),i[d].apply(this,l,f,r.CLEAR_MODES.CLEAR,t);var c=l;l=f,f=c}i[d].apply(this,l,h.renderTexture,r.CLEAR_MODES.BLEND,t),d>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}t.clear(),this.statePool.push(t)},e.prototype.bindAndClear=function(e,t){void 0===t&&(t=r.CLEAR_MODES.CLEAR);var i=this.renderer,n=i.renderTexture,o=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=e.filterFrame.width,s.height=e.filterFrame.height,n.bind(e,e.filterFrame,s)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=1&o.stateId||this.forceClear;(t===r.CLEAR_MODES.CLEAR||t===r.CLEAR_MODES.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},e.prototype.applyFilter=function(e,t,i,n){var o=this.renderer;o.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(r.DRAW_MODES.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(r.DRAW_MODES.TRIANGLE_STRIP))},e.prototype.calculateSpriteMatrix=function(e,t){var r=this.activeState,i=r.sourceFrame,n=r.destinationFrame,o=t._texture.orig,s=e.set(n.width,0,0,n.height,i.x,i.y),u=t.worldTransform.copyTo(a.Matrix.TEMP_MATRIX);return u.invert(),s.prepend(u),s.scale(1/o.width,1/o.height),s.translate(t.anchor.x,t.anchor.y),s},e.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},e.prototype.getOptimalFilterTexture=function(e,t,i,n){return void 0===i&&(i=1),void 0===n&&(n=r.MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(e,t,i,n)},e.prototype.getFilterTexture=function(e,t,i){if("number"==typeof e){var n=e;e=t,t=n}e=e||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||r.MSAA_QUALITY.NONE);return o.filterFrame=e.filterFrame,o},e.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},e.prototype.emptyPool=function(){this.texturePool.clear(!0)},e.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},e.prototype.transformAABB=function(e,t){var r=Q[0],i=Q[1],n=Q[2],o=Q[3];r.set(t.left,t.top),i.set(t.left,t.bottom),n.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(r,r),e.apply(i,i),e.apply(n,n),e.apply(o,o);var s=Math.min(r.x,i.x,n.x,o.x),a=Math.min(r.y,i.y,n.y,o.y),u=Math.max(r.x,i.x,n.x,o.x),h=Math.max(r.y,i.y,n.y,o.y);t.x=s,t.y=a,t.width=u-s,t.height=h-a},e.prototype.roundFrame=function(e,t,r,i,n){if(!(e.width<=0||e.height<=0||r.width<=0||r.height<=0)){if(n){var o=n.a,s=n.b,a=n.c,u=n.d;if((Math.abs(s)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}(n=n?q.copyFrom(n):q.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}},e}(),$=function(){function e(e){this.renderer=e}return e.prototype.flush=function(){},e.prototype.destroy=function(){this.renderer=null},e.prototype.start=function(){},e.prototype.stop=function(){this.flush()},e.prototype.render=function(e){},e}(),J=function(){function e(e){this.renderer=e,this.emptyRenderer=new $(e),this.currentRenderer=this.emptyRenderer}return e.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},e.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.copyBoundTextures=function(e,t){for(var r=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=r[i]||null,e[i]&&(e[i]._batchLocation=i)},e.prototype.boundArray=function(e,t,r,i){for(var n=e.elements,o=e.ids,s=e.count,a=0,u=0;u=0&&l=r.ENV.WEBGL2&&(n=e.getContext("webgl2",i)),n)this.webGLVersion=2;else if(this.webGLVersion=1,!(n=e.getContext("webgl",i)||e.getContext("experimental-webgl",i)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},e.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},e.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout((function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()}),0)},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},e.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(e){var t=e.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},e}(),re=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=r.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},ie=new a.Rectangle,ne=function(){function e(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new M(10,10),this.msaaSamples=null}return e.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new a.Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){var i=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;t.settings.PREFER_ENV===r.ENV.WEBGL_LEGACY&&(i=null,n=null),i?e.drawBuffers=function(e){return i.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},e.prototype.bind=function(e,t,r){void 0===r&&(r=0);var i=this.gl;if(e){var n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var o=0;o>r,u=t.height>>r,h=a/t.width;this.setViewport(t.x*h,t.y*h,a,u)}else{a=e.width>>r,u=e.height>>r;this.setViewport(0,0,a,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},e.prototype.setViewport=function(e,t,r,i){var n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===e&&n.y===t||(n.x=e,n.y=t,n.width=r,n.height=i,this.gl.viewport(e,t,r,i))},Object.defineProperty(e.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),e.prototype.clear=function(e,t,i,n,o){void 0===o&&(o=r.BUFFER_BITS.COLOR|r.BUFFER_BITS.DEPTH);var s=this.gl;s.clearColor(e,t,i,n),s.clear(o)},e.prototype.initFramebuffer=function(e){var t=this.gl,r=new re(t.createFramebuffer());return r.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(e),e.disposeRunner.add(this),r},e.prototype.resizeFramebuffer=function(e){var t=this.gl,r=e.glFramebuffers[this.CONTEXT_UID];r.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,r.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.RGBA8,e.width,e.height)),r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,n=i.length;t.drawBuffers||(n=Math.min(n,1));for(var o=0;o1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.RGBA8,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],a=0;a1&&r.drawBuffers(s),e.depthTexture)&&this.writeDepthTexture){var l=e.depthTexture;this.renderer.texture.bind(l,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,t)}!e.stencil&&!e.depth||e.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))},e.prototype.canMultisampleFramebuffer=function(e){return 1!==this.renderer.context.webGLVersion&&e.colorTextures.length<=1&&!e.depthTexture},e.prototype.detectSamples=function(e){var t=this.msaaSamples,i=r.MSAA_QUALITY.NONE;if(e<=1||null===t)return i;for(var n=0;n=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}},e.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=r.ENV.WEBGL2&&(i=e.getContext("webgl2",{})),i||((i=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?i.getExtension("WEBGL_draw_buffers"):i=null),pe=i}return pe}function me(e,t,i){if("precision"!==e.substring(0,9)){var n=t;return t===r.PRECISION.HIGH&&i!==r.PRECISION.HIGH&&(n=r.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==r.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var ge={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function _e(e){return ge[e]}var ye=null,Ee={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Te(e,t){if(!ye){var r=Object.keys(Ee);ye={};for(var i=0;i0&&(t+="\nelse "),r0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==t&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))},e.prototype.destroy=function(){this.renderer=null},e}(),Ge=function(){function e(e){this.renderer=e,this.maskStack=[],this.glConst=0}return e.prototype.getStackLength=function(){return this.maskStack.length},e.prototype.setMaskStack=function(e){var t=this.renderer.gl,r=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==r&&(0===i?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},e.prototype._useCurrent=function(){},e.prototype.destroy=function(){this.renderer=null,this.maskStack=null},e}(),ke=new a.Matrix,Ve=[],He=function(e){function r(r){var i=e.call(this,r)||this;return i.glConst=t.settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return f(r,e),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},r.prototype.calcScissorRect=function(e){var t;if(!e._scissorRectLocal){var r=e._scissorRect,i=e.maskObject,n=this.renderer,o=n.renderTexture,s=i.getBounds(!0,null!==(t=Ve.pop())&&void 0!==t?t:new a.Rectangle);this.roundFrameToPixels(s,o.current?o.current.resolution:n.resolution,o.sourceFrame,o.destinationFrame,n.projection.transform),r&&s.fit(r),e._scissorRectLocal=s}},r.isMatrixRotated=function(e){if(!e)return!1;var t=e.a,r=e.b,i=e.c,n=e.d;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(n)>1e-4)},r.prototype.testScissor=function(e){var t=e.maskObject;if(!t.isFastRect||!t.isFastRect())return!1;if(r.isMatrixRotated(t.worldTransform))return!1;if(r.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var i=e._scissorRectLocal;return i.width>0&&i.height>0},r.prototype.roundFrameToPixels=function(e,t,i,n,o){r.isMatrixRotated(o)||((o=o?ke.copyFrom(o):ke.identity()).translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.renderer.filter.transformAABB(o,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))},r.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var t=this.renderer.gl;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;e&&Ve.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)},r.prototype._useCurrent=function(){var e,t=this.maskStack[this.maskStack.length-1]._scissorRect;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)},r}(Ge),je=function(e){function r(r){var i=e.call(this,r)||this;return i.glConst=t.settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return f(r,e),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},r.prototype.push=function(e){var t=e.maskObject,r=this.renderer.gl,i=e._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),e._stencilCounter++;var n=e._colorMask;0!==n&&(e._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==n&&(e._colorMask=n,r.colorMask(0!=(1&n),0!=(2&n),0!=(4&n),0!=(8&n))),this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;if(0===this.getStackLength())t.disable(t.STENCIL_TEST);else{var r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==i&&(r._colorMask=i,t.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}},r.prototype._useCurrent=function(){var e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},r}(Ge),Xe=function(){function e(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new a.Matrix,this.transform=null}return e.prototype.update=function(e,t,r,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},e.prototype.calculateProjection=function(e,t,r,i){var n=this.projectionMatrix,o=i?-1:1;n.identity(),n.a=1/t.width*2,n.d=o*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-o-t.y*n.d},e.prototype.setTransform=function(e){},e.prototype.destroy=function(){this.renderer=null},e}(),ze=new a.Rectangle,Ye=new a.Rectangle,We=function(){function e(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new a.Rectangle,this.destinationFrame=new a.Rectangle,this.viewportFrame=new a.Rectangle}return e.prototype.bind=function(e,t,r){void 0===e&&(e=null);var i,n,o,s=this.renderer;this.current=e,e?(o=(i=e.baseTexture).resolution,t||(ze.width=e.frame.width,ze.height=e.frame.height,t=ze),r||(Ye.x=e.frame.x,Ye.y=e.frame.y,Ye.width=t.width,Ye.height=t.height,r=Ye),n=i.framebuffer):(o=s.resolution,t||(ze.width=s.screen.width,ze.height=s.screen.height,t=ze),r||((r=ze).width=t.width,r.height=t.height));var a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,e||(a.y=s.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(r,t,o,!n),e?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(r)},e.prototype.clear=function(e,t){e=this.current?e||this.current.baseTexture.clearColor:e||this.clearColor;var r=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,n=r.width!==i.width||r.height!==i.height;if(n){var o=this.viewportFrame,s=o.x,a=o.y,u=o.width,h=o.height;s=Math.round(s),a=Math.round(a),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,a,u,h)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),n&&this.renderer.scissor.pop()},e.prototype.resize=function(){this.bind(null)},e.prototype.reset=function(){this.bind(null)},e.prototype.destroy=function(){this.renderer=null},e}();function Ke(e,t,r,i,n){r.buffer.update(n)}var Qe={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},qe={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function Ze(e){for(var t=e.map((function(e){return{data:e,offset:0,dataLen:0,dirty:0}})),r=0,i=0,n=0,o=0;o1&&(r=Math.max(r,16)*s.data.size),s.dataLen=r,i%r!=0&&i<16){var a=i%r%16;i+=a,n+=a}i+r>16?(n=16*Math.ceil(n/16),s.offset=n,n+=r,i=r):(s.offset=n,i+=r,n+=r)}return{uboElements:t,size:n=16*Math.ceil(n/16)}}function $e(e,t){var r=[];for(var i in e)t[i]&&r.push(t[i]);return r.sort((function(e,t){return e.index-t.index})),r}function Je(e,t){if(!e.autoManage)return{size:0,syncFunc:Ke};for(var r=Ze($e(e.uniforms,t)),i=r.uboElements,n=r.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],s=0;s1){var c=_e(a.data.type),p=Math.max(qe[a.data.type]/16,1),v=c/p,m=(4-v%4)%4;o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*p+"; i++)\n {\n for(var j = 0; j < "+v+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+m+";\n }\n\n ")}else{var g=Qe[a.data.type];o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n "+g+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var et=function(){},tt=function(){function e(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return e.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},e}();function rt(e,t){var r=ue(e,e.VERTEX_SHADER,t.vertexSrc),i=ue(e,e.FRAGMENT_SHADER,t.fragmentSrc),n=e.createProgram();if(e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||function(e,t,r,i){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||he(e,r),e.getShaderParameter(i,e.COMPILE_STATUS)||he(e,i),console.error("PixiJS Error: Could not initialize shader."),""!==e.getProgramInfoLog(t)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}(e,n,r,i),t.attributeData=function(e,t){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;nt?1:-1}));for(var s=0;s>=1,r++;this.stateId=e.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},e.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),t[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(e.children[i])},e.prototype.destroy=function(){this.renderer=null},e}();var ut=function(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=r.TYPES.UNSIGNED_BYTE,this.internalFormat=r.FORMATS.RGBA,this.samplerType=0},ht=function(){function e(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new m,this.hasIntegerTextures=!1}return e.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(e){var t,i,n,o,s,a,u,h,l,f,d,c,p,v,m,g,_,y,E,T,x,b,S;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?((t={})[r.TYPES.UNSIGNED_BYTE]=((i={})[r.FORMATS.RGBA]=e.RGBA8,i[r.FORMATS.RGB]=e.RGB8,i[r.FORMATS.RG]=e.RG8,i[r.FORMATS.RED]=e.R8,i[r.FORMATS.RGBA_INTEGER]=e.RGBA8UI,i[r.FORMATS.RGB_INTEGER]=e.RGB8UI,i[r.FORMATS.RG_INTEGER]=e.RG8UI,i[r.FORMATS.RED_INTEGER]=e.R8UI,i[r.FORMATS.ALPHA]=e.ALPHA,i[r.FORMATS.LUMINANCE]=e.LUMINANCE,i[r.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,i),t[r.TYPES.BYTE]=((n={})[r.FORMATS.RGBA]=e.RGBA8_SNORM,n[r.FORMATS.RGB]=e.RGB8_SNORM,n[r.FORMATS.RG]=e.RG8_SNORM,n[r.FORMATS.RED]=e.R8_SNORM,n[r.FORMATS.RGBA_INTEGER]=e.RGBA8I,n[r.FORMATS.RGB_INTEGER]=e.RGB8I,n[r.FORMATS.RG_INTEGER]=e.RG8I,n[r.FORMATS.RED_INTEGER]=e.R8I,n),t[r.TYPES.UNSIGNED_SHORT]=((o={})[r.FORMATS.RGBA_INTEGER]=e.RGBA16UI,o[r.FORMATS.RGB_INTEGER]=e.RGB16UI,o[r.FORMATS.RG_INTEGER]=e.RG16UI,o[r.FORMATS.RED_INTEGER]=e.R16UI,o[r.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT16,o),t[r.TYPES.SHORT]=((s={})[r.FORMATS.RGBA_INTEGER]=e.RGBA16I,s[r.FORMATS.RGB_INTEGER]=e.RGB16I,s[r.FORMATS.RG_INTEGER]=e.RG16I,s[r.FORMATS.RED_INTEGER]=e.R16I,s),t[r.TYPES.UNSIGNED_INT]=((a={})[r.FORMATS.RGBA_INTEGER]=e.RGBA32UI,a[r.FORMATS.RGB_INTEGER]=e.RGB32UI,a[r.FORMATS.RG_INTEGER]=e.RG32UI,a[r.FORMATS.RED_INTEGER]=e.R32UI,a[r.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT24,a),t[r.TYPES.INT]=((u={})[r.FORMATS.RGBA_INTEGER]=e.RGBA32I,u[r.FORMATS.RGB_INTEGER]=e.RGB32I,u[r.FORMATS.RG_INTEGER]=e.RG32I,u[r.FORMATS.RED_INTEGER]=e.R32I,u),t[r.TYPES.FLOAT]=((h={})[r.FORMATS.RGBA]=e.RGBA32F,h[r.FORMATS.RGB]=e.RGB32F,h[r.FORMATS.RG]=e.RG32F,h[r.FORMATS.RED]=e.R32F,h[r.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT32F,h),t[r.TYPES.HALF_FLOAT]=((l={})[r.FORMATS.RGBA]=e.RGBA16F,l[r.FORMATS.RGB]=e.RGB16F,l[r.FORMATS.RG]=e.RG16F,l[r.FORMATS.RED]=e.R16F,l),t[r.TYPES.UNSIGNED_SHORT_5_6_5]=((f={})[r.FORMATS.RGB]=e.RGB565,f),t[r.TYPES.UNSIGNED_SHORT_4_4_4_4]=((d={})[r.FORMATS.RGBA]=e.RGBA4,d),t[r.TYPES.UNSIGNED_SHORT_5_5_5_1]=((c={})[r.FORMATS.RGBA]=e.RGB5_A1,c),t[r.TYPES.UNSIGNED_INT_2_10_10_10_REV]=((p={})[r.FORMATS.RGBA]=e.RGB10_A2,p[r.FORMATS.RGBA_INTEGER]=e.RGB10_A2UI,p),t[r.TYPES.UNSIGNED_INT_10F_11F_11F_REV]=((v={})[r.FORMATS.RGB]=e.R11F_G11F_B10F,v),t[r.TYPES.UNSIGNED_INT_5_9_9_9_REV]=((m={})[r.FORMATS.RGB]=e.RGB9_E5,m),t[r.TYPES.UNSIGNED_INT_24_8]=((g={})[r.FORMATS.DEPTH_STENCIL]=e.DEPTH24_STENCIL8,g),t[r.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=((_={})[r.FORMATS.DEPTH_STENCIL]=e.DEPTH32F_STENCIL8,_),S=t):((y={})[r.TYPES.UNSIGNED_BYTE]=((E={})[r.FORMATS.RGBA]=e.RGBA,E[r.FORMATS.RGB]=e.RGB,E[r.FORMATS.ALPHA]=e.ALPHA,E[r.FORMATS.LUMINANCE]=e.LUMINANCE,E[r.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,E),y[r.TYPES.UNSIGNED_SHORT_5_6_5]=((T={})[r.FORMATS.RGB]=e.RGB,T),y[r.TYPES.UNSIGNED_SHORT_4_4_4_4]=((x={})[r.FORMATS.RGBA]=e.RGBA,x),y[r.TYPES.UNSIGNED_SHORT_5_5_5_1]=((b={})[r.FORMATS.RGBA]=e.RGBA,b),S=y),S}(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var i=0;i=0;--s){var a=i[s];if(a)a._glTextures[o].samplerType!==r.SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(a)}},e.prototype.initTexture=function(e){var t=new ut(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},e.prototype.initTextureType=function(e,t){var i,n;t.internalFormat=null!==(n=null===(i=this.internalFormats[e.type])||void 0===i?void 0:i[e.format])&&void 0!==n?n:e.format,2===this.webGLVersion&&e.type===r.TYPES.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},e.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var i=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(i,e,t))t.samplerType!==r.SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,o=e.realHeight,s=i.gl;(t.width!==n||t.height!==o||t.dirtyId<0)&&(t.width=n,t.height=o,s.texImage2D(e.target,0,t.internalFormat,n,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},e.prototype.destroyTexture=function(e,t){var r=this.gl;if((e=e.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(e),r.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var n=this.managedTextures.indexOf(e);-1!==n&&i.removeItems(this.managedTextures,n,1)}},e.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&(e.mipmap!==r.MIPMAP_MODES.POW2&&2===this.webGLVersion||e.isPowerOfTwo?t.mipmap=e.mipmap>=1:t.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?t.wrapMode=e.wrapMode:t.wrapMode=r.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},e.prototype.setStyle=function(e,t){var i=this.gl;if(t.mipmap&&e.mipmap!==r.MIPMAP_MODES.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===r.SCALE_MODES.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===r.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===r.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===r.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST)},e.prototype.destroy=function(){this.renderer=null},e}(),lt={__proto__:null,FilterSystem:Z,BatchSystem:J,ContextSystem:te,FramebufferSystem:ne,GeometrySystem:se,MaskSystem:Ue,ScissorSystem:He,StencilSystem:je,ProjectionSystem:Xe,RenderTextureSystem:We,ShaderSystem:ot,StateSystem:st,TextureGCSystem:at,TextureSystem:ht},ft=new a.Matrix,dt=function(e){function n(i,n){void 0===i&&(i=r.RENDERER_TYPE.UNKNOWN);var o=e.call(this)||this;return n=Object.assign({},t.settings.RENDER_OPTIONS,n),o.options=n,o.type=i,o.screen=new a.Rectangle(0,0,n.width,n.height),o.view=n.view||t.settings.ADAPTER.createCanvas(),o.resolution=n.resolution||t.settings.RESOLUTION,o.useContextAlpha=n.useContextAlpha,o.autoDensity=!!n.autoDensity,o.preserveDrawingBuffer=n.preserveDrawingBuffer,o.clearBeforeRender=n.clearBeforeRender,o._backgroundColor=0,o._backgroundColorRgba=[0,0,0,1],o._backgroundColorString="#000000",o.backgroundColor=n.backgroundColor||o._backgroundColor,o.backgroundAlpha=n.backgroundAlpha,void 0!==n.transparent&&(o.useContextAlpha=n.transparent,o.backgroundAlpha=n.transparent?0:1),o._lastObjectRendered=null,o.plugins={},o}return f(n,e),n.prototype.initPlugins=function(e){for(var t in e)this.plugins[t]=new e[t](this)},Object.defineProperty(n.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),n.prototype.resize=function(e,t){this.view.width=Math.round(e*this.resolution),this.view.height=Math.round(t*this.resolution);var r=this.view.width/this.resolution,i=this.view.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.view.style.width=r+"px",this.view.style.height=i+"px"),this.emit("resize",r,i)},n.prototype.generateTexture=function(e,t,r,i){void 0===t&&(t={}),"number"==typeof t&&(t={scaleMode:t,resolution:r,region:i});var n=t.region,o=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{var n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;i.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}},e.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var r=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),r&&(t||i.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID])}},e.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),r=0;r=r.MSAA_QUALITY.HIGH?this.multisample=r.MSAA_QUALITY.HIGH:e>=r.MSAA_QUALITY.MEDIUM?this.multisample=r.MSAA_QUALITY.MEDIUM:e>=r.MSAA_QUALITY.LOW?this.multisample=r.MSAA_QUALITY.LOW:this.multisample=r.MSAA_QUALITY.NONE},t.prototype.addSystem=function(e,t){var r=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(var i in this[t]=r,this.runners)this.runners[i].add(r);return this},t.prototype.render=function(e,t){var r,i,n,o;if(t&&(t instanceof N?(r=t,i=arguments[2],n=arguments[3],o=arguments[4]):(r=t.renderTexture,i=t.clear,n=t.transform,o=t.skipUpdateTransform)),this.renderingToScreen=!r,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(r||(this._lastObjectRendered=e),!o){var s=e.enableTempParent();e.updateTransform(),e.disableTempParent(s)}this.renderTexture.bind(r),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),r&&r.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.generateTexture=function(t,r,i,n){void 0===r&&(r={});var o=e.prototype.generateTexture.call(this,t,r,i,n);return this.framebuffer.blit(),o},t.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(this.screen.height,this.screen.width)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,t){n.extensions.add({name:e,type:n.ExtensionType.RendererPlugin,ref:t})},t.__plugins={},t}(dt);n.extensions.handleByMap(n.ExtensionType.RendererPlugin,vt.__plugins);var mt=function(){function e(e){this.renderer=e}return e.prototype.destroy=function(){this.renderer=null},e}(),gt=function(){this.texArray=null,this.blend=0,this.type=r.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},_t=function(){function e(){this.elements=[],this.ids=[],this.count=0}return e.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},n.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=n._textureArrayPool,i=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++m._globalBatch,u=0,h=r[0],l=0;i.copyBoundTextures(o,t);for(var f=0;f=t&&(i.boundArray(h,o,a,t),this.buildDrawCalls(h,l,f),l=f,h=r[++u],++a),d._batchEnabled=a,d.touched=s,h.elements[h.count++]=d)}h.count>0&&(i.boundArray(h,o,a,t),this.buildDrawCalls(h,l,this._bufferSize),++u,++a);for(f=0;f0&&(t+="\nelse "),r\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n"],"names":["settings","PREFER_ENV","isMobile","any","ENV","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","source","options","extension","result","exec","toLowerCase","i","length","ResourcePlugin","test","Error","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__assign","assign","t","s","n","arguments","call","apply","Resource","width","height","_width","_height","destroyed","internal","onResize","Runner","onUpdate","onError","bind","baseTexture","add","emit","unbind","remove","resize","defineProperty","get","update","load","Promise","resolve","style","_renderer","_baseTexture","_glTexture","dispose","destroy","removeAll","_source","_extension","BufferResource","_super","_this","_a","data","upload","renderer","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","alphaMode","ALPHA_MODES","UNPACK","realWidth","realHeight","texSubImage2D","target","format","type","texImage2D","internalFormat","Float32Array","Uint8Array","Uint32Array","defaultBufferOptions","scaleMode","SCALE_MODES","NEAREST","FORMATS","RGBA","NPM","BaseTexture","resource","mipmap","anisotropicLevel","wrapMode","resolution","resourceOptions","RESOLUTION","Math","round","_mipmap","undefined","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","_wrapMode","WRAP_MODE","_scaleMode","SCALE_MODE","TYPES","UNSIGNED_BYTE","TARGETS","TEXTURE_2D","uid","touched","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","valid","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","set","value","setStyle","dirty","setSize","desiredWidth","desiredHeight","setRealSize","isPow2","setResolution","oldResolution","event","BaseTextureCache","TextureCache","removeFromCache","castToBaseTexture","from","strict","isFrame","_pixiId","prefix","pixiIdPrefix","addToCache","fromBuffer","buffer","FLOAT","id","indexOf","push","console","warn","baseTextureFromCache","index","splice","_globalBatch","EventEmitter","AbstractMultiResource","items","itemDirtyIds","partTexture","_load","initFromArray","resources","addBaseTextureAt","addResourceAt","len","on","off","promises","map","item","filter","all","then","ArrayResource","urls","isArray","TEXTURE_2D_ARRAY","texture","texImage3D","texSubImage3D","BaseImageResource","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","crossOrigin","element","url","crossorigin","determineCrossOrigin","HTMLImageElement","complete","HTMLVideoElement","readyState","CanvasResource","OffscreenCanvas","globalThis","HTMLCanvasElement","CubeResource","autoLoad","linkBaseTexture","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","keys","side","ImageResource","imageElement","Image","src","_process","preserveBitmap","createBitmap","CREATE_IMAGE_BITMAP","createImageBitmap","bitmap","reject","completed","onload","onerror","process","cors","fetch","mode","r","blob","premultiplyAlpha","flag","glTextures","key","otherTex","close","SVGResource","sourceBase64","ADAPTER","createCanvas","svg","scale","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVG_XML","trim","btoa","unescape","encodeURIComponent","_loadSvg","tempImage","svgWidth","svgHeight","canvas","getContext","drawImage","getSize","svgString","sizeMatch","SVG_SIZE","size","parseFloat","startsWith","VideoResource","videoElement","document","createElement","setAttribute","firstSrc","sourceElement","mime","baseSrc","split","shift","ext","slice","lastIndexOf","MIME_TYPES","appendChild","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","_deltaTime","elapsedMS","Ticker","shared","playbackRate","floor","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","addEventListener","_onPlayStart","_onPlayStop","_isSourceReady","removeEventListener","_isSourcePlaying","paused","ended","autoUpdate","play","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","DepthResource","Framebuffer","stencil","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","MSAA_QUALITY","NONE","addColorTexture","MIPMAP_MODES","OFF","addDepthTexture","DEPTH_COMPONENT","UNSIGNED_SHORT","enableDepth","enableStencil","destroyDepthTexture","BaseRenderTexture","clearColor","framebuffer","maskStack","filterStack","TextureUvs","x0","y0","x1","y1","x2","y2","x3","y3","uvsFloat32","frame","baseFrame","rotate","tw","th","w2","h2","cX","x","cY","y","groupD8","NW","uX","uY","DEFAULT_UVS","removeAllHandlers","tex","once","Texture","orig","anchor","noFrame","Rectangle","_frame","_uvs","uvMatrix","_rotate","Number","defaultAnchor","Point","_updateID","onBaseTextureUpdated","updateUvs","destroyBase","clone","clonedFrame","clonedOrig","clonedTexture","getResolutionOfUrl","fromURL","fromLoader","imageUrl","name","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","_EMPTY","_WHITE","context","fillStyle","fillRect","RenderTexture","baseRenderTexture","filterFrame","filterPoolKey","resizeBaseTexture","rest","_i","RenderTexturePool","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","createTexture","getOptimalTexture","minWidth","minHeight","ceil","nextPow2","renderTexture","pop","getFilterTexture","input","filterTexture","returnTexture","returnFilterTexture","clear","destroyTextures","textures","j","setScreenSize","SCREEN_KEY","Attribute","normalized","stride","start","instance","UID","Buffer","_static","_glBuffers","static","BUFFER_TYPE","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","Int32Array","byteSizeMap","Uint16Array","Geometry","buffers","attributes","indexBuffer","glVertexArrayObjects","instanced","instanceCount","refCount","addAttribute","ids","bufferIndex","getAttribute","getBuffer","addIndex","getIndex","interleave","arrays","sizes","interleavedBuffer","attribute","outSize","views","ArrayBuffer","out","littleOffset","array","getBufferType","interleaveTypedArrays","geometry","attrib","merge","geometries","geometryOut","offsets","offset","offset2","bufferIndexToCount","indexBufferData","Quad","QuadUv","vertices","uvs","vertexBuffer","uvBuffer","targetTextureFrame","destinationFrame","invalidate","UniformGroup","uniforms","isStatic","isUbo","group","syncUniforms","ubo","UNIFORM_BUFFER","autoManage","_ubo","uboFrom","FilterState","legacy","sourceFrame","bindingSourceFrame","bindingDestinationFrame","filters","transform","tempPoints","tempMatrix","Matrix","FilterSystem","defaultFilterStack","view","statePool","quad","quadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterArea","filterClamp","forceClear","useMaxPadding","state","renderTextureSystem","padding","autoFit","min","max","_b","current","copyFrom","getBounds","pad","sourceFrameProjected","projection","transformAABB","invert","fit","intersects","roundFrame","getOptimalFilterTexture","lastState","blit","CLEAR_MODES","BLEND","flip","flop","CLEAR","bindAndClear","clearMode","stateSystem","autoClear","stateId","BLIT","applyFilter","output","uSampler","filterGlobals","shader","program","attributeData","aTextureCoord","draw","DRAW_MODES","TRIANGLES","TRIANGLE_STRIP","calculateSpriteMatrix","outputMatrix","sprite","_texture","mappedMatrix","worldTransform","copyTo","TEMP_MATRIX","prepend","translate","swap","emptyPool","matrix","rect","lt","lb","rt","rb","left","top","bottom","right","a","c","abs","identity","ObjectRenderer","flush","stop","render","_object","BatchSystem","emptyRenderer","currentRenderer","setObjectRenderer","objectRenderer","reset","copyBoundTextures","arr","maxTextures","boundTextures","boundArray","texArray","batchId","elements","count","loc","bound","CONTEXT_UID_COUNTER","ContextSystem","webGLVersion","extensions","supports","uint32Indices","handleContextLost","handleContextRestored","isContextLost","contextChange","CONTEXT_UID","initFromContext","validateContext","runners","initFromOptions","createContext","getExtensions","common","loseContext","getExtension","anisotropicFiltering","floatTextureLinear","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","drawBuffers","vertexArrayObject","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","preventDefault","setTimeout","restoreContext","useProgram","postrender","renderingToScreen","getContextAttributes","isWebGl2","WebGL2RenderingContext","hasuint32","GLFramebuffer","msaaBuffer","blitFramebuffer","mipLevel","tempRectangle","FramebufferSystem","managedFramebuffers","unknownFramebuffer","msaaSamples","disposeAll","viewport","hasMRT","writeDepthTexture","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","mipWidth","mipHeight","setViewport","v","g","mask","BUFFER_BITS","COLOR","DEPTH","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorageMultisample","DEPTH24_STENCIL8","renderbufferStorage","DEPTH_STENCIL","parentTexture","canMultisampleFramebuffer","createRenderbuffer","framebufferRenderbuffer","COLOR_ATTACHMENT0","deleteRenderbuffer","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","res","sourcePixels","destPixels","colorTexture","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","LINEAR","disposeFramebuffer","contextLost","deleteFramebuffer","list","forceStencil","w","h","GeometrySystem","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","e","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","initGeometryVao","activateVao","updateBuffers","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","location","join","glPrograms","generateProgram","signature","vaoObjectHash","tempStride","tempStart","attribSize","disposeGeometry","buf","vaoId","lastBuffer","glBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","BYTES_PER_ELEMENT","glType","UNSIGNED_INT","drawElements","drawArrays","MaskData","maskObject","MASK_TYPES","autoDetect","pooled","isMaskData","FILTER_MULTISAMPLE","enabled","colorMask","_filters","_stencilCounter","_scissorCounter","_scissorRect","_scissorRectLocal","_colorMask","_target","copyCountersOrReset","maskAbove","compileShader","createShader","shaderSource","logPrettyShaderError","shaderSrc","getShaderSource","line","shaderLog","getShaderInfoLog","splitShader","dedupe","lineNumbers","replace","logArgs","forEach","number","fragmentSourceToLog","error","groupCollapsed","groupEnd","booleanArray","defaultValue","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","substring","precision","PRECISION","HIGH","MEDIUM","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","uint","uvec2","uvec3","uvec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","codeUbo","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","FRAGMENT_SHADER","fragmentSrc","getShaderParameter","COMPILE_STATUS","nameCache","Program","vertexSrc","defaultVertexSrc","defaultFragmentSrc","PRECISION_VERTEX","PRECISION_FRAGMENT","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","ProgramCache","Shader","uniformBindCount","uniformGroup","checkUniformExists","State","blendMode","BLEND_MODES","NORMAL","polygonOffset","blend","depthMask","_blendMode","_polygonOffset","for2d","depthTest","Filter","FILTER_RESOLUTION","filterManager","_currentState","_resolution","tempMat","TextureMatrix","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","clampOffset","isSimple","multiplyUvs","mat","tx","ty","forceUpdate","append","texBase","margin","SpriteMaskFilter","maskSprite","maskMatrix","_maskSprite","renderable","npmAlpha","otherMatrix","alpha","worldAlpha","maskClamp","MaskSystem","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","setMaskStack","scissor","maskDataOrTarget","maskData","detect","SPRITE","SCISSOR","STENCIL","pushSpriteMask","pushColorMask","popSpriteMask","popColorMask","maskCurrent","isSprite","testScissor","alphaMaskFilter","stashFilterArea","currColorMask","nextColorMask","AbstractMaskSystem","glConst","getStackLength","curStackLen","newStackLen","disable","enable","_useCurrent","rectPool","ScissorSystem","getWebGLRenderingContext","SCISSOR_TEST","calcScissorRect","prevData","roundFrameToPixels","isMatrixRotated","isFastRect","StencilSystem","STENCIL_TEST","prevMaskCount","clearStencil","STENCIL_BUFFER_BIT","stencilFunc","EQUAL","stencilOp","KEEP","INCR","batch","DECR","ProjectionSystem","defaultFrame","projectionMatrix","root","calculateProjection","syncUniformGroup","globals","_destinationFrame","pm","sign","setTransform","_matrix","tempRect2","RenderTextureSystem","_backgroundColorRgba","defaultMaskStack","viewportFrame","screen","clearMask","uboUpdate","_ud","_uv","_syncData","UBO_TO_SINGLE_SETTERS","GLSL_TO_STD40_SIZE","createUBOElements","uniformData","uboElements","dataLen","chunkSize","uboElement","lineUpValue","getUBOData","usedUniformDatas","sort","generateUniformBufferSync","syncFunc","funcFragments","parsed","uniformParser","size_1","rowSize","elementSize","remainder","template","Function","IGLUniformData","GLProgram","uniformGroups","uniformDirtyGroups","uniformBufferBindings","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getProgramInfoLog","logProgramError","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","getAttribLocation","getAttributeData","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","match","getUniformData","bindAttribLocation","deleteShader","getUniformLocation","defaultSyncData","textureCount","uboCount","ShaderSystem","systemCheck","cache","_uboCache","func","unsafeEvalSupported","dontSync","glProgram","setUniforms","syncData","getGlProgram","createSyncGroups","generateUniformsSync","syncUniformBufferGroup","createSyncBufferGroup","bindBufferBase","uniformBlockIndex","getUniformBlockIndex","uniformBlockBinding","uboData","preFix","disposeShader","StateSystem","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","blendModes","ONE","ONE_MINUS_SRC_ALPHA","ADD","MULTIPLY","DST_COLOR","SCREEN","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","NORMAL_NPM","SRC_ALPHA","ADD_NPM","SCREEN_NPM","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","forceState","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","setBlendMode","blendFunc","blendFuncSeparate","blendEquationSeparate","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","system","TextureGCSystem","checkCount","maxIdle","GC_MAX_IDLE","checkCountMax","GC_MAX_CHECK_COUNT","GC_MODE","GC_MODES","MANUAL","run","tm","managedTextures","wasRemoved","destroyTexture","unload","displayObject","children","GLTexture","samplerType","TextureSystem","currentLocation","_unknownBoundTextures","unknownTexture","hasIntegerTextures","internalFormats","table","RGB","RGB8","RG","RG8","RED","R8","RGBA_INTEGER","RGBA8UI","RGB_INTEGER","RGB8UI","RG_INTEGER","RG8UI","RED_INTEGER","R8UI","ALPHA","LUMINANCE","LUMINANCE_ALPHA","BYTE","_c","RGBA8_SNORM","RGB8_SNORM","RG8_SNORM","R8_SNORM","RGBA8I","RGB8I","RG8I","R8I","_d","RGBA16UI","RGB16UI","RG16UI","R16UI","DEPTH_COMPONENT16","SHORT","_e","RGBA16I","RGB16I","RG16I","R16I","_f","RGBA32UI","RGB32UI","RG32UI","R32UI","DEPTH_COMPONENT24","_g","RGBA32I","RGB32I","RG32I","R32I","_h","RGBA32F","RGB32F","RG32F","R32F","DEPTH_COMPONENT32F","HALF_FLOAT","_j","RGBA16F","RGB16F","RG16F","R16F","UNSIGNED_SHORT_5_6_5","_k","RGB565","UNSIGNED_SHORT_4_4_4_4","_l","RGBA4","UNSIGNED_SHORT_5_5_5_1","_m","RGB5_A1","UNSIGNED_INT_2_10_10_10_REV","_o","RGB10_A2","RGB10_A2UI","UNSIGNED_INT_10F_11F_11F_REV","_p","R11F_G11F_B10F","UNSIGNED_INT_5_9_9_9_REV","_q","RGB9_E5","UNSIGNED_INT_24_8","_r","FLOAT_32_UNSIGNED_INT_24_8_REV","_s","DEPTH32F_STENCIL8","_t","_u","_v","_w","_x","mapTypeAndFormatToInternalFormat","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","updateTextureStyle","ensureSamplerType","SAMPLER_TYPES","initTextureType","skipRemove","deleteTexture","removeItems","POW2","WRAP_MODES","CLAMP","ON_MANUAL","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","AbstractRenderer","RENDERER_TYPE","UNKNOWN","RENDER_OPTIONS","useContextAlpha","autoDensity","preserveDrawingBuffer","clearBeforeRender","_backgroundColor","_backgroundColorString","backgroundColor","backgroundAlpha","transparent","_lastObjectRendered","plugins","initPlugins","staticMap","o","desiredScreenWidth","desiredScreenHeight","screenWidth","screenHeight","generateTexture","region","manualRegion","getOwnPropertySymbols","propertyIsEnumerable","__rest","getLocalBounds","skipUpdateTransform","parent","removeView","parentNode","removeChild","thisAny","_tempDisplayObjectParent","hex2string","hex2rgb","GLBuffer","updateID","byteLength","BufferSystem","managedBuffers","boundBufferBases","createGLBuffer","bindBuffer","bindBufferRange","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","deleteBuffer","createBuffer","Renderer","prerender","addSystem","__plugins","antialias","premultipliedAlpha","powerPreference","sayHello","isWebGLSupported","FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER","LOW","ClassRef","isLost","cacheParent","enableTempParent","updateTransform","disableTempParent","extract","registerPlugin","pluginName","ctor","ExtensionType","RendererPlugin","ref","handleByMap","System","BatchDrawCall","BatchTextureArray","ViewableBuffer","sizeOrBuffer","rawBinaryData","uint32View","float32View","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","sizeOf","AbstractBatchRenderer","shaderGenerator","geometryClass","vertexSize","SPRITE_BATCH_SIZE","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","SPRITE_MAX_TEXTURES","generateShader","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","vertexData","indices","buildTexturesAndDrawCalls","textureArrays","touch","TICK","countTexArrays","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","premultiplyBlendMode","packInterleavedGeometry","bindAndClearTexArray","textureSystem","updateGeometry","packedGeometries","attributeBuffer","CAN_UPLOAD_SAME_BUFFER","_buffer","drawBatches","dcCount","curTexArray","getAttributeBuffer","getIndexBuffer","roundedP2","roundedSizeIndex","log2","roundedSize","packedVertices","indicies","textureId","argb","premultiplyTint","_tintRGB","BatchShaderGenerator","programCache","defaultGroupCache","sampleValues","uSamplers","generateSampleSrc","tint","translationMatrix","default","BatchGeometry","BatchPluginFactory","vertex","defaultVertex","fragment","defaultFragment","BatchPlugin","BatchRenderer","_resources","systems","_systems"],"mappings":";;;;;;;8EAmBAA,EAAAA,SAASC,WAAaC,EAAAA,SAASC,IAAMC,EAAGA,IAACC,MAAQD,EAAGA,IAACE,OAiB7CN,EAAAA,SAACO,sBAAuB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i/core/dist/cjs/core.js new file mode 100644 index 0000000..abc321c --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/cjs/core.js @@ -0,0 +1,10456 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var settings = require('@pixi/settings'); +var constants = require('@pixi/constants'); +var utils = require('@pixi/utils'); +var extensions = require('@pixi/extensions'); +var runner = require('@pixi/runner'); +var ticker = require('@pixi/ticker'); +var math = require('@pixi/math'); + +/** + * The maximum support for using WebGL. If a device does not + * support WebGL version, for instance WebGL 2, it will still + * attempt to fallback support to WebGL 1. If you want to + * explicitly remove feature support to target a more stable + * baseline, prefer a lower environment. + * + * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} + * we disable webgl2 by default for all non-apple mobile devices. + * @static + * @name PREFER_ENV + * @memberof PIXI.settings + * @type {number} + * @default PIXI.ENV.WEBGL2 + */ +settings.settings.PREFER_ENV = utils.isMobile.any ? constants.ENV.WEBGL : constants.ENV.WEBGL2; +/** + * If set to `true`, *only* Textures and BaseTexture objects stored + * in the caches ({@link PIXI.utils.TextureCache TextureCache} and + * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be + * used when calling {@link PIXI.Texture.from Texture.from} or + * {@link PIXI.BaseTexture.from BaseTexture.from}. + * Otherwise, these `from` calls throw an exception. Using this property + * can be useful if you want to enforce preloading all assets with + * {@link PIXI.Loader Loader}. + * @static + * @name STRICT_TEXTURE_CACHE + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.settings.STRICT_TEXTURE_CACHE = false; + +/** + * Collection of installed resource types, class must extend {@link PIXI.Resource}. + * @example + * class CustomResource extends PIXI.Resource { + * // MUST have source, options constructor signature + * // for auto-detected resources to be created. + * constructor(source, options) { + * super(); + * } + * upload(renderer, baseTexture, glTexture) { + * // upload with GL + * return true; + * } + * // used to auto-detect resource + * static test(source, extension) { + * return extension === 'xyz'|| source instanceof SomeClass; + * } + * } + * // Install the new resource type + * PIXI.INSTALLED.push(CustomResource); + * @memberof PIXI + * @type {Array} + * @static + * @readonly + */ +var INSTALLED = []; +/** + * Create a resource element from a single source element. This + * auto-detects which type of resource to create. All resources that + * are auto-detectable must have a static `test` method and a constructor + * with the arguments `(source, options?)`. Currently, the supported + * resources for auto-detection include: + * - {@link PIXI.ImageResource} + * - {@link PIXI.CanvasResource} + * - {@link PIXI.VideoResource} + * - {@link PIXI.SVGResource} + * - {@link PIXI.BufferResource} + * @static + * @memberof PIXI + * @function autoDetectResource + * @param {string|*} source - Resource source, this can be the URL to the resource, + * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri + * or any other resource that can be auto-detected. If not resource is + * detected, it's assumed to be an ImageResource. + * @param {object} [options] - Pass-through options to use for Resource + * @param {number} [options.width] - Width of BufferResource or SVG rasterization + * @param {number} [options.height] - Height of BufferResource or SVG rasterization + * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading + * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object + * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin + * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately + * @param {number} [options.updateFPS=0] - Video option to update how many times a second the + * texture should be updated from the video. Leave at 0 to update at every render + * @returns {PIXI.Resource} The created resource. + */ +function autoDetectResource(source, options) { + if (!source) { + return null; + } + var extension = ''; + if (typeof source === 'string') { + // search for file extension: period, 3-4 chars, then ?, # or EOL + var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); + if (result) { + extension = result[1].toLowerCase(); + } + } + for (var i = INSTALLED.length - 1; i >= 0; --i) { + var ResourcePlugin = INSTALLED[i]; + if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { + return new ResourcePlugin(source, options); + } + } + throw new Error('Unrecognized source type to auto-detect Resource'); +} + +/*! ***************************************************************************** +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 __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); +}; + +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; +} + +/** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * @memberof PIXI + */ +var Resource = /** @class */ (function () { + /** + * @param width - Width of the resource + * @param height - Height of the resource + */ + function Resource(width, height) { + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this._width = width; + this._height = height; + this.destroyed = false; + this.internal = false; + this.onResize = new runner.Runner('setRealSize'); + this.onUpdate = new runner.Runner('update'); + this.onError = new runner.Runner('onError'); + } + /** + * Bind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.bind = function (baseTexture) { + this.onResize.add(baseTexture); + this.onUpdate.add(baseTexture); + this.onError.add(baseTexture); + // Call a resize immediate if we already + // have the width and height of the resource + if (this._width || this._height) { + this.onResize.emit(this._width, this._height); + } + }; + /** + * Unbind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.unbind = function (baseTexture) { + this.onResize.remove(baseTexture); + this.onUpdate.remove(baseTexture); + this.onError.remove(baseTexture); + }; + /** + * Trigger a resize event + * @param width - X dimension + * @param height - Y dimension + */ + Resource.prototype.resize = function (width, height) { + if (width !== this._width || height !== this._height) { + this._width = width; + this._height = height; + this.onResize.emit(width, height); + } + }; + Object.defineProperty(Resource.prototype, "valid", { + /** + * Has been validated + * @readonly + */ + get: function () { + return !!this._width && !!this._height; + }, + enumerable: false, + configurable: true + }); + /** Has been updated trigger event. */ + Resource.prototype.update = function () { + if (!this.destroyed) { + this.onUpdate.emit(); + } + }; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @returns Handle the validate event + */ + Resource.prototype.load = function () { + return Promise.resolve(this); + }; + Object.defineProperty(Resource.prototype, "width", { + /** + * The width of the resource. + * @readonly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resource.prototype, "height", { + /** + * The height of the resource. + * @readonly + */ + get: function () { + return this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Set the style, optional to override + * @param _renderer - yeah, renderer! + * @param _baseTexture - the texture + * @param _glTexture - texture instance for this webgl context + * @returns - `true` is success + */ + Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { + return false; + }; + /** Clean up anything, this happens when destroying is ready. */ + Resource.prototype.dispose = function () { + // override + }; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + Resource.prototype.destroy = function () { + if (!this.destroyed) { + this.destroyed = true; + this.dispose(); + this.onError.removeAll(); + this.onError = null; + this.onResize.removeAll(); + this.onResize = null; + this.onUpdate.removeAll(); + this.onUpdate = null; + } + }; + /** + * Abstract, used to auto-detect resource type. + * @param {*} _source - The source object + * @param {string} _extension - The extension of source, if set + */ + Resource.test = function (_source, _extension) { + return false; + }; + return Resource; +}()); + +/** + * @interface SharedArrayBuffer + */ +/** + * Buffer resource with data of typed array. + * @memberof PIXI + */ +var BufferResource = /** @class */ (function (_super) { + __extends(BufferResource, _super); + /** + * @param source - Source buffer + * @param options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + function BufferResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + if (!width || !height) { + throw new Error('BufferResource width or height invalid'); + } + _this = _super.call(this, width, height) || this; + _this.data = source; + return _this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + /** Destroy and don't use after this. */ + BufferResource.prototype.dispose = function () { + this.data = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if + */ + BufferResource.test = function (source) { + return source instanceof Float32Array + || source instanceof Uint8Array + || source instanceof Uint32Array; + }; + return BufferResource; +}(Resource)); + +var defaultBufferOptions = { + scaleMode: constants.SCALE_MODES.NEAREST, + format: constants.FORMATS.RGBA, + alphaMode: constants.ALPHA_MODES.NPM, +}; +/** + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + * @typeParam RO - The options for constructing resource. + */ +var BaseTexture = /** @class */ (function (_super) { + __extends(BaseTexture, _super); + /** + * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - + * The current resource to use, for things that aren't Resource objects, will be converted + * into a Resource. + * @param options - Collection of options + * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture + * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture + * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type + * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha + * @param {number} [options.width=0] - Width of the texture + * @param {number} [options.height=0] - Height of the texture + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture + * @param {object} [options.resourceOptions] - Optional resource options, + * see {@link PIXI.autoDetectResource autoDetectResource} + */ + function BaseTexture(resource, options) { + if (resource === void 0) { resource = null; } + if (options === void 0) { options = null; } + var _this = _super.call(this) || this; + options = options || {}; + var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; + // Convert the resource to a Resource object + if (resource && !(resource instanceof Resource)) { + resource = autoDetectResource(resource, resourceOptions); + resource.internal = true; + } + _this.resolution = resolution || settings.settings.RESOLUTION; + _this.width = Math.round((width || 0) * _this.resolution) / _this.resolution; + _this.height = Math.round((height || 0) * _this.resolution) / _this.resolution; + _this._mipmap = mipmap !== undefined ? mipmap : settings.settings.MIPMAP_TEXTURES; + _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.settings.ANISOTROPIC_LEVEL; + _this._wrapMode = wrapMode || settings.settings.WRAP_MODE; + _this._scaleMode = scaleMode !== undefined ? scaleMode : settings.settings.SCALE_MODE; + _this.format = format || constants.FORMATS.RGBA; + _this.type = type || constants.TYPES.UNSIGNED_BYTE; + _this.target = target || constants.TARGETS.TEXTURE_2D; + _this.alphaMode = alphaMode !== undefined ? alphaMode : constants.ALPHA_MODES.UNPACK; + _this.uid = utils.uid(); + _this.touched = 0; + _this.isPowerOfTwo = false; + _this._refreshPOT(); + _this._glTextures = {}; + _this.dirtyId = 0; + _this.dirtyStyleId = 0; + _this.cacheId = null; + _this.valid = width > 0 && height > 0; + _this.textureCacheIds = []; + _this.destroyed = false; + _this.resource = null; + _this._batchEnabled = 0; + _this._batchLocation = 0; + _this.parentTextureArray = null; + /** + * Fired when a not-immediately-available source finishes loading. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when a not-immediately-available source fails to load. + * @protected + * @event PIXI.BaseTexture#error + * @param {PIXI.BaseTexture} baseTexture - Resource errored. + * @param {ErrorEvent} event - Load error event. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#update + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. + */ + /** + * Fired when BaseTexture is destroyed. + * @protected + * @event PIXI.BaseTexture#dispose + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. + */ + // Set the resource + _this.setResource(resource); + return _this; + } + Object.defineProperty(BaseTexture.prototype, "realWidth", { + /** + * Pixel width of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.width * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "realHeight", { + /** + * Pixel height of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.height * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "mipmap", { + /** + * Mipmap mode of the texture, affects downscaled images + * @default PIXI.settings.MIPMAP_TEXTURES + */ + get: function () { + return this._mipmap; + }, + set: function (value) { + if (this._mipmap !== value) { + this._mipmap = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "scaleMode", { + /** + * The scale mode to apply when scaling this texture + * @default PIXI.settings.SCALE_MODE + */ + get: function () { + return this._scaleMode; + }, + set: function (value) { + if (this._scaleMode !== value) { + this._scaleMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "wrapMode", { + /** + * How the texture wraps + * @default PIXI.settings.WRAP_MODE + */ + get: function () { + return this._wrapMode; + }, + set: function (value) { + if (this._wrapMode !== value) { + this._wrapMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + /** + * Changes style options of BaseTexture + * @param scaleMode - Pixi scalemode + * @param mipmap - enable mipmaps + * @returns - this + */ + BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { + var dirty; + if (scaleMode !== undefined && scaleMode !== this.scaleMode) { + this.scaleMode = scaleMode; + dirty = true; + } + if (mipmap !== undefined && mipmap !== this.mipmap) { + this.mipmap = mipmap; + dirty = true; + } + if (dirty) { + this.dirtyStyleId++; + } + return this; + }; + /** + * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. + * @param desiredWidth - Desired visual width + * @param desiredHeight - Desired visual height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setSize = function (desiredWidth, desiredHeight, resolution) { + resolution = resolution || this.resolution; + return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution); + }; + /** + * Sets real size of baseTexture, preserves current resolution. + * @param realWidth - Full rendered width + * @param realHeight - Full rendered height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { + this.resolution = resolution || this.resolution; + this.width = Math.round(realWidth) / this.resolution; + this.height = Math.round(realHeight) / this.resolution; + this._refreshPOT(); + this.update(); + return this; + }; + /** + * Refresh check for isPowerOfTwo texture based on size + * @private + */ + BaseTexture.prototype._refreshPOT = function () { + this.isPowerOfTwo = utils.isPow2(this.realWidth) && utils.isPow2(this.realHeight); + }; + /** + * Changes resolution + * @param resolution - res + * @returns - this + */ + BaseTexture.prototype.setResolution = function (resolution) { + var oldResolution = this.resolution; + if (oldResolution === resolution) { + return this; + } + this.resolution = resolution; + if (this.valid) { + this.width = Math.round(this.width * oldResolution) / resolution; + this.height = Math.round(this.height * oldResolution) / resolution; + this.emit('update', this); + } + this._refreshPOT(); + return this; + }; + /** + * Sets the resource if it wasn't set. Throws error if resource already present + * @param resource - that is managing this BaseTexture + * @returns - this + */ + BaseTexture.prototype.setResource = function (resource) { + if (this.resource === resource) { + return this; + } + if (this.resource) { + throw new Error('Resource can be set only once'); + } + resource.bind(this); + this.resource = resource; + return this; + }; + /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */ + BaseTexture.prototype.update = function () { + if (!this.valid) { + if (this.width > 0 && this.height > 0) { + this.valid = true; + this.emit('loaded', this); + this.emit('update', this); + } + } + else { + this.dirtyId++; + this.dirtyStyleId++; + this.emit('update', this); + } + }; + /** + * Handle errors with resources. + * @private + * @param event - Error event emitted. + */ + BaseTexture.prototype.onError = function (event) { + this.emit('error', this, event); + }; + /** + * Destroys this base texture. + * The method stops if resource doesn't want this texture to be destroyed. + * Removes texture from all caches. + */ + BaseTexture.prototype.destroy = function () { + // remove and destroy the resource + if (this.resource) { + this.resource.unbind(this); + // only destroy resourced created internally + if (this.resource.internal) { + this.resource.destroy(); + } + this.resource = null; + } + if (this.cacheId) { + delete utils.BaseTextureCache[this.cacheId]; + delete utils.TextureCache[this.cacheId]; + this.cacheId = null; + } + // finally let the WebGL renderer know.. + this.dispose(); + BaseTexture.removeFromCache(this); + this.textureCacheIds = null; + this.destroyed = true; + }; + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseTexture.prototype.dispose = function () { + this.emit('dispose', this); + }; + /** Utility function for BaseTexture|Texture cast. */ + BaseTexture.prototype.castToBaseTexture = function () { + return this; + }; + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * @static + * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The + * source to create base texture from. + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.BaseTexture} The new base texture. + */ + BaseTexture.from = function (source, options, strict) { + if (strict === void 0) { strict = settings.settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + utils.uid(); + } + cacheId = source._pixiId; + } + var baseTexture = utils.BaseTextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !baseTexture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); + } + if (!baseTexture) { + baseTexture = new BaseTexture(source, options); + baseTexture.cacheId = cacheId; + BaseTexture.addToCache(baseTexture, cacheId); + } + return baseTexture; + }; + /** + * Create a new BaseTexture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * Default properties are different from the constructor's defaults. + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default + * @returns - The resulting new BaseTexture + */ + BaseTexture.fromBuffer = function (buffer, width, height, options) { + buffer = buffer || new Float32Array(width * height * 4); + var resource = new BufferResource(buffer, { width: width, height: height }); + var type = buffer instanceof Float32Array ? constants.TYPES.FLOAT : constants.TYPES.UNSIGNED_BYTE; + return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width: width, height: height, type: type })); + }; + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + BaseTexture.addToCache = function (baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { + baseTexture.textureCacheIds.push(id); + } + if (utils.BaseTextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); + } + utils.BaseTextureCache[id] = baseTexture; + } + }; + /** + * Remove a BaseTexture from the global BaseTextureCache. + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + BaseTexture.removeFromCache = function (baseTexture) { + if (typeof baseTexture === 'string') { + var baseTextureFromCache = utils.BaseTextureCache[baseTexture]; + if (baseTextureFromCache) { + var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); + if (index > -1) { + baseTextureFromCache.textureCacheIds.splice(index, 1); + } + delete utils.BaseTextureCache[baseTexture]; + return baseTextureFromCache; + } + } + else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { + delete utils.BaseTextureCache[baseTexture.textureCacheIds[i]]; + } + baseTexture.textureCacheIds.length = 0; + return baseTexture; + } + return null; + }; + /** Global number of the texture batch, used by multi-texture renderers. */ + BaseTexture._globalBatch = 0; + return BaseTexture; +}(utils.EventEmitter)); + +/** + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource + * @memberof PIXI + */ +var AbstractMultiResource = /** @class */ (function (_super) { + __extends(AbstractMultiResource, _super); + /** + * @param length + * @param options - Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function AbstractMultiResource(length, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + _this = _super.call(this, width, height) || this; + _this.items = []; + _this.itemDirtyIds = []; + for (var i = 0; i < length; i++) { + var partTexture = new BaseTexture(); + _this.items.push(partTexture); + // -2 - first run of texture array upload + // -1 - texture item was allocated + // >=0 - texture item uploaded , in sync with items[i].dirtyId + _this.itemDirtyIds.push(-2); + } + _this.length = length; + _this._load = null; + _this.baseTexture = null; + return _this; + } + /** + * Used from ArrayResource and CubeResource constructors. + * @param resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param options - Detect options for resources + */ + AbstractMultiResource.prototype.initFromArray = function (resources, options) { + for (var i = 0; i < this.length; i++) { + if (!resources[i]) { + continue; + } + if (resources[i].castToBaseTexture) { + this.addBaseTextureAt(resources[i].castToBaseTexture(), i); + } + else if (resources[i] instanceof Resource) { + this.addResourceAt(resources[i], i); + } + else { + this.addResourceAt(autoDetectResource(resources[i], options), i); + } + } + }; + /** Destroy this BaseImageResource. */ + AbstractMultiResource.prototype.dispose = function () { + for (var i = 0, len = this.length; i < len; i++) { + this.items[i].destroy(); + } + this.items = null; + this.itemDirtyIds = null; + this._load = null; + }; + /** + * Set a resource by ID + * @param resource + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + AbstractMultiResource.prototype.addResourceAt = function (resource, index) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + // Inherit the first resource dimensions + if (resource.valid && !this.valid) { + this.resize(resource.width, resource.height); + } + this.items[index].setResource(resource); + return this; + }; + /** + * Set the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.bind = function (baseTexture) { + if (this.baseTexture !== null) { + throw new Error('Only one base texture per TextureArray is allowed'); + } + _super.prototype.bind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = baseTexture; + this.items[i].on('update', baseTexture.update, baseTexture); + } + }; + /** + * Unset the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.unbind = function (baseTexture) { + _super.prototype.unbind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = null; + this.items[i].off('update', baseTexture.update, baseTexture); + } + }; + /** + * Load all the resources simultaneously + * @returns - When load is resolved + */ + AbstractMultiResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); + // TODO: also implement load part-by-part strategy + var promises = resources.map(function (item) { return item.load(); }); + this._load = Promise.all(promises) + .then(function () { + var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; + _this.resize(realWidth, realHeight); + return Promise.resolve(_this); + }); + return this._load; + }; + return AbstractMultiResource; +}(Resource)); + +/** + * A resource that contains a number of sources. + * @memberof PIXI + */ +var ArrayResource = /** @class */ (function (_super) { + __extends(ArrayResource, _super); + /** + * @param source - Number of items in array or the collection + * of image URLs to use. Can also be resources, image elements, canvas, etc. + * @param options - Options to apply to {@link PIXI.autoDetectResource} + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function ArrayResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + var urls; + var length; + if (Array.isArray(source)) { + urls = source; + length = source.length; + } + else { + length = source; + } + _this = _super.call(this, length, { width: width, height: height }) || this; + if (urls) { + _this.initFromArray(urls, options); + } + return _this; + } + /** + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more + * @param baseTexture + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error('ArrayResource does not support RenderTexture'); + } + return this; + }; + /** + * Add binding + * @param baseTexture + */ + ArrayResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = constants.TARGETS.TEXTURE_2D_ARRAY; + }; + /** + * Upload the resources to the GPU. + * @param renderer + * @param texture + * @param glTexture + * @returns - whether texture was uploaded + */ + ArrayResource.prototype.upload = function (renderer, texture, glTexture) { + var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; + var gl = renderer.gl; + if (glTexture.dirtyId < 0) { + gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, glTexture.internalFormat, this._width, this._height, length, 0, texture.format, glTexture.type, null); + } + for (var i = 0; i < length; i++) { + var item = items[i]; + if (itemDirtyIds[i] < item.dirtyId) { + itemDirtyIds[i] = item.dirtyId; + if (item.valid) { + gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset + 0, // yoffset + i, // zoffset + item.resource.width, item.resource.height, 1, texture.format, glTexture.type, item.resource.source); + } + } + } + return true; + }; + return ArrayResource; +}(AbstractMultiResource)); + +/** + * Base for all the image/canvas resources. + * @memberof PIXI + */ +var BaseImageResource = /** @class */ (function (_super) { + __extends(BaseImageResource, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + function BaseImageResource(source) { + var _this = this; + var sourceAny = source; + var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; + var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; + _this = _super.call(this, width, height) || this; + _this.source = source; + _this.noSubImage = false; + return _this; + } + /** + * Set cross origin based detecting the url and the crossorigin + * @param element - Element to apply crossOrigin + * @param url - URL to check + * @param crossorigin - Cross origin value to use + */ + BaseImageResource.crossOrigin = function (element, url, crossorigin) { + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + element.crossOrigin = utils.determineCrossOrigin(url); + } + else if (crossorigin !== false) { + element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + }; + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional) + * @returns - true is success + */ + BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { + var gl = renderer.gl; + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + source = source || this.source; + if (source instanceof HTMLImageElement) { + if (!source.complete || source.naturalWidth === 0) { + return false; + } + } + else if (source instanceof HTMLVideoElement) { + if (source.readyState <= 1) { + return false; + } + } + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + if (!this.noSubImage + && baseTexture.target === gl.TEXTURE_2D + && glTexture.width === width + && glTexture.height === height) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source); + } + return true; + }; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + BaseImageResource.prototype.update = function () { + if (this.destroyed) { + return; + } + var source = this.source; + var width = source.naturalWidth || source.videoWidth || source.width; + var height = source.naturalHeight || source.videoHeight || source.height; + this.resize(width, height); + _super.prototype.update.call(this); + }; + /** Destroy this {@link BaseImageResource} */ + BaseImageResource.prototype.dispose = function () { + this.source = null; + }; + return BaseImageResource; +}(Resource)); + +/** + * @interface OffscreenCanvas + */ +/** + * Resource type for HTMLCanvasElement. + * @memberof PIXI + */ +var CanvasResource = /** @class */ (function (_super) { + __extends(CanvasResource, _super); + /** + * @param source - Canvas element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function CanvasResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + CanvasResource.test = function (source) { + var OffscreenCanvas = globalThis.OffscreenCanvas; + // Check for browsers that don't yet support OffscreenCanvas + if (OffscreenCanvas && source instanceof OffscreenCanvas) { + return true; + } + return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement; + }; + return CanvasResource; +}(BaseImageResource)); + +/** + * Resource for a CubeTexture which contains six resources. + * @memberof PIXI + */ +var CubeResource = /** @class */ (function (_super) { + __extends(CubeResource, _super); + /** + * @param {Array} [source] - Collection of URLs or resources + * to use as the sides of the cube. + * @param options - ImageResource options + * @param {number} [options.width] - Width of resource + * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use + */ + function CubeResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; + if (source && source.length !== CubeResource.SIDES) { + throw new Error("Invalid length. Got " + source.length + ", expected 6"); + } + _this = _super.call(this, 6, { width: width, height: height }) || this; + for (var i = 0; i < CubeResource.SIDES; i++) { + _this.items[i].target = constants.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; + } + _this.linkBaseTexture = linkBaseTexture !== false; + if (source) { + _this.initFromArray(source, options); + } + if (autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Add binding. + * @param baseTexture - parent base texture + */ + CubeResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = constants.TARGETS.TEXTURE_CUBE_MAP; + }; + CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + if (!this.linkBaseTexture + || baseTexture.parentTextureArray + || Object.keys(baseTexture._glTextures).length > 0) { + // copy mode + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error("CubeResource does not support copying of renderTexture."); + } + } + else { + // link mode, the difficult one! + baseTexture.target = constants.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; + baseTexture.parentTextureArray = this.baseTexture; + this.items[index] = baseTexture; + } + if (baseTexture.valid && !this.valid) { + this.resize(baseTexture.realWidth, baseTexture.realHeight); + } + this.items[index] = baseTexture; + return this; + }; + /** + * Upload the resource + * @param renderer + * @param _baseTexture + * @param glTexture + * @returns {boolean} true is success + */ + CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { + var dirty = this.itemDirtyIds; + for (var i = 0; i < CubeResource.SIDES; i++) { + var side = this.items[i]; + if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId) { + if (side.valid && side.resource) { + side.resource.upload(renderer, side, glTexture); + dirty[i] = side.dirtyId; + } + else if (dirty[i] < -1) { + // either item is not valid yet, either its a renderTexture + // allocate the memory + renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); + dirty[i] = -1; + } + } + } + return true; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an array of 6 elements + */ + CubeResource.test = function (source) { + return Array.isArray(source) && source.length === CubeResource.SIDES; + }; + /** Number of texture sides to store for CubeResources. */ + CubeResource.SIDES = 6; + return CubeResource; +}(AbstractMultiResource)); + +/** + * Resource type for HTMLImageElement. + * @memberof PIXI + */ +var ImageResource = /** @class */ (function (_super) { + __extends(ImageResource, _super); + /** + * @param source - image source or URL + * @param options + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + function ImageResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLImageElement)) { + var imageElement = new Image(); + BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); + imageElement.src = source; + source = imageElement; + } + _this = _super.call(this, source) || this; + // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height + // to non-zero values before its loading completes if images are in a cache. + // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. + // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). + if (!source.complete && !!_this._width && !!_this._height) { + _this._width = 0; + _this._height = 0; + } + _this.url = source.src; + _this._process = null; + _this.preserveBitmap = false; + _this.createBitmap = (options.createBitmap !== undefined + ? options.createBitmap : settings.settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap; + _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; + _this.bitmap = null; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Returns a promise when image will be loaded and processed. + * @param createBitmap - whether process image into bitmap + */ + ImageResource.prototype.load = function (createBitmap) { + var _this = this; + if (this._load) { + return this._load; + } + if (createBitmap !== undefined) { + this.createBitmap = createBitmap; + } + this._load = new Promise(function (resolve, reject) { + var source = _this.source; + _this.url = source.src; + var completed = function () { + if (_this.destroyed) { + return; + } + source.onload = null; + source.onerror = null; + _this.resize(source.width, source.height); + _this._load = null; + if (_this.createBitmap) { + resolve(_this.process()); + } + else { + resolve(_this); + } + }; + if (source.complete && source.src) { + completed(); + } + else { + source.onload = completed; + source.onerror = function (event) { + // Avoids Promise freezing when resource broken + reject(event); + _this.onError.emit(event); + }; + } + }); + return this._load; + }; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * @returns - Cached promise to fill that bitmap + */ + ImageResource.prototype.process = function () { + var _this = this; + var source = this.source; + if (this._process !== null) { + return this._process; + } + if (this.bitmap !== null || !globalThis.createImageBitmap) { + return Promise.resolve(this); + } + var createImageBitmap = globalThis.createImageBitmap; + var cors = !source.crossOrigin || source.crossOrigin === 'anonymous'; + this._process = fetch(source.src, { + mode: cors ? 'cors' : 'no-cors' + }) + .then(function (r) { return r.blob(); }) + .then(function (blob) { return createImageBitmap(blob, 0, 0, source.width, source.height, { + premultiplyAlpha: _this.alphaMode === null || _this.alphaMode === constants.ALPHA_MODES.UNPACK + ? 'premultiply' : 'none', + }); }) + .then(function (bitmap) { + if (_this.destroyed) { + return Promise.reject(); + } + _this.bitmap = bitmap; + _this.update(); + _this._process = null; + return Promise.resolve(_this); + }); + return this._process; + }; + /** + * Upload the image resource to GPU. + * @param renderer - Renderer to upload to + * @param baseTexture - BaseTexture for this resource + * @param glTexture - GLTexture to use + * @returns {boolean} true is success + */ + ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { + if (typeof this.alphaMode === 'number') { + // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it + baseTexture.alphaMode = this.alphaMode; + } + if (!this.createBitmap) { + return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); + } + if (!this.bitmap) { + // yeah, ignore the output + this.process(); + if (!this.bitmap) { + return false; + } + } + _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); + if (!this.preserveBitmap) { + // checks if there are other renderers that possibly need this bitmap + var flag = true; + var glTextures = baseTexture._glTextures; + for (var key in glTextures) { + var otherTex = glTextures[key]; + if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { + flag = false; + break; + } + } + if (flag) { + if (this.bitmap.close) { + this.bitmap.close(); + } + this.bitmap = null; + } + } + return true; + }; + /** Destroys this resource. */ + ImageResource.prototype.dispose = function () { + this.source.onload = null; + this.source.onerror = null; + _super.prototype.dispose.call(this); + if (this.bitmap) { + this.bitmap.close(); + this.bitmap = null; + } + this._process = null; + this._load = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is string or HTMLImageElement + */ + ImageResource.test = function (source) { + return typeof source === 'string' || source instanceof HTMLImageElement; + }; + return ImageResource; +}(BaseImageResource)); + +/** + * Resource type for SVG elements and graphics. + * @memberof PIXI + */ +var SVGResource = /** @class */ (function (_super) { + __extends(SVGResource, _super); + /** + * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file. + * @param {object} [options] - Options to use + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. + */ + function SVGResource(sourceBase64, options) { + var _this = this; + options = options || {}; + _this = _super.call(this, settings.settings.ADAPTER.createCanvas()) || this; + _this._width = 0; + _this._height = 0; + _this.svg = sourceBase64; + _this.scale = options.scale || 1; + _this._overrideWidth = options.width; + _this._overrideHeight = options.height; + _this._resolve = null; + _this._crossorigin = options.crossorigin; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + SVGResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + this._load = new Promise(function (resolve) { + // Save this until after load is finished + _this._resolve = function () { + _this.resize(_this.source.width, _this.source.height); + resolve(_this); + }; + // Convert SVG inline string to data-uri + if (SVGResource.SVG_XML.test(_this.svg.trim())) { + if (!btoa) { + throw new Error('Your browser doesn\'t support base64 conversions.'); + } + _this.svg = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(_this.svg))); + } + _this._loadSvg(); + }); + return this._load; + }; + /** Loads an SVG image from `imageUrl` or `data URL`. */ + SVGResource.prototype._loadSvg = function () { + var _this = this; + var tempImage = new Image(); + BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin); + tempImage.src = this.svg; + tempImage.onerror = function (event) { + if (!_this._resolve) { + return; + } + tempImage.onerror = null; + _this.onError.emit(event); + }; + tempImage.onload = function () { + if (!_this._resolve) { + return; + } + var svgWidth = tempImage.width; + var svgHeight = tempImage.height; + if (!svgWidth || !svgHeight) { + throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.'); + } + // Set render size + var width = svgWidth * _this.scale; + var height = svgHeight * _this.scale; + if (_this._overrideWidth || _this._overrideHeight) { + width = _this._overrideWidth || _this._overrideHeight / svgHeight * svgWidth; + height = _this._overrideHeight || _this._overrideWidth / svgWidth * svgHeight; + } + width = Math.round(width); + height = Math.round(height); + // Create a canvas element + var canvas = _this.source; + canvas.width = width; + canvas.height = height; + canvas._pixiId = "canvas_" + utils.uid(); + // Draw the Svg to the canvas + canvas + .getContext('2d') + .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height); + _this._resolve(); + _this._resolve = null; + }; + }; + /** + * Get size from an svg string using a regular expression. + * @param svgString - a serialized svg element + * @returns - image extension + */ + SVGResource.getSize = function (svgString) { + var sizeMatch = SVGResource.SVG_SIZE.exec(svgString); + var size = {}; + if (sizeMatch) { + size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3])); + size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7])); + } + return size; + }; + /** Destroys this texture. */ + SVGResource.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this._resolve = null; + this._crossorigin = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} - If the source is a SVG source or data file + */ + SVGResource.test = function (source, extension) { + // url file extension is SVG + return extension === 'svg' + // source is SVG data-uri + || (typeof source === 'string' && source.startsWith('data:image/svg+xml')) + // source is SVG inline + || (typeof source === 'string' && SVGResource.SVG_XML.test(source)); + }; + /** + * Regular expression for SVG XML document. + * @example <?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg + * @readonly + */ + SVGResource.SVG_XML = /^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len + return SVGResource; +}(BaseImageResource)); + +/** + * Resource type for {@code HTMLVideoElement}. + * @memberof PIXI + */ +var VideoResource = /** @class */ (function (_super) { + __extends(VideoResource, _super); + /** + * @param {HTMLVideoElement|object|string|Array} source - Video element to use. + * @param {object} [options] - Options to use + * @param {boolean} [options.autoLoad=true] - Start loading the video immediately + * @param {boolean} [options.autoPlay=true] - Start playing video immediately + * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. + * Leave at 0 to update at every render. + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + */ + function VideoResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLVideoElement)) { + var videoElement = document.createElement('video'); + // workaround for https://github.com/pixijs/pixi.js/issues/5996 + videoElement.setAttribute('preload', 'auto'); + videoElement.setAttribute('webkit-playsinline', ''); + videoElement.setAttribute('playsinline', ''); + if (typeof source === 'string') { + source = [source]; + } + var firstSrc = source[0].src || source[0]; + BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); + // array of objects or strings + for (var i = 0; i < source.length; ++i) { + var sourceElement = document.createElement('source'); + var _a = source[i], src = _a.src, mime = _a.mime; + src = src || source[i]; + var baseSrc = src.split('?').shift().toLowerCase(); + var ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1); + mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; + sourceElement.src = src; + sourceElement.type = mime; + videoElement.appendChild(sourceElement); + } + // Override the source + source = videoElement; + } + _this = _super.call(this, source) || this; + _this.noSubImage = true; + _this._autoUpdate = true; + _this._isConnectedToTicker = false; + _this._updateFPS = options.updateFPS || 0; + _this._msToNextUpdate = 0; + _this.autoPlay = options.autoPlay !== false; + _this._load = null; + _this._resolve = null; + // Bind for listeners + _this._onCanPlay = _this._onCanPlay.bind(_this); + _this._onError = _this._onError.bind(_this); + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Trigger updating of the texture. + * @param _deltaTime - time delta since last tick + */ + VideoResource.prototype.update = function (_deltaTime) { + if (!this.destroyed) { + // account for if video has had its playbackRate changed + var elapsedMS = ticker.Ticker.shared.elapsedMS * this.source.playbackRate; + this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); + if (!this._updateFPS || this._msToNextUpdate <= 0) { + _super.prototype.update.call(this); + this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; + } + } + }; + /** + * Start preloading the video resource. + * @returns {Promise} Handle the validate event + */ + VideoResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var source = this.source; + if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) + && source.width && source.height) { + source.complete = true; + } + source.addEventListener('play', this._onPlayStart.bind(this)); + source.addEventListener('pause', this._onPlayStop.bind(this)); + if (!this._isSourceReady()) { + source.addEventListener('canplay', this._onCanPlay); + source.addEventListener('canplaythrough', this._onCanPlay); + source.addEventListener('error', this._onError, true); + } + else { + this._onCanPlay(); + } + this._load = new Promise(function (resolve) { + if (_this.valid) { + resolve(_this); + } + else { + _this._resolve = resolve; + source.load(); + } + }); + return this._load; + }; + /** + * Handle video error events. + * @param event + */ + VideoResource.prototype._onError = function (event) { + this.source.removeEventListener('error', this._onError, true); + this.onError.emit(event); + }; + /** + * Returns true if the underlying source is playing. + * @returns - True if playing. + */ + VideoResource.prototype._isSourcePlaying = function () { + var source = this.source; + return (!source.paused && !source.ended && this._isSourceReady()); + }; + /** + * Returns true if the underlying source is ready for playing. + * @returns - True if ready. + */ + VideoResource.prototype._isSourceReady = function () { + var source = this.source; + return source.readyState > 2; + }; + /** Runs the update loop when the video is ready to play. */ + VideoResource.prototype._onPlayStart = function () { + // Just in case the video has not received its can play even yet.. + if (!this.valid) { + this._onCanPlay(); + } + if (this.autoUpdate && !this._isConnectedToTicker) { + ticker.Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + }; + /** Fired when a pause event is triggered, stops the update loop. */ + VideoResource.prototype._onPlayStop = function () { + if (this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + }; + /** Fired when the video is loaded and ready to play. */ + VideoResource.prototype._onCanPlay = function () { + var source = this.source; + source.removeEventListener('canplay', this._onCanPlay); + source.removeEventListener('canplaythrough', this._onCanPlay); + var valid = this.valid; + this.resize(source.videoWidth, source.videoHeight); + // prevent multiple loaded dispatches.. + if (!valid && this._resolve) { + this._resolve(this); + this._resolve = null; + } + if (this._isSourcePlaying()) { + this._onPlayStart(); + } + else if (this.autoPlay) { + source.play(); + } + }; + /** Destroys this texture. */ + VideoResource.prototype.dispose = function () { + if (this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + var source = this.source; + if (source) { + source.removeEventListener('error', this._onError, true); + source.pause(); + source.src = ''; + source.load(); + } + _super.prototype.dispose.call(this); + }; + Object.defineProperty(VideoResource.prototype, "autoUpdate", { + /** Should the base texture automatically update itself, set to true by default. */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + ticker.Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { + ticker.Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VideoResource.prototype, "updateFPS", { + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + */ + get: function () { + return this._updateFPS; + }, + set: function (value) { + if (value !== this._updateFPS) { + this._updateFPS = value; + } + }, + enumerable: false, + configurable: true + }); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} `true` if video source + */ + VideoResource.test = function (source, extension) { + return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement) + || VideoResource.TYPES.indexOf(extension) > -1; + }; + /** + * List of common video file extensions supported by VideoResource. + * @readonly + */ + VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @readonly + */ + VideoResource.MIME_TYPES = { + ogv: 'video/ogg', + mov: 'video/quicktime', + m4v: 'video/mp4', + }; + return VideoResource; +}(BaseImageResource)); + +/** + * Resource type for ImageBitmap. + * @memberof PIXI + */ +var ImageBitmapResource = /** @class */ (function (_super) { + __extends(ImageBitmapResource, _super); + /** + * @param source - Image element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function ImageBitmapResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an ImageBitmap + */ + ImageBitmapResource.test = function (source) { + return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap; + }; + return ImageBitmapResource; +}(BaseImageResource)); + +INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); + +var _resources = { + __proto__: null, + Resource: Resource, + BaseImageResource: BaseImageResource, + INSTALLED: INSTALLED, + autoDetectResource: autoDetectResource, + AbstractMultiResource: AbstractMultiResource, + ArrayResource: ArrayResource, + BufferResource: BufferResource, + CanvasResource: CanvasResource, + CubeResource: CubeResource, + ImageResource: ImageResource, + SVGResource: SVGResource, + VideoResource: VideoResource, + ImageBitmapResource: ImageBitmapResource +}; + +/** + * Resource type for DepthTexture. + * @memberof PIXI + */ +var DepthResource = /** @class */ (function (_super) { + __extends(DepthResource, _super); + function DepthResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === constants.ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + return DepthResource; +}(BufferResource)); + +/** + * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses + * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer. + * + * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES. + * @memberof PIXI + */ +var Framebuffer = /** @class */ (function () { + /** + * @param width - Width of the frame buffer + * @param height - Height of the frame buffer + */ + function Framebuffer(width, height) { + this.width = Math.round(width || 100); + this.height = Math.round(height || 100); + this.stencil = false; + this.depth = false; + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + this.depthTexture = null; + this.colorTextures = []; + this.glFramebuffers = {}; + this.disposeRunner = new runner.Runner('disposeFramebuffer'); + this.multisample = constants.MSAA_QUALITY.NONE; + } + Object.defineProperty(Framebuffer.prototype, "colorTexture", { + /** + * Reference to the colorTexture. + * @readonly + */ + get: function () { + return this.colorTextures[0]; + }, + enumerable: false, + configurable: true + }); + /** + * Add texture to the colorTexture array. + * @param index - Index of the array to add the texture to + * @param texture - Texture to add to the array + */ + Framebuffer.prototype.addColorTexture = function (index, texture) { + if (index === void 0) { index = 0; } + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index] = texture || new BaseTexture(null, { + scaleMode: constants.SCALE_MODES.NEAREST, + resolution: 1, + mipmap: constants.MIPMAP_MODES.OFF, + width: this.width, + height: this.height, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Add a depth texture to the frame buffer. + * @param texture - Texture to add. + */ + Framebuffer.prototype.addDepthTexture = function (texture) { + /* eslint-disable max-len */ + this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { + scaleMode: constants.SCALE_MODES.NEAREST, + resolution: 1, + width: this.width, + height: this.height, + mipmap: constants.MIPMAP_MODES.OFF, + format: constants.FORMATS.DEPTH_COMPONENT, + type: constants.TYPES.UNSIGNED_SHORT, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable depth on the frame buffer. */ + Framebuffer.prototype.enableDepth = function () { + this.depth = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable stencil on the frame buffer. */ + Framebuffer.prototype.enableStencil = function () { + this.stencil = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Resize the frame buffer + * @param width - Width of the frame buffer to resize to + * @param height - Height of the frame buffer to resize to + */ + Framebuffer.prototype.resize = function (width, height) { + width = Math.round(width); + height = Math.round(height); + if (width === this.width && height === this.height) + { return; } + this.width = width; + this.height = height; + this.dirtyId++; + this.dirtySize++; + for (var i = 0; i < this.colorTextures.length; i++) { + var texture = this.colorTextures[i]; + var resolution = texture.resolution; + // take into account the fact the texture may have a different resolution.. + texture.setSize(width / resolution, height / resolution); + } + if (this.depthTexture) { + var resolution = this.depthTexture.resolution; + this.depthTexture.setSize(width / resolution, height / resolution); + } + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Framebuffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys and removes the depth texture added to this framebuffer. */ + Framebuffer.prototype.destroyDepthTexture = function () { + if (this.depthTexture) { + this.depthTexture.destroy(); + this.depthTexture = null; + ++this.dirtyId; + ++this.dirtyFormat; + } + }; + return Framebuffer; +}()); + +/** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +var BaseRenderTexture = /** @class */ (function (_super) { + __extends(BaseRenderTexture, _super); + /** + * @param options + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} + * for possible values. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio + * of the texture being generated. + * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer. + */ + function BaseRenderTexture(options) { + if (options === void 0) { options = {}; } + var _this = this; + if (typeof options === 'number') { + /* eslint-disable prefer-rest-params */ + // Backward compatibility of signature + var width = arguments[0]; + var height = arguments[1]; + var scaleMode = arguments[2]; + var resolution = arguments[3]; + options = { width: width, height: height, scaleMode: scaleMode, resolution: resolution }; + /* eslint-enable prefer-rest-params */ + } + options.width = options.width || 100; + options.height = options.height || 100; + options.multisample = options.multisample !== undefined ? options.multisample : constants.MSAA_QUALITY.NONE; + _this = _super.call(this, null, options) || this; + // Set defaults + _this.mipmap = constants.MIPMAP_MODES.OFF; + _this.valid = true; + _this.clearColor = [0, 0, 0, 0]; + _this.framebuffer = new Framebuffer(_this.realWidth, _this.realHeight) + .addColorTexture(0, _this); + _this.framebuffer.multisample = options.multisample; + // TODO - could this be added the systems? + _this.maskStack = []; + _this.filterStack = [{}]; + return _this; + } + /** + * Resizes the BaseRenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + */ + BaseRenderTexture.prototype.resize = function (desiredWidth, desiredHeight) { + this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution); + this.setRealSize(this.framebuffer.width, this.framebuffer.height); + }; + /** + * Frees the texture and framebuffer from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseRenderTexture.prototype.dispose = function () { + this.framebuffer.dispose(); + _super.prototype.dispose.call(this); + }; + /** Destroys this texture. */ + BaseRenderTexture.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.framebuffer.destroyDepthTexture(); + this.framebuffer = null; + }; + return BaseRenderTexture; +}(BaseTexture)); + +/** + * Stores a texture's frame in UV coordinates, in + * which everything lies in the rectangle `[(0,0), (1,0), + * (1,1), (0,1)]`. + * + * | Corner | Coordinates | + * |--------------|-------------| + * | Top-Left | `(x0,y0)` | + * | Top-Right | `(x1,y1)` | + * | Bottom-Right | `(x2,y2)` | + * | Bottom-Left | `(x3,y3)` | + * @protected + * @memberof PIXI + */ +var TextureUvs = /** @class */ (function () { + function TextureUvs() { + this.x0 = 0; + this.y0 = 0; + this.x1 = 1; + this.y1 = 0; + this.x2 = 1; + this.y2 = 1; + this.x3 = 0; + this.y3 = 1; + this.uvsFloat32 = new Float32Array(8); + } + /** + * Sets the texture Uvs based on the given frame information. + * @protected + * @param frame - The frame of the texture + * @param baseFrame - The base frame of the texture + * @param rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + TextureUvs.prototype.set = function (frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + // coordinates of center + var cX = (frame.x / tw) + w2; + var cY = (frame.y / th) + h2; + rotate = math.groupD8.add(rotate, math.groupD8.NW); // NW is top-left corner + this.x0 = cX + (w2 * math.groupD8.uX(rotate)); + this.y0 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + (w2 * math.groupD8.uX(rotate)); + this.y1 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + this.x2 = cX + (w2 * math.groupD8.uX(rotate)); + this.y2 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + this.x3 = cX + (w2 * math.groupD8.uX(rotate)); + this.y3 = cY + (h2 * math.groupD8.uY(rotate)); + } + else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + this.uvsFloat32[0] = this.x0; + this.uvsFloat32[1] = this.y0; + this.uvsFloat32[2] = this.x1; + this.uvsFloat32[3] = this.y1; + this.uvsFloat32[4] = this.x2; + this.uvsFloat32[5] = this.y2; + this.uvsFloat32[6] = this.x3; + this.uvsFloat32[7] = this.y3; + }; + TextureUvs.prototype.toString = function () { + return "[@pixi/core:TextureUvs " + + ("x0=" + this.x0 + " y0=" + this.y0 + " ") + + ("x1=" + this.x1 + " y1=" + this.y1 + " x2=" + this.x2 + " ") + + ("y2=" + this.y2 + " x3=" + this.x3 + " y3=" + this.y3) + + "]"; + }; + return TextureUvs; +}()); + +var DEFAULT_UVS = new TextureUvs(); +/** + * Used to remove listeners from WHITE and EMPTY Textures + * @ignore + */ +function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() { }; + tex.on = function _emptyOn() { }; + tex.once = function _emptyOnce() { }; + tex.emit = function _emptyEmit() { }; +} +/** + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.from('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: + * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.from('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + */ +var Texture = /** @class */ (function (_super) { + __extends(Texture, _super); + /** + * @param baseTexture - The base texture source to create the texture from + * @param frame - The rectangle frame of the texture to show + * @param orig - The area of original texture + * @param trim - Trimmed rectangle of original texture + * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param anchor - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + var _this = _super.call(this) || this; + _this.noFrame = false; + if (!frame) { + _this.noFrame = true; + frame = new math.Rectangle(0, 0, 1, 1); + } + if (baseTexture instanceof Texture) { + baseTexture = baseTexture.baseTexture; + } + _this.baseTexture = baseTexture; + _this._frame = frame; + _this.trim = trim; + _this.valid = false; + _this._uvs = DEFAULT_UVS; + _this.uvMatrix = null; + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + _this._rotate = Number(rotate || 0); + if (rotate === true) { + // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures + _this._rotate = 2; + } + else if (_this._rotate % 2 !== 0) { + throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); + } + _this.defaultAnchor = anchor ? new math.Point(anchor.x, anchor.y) : new math.Point(0, 0); + _this._updateID = 0; + _this.textureCacheIds = []; + if (!baseTexture.valid) { + baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); + } + else if (_this.noFrame) { + // if there is no frame we should monitor for any base texture changes.. + if (baseTexture.valid) { + _this.onBaseTextureUpdated(baseTexture); + } + } + else { + _this.frame = frame; + } + if (_this.noFrame) { + baseTexture.on('update', _this.onBaseTextureUpdated, _this); + } + return _this; + } + /** + * Updates this texture on the gpu. + * + * Calls the TextureResource update. + * + * If you adjusted `frame` manually, please call `updateUvs()` instead. + */ + Texture.prototype.update = function () { + if (this.baseTexture.resource) { + this.baseTexture.resource.update(); + } + }; + /** + * Called when the base texture is updated + * @protected + * @param baseTexture - The base texture. + */ + Texture.prototype.onBaseTextureUpdated = function (baseTexture) { + if (this.noFrame) { + if (!this.baseTexture.valid) { + return; + } + this._frame.width = baseTexture.width; + this._frame.height = baseTexture.height; + this.valid = true; + this.updateUvs(); + } + else { + // TODO this code looks confusing.. boo to abusing getters and setters! + // if user gave us frame that has bigger size than resized texture it can be a problem + this.frame = this._frame; + } + this.emit('update', this); + }; + /** + * Destroys this texture + * @param [destroyBase=false] - Whether to destroy the base texture as well + */ + Texture.prototype.destroy = function (destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + var resource = this.baseTexture.resource; + // delete the texture if it exists in the texture cache.. + // this only needs to be removed if the base texture is actually destroyed too.. + if (resource && resource.url && utils.TextureCache[resource.url]) { + Texture.removeFromCache(resource.url); + } + this.baseTexture.destroy(); + } + this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); + this.baseTexture.off('update', this.onBaseTextureUpdated, this); + this.baseTexture = null; + } + this._frame = null; + this._uvs = null; + this.trim = null; + this.orig = null; + this.valid = false; + Texture.removeFromCache(this); + this.textureCacheIds = null; + }; + /** + * Creates a new texture object that acts the same as this one. + * @returns - The new texture + */ + Texture.prototype.clone = function () { + var clonedFrame = this._frame.clone(); + var clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone(); + var clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); + if (this.noFrame) { + clonedTexture._frame = clonedFrame; + } + return clonedTexture; + }; + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + * Call it after changing the frame + */ + Texture.prototype.updateUvs = function () { + if (this._uvs === DEFAULT_UVS) { + this._uvs = new TextureUvs(); + } + this._uvs.set(this._frame, this.baseTexture, this.rotate); + this._updateID++; + }; + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - + * Source or array of sources to create texture from + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.Texture} The newly created texture + */ + Texture.from = function (source, options, strict) { + if (options === void 0) { options = {}; } + if (strict === void 0) { strict = settings.settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else if (source instanceof BaseTexture) { + if (!source.cacheId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source.cacheId = prefix + "-" + utils.uid(); + BaseTexture.addToCache(source, source.cacheId); + } + cacheId = source.cacheId; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + utils.uid(); + } + cacheId = source._pixiId; + } + var texture = utils.TextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !texture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); + } + if (!texture && !(source instanceof BaseTexture)) { + if (!options.resolution) { + options.resolution = utils.getResolutionOfUrl(source); + } + texture = new Texture(new BaseTexture(source, options)); + texture.baseTexture.cacheId = cacheId; + BaseTexture.addToCache(texture.baseTexture, cacheId); + Texture.addToCache(texture, cacheId); + } + else if (!texture && (source instanceof BaseTexture)) { + texture = new Texture(source); + Texture.addToCache(texture, cacheId); + } + // lets assume its a base texture! + return texture; + }; + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param url - The remote URL or array of URLs to load. + * @param options - Optional options to include + * @returns - A Promise that resolves to a Texture. + */ + Texture.fromURL = function (url, options) { + var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); + var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); + var resource = texture.baseTexture.resource; + // The texture was already loaded + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // Manually load the texture, this should allow users to handle load errors + return resource.load().then(function () { return Promise.resolve(texture); }); + }; + /** + * Create a new Texture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns - The resulting new BaseTexture + */ + Texture.fromBuffer = function (buffer, width, height, options) { + return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); + }; + /** + * Create a texture from a source and add to the cache. + * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source. + * @param imageUrl - File name of texture, for cache and resolving resolution. + * @param name - Human readable name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @param options + * @returns - Output texture + */ + Texture.fromLoader = function (source, imageUrl, name, options) { + var baseTexture = new BaseTexture(source, Object.assign({ + scaleMode: settings.settings.SCALE_MODE, + resolution: utils.getResolutionOfUrl(imageUrl), + }, options)); + var resource = baseTexture.resource; + if (resource instanceof ImageResource) { + resource.url = imageUrl; + } + var texture = new Texture(baseTexture); + // No name, use imageUrl instead + if (!name) { + name = imageUrl; + } + // lets also add the frame to pixi's global cache for 'fromLoader' function + BaseTexture.addToCache(texture.baseTexture, name); + Texture.addToCache(texture, name); + // also add references by url if they are different. + if (name !== imageUrl) { + BaseTexture.addToCache(texture.baseTexture, imageUrl); + Texture.addToCache(texture, imageUrl); + } + // Generally images are valid right away + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // SVG assets need to be parsed async, let's wait + return new Promise(function (resolve) { + texture.baseTexture.once('loaded', function () { return resolve(texture); }); + }); + }; + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * @param texture - The Texture to add to the cache. + * @param id - The id that the Texture will be stored against. + */ + Texture.addToCache = function (texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { + texture.textureCacheIds.push(id); + } + if (utils.TextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); + } + utils.TextureCache[id] = texture; + } + }; + /** + * Remove a Texture from the global TextureCache. + * @param texture - id of a Texture to be removed, or a Texture instance itself + * @returns - The Texture that was removed + */ + Texture.removeFromCache = function (texture) { + if (typeof texture === 'string') { + var textureFromCache = utils.TextureCache[texture]; + if (textureFromCache) { + var index = textureFromCache.textureCacheIds.indexOf(texture); + if (index > -1) { + textureFromCache.textureCacheIds.splice(index, 1); + } + delete utils.TextureCache[texture]; + return textureFromCache; + } + } + else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { + // Check that texture matches the one being passed in before deleting it from the cache. + if (utils.TextureCache[texture.textureCacheIds[i]] === texture) { + delete utils.TextureCache[texture.textureCacheIds[i]]; + } + } + texture.textureCacheIds.length = 0; + return texture; + } + return null; + }; + Object.defineProperty(Texture.prototype, "resolution", { + /** + * Returns resolution of baseTexture + * @readonly + */ + get: function () { + return this.baseTexture.resolution; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "frame", { + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + */ + get: function () { + return this._frame; + }, + set: function (frame) { + this._frame = frame; + this.noFrame = false; + var x = frame.x, y = frame.y, width = frame.width, height = frame.height; + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; + var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + + (errorX + " " + relationship + " " + errorY)); + } + this.valid = width && height && this.baseTexture.valid; + if (!this.trim && !this.rotate) { + this.orig = frame; + } + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "rotate", { + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + */ + get: function () { + return this._rotate; + }, + set: function (rotate) { + this._rotate = rotate; + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "width", { + /** The width of the Texture in pixels. */ + get: function () { + return this.orig.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "height", { + /** The height of the Texture in pixels. */ + get: function () { + return this.orig.height; + }, + enumerable: false, + configurable: true + }); + /** Utility function for BaseTexture|Texture cast. */ + Texture.prototype.castToBaseTexture = function () { + return this.baseTexture; + }; + Object.defineProperty(Texture, "EMPTY", { + /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */ + get: function () { + if (!Texture._EMPTY) { + Texture._EMPTY = new Texture(new BaseTexture()); + removeAllHandlers(Texture._EMPTY); + removeAllHandlers(Texture._EMPTY.baseTexture); + } + return Texture._EMPTY; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture, "WHITE", { + /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */ + get: function () { + if (!Texture._WHITE) { + var canvas = settings.settings.ADAPTER.createCanvas(16, 16); + var context = canvas.getContext('2d'); + canvas.width = 16; + canvas.height = 16; + context.fillStyle = 'white'; + context.fillRect(0, 0, 16, 16); + Texture._WHITE = new Texture(BaseTexture.from(canvas)); + removeAllHandlers(Texture._WHITE); + removeAllHandlers(Texture._WHITE.baseTexture); + } + return Texture._WHITE; + }, + enumerable: false, + configurable: true + }); + return Texture; +}(utils.EventEmitter)); + +/** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * __Hint-2__: The actual memory allocation will happen on first render. + * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * Note that you should not create a new renderer, but reuse the same one as the rest of the application. + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 }); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +var RenderTexture = /** @class */ (function (_super) { + __extends(RenderTexture, _super); + /** + * @param baseRenderTexture - The base texture object that this texture uses. + * @param frame - The rectangle frame of the texture to show. + */ + function RenderTexture(baseRenderTexture, frame) { + var _this = _super.call(this, baseRenderTexture, frame) || this; + _this.valid = true; + _this.filterFrame = null; + _this.filterPoolKey = null; + _this.updateUvs(); + return _this; + } + Object.defineProperty(RenderTexture.prototype, "framebuffer", { + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @readonly + */ + get: function () { + return this.baseTexture.framebuffer; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(RenderTexture.prototype, "multisample", { + /** + * Shortcut to `this.framebuffer.multisample`. + * @default PIXI.MSAA_QUALITY.NONE + */ + get: function () { + return this.framebuffer.multisample; + }, + set: function (value) { + this.framebuffer.multisample = value; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the RenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well? + */ + RenderTexture.prototype.resize = function (desiredWidth, desiredHeight, resizeBaseTexture) { + if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } + var resolution = this.baseTexture.resolution; + var width = Math.round(desiredWidth * resolution) / resolution; + var height = Math.round(desiredHeight * resolution) / resolution; + // TODO - could be not required.. + this.valid = (width > 0 && height > 0); + this._frame.width = this.orig.width = width; + this._frame.height = this.orig.height = height; + if (resizeBaseTexture) { + this.baseTexture.resize(width, height); + } + this.updateUvs(); + }; + /** + * Changes the resolution of baseTexture, but does not change framebuffer size. + * @param resolution - The new resolution to apply to RenderTexture + */ + RenderTexture.prototype.setResolution = function (resolution) { + var baseTexture = this.baseTexture; + if (baseTexture.resolution === resolution) { + return; + } + baseTexture.setResolution(resolution); + this.resize(baseTexture.width, baseTexture.height, false); + }; + RenderTexture.create = function (options) { + var arguments$1 = arguments; + + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments$1[_i]; + } + // @deprecated fallback, old-style: create(width, height, scaleMode, resolution) + if (typeof options === 'number') { + utils.deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.'); + /* eslint-disable prefer-rest-params */ + options = { + width: options, + height: rest[0], + scaleMode: rest[1], + resolution: rest[2], + }; + /* eslint-enable prefer-rest-params */ + } + return new RenderTexture(new BaseRenderTexture(options)); + }; + return RenderTexture; +}(Texture)); + +/** + * Texture pool, used by FilterSystem and plugins. + * + * Stores collection of temporary pow2 or screen-sized renderTextures + * + * If you use custom RenderTexturePool for your filters, you can use methods + * `getFilterTexture` and `returnFilterTexture` same as in + * @memberof PIXI + */ +var RenderTexturePool = /** @class */ (function () { + /** + * @param textureOptions - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + */ + function RenderTexturePool(textureOptions) { + this.texturePool = {}; + this.textureOptions = textureOptions || {}; + this.enableFullScreen = false; + this._pixelsWidth = 0; + this._pixelsHeight = 0; + } + /** + * Creates texture with params that were specified in pool constructor. + * @param realWidth - Width of texture in pixels. + * @param realHeight - Height of texture in pixels. + * @param multisample - Number of samples of the framebuffer. + */ + RenderTexturePool.prototype.createTexture = function (realWidth, realHeight, multisample) { + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + var baseRenderTexture = new BaseRenderTexture(Object.assign({ + width: realWidth, + height: realHeight, + resolution: 1, + multisample: multisample, + }, this.textureOptions)); + return new RenderTexture(baseRenderTexture); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture. + * @param minHeight - The minimum height of the render texture. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns The new render texture. + */ + RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + var key; + minWidth = Math.ceil((minWidth * resolution) - 1e-6); + minHeight = Math.ceil((minHeight * resolution) - 1e-6); + if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { + minWidth = utils.nextPow2(minWidth); + minHeight = utils.nextPow2(minHeight); + key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0; + if (multisample > 1) { + key += multisample * 0x100000000; + } + } + else { + key = multisample > 1 ? -multisample : -1; + } + if (!this.texturePool[key]) { + this.texturePool[key] = []; + } + var renderTexture = this.texturePool[key].pop(); + if (!renderTexture) { + renderTexture = this.createTexture(minWidth, minHeight, multisample); + } + renderTexture.filterPoolKey = key; + renderTexture.setResolution(resolution); + return renderTexture; + }; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * It overrides, it does not multiply + * @param multisample - number of samples of the renderTexture + */ + RenderTexturePool.prototype.getFilterTexture = function (input, resolution, multisample) { + var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || constants.MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Place a render texture back into the pool. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnTexture = function (renderTexture) { + var key = renderTexture.filterPoolKey; + renderTexture.filterFrame = null; + this.texturePool[key].push(renderTexture); + }; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { + this.returnTexture(renderTexture); + }; + /** + * Clears the pool. + * @param destroyTextures - Destroy all stored textures. + */ + RenderTexturePool.prototype.clear = function (destroyTextures) { + destroyTextures = destroyTextures !== false; + if (destroyTextures) { + for (var i in this.texturePool) { + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + } + } + this.texturePool = {}; + }; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * @param size - Initial size of screen. + */ + RenderTexturePool.prototype.setScreenSize = function (size) { + if (size.width === this._pixelsWidth + && size.height === this._pixelsHeight) { + return; + } + this.enableFullScreen = size.width > 0 && size.height > 0; + for (var i in this.texturePool) { + if (!(Number(i) < 0)) { + continue; + } + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.texturePool[i] = []; + } + this._pixelsWidth = size.width; + this._pixelsHeight = size.height; + }; + /** + * Key that is used to store fullscreen renderTextures in a pool + * @constant + */ + RenderTexturePool.SCREEN_KEY = -1; + return RenderTexturePool; +}()); + +/* eslint-disable max-len */ +/** + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. + * @memberof PIXI + */ +var Attribute = /** @class */ (function () { + /** + * @param buffer - the id of the buffer that this attribute will look for + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param normalized - should the data be normalized. + * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param [instance=false] - Whether the geometry is instanced. + */ + function Attribute(buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (type === void 0) { type = constants.TYPES.FLOAT; } + this.buffer = buffer; + this.size = size; + this.normalized = normalized; + this.type = type; + this.stride = stride; + this.start = start; + this.instance = instance; + } + /** Destroys the Attribute. */ + Attribute.prototype.destroy = function () { + this.buffer = null; + }; + /** + * Helper function that creates an Attribute based on the information provided + * @param buffer - the id of the buffer that this attribute will look for + * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param [normalized=false] - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @returns - A new {@link PIXI.Attribute} based on the information provided + */ + Attribute.from = function (buffer, size, normalized, type, stride) { + return new Attribute(buffer, size, normalized, type, stride); + }; + return Attribute; +}()); + +var UID$4 = 0; +/** + * A wrapper for data so that it can be used and uploaded by WebGL + * @memberof PIXI + */ +var Buffer = /** @class */ (function () { + /** + * @param {PIXI.IArrayBuffer} data - the data to store in the buffer. + * @param _static - `true` for static buffer + * @param index - `true` for index buffer + */ + function Buffer(data, _static, index) { + if (_static === void 0) { _static = true; } + if (index === void 0) { index = false; } + this.data = (data || new Float32Array(1)); + this._glBuffers = {}; + this._updateID = 0; + this.index = index; + this.static = _static; + this.id = UID$4++; + this.disposeRunner = new runner.Runner('disposeBuffer'); + } + // TODO could explore flagging only a partial upload? + /** + * Flags this buffer as requiring an upload to the GPU. + * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer. + */ + Buffer.prototype.update = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + this.data = data || this.data; + this._updateID++; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Buffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the buffer. */ + Buffer.prototype.destroy = function () { + this.dispose(); + this.data = null; + }; + Object.defineProperty(Buffer.prototype, "index", { + get: function () { + return this.type === constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + }, + /** + * Flags whether this is an index buffer. + * + * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make + * the buffer of type `ARRAY_BUFFER`. + * + * For backwards compatibility. + */ + set: function (value) { + this.type = value ? constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : constants.BUFFER_TYPE.ARRAY_BUFFER; + }, + enumerable: false, + configurable: true + }); + /** + * Helper function that creates a buffer based on an array or TypedArray + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @returns - A new Buffer based on the data provided. + */ + Buffer.from = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + return new Buffer(data); + }; + return Buffer; +}()); + +/* eslint-disable object-shorthand */ +var map$1 = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, +}; +function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + var type = utils.getBufferType(array); + if (!views[type]) { + views[type] = new map$1[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); +} + +var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; +var UID$3 = 0; +/* eslint-disable object-shorthand */ +var map = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + Uint16Array: Uint16Array, +}; +/* eslint-disable max-len */ +/** + * The Geometry represents a model. It consists of two components: + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. + * + * Geometry can be defined without passing in a style or data if required (thats how I prefer!) + * + * ```js + * let geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) + * geometry.addIndex([0,1,2,1,3,2]) + * ``` + * @memberof PIXI + */ +var Geometry = /** @class */ (function () { + /** + * @param buffers - An array of buffers. optional. + * @param attributes - Of the geometry, optional structure of the attributes layout + */ + function Geometry(buffers, attributes) { + if (buffers === void 0) { buffers = []; } + if (attributes === void 0) { attributes = {}; } + this.buffers = buffers; + this.indexBuffer = null; + this.attributes = attributes; + this.glVertexArrayObjects = {}; + this.id = UID$3++; + this.instanced = false; + this.instanceCount = 1; + this.disposeRunner = new runner.Runner('disposeGeometry'); + this.refCount = 0; + } + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * @param id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param normalized - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param instance - Instancing flag + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (instance === void 0) { instance = false; } + if (!buffer) { + throw new Error('You must pass a buffer when creating an attribute'); + } + // check if this is a buffer! + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Float32Array(buffer); + } + buffer = new Buffer(buffer); + } + var ids = id.split('|'); + if (ids.length > 1) { + for (var i = 0; i < ids.length; i++) { + this.addAttribute(ids[i], buffer, size, normalized, type); + } + return this; + } + var bufferIndex = this.buffers.indexOf(buffer); + if (bufferIndex === -1) { + this.buffers.push(buffer); + bufferIndex = this.buffers.length - 1; + } + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); + // assuming that if there is instanced data then this will be drawn with instancing! + this.instanced = this.instanced || instance; + return this; + }; + /** + * Returns the requested attribute. + * @param id - The name of the attribute required + * @returns - The attribute requested. + */ + Geometry.prototype.getAttribute = function (id) { + return this.attributes[id]; + }; + /** + * Returns the requested buffer. + * @param id - The name of the buffer required. + * @returns - The buffer requested. + */ + Geometry.prototype.getBuffer = function (id) { + return this.buffers[this.getAttribute(id).buffer]; + }; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addIndex = function (buffer) { + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Uint16Array(buffer); + } + buffer = new Buffer(buffer); + } + buffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + this.indexBuffer = buffer; + if (this.buffers.indexOf(buffer) === -1) { + this.buffers.push(buffer); + } + return this; + }; + /** + * Returns the index buffer + * @returns - The index buffer. + */ + Geometry.prototype.getIndex = function () { + return this.indexBuffer; + }; + /** + * This function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.interleave = function () { + // a simple check to see if buffers are already interleaved.. + if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) + { return this; } + // assume already that no buffers are interleaved + var arrays = []; + var sizes = []; + var interleavedBuffer = new Buffer(); + var i; + for (i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + arrays.push(buffer.data); + sizes.push((attribute.size * byteSizeMap$1[attribute.type]) / 4); + attribute.buffer = 0; + } + interleavedBuffer.data = interleaveTypedArrays(arrays, sizes); + for (i = 0; i < this.buffers.length; i++) { + if (this.buffers[i] !== this.indexBuffer) { + this.buffers[i].destroy(); + } + } + this.buffers = [interleavedBuffer]; + if (this.indexBuffer) { + this.buffers.push(this.indexBuffer); + } + return this; + }; + /** Get the size of the geometries, in vertices. */ + Geometry.prototype.getSize = function () { + for (var i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + return buffer.data.length / ((attribute.stride / 4) || attribute.size); + } + return 0; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Geometry.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the geometry. */ + Geometry.prototype.destroy = function () { + this.dispose(); + this.buffers = null; + this.indexBuffer = null; + this.attributes = null; + }; + /** + * Returns a clone of the geometry. + * @returns - A new clone of this geometry. + */ + Geometry.prototype.clone = function () { + var geometry = new Geometry(); + for (var i = 0; i < this.buffers.length; i++) { + geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); + } + for (var i in this.attributes) { + var attrib = this.attributes[i]; + geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); + } + if (this.indexBuffer) { + geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; + geometry.indexBuffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + } + return geometry; + }; + /** + * Merges an array of geometries into a new single one. + * + * Geometry attribute styles must match for this operation to work. + * @param geometries - array of geometries to merge + * @returns - Shiny new geometry! + */ + Geometry.merge = function (geometries) { + // todo add a geometry check! + // also a size check.. cant be too big!] + var geometryOut = new Geometry(); + var arrays = []; + var sizes = []; + var offsets = []; + var geometry; + // pass one.. get sizes.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + sizes[j] = sizes[j] || 0; + sizes[j] += geometry.buffers[j].data.length; + offsets[j] = 0; + } + } + // build the correct size arrays.. + for (var i = 0; i < geometry.buffers.length; i++) { + // TODO types! + arrays[i] = new map[utils.getBufferType(geometry.buffers[i].data)](sizes[i]); + geometryOut.buffers[i] = new Buffer(arrays[i]); + } + // pass to set data.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + arrays[j].set(geometry.buffers[j].data, offsets[j]); + offsets[j] += geometry.buffers[j].data.length; + } + } + geometryOut.attributes = geometry.attributes; + if (geometry.indexBuffer) { + geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; + geometryOut.indexBuffer.type = constants.BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + var offset = 0; + var stride = 0; + var offset2 = 0; + var bufferIndexToCount = 0; + // get a buffer + for (var i = 0; i < geometry.buffers.length; i++) { + if (geometry.buffers[i] !== geometry.indexBuffer) { + bufferIndexToCount = i; + break; + } + } + // figure out the stride of one buffer.. + for (var i in geometry.attributes) { + var attribute = geometry.attributes[i]; + if ((attribute.buffer | 0) === bufferIndexToCount) { + stride += ((attribute.size * byteSizeMap$1[attribute.type]) / 4); + } + } + // time to off set all indexes.. + for (var i = 0; i < geometries.length; i++) { + var indexBufferData = geometries[i].indexBuffer.data; + for (var j = 0; j < indexBufferData.length; j++) { + geometryOut.indexBuffer.data[j + offset2] += offset; + } + offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride); + offset2 += indexBufferData.length; + } + } + return geometryOut; + }; + return Geometry; +}()); + +/** + * Helper class to create a quad + * @memberof PIXI + */ +var Quad = /** @class */ (function (_super) { + __extends(Quad, _super); + function Quad() { + var _this = _super.call(this) || this; + _this.addAttribute('aVertexPosition', new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ])) + .addIndex([0, 1, 3, 2]); + return _this; + } + return Quad; +}(Geometry)); + +/** + * Helper class to create a quad with uvs like in v4 + * @memberof PIXI + */ +var QuadUv = /** @class */ (function (_super) { + __extends(QuadUv, _super); + function QuadUv() { + var _this = _super.call(this) || this; + _this.vertices = new Float32Array([ + -1, -1, + 1, -1, + 1, 1, + -1, 1 ]); + _this.uvs = new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ]); + _this.vertexBuffer = new Buffer(_this.vertices); + _this.uvBuffer = new Buffer(_this.uvs); + _this.addAttribute('aVertexPosition', _this.vertexBuffer) + .addAttribute('aTextureCoord', _this.uvBuffer) + .addIndex([0, 1, 2, 0, 2, 3]); + return _this; + } + /** + * Maps two Rectangle to the quad. + * @param targetTextureFrame - The first rectangle + * @param destinationFrame - The second rectangle + * @returns - Returns itself. + */ + QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { + var x = 0; // destinationFrame.x / targetTextureFrame.width; + var y = 0; // destinationFrame.y / targetTextureFrame.height; + this.uvs[0] = x; + this.uvs[1] = y; + this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[3] = y; + this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); + this.uvs[6] = x; + this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); + x = destinationFrame.x; + y = destinationFrame.y; + this.vertices[0] = x; + this.vertices[1] = y; + this.vertices[2] = x + destinationFrame.width; + this.vertices[3] = y; + this.vertices[4] = x + destinationFrame.width; + this.vertices[5] = y + destinationFrame.height; + this.vertices[6] = x; + this.vertices[7] = y + destinationFrame.height; + this.invalidate(); + return this; + }; + /** + * Legacy upload method, just marks buffers dirty. + * @returns - Returns itself. + */ + QuadUv.prototype.invalidate = function () { + this.vertexBuffer._updateID++; + this.uvBuffer._updateID++; + return this; + }; + return QuadUv; +}(Geometry)); + +var UID$2 = 0; +/** + * Uniform group holds uniform map and some ID's for work + * + * `UniformGroup` has two modes: + * + * 1: Normal mode + * Normal mode will upload the uniforms with individual function calls as required + * + * 2: Uniform buffer mode + * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or + * or a generic object that PixiJS will automatically map to a buffer for you. + * For maximum benefits, make Ubo UniformGroups static, and only update them each frame. + * + * Rules of UBOs: + * - UBOs only work with WebGL2, so make sure you have a fallback! + * - Only floats are supported (including vec[2,3,4], mat[2,3,4]) + * - Samplers cannot be used in ubo's (a GPU limitation) + * - You must ensure that the object you pass in exactly matches in the shader ubo structure. + * Otherwise, weirdness will ensue! + * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader. + * + * ``` + * // ubo in shader: + * uniform myCoolData { // declaring a ubo.. + * mat4 uCoolMatrix; + * float uFloatyMcFloatFace + * + * + * // a new uniform buffer object.. + * const myCoolData = new UniformBufferGroup({ + * uCoolMatrix: new Matrix(), + * uFloatyMcFloatFace: 23, + * }} + * + * // build a shader... + * const shader = Shader.from(srcVert, srcFrag, { + * myCoolData // name matches the ubo name in the shader. will be processed accordingly. + * }) + * + * ``` + * @memberof PIXI + */ +var UniformGroup = /** @class */ (function () { + /** + * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer. + * @param isStatic - Uniforms wont be changed after creation. + * @param isUbo - If true, will treat this uniform group as a uniform buffer object. + */ + function UniformGroup(uniforms, isStatic, isUbo) { + this.group = true; + // lets generate this when the shader ? + this.syncUniforms = {}; + this.dirtyId = 0; + this.id = UID$2++; + this.static = !!isStatic; + this.ubo = !!isUbo; + if (uniforms instanceof Buffer) { + this.buffer = uniforms; + this.buffer.type = constants.BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = false; + this.ubo = true; + } + else { + this.uniforms = uniforms; + if (this.ubo) { + this.buffer = new Buffer(new Float32Array(1)); + this.buffer.type = constants.BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = true; + } + } + } + UniformGroup.prototype.update = function () { + this.dirtyId++; + if (!this.autoManage && this.buffer) { + this.buffer.update(); + } + }; + UniformGroup.prototype.add = function (name, uniforms, _static) { + if (!this.ubo) { + this.uniforms[name] = new UniformGroup(uniforms, _static); + } + else { + // eslint-disable-next-line max-len + throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them'); + } + }; + UniformGroup.from = function (uniforms, _static, _ubo) { + return new UniformGroup(uniforms, _static, _ubo); + }; + /** + * A short hand function for creating a static UBO UniformGroup. + * @param uniforms - the ubo item + * @param _static - should this be updated each time it is used? defaults to true here! + */ + UniformGroup.uboFrom = function (uniforms, _static) { + return new UniformGroup(uniforms, _static !== null && _static !== void 0 ? _static : true, true); + }; + return UniformGroup; +}()); + +/** + * System plugin to the renderer to manage filter states. + * @ignore + */ +var FilterState = /** @class */ (function () { + function FilterState() { + this.renderTexture = null; + this.target = null; + this.legacy = false; + this.resolution = 1; + this.multisample = constants.MSAA_QUALITY.NONE; + // next three fields are created only for root + // re-assigned for everything else + this.sourceFrame = new math.Rectangle(); + this.destinationFrame = new math.Rectangle(); + this.bindingSourceFrame = new math.Rectangle(); + this.bindingDestinationFrame = new math.Rectangle(); + this.filters = []; + this.transform = null; + } + /** Clears the state */ + FilterState.prototype.clear = function () { + this.target = null; + this.filters = null; + this.renderTexture = null; + }; + return FilterState; +}()); + +var tempPoints = [new math.Point(), new math.Point(), new math.Point(), new math.Point()]; +var tempMatrix$2 = new math.Matrix(); +/** + * System plugin to the renderer to manage filters. + * + * ## Pipeline + * + * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its + * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target. + * + * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into + * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called + * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame` + * in the final render-target. + * + * ## Usage + * + * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process: + * + * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target. + * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents + * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is + * illegal during an existing render cycle, and it may reset the filter system. + * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them + * serially and output to the bounds of the filter-target. + * @memberof PIXI + */ +var FilterSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FilterSystem(renderer) { + this.renderer = renderer; + this.defaultFilterStack = [{}]; + this.texturePool = new RenderTexturePool(); + this.texturePool.setScreenSize(renderer.view); + this.statePool = []; + this.quad = new Quad(); + this.quadUv = new QuadUv(); + this.tempRect = new math.Rectangle(); + this.activeState = {}; + this.globalUniforms = new UniformGroup({ + outputFrame: new math.Rectangle(), + inputSize: new Float32Array(4), + inputPixel: new Float32Array(4), + inputClamp: new Float32Array(4), + resolution: 1, + // legacy variables + filterArea: new Float32Array(4), + filterClamp: new Float32Array(4), + }, true); + this.forceClear = false; + this.useMaxPadding = false; + } + /** + * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an + * input render-texture for the rest of the filtering pipeline. + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param filters - The filters to apply. + */ + FilterSystem.prototype.push = function (target, filters) { + var _a, _b; + var renderer = this.renderer; + var filterStack = this.defaultFilterStack; + var state = this.statePool.pop() || new FilterState(); + var renderTextureSystem = this.renderer.renderTexture; + var resolution = filters[0].resolution; + var multisample = filters[0].multisample; + var padding = filters[0].padding; + var autoFit = filters[0].autoFit; + // We don't know whether it's a legacy filter until it was bound for the first time, + // therefore we have to assume that it is if legacy is undefined. + var legacy = (_a = filters[0].legacy) !== null && _a !== void 0 ? _a : true; + for (var i = 1; i < filters.length; i++) { + var filter = filters[i]; + // let's use the lowest resolution + resolution = Math.min(resolution, filter.resolution); + // let's use the lowest number of samples + multisample = Math.min(multisample, filter.multisample); + // figure out the padding required for filters + padding = this.useMaxPadding + // old behavior: use largest amount of padding! + ? Math.max(padding, filter.padding) + // new behavior: sum the padding + : padding + filter.padding; + // only auto fit if all filters are autofit + autoFit = autoFit && filter.autoFit; + legacy = legacy || ((_b = filter.legacy) !== null && _b !== void 0 ? _b : true); + } + if (filterStack.length === 1) { + this.defaultFilterStack[0].renderTexture = renderTextureSystem.current; + } + filterStack.push(state); + state.resolution = resolution; + state.multisample = multisample; + state.legacy = legacy; + state.target = target; + state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); + state.sourceFrame.pad(padding); + var sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame); + // Project source frame into world space (if projection is applied) + if (renderer.projection.transform) { + this.transformAABB(tempMatrix$2.copyFrom(renderer.projection.transform).invert(), sourceFrameProjected); + } + if (autoFit) { + state.sourceFrame.fit(sourceFrameProjected); + if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + } + else if (!state.sourceFrame.intersects(sourceFrameProjected)) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + // Round sourceFrame in screen space based on render-texture. + this.roundFrame(state.sourceFrame, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution, multisample); + state.filters = filters; + state.destinationFrame.width = state.renderTexture.width; + state.destinationFrame.height = state.renderTexture.height; + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = state.sourceFrame.width; + destinationFrame.height = state.sourceFrame.height; + state.renderTexture.filterFrame = state.sourceFrame; + state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame); + state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame); + state.transform = renderer.projection.transform; + renderer.projection.transform = null; + renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame); + renderer.framebuffer.clear(0, 0, 0, 0); + }; + /** Pops off the filter and applies it. */ + FilterSystem.prototype.pop = function () { + var filterStack = this.defaultFilterStack; + var state = filterStack.pop(); + var filters = state.filters; + this.activeState = state; + var globalUniforms = this.globalUniforms.uniforms; + globalUniforms.outputFrame = state.sourceFrame; + globalUniforms.resolution = state.resolution; + var inputSize = globalUniforms.inputSize; + var inputPixel = globalUniforms.inputPixel; + var inputClamp = globalUniforms.inputClamp; + inputSize[0] = state.destinationFrame.width; + inputSize[1] = state.destinationFrame.height; + inputSize[2] = 1.0 / inputSize[0]; + inputSize[3] = 1.0 / inputSize[1]; + inputPixel[0] = Math.round(inputSize[0] * state.resolution); + inputPixel[1] = Math.round(inputSize[1] * state.resolution); + inputPixel[2] = 1.0 / inputPixel[0]; + inputPixel[3] = 1.0 / inputPixel[1]; + inputClamp[0] = 0.5 * inputPixel[2]; + inputClamp[1] = 0.5 * inputPixel[3]; + inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); + inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); + // only update the rect if its legacy.. + if (state.legacy) { + var filterArea = globalUniforms.filterArea; + filterArea[0] = state.destinationFrame.width; + filterArea[1] = state.destinationFrame.height; + filterArea[2] = state.sourceFrame.x; + filterArea[3] = state.sourceFrame.y; + globalUniforms.filterClamp = globalUniforms.inputClamp; + } + this.globalUniforms.update(); + var lastState = filterStack[filterStack.length - 1]; + this.renderer.framebuffer.blit(); + if (filters.length === 1) { + filters[0].apply(this, state.renderTexture, lastState.renderTexture, constants.CLEAR_MODES.BLEND, state); + this.returnFilterTexture(state.renderTexture); + } + else { + var flip = state.renderTexture; + var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + var i = 0; + for (i = 0; i < filters.length - 1; ++i) { + if (i === 1 && state.multisample > 1) { + flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + } + filters[i].apply(this, flip, flop, constants.CLEAR_MODES.CLEAR, state); + var t = flip; + flip = flop; + flop = t; + } + filters[i].apply(this, flip, lastState.renderTexture, constants.CLEAR_MODES.BLEND, state); + if (i > 1 && state.multisample > 1) { + this.returnFilterTexture(state.renderTexture); + } + this.returnFilterTexture(flip); + this.returnFilterTexture(flop); + } + // lastState.renderTexture is blitted when lastState is popped + state.clear(); + this.statePool.push(state); + }; + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { + if (clearMode === void 0) { clearMode = constants.CLEAR_MODES.CLEAR; } + var _a = this.renderer, renderTextureSystem = _a.renderTexture, stateSystem = _a.state; + if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + // Restore projection transform if rendering into the output render-target. + this.renderer.projection.transform = this.activeState.transform; + } + else { + // Prevent projection within filtering pipeline. + this.renderer.projection.transform = null; + } + if (filterTexture && filterTexture.filterFrame) { + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = filterTexture.filterFrame.width; + destinationFrame.height = filterTexture.filterFrame.height; + renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame); + } + else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + renderTextureSystem.bind(filterTexture); + } + else { + // Restore binding for output render-target. + this.renderer.renderTexture.bind(filterTexture, this.activeState.bindingSourceFrame, this.activeState.bindingDestinationFrame); + } + // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending + // is stored in the 0th bit of the state. + var autoClear = (stateSystem.stateId & 1) || this.forceClear; + if (clearMode === constants.CLEAR_MODES.CLEAR + || (clearMode === constants.CLEAR_MODES.BLIT && autoClear)) { + // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering + // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur) + // instead of clamping their arithmetic. + this.renderer.framebuffer.clear(0, 0, 0, 0); + } + }; + /** + * Draws a filter using the default rendering process. + * + * This should be called only by {@link Filter#apply}. + * @param filter - The filter to draw. + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it + */ + FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { + var renderer = this.renderer; + // Set state before binding, so bindAndClear gets the blend mode. + renderer.state.set(filter.state); + this.bindAndClear(output, clearMode); + // set the uniforms.. + filter.uniforms.uSampler = input; + filter.uniforms.filterGlobals = this.globalUniforms; + // TODO make it so that the order of this does not matter.. + // because it does at the moment cos of global uniforms. + // they need to get resynced + renderer.shader.bind(filter); + // check to see if the filter is a legacy one.. + filter.legacy = !!filter.program.attributeData.aTextureCoord; + if (filter.legacy) { + this.quadUv.map(input._frame, input.filterFrame); + renderer.geometry.bind(this.quadUv); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES); + } + else { + renderer.geometry.bind(this.quad); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLE_STRIP); + } + }; + /** + * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. + * + * Use `outputMatrix * vTextureCoord` in the shader. + * @param outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @returns The mapped matrix. + */ + FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); + var worldTransform = sprite.worldTransform.copyTo(math.Matrix.TEMP_MATRIX); + worldTransform.invert(); + mappedMatrix.prepend(worldTransform); + mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); + mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); + return mappedMatrix; + }; + /** Destroys this Filter System. */ + FilterSystem.prototype.destroy = function () { + this.renderer = null; + // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem + this.texturePool.clear(false); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture in real pixels. + * @param minHeight - The minimum height of the render texture in real pixels. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns - The new render texture. + */ + FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = constants.MSAA_QUALITY.NONE; } + return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample); + }; + /** + * Gets extra render texture to use inside current filter + * To be compliant with older filters, you can use params in any order + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * @param multisample - number of samples of the renderTexture + */ + FilterSystem.prototype.getFilterTexture = function (input, resolution, multisample) { + if (typeof input === 'number') { + var swap = input; + input = resolution; + resolution = swap; + } + input = input || this.activeState.renderTexture; + var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || constants.MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Frees a render texture back into the pool. + * @param renderTexture - The renderTarget to free + */ + FilterSystem.prototype.returnFilterTexture = function (renderTexture) { + this.texturePool.returnTexture(renderTexture); + }; + /** Empties the texture pool. */ + FilterSystem.prototype.emptyPool = function () { + this.texturePool.clear(true); + }; + /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */ + FilterSystem.prototype.resize = function () { + this.texturePool.setScreenSize(this.renderer.view); + }; + /** + * @param matrix - first param + * @param rect - second param + */ + FilterSystem.prototype.transformAABB = function (matrix, rect) { + var lt = tempPoints[0]; + var lb = tempPoints[1]; + var rt = tempPoints[2]; + var rb = tempPoints[3]; + lt.set(rect.left, rect.top); + lb.set(rect.left, rect.bottom); + rt.set(rect.right, rect.top); + rb.set(rect.right, rect.bottom); + matrix.apply(lt, lt); + matrix.apply(lb, lb); + matrix.apply(rt, rt); + matrix.apply(rb, rb); + var x0 = Math.min(lt.x, lb.x, rt.x, rb.x); + var y0 = Math.min(lt.y, lb.y, rt.y, rb.y); + var x1 = Math.max(lt.x, lb.x, rt.x, rb.x); + var y1 = Math.max(lt.y, lb.y, rt.y, rb.y); + rect.x = x0; + rect.y = y0; + rect.width = x1 - x0; + rect.height = y1 - y0; + }; + FilterSystem.prototype.roundFrame = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0) { + return; + } + if (transform) { + var a = transform.a, b = transform.b, c = transform.c, d = transform.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)) { + return; + } + } + transform = transform ? tempMatrix$2.copyFrom(transform) : tempMatrix$2.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.transformAABB(transform, frame); + // Round frame in screen space + frame.ceil(resolution); + // Project back into world space. + this.transformAABB(transform.invert(), frame); + }; + return FilterSystem; +}()); + +/** + * Base for a common object renderer that can be used as a + * system renderer plugin. + * @memberof PIXI + */ +var ObjectRenderer = /** @class */ (function () { + /** + * @param renderer - The renderer this manager works for. + */ + function ObjectRenderer(renderer) { + this.renderer = renderer; + } + /** Stub method that should be used to empty the current batch by rendering objects now. */ + ObjectRenderer.prototype.flush = function () { + // flush! + }; + /** Generic destruction method that frees all resources. This should be called by subclasses. */ + ObjectRenderer.prototype.destroy = function () { + this.renderer = null; + }; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + ObjectRenderer.prototype.start = function () { + // set the shader.. + }; + /** Stops the renderer. It should free up any state and become dormant. */ + ObjectRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * @param {PIXI.DisplayObject} _object - The object to render. + */ + ObjectRenderer.prototype.render = function (_object) { + // render the object + }; + return ObjectRenderer; +}()); + +/** + * System plugin to the renderer to manage batching. + * @memberof PIXI + */ +var BatchSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function BatchSystem(renderer) { + this.renderer = renderer; + this.emptyRenderer = new ObjectRenderer(renderer); + this.currentRenderer = this.emptyRenderer; + } + /** + * Changes the current renderer to the one given in parameter + * @param objectRenderer - The object renderer to use. + */ + BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { + if (this.currentRenderer === objectRenderer) { + return; + } + this.currentRenderer.stop(); + this.currentRenderer = objectRenderer; + this.currentRenderer.start(); + }; + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + */ + BatchSystem.prototype.flush = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** Reset the system to an empty renderer */ + BatchSystem.prototype.reset = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** + * Handy function for batch renderers: copies bound textures in first maxTextures locations to array + * sets actual _batchLocation for them + * @param arr - arr copy destination + * @param maxTextures - number of copied elements + */ + BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { + var boundTextures = this.renderer.texture.boundTextures; + for (var i = maxTextures - 1; i >= 0; --i) { + arr[i] = boundTextures[i] || null; + if (arr[i]) { + arr[i]._batchLocation = i; + } + } + }; + /** + * Assigns batch locations to textures in array based on boundTextures state. + * All textures in texArray should have `_batchEnabled = _batchId`, + * and their count should be less than `maxTextures`. + * @param texArray - textures to bound + * @param boundTextures - current state of bound textures + * @param batchId - marker for _batchEnabled param of textures in texArray + * @param maxTextures - number of texture locations to manipulate + */ + BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { + var elements = texArray.elements, ids = texArray.ids, count = texArray.count; + var j = 0; + for (var i = 0; i < count; i++) { + var tex = elements[i]; + var loc = tex._batchLocation; + if (loc >= 0 && loc < maxTextures + && boundTextures[loc] === tex) { + ids[i] = loc; + continue; + } + while (j < maxTextures) { + var bound = boundTextures[j]; + if (bound && bound._batchEnabled === batchId + && bound._batchLocation === j) { + j++; + continue; + } + ids[i] = j; + tex._batchLocation = j; + boundTextures[j] = tex; + break; + } + } + }; + /** + * @ignore + */ + BatchSystem.prototype.destroy = function () { + this.renderer = null; + }; + return BatchSystem; +}()); + +var CONTEXT_UID_COUNTER = 0; +/** + * System plugin to the renderer to manage the context. + * @memberof PIXI + */ +var ContextSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ContextSystem(renderer) { + this.renderer = renderer; + this.webGLVersion = 1; + this.extensions = {}; + this.supports = { + uint32Indices: false, + }; + // Bind functions + this.handleContextLost = this.handleContextLost.bind(this); + this.handleContextRestored = this.handleContextRestored.bind(this); + renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false); + renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); + } + Object.defineProperty(ContextSystem.prototype, "isLost", { + /** + * `true` if the context is lost + * @readonly + */ + get: function () { + return (!this.gl || this.gl.isContextLost()); + }, + enumerable: false, + configurable: true + }); + /** + * Handles the context change event. + * @param {WebGLRenderingContext} gl - New WebGL context. + */ + ContextSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + }; + /** + * Initializes the context. + * @protected + * @param {WebGLRenderingContext} gl - WebGL context + */ + ContextSystem.prototype.initFromContext = function (gl) { + this.gl = gl; + this.validateContext(gl); + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + this.renderer.runners.contextChange.emit(gl); + }; + /** + * Initialize from context options + * @protected + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext + * @param {object} options - context attributes + */ + ContextSystem.prototype.initFromOptions = function (options) { + var gl = this.createContext(this.renderer.view, options); + this.initFromContext(gl); + }; + /** + * Helper class to create a WebGL Context + * @param canvas - the canvas element that we will get the context from + * @param options - An options object that gets passed in to the canvas element containing the + * context attributes + * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext + * @returns {WebGLRenderingContext} the WebGL context + */ + ContextSystem.prototype.createContext = function (canvas, options) { + var gl; + if (settings.settings.PREFER_ENV >= constants.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', options); + } + if (gl) { + this.webGLVersion = 2; + } + else { + this.webGLVersion = 1; + gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options); + if (!gl) { + // fail, not able to get a context + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); + } + } + this.gl = gl; + this.getExtensions(); + return this.gl; + }; + /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */ + ContextSystem.prototype.getExtensions = function () { + // time to set up default extensions that Pixi uses. + var gl = this.gl; + var common = { + loseContext: gl.getExtension('WEBGL_lose_context'), + anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'), + s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), + etc: gl.getExtension('WEBGL_compressed_texture_etc'), + etc1: gl.getExtension('WEBGL_compressed_texture_etc1'), + pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc') + || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'), + atc: gl.getExtension('WEBGL_compressed_texture_atc'), + astc: gl.getExtension('WEBGL_compressed_texture_astc') + }; + if (this.webGLVersion === 1) { + Object.assign(this.extensions, common, { + drawBuffers: gl.getExtension('WEBGL_draw_buffers'), + depthTexture: gl.getExtension('WEBGL_depth_texture'), + vertexArrayObject: gl.getExtension('OES_vertex_array_object') + || gl.getExtension('MOZ_OES_vertex_array_object') + || gl.getExtension('WEBKIT_OES_vertex_array_object'), + uint32ElementIndex: gl.getExtension('OES_element_index_uint'), + // Floats and half-floats + floatTexture: gl.getExtension('OES_texture_float'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + textureHalfFloat: gl.getExtension('OES_texture_half_float'), + textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), + }); + } + else if (this.webGLVersion === 2) { + Object.assign(this.extensions, common, { + // Floats and half-floats + colorBufferFloat: gl.getExtension('EXT_color_buffer_float') + }); + } + }; + /** + * Handles a lost webgl context + * @param {WebGLContextEvent} event - The context lost event. + */ + ContextSystem.prototype.handleContextLost = function (event) { + var _this = this; + // Prevent default to be able to restore the context + event.preventDefault(); + // Restore the context after this event has exited + setTimeout(function () { + if (_this.gl.isContextLost() && _this.extensions.loseContext) { + _this.extensions.loseContext.restoreContext(); + } + }, 0); + }; + /** Handles a restored webgl context. */ + ContextSystem.prototype.handleContextRestored = function () { + this.renderer.runners.contextChange.emit(this.gl); + }; + ContextSystem.prototype.destroy = function () { + var view = this.renderer.view; + this.renderer = null; + // remove listeners + view.removeEventListener('webglcontextlost', this.handleContextLost); + view.removeEventListener('webglcontextrestored', this.handleContextRestored); + this.gl.useProgram(null); + if (this.extensions.loseContext) { + this.extensions.loseContext.loseContext(); + } + }; + /** Handle the post-render runner event. */ + ContextSystem.prototype.postrender = function () { + if (this.renderer.renderingToScreen) { + this.gl.flush(); + } + }; + /** + * Validate context. + * @param {WebGLRenderingContext} gl - Render context. + */ + ContextSystem.prototype.validateContext = function (gl) { + var attributes = gl.getContextAttributes(); + var isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext; + if (isWebGl2) { + this.webGLVersion = 2; + } + // this is going to be fairly simple for now.. but at least we have room to grow! + if (attributes && !attributes.stencil) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); + /* eslint-enable max-len, no-console */ + } + var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); + this.supports.uint32Indices = hasuint32; + if (!hasuint32) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); + /* eslint-enable max-len, no-console */ + } + }; + return ContextSystem; +}()); + +/** + * Internal framebuffer for WebGL context. + * @memberof PIXI + */ +var GLFramebuffer = /** @class */ (function () { + function GLFramebuffer(framebuffer) { + this.framebuffer = framebuffer; + this.stencil = null; + this.dirtyId = -1; + this.dirtyFormat = -1; + this.dirtySize = -1; + this.multisample = constants.MSAA_QUALITY.NONE; + this.msaaBuffer = null; + this.blitFramebuffer = null; + this.mipLevel = 0; + } + return GLFramebuffer; +}()); + +var tempRectangle = new math.Rectangle(); +/** + * System plugin to the renderer to manage framebuffers. + * @memberof PIXI + */ +var FramebufferSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FramebufferSystem(renderer) { + this.renderer = renderer; + this.managedFramebuffers = []; + this.unknownFramebuffer = new Framebuffer(10, 10); + this.msaaSamples = null; + } + /** Sets up the renderer context and necessary buffers. */ + FramebufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.current = this.unknownFramebuffer; + this.viewport = new math.Rectangle(); + this.hasMRT = true; + this.writeDepthTexture = true; + // webgl2 + if (this.renderer.context.webGLVersion === 1) { + // webgl 1! + var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; + var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + nativeDrawBuffersExtension_1 = null; + nativeDepthTextureExtension = null; + } + if (nativeDrawBuffersExtension_1) { + gl.drawBuffers = function (activeTextures) { + return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); + }; + } + else { + this.hasMRT = false; + gl.drawBuffers = function () { + // empty + }; + } + if (!nativeDepthTextureExtension) { + this.writeDepthTexture = false; + } + } + else { + // WebGL2 + // cache possible MSAA samples + this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); + } + }; + /** + * Bind a framebuffer. + * @param framebuffer + * @param frame - frame, default is framebuffer size + * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0 + */ + FramebufferSystem.prototype.bind = function (framebuffer, frame, mipLevel) { + if (mipLevel === void 0) { mipLevel = 0; } + var gl = this.gl; + if (framebuffer) { + // TODO caching layer! + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + if (this.current !== framebuffer) { + this.current = framebuffer; + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); + } + // make sure all textures are unbound.. + if (fbo.mipLevel !== mipLevel) { + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + fbo.mipLevel = mipLevel; + } + // now check for updates... + if (fbo.dirtyId !== framebuffer.dirtyId) { + fbo.dirtyId = framebuffer.dirtyId; + if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { + fbo.dirtyFormat = framebuffer.dirtyFormat; + fbo.dirtySize = framebuffer.dirtySize; + this.updateFramebuffer(framebuffer, mipLevel); + } + else if (fbo.dirtySize !== framebuffer.dirtySize) { + fbo.dirtySize = framebuffer.dirtySize; + this.resizeFramebuffer(framebuffer); + } + } + for (var i = 0; i < framebuffer.colorTextures.length; i++) { + var tex = framebuffer.colorTextures[i]; + this.renderer.texture.unbind(tex.parentTextureArray || tex); + } + if (framebuffer.depthTexture) { + this.renderer.texture.unbind(framebuffer.depthTexture); + } + if (frame) { + var mipWidth = (frame.width >> mipLevel); + var mipHeight = (frame.height >> mipLevel); + var scale = mipWidth / frame.width; + this.setViewport(frame.x * scale, frame.y * scale, mipWidth, mipHeight); + } + else { + var mipWidth = (framebuffer.width >> mipLevel); + var mipHeight = (framebuffer.height >> mipLevel); + this.setViewport(0, 0, mipWidth, mipHeight); + } + } + else { + if (this.current) { + this.current = null; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + if (frame) { + this.setViewport(frame.x, frame.y, frame.width, frame.height); + } + else { + this.setViewport(0, 0, this.renderer.width, this.renderer.height); + } + } + }; + /** + * Set the WebGLRenderingContext's viewport. + * @param x - X position of viewport + * @param y - Y position of viewport + * @param width - Width of viewport + * @param height - Height of viewport + */ + FramebufferSystem.prototype.setViewport = function (x, y, width, height) { + var v = this.viewport; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { + v.x = x; + v.y = y; + v.width = width; + v.height = height; + this.gl.viewport(x, y, width, height); + } + }; + Object.defineProperty(FramebufferSystem.prototype, "size", { + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * @readonly + */ + get: function () { + if (this.current) { + // TODO store temp + return { x: 0, y: 0, width: this.current.width, height: this.current.height }; + } + return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; + }, + enumerable: false, + configurable: true + }); + /** + * Clear the color of the context + * @param r - Red value from 0 to 1 + * @param g - Green value from 0 to 1 + * @param b - Blue value from 0 to 1 + * @param a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { + if (mask === void 0) { mask = constants.BUFFER_BITS.COLOR | constants.BUFFER_BITS.DEPTH; } + var gl = this.gl; + // TODO clear color can be set only one right? + gl.clearColor(r, g, b, a); + gl.clear(mask); + }; + /** + * Initialize framebuffer for this context + * @protected + * @param framebuffer + * @returns - created GLFramebuffer + */ + FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = new GLFramebuffer(gl.createFramebuffer()); + fbo.multisample = this.detectSamples(framebuffer.multisample); + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; + this.managedFramebuffers.push(framebuffer); + framebuffer.disposeRunner.add(this); + return fbo; + }; + /** + * Resize the framebuffer + * @param framebuffer + * @protected + */ + FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (fbo.msaaBuffer) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + } + if (fbo.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + } + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + } + if (framebuffer.depthTexture && this.writeDepthTexture) { + this.renderer.texture.bind(framebuffer.depthTexture, 0); + } + }; + /** + * Update the framebuffer + * @param framebuffer + * @param mipLevel + * @protected + */ + FramebufferSystem.prototype.updateFramebuffer = function (framebuffer, mipLevel) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + // bind the color texture + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer)) { + fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); + } + else if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + fbo.msaaBuffer = null; + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + fbo.blitFramebuffer = null; + } + } + var activeTextures = []; + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + if (i === 0 && fbo.msaaBuffer) { + continue; + } + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + activeTextures.push(gl.COLOR_ATTACHMENT0 + i); + } + if (activeTextures.length > 1) { + gl.drawBuffers(activeTextures); + } + if (framebuffer.depthTexture) { + var writeDepthTexture = this.writeDepthTexture; + if (writeDepthTexture) { + var depthTexture = framebuffer.depthTexture; + this.renderer.texture.bind(depthTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + } + } + if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture)) { + fbo.stencil = fbo.stencil || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); + } + else if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + fbo.stencil = null; + } + }; + /** + * Returns true if the frame buffer can be multisampled. + * @param framebuffer + */ + FramebufferSystem.prototype.canMultisampleFramebuffer = function (framebuffer) { + return this.renderer.context.webGLVersion !== 1 + && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture; + }; + /** + * Detects number of samples that is not more than a param but as close to it as possible + * @param samples - number of samples + * @returns - recommended number of samples + */ + FramebufferSystem.prototype.detectSamples = function (samples) { + var msaaSamples = this.msaaSamples; + var res = constants.MSAA_QUALITY.NONE; + if (samples <= 1 || msaaSamples === null) { + return res; + } + for (var i = 0; i < msaaSamples.length; i++) { + if (msaaSamples[i] <= samples) { + res = msaaSamples[i]; + break; + } + } + if (res === 1) { + res = constants.MSAA_QUALITY.NONE; + } + return res; + }; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * @param framebuffer - by default it blits "into itself", from renderBuffer to texture. + * @param sourcePixels - source rectangle in pixels + * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { + var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (renderer.context.webGLVersion !== 2) { + return; + } + if (!current) { + return; + } + var fbo = current.glFramebuffers[CONTEXT_UID]; + if (!fbo) { + return; + } + if (!framebuffer) { + if (!fbo.msaaBuffer) { + return; + } + var colorTexture = current.colorTextures[0]; + if (!colorTexture) { + return; + } + if (!fbo.blitFramebuffer) { + fbo.blitFramebuffer = new Framebuffer(current.width, current.height); + fbo.blitFramebuffer.addColorTexture(0, colorTexture); + } + framebuffer = fbo.blitFramebuffer; + if (framebuffer.colorTextures[0] !== colorTexture) { + framebuffer.colorTextures[0] = colorTexture; + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + } + if (framebuffer.width !== current.width || framebuffer.height !== current.height) { + framebuffer.width = current.width; + framebuffer.height = current.height; + framebuffer.dirtyId++; + framebuffer.dirtySize++; + } + } + if (!sourcePixels) { + sourcePixels = tempRectangle; + sourcePixels.width = current.width; + sourcePixels.height = current.height; + } + if (!destPixels) { + destPixels = sourcePixels; + } + var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; + this.bind(framebuffer); + gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); + gl.blitFramebuffer(sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom, destPixels.left, destPixels.top, destPixels.right, destPixels.bottom, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); + }; + /** + * Disposes framebuffer. + * @param framebuffer - framebuffer that has to be disposed of + * @param contextLost - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + var gl = this.gl; + if (!fbo) { + return; + } + delete framebuffer.glFramebuffers[this.CONTEXT_UID]; + var index = this.managedFramebuffers.indexOf(framebuffer); + if (index >= 0) { + this.managedFramebuffers.splice(index, 1); + } + framebuffer.disposeRunner.remove(this); + if (!contextLost) { + gl.deleteFramebuffer(fbo.framebuffer); + if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + } + if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + } + } + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + } + }; + /** + * Disposes all framebuffers, but not textures bound to them. + * @param [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeAll = function (contextLost) { + var list = this.managedFramebuffers; + this.managedFramebuffers = []; + for (var i = 0; i < list.length; i++) { + this.disposeFramebuffer(list[i], contextLost); + } + }; + /** + * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. + * Used by MaskSystem, when its time to use stencil mask for Graphics element. + * + * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. + * @private + */ + FramebufferSystem.prototype.forceStencil = function () { + var framebuffer = this.current; + if (!framebuffer) { + return; + } + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (!fbo || fbo.stencil) { + return; + } + framebuffer.stencil = true; + var w = framebuffer.width; + var h = framebuffer.height; + var gl = this.gl; + var stencil = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); + } + fbo.stencil = stencil; + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); + }; + /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */ + FramebufferSystem.prototype.reset = function () { + this.current = this.unknownFramebuffer; + this.viewport = new math.Rectangle(); + }; + FramebufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + return FramebufferSystem; +}()); + +var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; +/** + * System plugin to the renderer to manage geometry. + * @memberof PIXI + */ +var GeometrySystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function GeometrySystem(renderer) { + this.renderer = renderer; + this._activeGeometry = null; + this._activeVao = null; + this.hasVao = true; + this.hasInstance = true; + this.canUseUInt32ElementIndex = false; + this.managedGeometries = {}; + } + /** Sets up the renderer context and necessary buffers. */ + GeometrySystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + var context = this.renderer.context; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + // webgl2 + if (context.webGLVersion !== 2) { + // webgl 1! + var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + nativeVaoExtension_1 = null; + } + if (nativeVaoExtension_1) { + gl.createVertexArray = function () { + return nativeVaoExtension_1.createVertexArrayOES(); + }; + gl.bindVertexArray = function (vao) { + return nativeVaoExtension_1.bindVertexArrayOES(vao); + }; + gl.deleteVertexArray = function (vao) { + return nativeVaoExtension_1.deleteVertexArrayOES(vao); + }; + } + else { + this.hasVao = false; + gl.createVertexArray = function () { + return null; + }; + gl.bindVertexArray = function () { + return null; + }; + gl.deleteVertexArray = function () { + return null; + }; + } + } + if (context.webGLVersion !== 2) { + var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); + if (instanceExt_1) { + gl.vertexAttribDivisor = function (a, b) { + return instanceExt_1.vertexAttribDivisorANGLE(a, b); + }; + gl.drawElementsInstanced = function (a, b, c, d, e) { + return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); + }; + gl.drawArraysInstanced = function (a, b, c, d) { + return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); + }; + } + else { + this.hasInstance = false; + } + } + this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; + }; + /** + * Binds geometry so that is can be drawn. Creating a Vao if required + * @param geometry - Instance of geometry to bind. + * @param shader - Instance of shader to use vao for. + */ + GeometrySystem.prototype.bind = function (geometry, shader) { + shader = shader || this.renderer.shader.shader; + var gl = this.gl; + // not sure the best way to address this.. + // currently different shaders require different VAOs for the same geometry + // Still mulling over the best way to solve this one.. + // will likely need to modify the shader attribute locations at run time! + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var incRefCount = false; + if (!vaos) { + this.managedGeometries[geometry.id] = geometry; + geometry.disposeRunner.add(this); + geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; + incRefCount = true; + } + var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount); + this._activeGeometry = geometry; + if (this._activeVao !== vao) { + this._activeVao = vao; + if (this.hasVao) { + gl.bindVertexArray(vao); + } + else { + this.activateVao(geometry, shader.program); + } + } + // TODO - optimise later! + // don't need to loop through if nothing changed! + // maybe look to add an 'autoupdate' to geometry? + this.updateBuffers(); + }; + /** Reset and unbind any active VAO and geometry. */ + GeometrySystem.prototype.reset = function () { + this.unbind(); + }; + /** Update buffers of the currently bound geometry. */ + GeometrySystem.prototype.updateBuffers = function () { + var geometry = this._activeGeometry; + var bufferSystem = this.renderer.buffer; + for (var i = 0; i < geometry.buffers.length; i++) { + var buffer = geometry.buffers[i]; + bufferSystem.update(buffer); + } + }; + /** + * Check compatibility between a geometry and a program + * @param geometry - Geometry instance. + * @param program - Program instance. + */ + GeometrySystem.prototype.checkCompatibility = function (geometry, program) { + // geometry must have at least all the attributes that the shader requires. + var geometryAttributes = geometry.attributes; + var shaderAttributes = program.attributeData; + for (var j in shaderAttributes) { + if (!geometryAttributes[j]) { + throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); + } + } + }; + /** + * Takes a geometry and program and generates a unique signature for them. + * @param geometry - To get signature from. + * @param program - To test geometry against. + * @returns - Unique signature of the geometry and program + */ + GeometrySystem.prototype.getSignature = function (geometry, program) { + var attribs = geometry.attributes; + var shaderAttributes = program.attributeData; + var strings = ['g', geometry.id]; + for (var i in attribs) { + if (shaderAttributes[i]) { + strings.push(i, shaderAttributes[i].location); + } + } + return strings.join('-'); + }; + /** + * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. + * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the + * attribute locations. + * @param geometry - Instance of geometry to to generate Vao for. + * @param shader - Instance of the shader. + * @param incRefCount - Increment refCount of all geometry buffers. + */ + GeometrySystem.prototype.initGeometryVao = function (geometry, shader, incRefCount) { + if (incRefCount === void 0) { incRefCount = true; } + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var program = shader.program; + if (!program.glPrograms[CONTEXT_UID]) { + this.renderer.shader.generateProgram(shader); + } + this.checkCompatibility(geometry, program); + var signature = this.getSignature(geometry, program); + var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var vao = vaoObjectHash[signature]; + if (vao) { + // this will give us easy access to the vao + vaoObjectHash[program.id] = vao; + return vao; + } + var buffers = geometry.buffers; + var attributes = geometry.attributes; + var tempStride = {}; + var tempStart = {}; + for (var j in buffers) { + tempStride[j] = 0; + tempStart[j] = 0; + } + for (var j in attributes) { + if (!attributes[j].size && program.attributeData[j]) { + attributes[j].size = program.attributeData[j].size; + } + else if (!attributes[j].size) { + console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line + } + tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type]; + } + for (var j in attributes) { + var attribute = attributes[j]; + var attribSize = attribute.size; + if (attribute.stride === undefined) { + if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type]) { + attribute.stride = 0; + } + else { + attribute.stride = tempStride[attribute.buffer]; + } + } + if (attribute.start === undefined) { + attribute.start = tempStart[attribute.buffer]; + tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type]; + } + } + vao = gl.createVertexArray(); + gl.bindVertexArray(vao); + // first update - and create the buffers! + // only create a gl buffer if it actually gets + for (var i = 0; i < buffers.length; i++) { + var buffer = buffers[i]; + bufferSystem.bind(buffer); + if (incRefCount) { + buffer._glBuffers[CONTEXT_UID].refCount++; + } + } + // TODO - maybe make this a data object? + // lets wait to see if we need to first! + this.activateVao(geometry, program); + this._activeVao = vao; + // add it to the cache! + vaoObjectHash[program.id] = vao; + vaoObjectHash[signature] = vao; + return vao; + }; + /** + * Disposes geometry. + * @param geometry - Geometry with buffers. Only VAO will be disposed + * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { + var _a; + if (!this.managedGeometries[geometry.id]) { + return; + } + delete this.managedGeometries[geometry.id]; + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var gl = this.gl; + var buffers = geometry.buffers; + var bufferSystem = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.buffer; + geometry.disposeRunner.remove(this); + if (!vaos) { + return; + } + // bufferSystem may have already been destroyed.. + // if this is the case, there is no need to destroy the geometry buffers... + // they already have been! + if (bufferSystem) { + for (var i = 0; i < buffers.length; i++) { + var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; + // my be null as context may have changed right before the dispose is called + if (buf) { + buf.refCount--; + if (buf.refCount === 0 && !contextLost) { + bufferSystem.dispose(buffers[i], contextLost); + } + } + } + } + if (!contextLost) { + for (var vaoId in vaos) { + // delete only signatures, everything else are copies + if (vaoId[0] === 'g') { + var vao = vaos[vaoId]; + if (this._activeVao === vao) { + this.unbind(); + } + gl.deleteVertexArray(vao); + } + } + } + delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; + }; + /** + * Dispose all WebGL resources of all managed geometries. + * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + GeometrySystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedGeometries); + for (var i = 0; i < all.length; i++) { + this.disposeGeometry(this.managedGeometries[all[i]], contextLost); + } + }; + /** + * Activate vertex array object. + * @param geometry - Geometry instance. + * @param program - Shader program instance. + */ + GeometrySystem.prototype.activateVao = function (geometry, program) { + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var buffers = geometry.buffers; + var attributes = geometry.attributes; + if (geometry.indexBuffer) { + // first update the index buffer if we have one.. + bufferSystem.bind(geometry.indexBuffer); + } + var lastBuffer = null; + // add a new one! + for (var j in attributes) { + var attribute = attributes[j]; + var buffer = buffers[attribute.buffer]; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (program.attributeData[j]) { + if (lastBuffer !== glBuffer) { + bufferSystem.bind(buffer); + lastBuffer = glBuffer; + } + var location = program.attributeData[j].location; + // TODO introduce state again + // we can optimise this for older devices that have no VAOs + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); + if (attribute.instance) { + // TODO calculate instance count based of this... + if (this.hasInstance) { + gl.vertexAttribDivisor(location, 1); + } + else { + throw new Error('geometry error, GPU Instancing is not supported on this device'); + } + } + } + } + }; + /** + * Draws the currently bound geometry. + * @param type - The type primitive to render. + * @param size - The number of elements to be rendered. If not specified, all vertices after the + * starting vertex will be drawn. + * @param start - The starting vertex in the geometry to start drawing from. If not specified, + * drawing will start from the first vertex. + * @param instanceCount - The number of instances of the set of elements to execute. If not specified, + * all instances will be drawn. + */ + GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { + var gl = this.gl; + var geometry = this._activeGeometry; + // TODO.. this should not change so maybe cache the function? + if (geometry.indexBuffer) { + var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; + var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; + if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { + if (geometry.instanced) { + /* eslint-disable max-len */ + gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); + /* eslint-enable max-len */ + } + else { + /* eslint-disable max-len */ + gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); + /* eslint-enable max-len */ + } + } + else { + console.warn('unsupported index buffer type: uint32'); + } + } + else if (geometry.instanced) { + // TODO need a better way to calculate size.. + gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); + } + else { + gl.drawArrays(type, start, size || geometry.getSize()); + } + return this; + }; + /** Unbind/reset everything. */ + GeometrySystem.prototype.unbind = function () { + this.gl.bindVertexArray(null); + this._activeVao = null; + this._activeGeometry = null; + }; + GeometrySystem.prototype.destroy = function () { + this.renderer = null; + }; + return GeometrySystem; +}()); + +/** + * Component for masked elements. + * + * Holds mask mode and temporary data about current mask. + * @memberof PIXI + */ +var MaskData = /** @class */ (function () { + /** + * Create MaskData + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask + */ + function MaskData(maskObject) { + if (maskObject === void 0) { maskObject = null; } + this.type = constants.MASK_TYPES.NONE; + this.autoDetect = true; + this.maskObject = maskObject || null; + this.pooled = false; + this.isMaskData = true; + this.resolution = null; + this.multisample = settings.settings.FILTER_MULTISAMPLE; + this.enabled = true; + this.colorMask = 0xf; + this._filters = null; + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + this._scissorRectLocal = null; + this._colorMask = 0xf; + this._target = null; + } + Object.defineProperty(MaskData.prototype, "filter", { + /** + * The sprite mask filter. + * If set to `null`, the default sprite mask filter is used. + * @default null + */ + get: function () { + return this._filters ? this._filters[0] : null; + }, + set: function (value) { + if (value) { + if (this._filters) { + this._filters[0] = value; + } + else { + this._filters = [value]; + } + } + else { + this._filters = null; + } + }, + enumerable: false, + configurable: true + }); + /** Resets the mask data after popMask(). */ + MaskData.prototype.reset = function () { + if (this.pooled) { + this.maskObject = null; + this.type = constants.MASK_TYPES.NONE; + this.autoDetect = true; + } + this._target = null; + this._scissorRectLocal = null; + }; + /** + * Copies counters from maskData above, called from pushMask(). + * @param maskAbove + */ + MaskData.prototype.copyCountersOrReset = function (maskAbove) { + if (maskAbove) { + this._stencilCounter = maskAbove._stencilCounter; + this._scissorCounter = maskAbove._scissorCounter; + this._scissorRect = maskAbove._scissorRect; + } + else { + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + } + }; + return MaskData; +}()); + +/** + * @private + * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram} + * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param {string} src - The vertex shader source as an array of strings. + * @returns {WebGLShader} the shader + */ +function compileShader(gl, type, src) { + var shader = gl.createShader(type); + gl.shaderSource(shader, src); + gl.compileShader(shader); + return shader; +} + +/** + * will log a shader error highlighting the lines with the error + * also will add numbers along the side. + * @param gl - the WebGLContext + * @param shader - the shader to log errors for + */ +function logPrettyShaderError(gl, shader) { + var shaderSrc = gl.getShaderSource(shader) + .split('\n') + .map(function (line, index) { return index + ": " + line; }); + var shaderLog = gl.getShaderInfoLog(shader); + var splitShader = shaderLog.split('\n'); + var dedupe = {}; + var lineNumbers = splitShader.map(function (line) { return parseFloat(line.replace(/^ERROR\: 0\:([\d]+)\:.*$/, '$1')); }) + .filter(function (n) { + if (n && !dedupe[n]) { + dedupe[n] = true; + return true; + } + return false; + }); + var logArgs = ['']; + lineNumbers.forEach(function (number) { + shaderSrc[number - 1] = "%c" + shaderSrc[number - 1] + "%c"; + logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px'); + }); + var fragmentSourceToLog = shaderSrc + .join('\n'); + logArgs[0] = fragmentSourceToLog; + console.error(shaderLog); + // eslint-disable-next-line no-console + console.groupCollapsed('click to view full shader code'); + console.warn.apply(console, logArgs); + // eslint-disable-next-line no-console + console.groupEnd(); +} +/** + * + * logs out any program errors + * @param gl - The current WebGL context + * @param program - the WebGL program to display errors for + * @param vertexShader - the fragment WebGL shader program + * @param fragmentShader - the vertex WebGL shader program + */ +function logProgramError(gl, program, vertexShader, fragmentShader) { + // if linking fails, then log and cleanup + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, vertexShader); + } + if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, fragmentShader); + } + console.error('PixiJS Error: Could not initialize shader.'); + // if there is a program info log, log it + if (gl.getProgramInfoLog(program) !== '') { + console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); + } + } +} + +function booleanArray(size) { + var array = new Array(size); + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + return array; +} +/** + * @method defaultValue + * @memberof PIXI.glCore.shader + * @param {string} type - Type of value + * @param {number} size + * @private + */ +function defaultValue(type, size) { + switch (type) { + case 'float': + return 0; + case 'vec2': + return new Float32Array(2 * size); + case 'vec3': + return new Float32Array(3 * size); + case 'vec4': + return new Float32Array(4 * size); + case 'int': + case 'uint': + case 'sampler2D': + case 'sampler2DArray': + return 0; + case 'ivec2': + return new Int32Array(2 * size); + case 'ivec3': + return new Int32Array(3 * size); + case 'ivec4': + return new Int32Array(4 * size); + case 'uvec2': + return new Uint32Array(2 * size); + case 'uvec3': + return new Uint32Array(3 * size); + case 'uvec4': + return new Uint32Array(4 * size); + case 'bool': + return false; + case 'bvec2': + return booleanArray(2 * size); + case 'bvec3': + return booleanArray(3 * size); + case 'bvec4': + return booleanArray(4 * size); + case 'mat2': + return new Float32Array([1, 0, + 0, 1]); + case 'mat3': + return new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + case 'mat4': + return new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + } + return null; +} + +var unknownContext = {}; +var context = unknownContext; +/** + * returns a little WebGL context to use for program inspection. + * @static + * @private + * @returns {WebGLRenderingContext} a gl context to test with + */ +function getTestContext() { + if (context === unknownContext || (context && context.isContextLost())) { + var canvas = settings.settings.ADAPTER.createCanvas(); + var gl = void 0; + if (settings.settings.PREFER_ENV >= constants.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', {}); + } + if (!gl) { + gl = (canvas.getContext('webgl', {}) + || canvas.getContext('experimental-webgl', {})); + if (!gl) { + // fail, not able to get a context + gl = null; + } + else { + // for shader testing.. + gl.getExtension('WEBGL_draw_buffers'); + } + } + context = gl; + } + return context; +} + +var maxFragmentPrecision; +function getMaxFragmentPrecision() { + if (!maxFragmentPrecision) { + maxFragmentPrecision = constants.PRECISION.MEDIUM; + var gl = getTestContext(); + if (gl) { + if (gl.getShaderPrecisionFormat) { + var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); + maxFragmentPrecision = shaderFragment.precision ? constants.PRECISION.HIGH : constants.PRECISION.MEDIUM; + } + } + } + return maxFragmentPrecision; +} + +/** + * Sets the float precision on the shader, ensuring the device supports the request precision. + * If the precision is already present, it just ensures that the device is able to handle it. + * @private + * @param {string} src - The shader source + * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader. + * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports. + * @returns {string} modified shader source + */ +function setPrecision(src, requestedPrecision, maxSupportedPrecision) { + if (src.substring(0, 9) !== 'precision') { + // no precision supplied, so PixiJS will add the requested level. + var precision = requestedPrecision; + // If highp is requested but not supported, downgrade precision to a level all devices support. + if (requestedPrecision === constants.PRECISION.HIGH && maxSupportedPrecision !== constants.PRECISION.HIGH) { + precision = constants.PRECISION.MEDIUM; + } + return "precision " + precision + " float;\n" + src; + } + else if (maxSupportedPrecision !== constants.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { + // precision was supplied, but at a level this device does not support, so downgrading to mediump. + return src.replace('precision highp', 'precision mediump'); + } + return src; +} + +var GLSL_TO_SIZE = { + float: 1, + vec2: 2, + vec3: 3, + vec4: 4, + int: 1, + ivec2: 2, + ivec3: 3, + ivec4: 4, + uint: 1, + uvec2: 2, + uvec3: 3, + uvec4: 4, + bool: 1, + bvec2: 2, + bvec3: 3, + bvec4: 4, + mat2: 4, + mat3: 9, + mat4: 16, + sampler2D: 1, +}; +/** + * @private + * @method mapSize + * @memberof PIXI.glCore.shader + * @param {string} type + */ +function mapSize(type) { + return GLSL_TO_SIZE[type]; +} + +var GL_TABLE = null; +var GL_TO_GLSL_TYPES = { + FLOAT: 'float', + FLOAT_VEC2: 'vec2', + FLOAT_VEC3: 'vec3', + FLOAT_VEC4: 'vec4', + INT: 'int', + INT_VEC2: 'ivec2', + INT_VEC3: 'ivec3', + INT_VEC4: 'ivec4', + UNSIGNED_INT: 'uint', + UNSIGNED_INT_VEC2: 'uvec2', + UNSIGNED_INT_VEC3: 'uvec3', + UNSIGNED_INT_VEC4: 'uvec4', + BOOL: 'bool', + BOOL_VEC2: 'bvec2', + BOOL_VEC3: 'bvec3', + BOOL_VEC4: 'bvec4', + FLOAT_MAT2: 'mat2', + FLOAT_MAT3: 'mat3', + FLOAT_MAT4: 'mat4', + SAMPLER_2D: 'sampler2D', + INT_SAMPLER_2D: 'sampler2D', + UNSIGNED_INT_SAMPLER_2D: 'sampler2D', + SAMPLER_CUBE: 'samplerCube', + INT_SAMPLER_CUBE: 'samplerCube', + UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', + SAMPLER_2D_ARRAY: 'sampler2DArray', + INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', +}; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function mapType(gl, type) { + if (!GL_TABLE) { + var typeNames = Object.keys(GL_TO_GLSL_TYPES); + GL_TABLE = {}; + for (var i = 0; i < typeNames.length; ++i) { + var tn = typeNames[i]; + GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; + } + } + return GL_TABLE[type]; +} + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +// Parsers, each one of these will take a look at the type of shader property and uniform. +// if they pass the test function then the code function is called that returns a the shader upload code for that uniform. +// Shader upload code is automagically generated with these parsers. +// If no parser is valid then the default upload functions are used. +// exposing Parsers means that custom upload logic can be added to pixi's shaders. +// A good example would be a pixi rectangle can be directly set on a uniform. +// If the shader sees it it knows how to upload the rectangle structure as a vec4 +// format is as follows: +// +// { +// test: (data, uniform) => {} <--- test is this code should be used for this uniform +// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform +// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the +// uniform to a uniform buffer +// } +var uniformParsers = [ + // a float cache layer + { + test: function (data) { + return data.type === 'float' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; + }, + }, + // handling samplers + { + test: function (data, uniform) { + // eslint-disable-next-line max-len,no-eq-null,eqeqeq + return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined); + }, + code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, + }, + // uploading pixi matrix object to mat3 + { + test: function (data, uniform) { + return data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined; + }, + code: function (name) { + // TODO and some smart caching dirty ids here! + return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; + }, + codeUbo: function (name) { + return "\n var " + name + "_matrix = uv." + name + ".toArray(true);\n\n data[offset] = " + name + "_matrix[0];\n data[offset+1] = " + name + "_matrix[1];\n data[offset+2] = " + name + "_matrix[2];\n \n data[offset + 4] = " + name + "_matrix[3];\n data[offset + 5] = " + name + "_matrix[4];\n data[offset + 6] = " + name + "_matrix[5];\n \n data[offset + 8] = " + name + "_matrix[6];\n data[offset + 9] = " + name + "_matrix[7];\n data[offset + 10] = " + name + "_matrix[8];\n "; + }, + }, + // uploading a pixi point as a vec2 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "; + } + }, + // caching layer for a vec2 + { + test: function (data) { + return data.type === 'vec2' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; + }, + }, + // upload a pixi rectangle as a vec4 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "; + } + }, + // a caching layer for vec4 uploading + { + test: function (data) { + return data.type === 'vec4' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; + }, + } ]; + +// cu = Cached value's uniform data field +// cv = Cached value +// v = value to upload +// ud = uniformData +// uv = uniformValue +// l = location +var GLSL_TO_SINGLE_SETTERS_CACHED = { + float: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }", + vec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }", + vec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", + vec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }", + int: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + ivec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + ivec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + ivec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + uint: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }", + uvec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }", + uvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }", + uvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }", + bool: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }", + bvec2: "\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + bvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + bvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + mat2: 'gl.uniformMatrix2fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + sampler2D: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + samplerCube: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + sampler2DArray: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", +}; +var GLSL_TO_ARRAY_SETTERS = { + float: "gl.uniform1fv(location, v)", + vec2: "gl.uniform2fv(location, v)", + vec3: "gl.uniform3fv(location, v)", + vec4: 'gl.uniform4fv(location, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + int: 'gl.uniform1iv(location, v)', + ivec2: 'gl.uniform2iv(location, v)', + ivec3: 'gl.uniform3iv(location, v)', + ivec4: 'gl.uniform4iv(location, v)', + uint: 'gl.uniform1uiv(location, v)', + uvec2: 'gl.uniform2uiv(location, v)', + uvec3: 'gl.uniform3uiv(location, v)', + uvec4: 'gl.uniform4uiv(location, v)', + bool: 'gl.uniform1iv(location, v)', + bvec2: 'gl.uniform2iv(location, v)', + bvec3: 'gl.uniform3iv(location, v)', + bvec4: 'gl.uniform4iv(location, v)', + sampler2D: 'gl.uniform1iv(location, v)', + samplerCube: 'gl.uniform1iv(location, v)', + sampler2DArray: 'gl.uniform1iv(location, v)', +}; +function generateUniformsSync(group, uniformData) { + var _a; + var funcFragments = ["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "]; + for (var i in group.uniforms) { + var data = uniformData[i]; + if (!data) { + if ((_a = group.uniforms[i]) === null || _a === void 0 ? void 0 : _a.group) { + if (group.uniforms[i].ubo) { + funcFragments.push("\n renderer.shader.syncUniformBufferGroup(uv." + i + ", '" + i + "');\n "); + } + else { + funcFragments.push("\n renderer.shader.syncUniformGroup(uv." + i + ", syncData);\n "); + } + } + continue; + } + var uniform = group.uniforms[i]; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + if (uniformParsers[j].test(data, uniform)) { + funcFragments.push(uniformParsers[j].code(i, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + var templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; + var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); + funcFragments.push("\n cu = ud[\"" + i + "\"];\n cv = cu.value;\n v = uv[\"" + i + "\"];\n " + template + ";"); + } + } + /* + * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly + * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used + * no matter which group is being used + * + */ + // eslint-disable-next-line no-new-func + return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); +} + +var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' ].join('\n'); +function generateIfTestSrc(maxIfs) { + var src = ''; + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxIfs - 1) { + src += "if(test == " + i + ".0){}"; + } + } + return src; +} +function checkMaxIfStatementsInShader(maxIfs, gl) { + if (maxIfs === 0) { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + var shader = gl.createShader(gl.FRAGMENT_SHADER); + while (true) // eslint-disable-line no-constant-condition + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + maxIfs = (maxIfs / 2) | 0; + } + else { + // valid! + break; + } + } + return maxIfs; +} + +// Cache the result to prevent running this over and over +var unsafeEval; +/** + * Not all platforms allow to generate function code (e.g., `new Function`). + * this provides the platform-level detection. + * @private + * @returns {boolean} `true` if `new Function` is supported. + */ +function unsafeEvalSupported() { + if (typeof unsafeEval === 'boolean') { + return unsafeEval; + } + try { + /* eslint-disable no-new-func */ + var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); + /* eslint-enable no-new-func */ + unsafeEval = func({ a: 'b' }, 'a', 'b') === true; + } + catch (e) { + unsafeEval = false; + } + return unsafeEval; +} + +var defaultFragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; + +var defaultVertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; + +var UID$1 = 0; +var nameCache = {}; +/** + * Helper class to create a shader program. + * @memberof PIXI + */ +var Program = /** @class */ (function () { + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + */ + function Program(vertexSrc, fragmentSrc, name) { + if (name === void 0) { name = 'pixi-shader'; } + this.id = UID$1++; + this.vertexSrc = vertexSrc || Program.defaultVertexSrc; + this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; + this.vertexSrc = this.vertexSrc.trim(); + this.fragmentSrc = this.fragmentSrc.trim(); + if (this.vertexSrc.substring(0, 8) !== '#version') { + name = name.replace(/\s+/g, '-'); + if (nameCache[name]) { + nameCache[name]++; + name += "-" + nameCache[name]; + } + else { + nameCache[name] = 1; + } + this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; + this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; + this.vertexSrc = setPrecision(this.vertexSrc, settings.settings.PRECISION_VERTEX, constants.PRECISION.HIGH); + this.fragmentSrc = setPrecision(this.fragmentSrc, settings.settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); + } + // currently this does not extract structs only default types + // this is where we store shader references.. + this.glPrograms = {}; + this.syncUniforms = null; + } + Object.defineProperty(Program, "defaultVertexSrc", { + /** + * The default vertex shader source. + * @constant + */ + get: function () { + return defaultVertex$3; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Program, "defaultFragmentSrc", { + /** + * The default fragment shader source. + * @constant + */ + get: function () { + return defaultFragment$2; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a program based of a vertex and fragment shader. + * + * This method will also check to see if there is a cached program. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + * @returns A shiny new PixiJS shader program! + */ + Program.from = function (vertexSrc, fragmentSrc, name) { + var key = vertexSrc + fragmentSrc; + var program = utils.ProgramCache[key]; + if (!program) { + utils.ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); + } + return program; + }; + return Program; +}()); + +/** + * A helper class for shaders. + * @memberof PIXI + */ +var Shader = /** @class */ (function () { + /** + * @param program - The program the shader will use. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Shader(program, uniforms) { + /** + * Used internally to bind uniform buffer objects. + * @ignore + */ + this.uniformBindCount = 0; + this.program = program; + // lets see whats been passed in + // uniforms should be converted to a uniform group + if (uniforms) { + if (uniforms instanceof UniformGroup) { + this.uniformGroup = uniforms; + } + else { + this.uniformGroup = new UniformGroup(uniforms); + } + } + else { + this.uniformGroup = new UniformGroup({}); + } + this.disposeRunner = new runner.Runner('disposeShader'); + } + // TODO move to shader system.. + Shader.prototype.checkUniformExists = function (name, group) { + if (group.uniforms[name]) { + return true; + } + for (var i in group.uniforms) { + var uniform = group.uniforms[i]; + if (uniform.group) { + if (this.checkUniformExists(name, uniform)) { + return true; + } + } + } + return false; + }; + Shader.prototype.destroy = function () { + // usage count on programs? + // remove if not used! + this.uniformGroup = null; + this.disposeRunner.emit(this); + this.disposeRunner.destroy(); + }; + Object.defineProperty(Shader.prototype, "uniforms", { + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms`. + * @readonly + */ + get: function () { + return this.uniformGroup.uniforms; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a shader based of a vertex and fragment shader. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + * @returns A shiny new PixiJS shader! + */ + Shader.from = function (vertexSrc, fragmentSrc, uniforms) { + var program = Program.from(vertexSrc, fragmentSrc); + return new Shader(program, uniforms); + }; + return Shader; +}()); + +/* eslint-disable max-len */ +var BLEND$1 = 0; +var OFFSET$1 = 1; +var CULLING$1 = 2; +var DEPTH_TEST$1 = 3; +var WINDING$1 = 4; +var DEPTH_MASK$1 = 5; +/** + * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}. + * + * Each mesh rendered may require WebGL to be in a different state. + * For example you may want different blend mode or to enable polygon offsets + * @memberof PIXI + */ +var State = /** @class */ (function () { + function State() { + this.data = 0; + this.blendMode = constants.BLEND_MODES.NORMAL; + this.polygonOffset = 0; + this.blend = true; + this.depthMask = true; + // this.depthTest = true; + } + Object.defineProperty(State.prototype, "blend", { + /** + * Activates blending of the computed fragment color values. + * @default true + */ + get: function () { + return !!(this.data & (1 << BLEND$1)); + }, + set: function (value) { + if (!!(this.data & (1 << BLEND$1)) !== value) { + this.data ^= (1 << BLEND$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "offsets", { + /** + * Activates adding an offset to depth values of polygon's fragments + * @default false + */ + get: function () { + return !!(this.data & (1 << OFFSET$1)); + }, + set: function (value) { + if (!!(this.data & (1 << OFFSET$1)) !== value) { + this.data ^= (1 << OFFSET$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "culling", { + /** + * Activates culling of polygons. + * @default false + */ + get: function () { + return !!(this.data & (1 << CULLING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << CULLING$1)) !== value) { + this.data ^= (1 << CULLING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthTest", { + /** + * Activates depth comparisons and updates to the depth buffer. + * @default false + */ + get: function () { + return !!(this.data & (1 << DEPTH_TEST$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_TEST$1)) !== value) { + this.data ^= (1 << DEPTH_TEST$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthMask", { + /** + * Enables or disables writing to the depth buffer. + * @default true + */ + get: function () { + return !!(this.data & (1 << DEPTH_MASK$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_MASK$1)) !== value) { + this.data ^= (1 << DEPTH_MASK$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "clockwiseFrontFace", { + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @default false + */ + get: function () { + return !!(this.data & (1 << WINDING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << WINDING$1)) !== value) { + this.data ^= (1 << WINDING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "blendMode", { + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this._blendMode; + }, + set: function (value) { + this.blend = (value !== constants.BLEND_MODES.NONE); + this._blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "polygonOffset", { + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * @default 0 + */ + get: function () { + return this._polygonOffset; + }, + set: function (value) { + this.offsets = !!value; + this._polygonOffset = value; + }, + enumerable: false, + configurable: true + }); + State.prototype.toString = function () { + return "[@pixi/core:State " + + ("blendMode=" + this.blendMode + " ") + + ("clockwiseFrontFace=" + this.clockwiseFrontFace + " ") + + ("culling=" + this.culling + " ") + + ("depthMask=" + this.depthMask + " ") + + ("polygonOffset=" + this.polygonOffset) + + "]"; + }; + State.for2d = function () { + var state = new State(); + state.depthTest = false; + state.blend = true; + return state; + }; + return State; +}()); + +var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; + +var defaultVertex$2 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + +/** + * A filter is a special shader that applies post-processing effects to an input texture and writes into an output + * render-target. + * + * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the + * {@link PIXI.filters.BlurFilter BlurFilter}. + * + * ### Usage + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. + * + * ``` + * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); + * const container = new PIXI.Container(); + * container.filters = [filter]; + * ``` + * + * ### Previous Version Differences + * + * In PixiJS **v3**, a filter was always applied to _whole screen_. + * + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers had to create a set of uniforms to deal with coordinates. + * + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. + * + * Also be aware that we have changed default vertex shader, please consult + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * ### Frames + * + * The following table summarizes the coordinate spaces used in the filtering pipeline: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Coordinate SpaceDescription
Texture Coordinates + * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along + * both axes. + *
World Space + * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space). + *
Physical Pixels + * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture + * coordinates by the dimensions of the texture. + *
+ * + * ### Built-in Uniforms + * + * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, + * and `projectionMatrix` uniform maps it to the gl viewport. + * + * **uSampler** + * + * The most important uniform is the input texture that container was rendered into. + * _Important note: as with all Framebuffers in PixiJS, both input and output are + * premultiplied by alpha._ + * + * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. + * Use it to sample the input. + * + * ``` + * const fragment = ` + * varying vec2 vTextureCoord; + * uniform sampler2D uSampler; + * void main(void) + * { + * gl_FragColor = texture2D(uSampler, vTextureCoord); + * } + * `; + * + * const myFilter = new PIXI.Filter(null, fragment); + * ``` + * + * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. + * + * **outputFrame** + * + * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. + * It's the same as `renderer.screen` for a fullscreen filter. + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, + * `(0, 0, outputFrame.width, outputFrame.height)`, + * + * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. + * To calculate vertex position in screen space using normalized (0-1) space: + * + * ``` + * vec4 filterVertexPosition( void ) + * { + * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + * } + * ``` + * + * **inputSize** + * + * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary framebuffer that holds input. + * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. + * + * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. + * + * To calculate input normalized coordinate, you have to map it to filter normalized space. + * Multiply by `outputFrame.zw` to get input coordinate. + * Divide by `inputSize.xy` to get input normalized coordinate. + * + * ``` + * vec2 filterTextureCoord( void ) + * { + * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy + * } + * ``` + * **resolution** + * + * The `resolution` is the ratio of screen (CSS) pixels to real pixels. + * + * **inputPixel** + * + * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` + * `inputPixel.zw` is inverted `inputPixel.xy`. + * + * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. + * + * **inputClamp** + * + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. + * For displacements, coordinates has to be clamped. + * + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer + * `inputClamp.zw` is bottom-right pixel center. + * + * ``` + * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw)) + * ``` + * OR + * ``` + * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) + * ``` + * + * ### Additional Information + * + * Complete documentation on Filter usage is located in the + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. + * @memberof PIXI + */ +var Filter = /** @class */ (function (_super) { + __extends(Filter, _super); + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); + _this = _super.call(this, program, uniforms) || this; + _this.padding = 0; + _this.resolution = settings.settings.FILTER_RESOLUTION; + _this.multisample = settings.settings.FILTER_MULTISAMPLE; + _this.enabled = true; + _this.autoFit = true; + _this.state = new State(); + return _this; + } + /** + * Applies the filter + * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it. + * @param {object} [_currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { + // do as you please! + filterManager.applyFilter(this, input, output, clearMode); + // or just do a regular render.. + }; + Object.defineProperty(Filter.prototype, "blendMode", { + /** + * Sets the blend mode of the filter. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.state.blendMode; + }, + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter.prototype, "resolution", { + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + */ + get: function () { + return this._resolution; + }, + set: function (value) { + this._resolution = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultVertexSrc", { + /** + * The default vertex shader source + * @constant + */ + get: function () { + return defaultVertex$2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultFragmentSrc", { + /** + * The default fragment shader source + * @constant + */ + get: function () { + return defaultFragment$1; + }, + enumerable: false, + configurable: true + }); + return Filter; +}(Shader)); + +var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; + +var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; + +var tempMat = new math.Matrix(); +/** + * Class controls uv mapping from Texture normal space to BaseTexture normal space. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. + * + * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * Takes track of Texture changes through `_lastTextureID` private field. + * Use `update()` method call to track it from outside. + * @see PIXI.Texture + * @see PIXI.Mesh + * @see PIXI.TilingSprite + * @memberof PIXI + */ +var TextureMatrix = /** @class */ (function () { + /** + * @param texture - observed texture + * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + */ + function TextureMatrix(texture, clampMargin) { + this._texture = texture; + this.mapCoord = new math.Matrix(); + this.uClampFrame = new Float32Array(4); + this.uClampOffset = new Float32Array(2); + this._textureID = -1; + this._updateID = 0; + this.clampOffset = 0; + this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; + this.isSimple = false; + } + Object.defineProperty(TextureMatrix.prototype, "texture", { + /** Texture property. */ + get: function () { + return this._texture; + }, + set: function (value) { + this._texture = value; + this._textureID = -1; + }, + enumerable: false, + configurable: true + }); + /** + * Multiplies uvs array to transform + * @param uvs - mesh uvs + * @param [out=uvs] - output + * @returns - output + */ + TextureMatrix.prototype.multiplyUvs = function (uvs, out) { + if (out === undefined) { + out = uvs; + } + var mat = this.mapCoord; + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + out[i] = (x * mat.a) + (y * mat.c) + mat.tx; + out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; + } + return out; + }; + /** + * Updates matrices if texture was changed. + * @param [forceUpdate=false] - if true, matrices will be updated any case + * @returns - Whether or not it was updated + */ + TextureMatrix.prototype.update = function (forceUpdate) { + var tex = this._texture; + if (!tex || !tex.valid) { + return false; + } + if (!forceUpdate + && this._textureID === tex._updateID) { + return false; + } + this._textureID = tex._updateID; + this._updateID++; + var uvs = tex._uvs; + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + var orig = tex.orig; + var trim = tex.trim; + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + this.isSimple = tex._frame.width === texBase.width + && tex._frame.height === texBase.height + && tex.rotate === 0; + return true; + }; + return TextureMatrix; +}()); + +/** + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. + * @memberof PIXI + */ +var SpriteMaskFilter = /** @class */ (function (_super) { + __extends(SpriteMaskFilter, _super); + /** @ignore */ + function SpriteMaskFilter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var sprite = null; + if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined) { + sprite = vertexSrc; + vertexSrc = undefined; + fragmentSrc = undefined; + uniforms = undefined; + } + _this = _super.call(this, vertexSrc || vertex, fragmentSrc || fragment, uniforms) || this; + _this.maskSprite = sprite; + _this.maskMatrix = new math.Matrix(); + return _this; + } + Object.defineProperty(SpriteMaskFilter.prototype, "maskSprite", { + /** + * Sprite mask + * @type {PIXI.DisplayObject} + */ + get: function () { + return this._maskSprite; + }, + set: function (value) { + this._maskSprite = value; + if (this._maskSprite) { + this._maskSprite.renderable = false; + } + }, + enumerable: false, + configurable: true + }); + /** + * Applies the filter + * @param filterManager - The renderer to retrieve the filter from + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it. + */ + SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { + var maskSprite = this._maskSprite; + var tex = maskSprite._texture; + if (!tex.valid) { + return; + } + if (!tex.uvMatrix) { + // margin = 0.0, let it bleed a bit, shader code becomes easier + // assuming that atlas textures were made with 1-pixel padding + tex.uvMatrix = new TextureMatrix(tex, 0.0); + } + tex.uvMatrix.update(); + this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; + this.uniforms.mask = tex; + // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` + this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) + .prepend(tex.uvMatrix.mapCoord); + this.uniforms.alpha = maskSprite.worldAlpha; + this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; + filterManager.applyFilter(this, input, output, clearMode); + }; + return SpriteMaskFilter; +}(Filter)); + +/** + * System plugin to the renderer to manage masks. + * + * There are three built-in types of masking: + * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is + * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular. + * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil + * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does + * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks. + * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's + * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this + * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins. + * + * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics` + * object with just a rectangle drawn. + * + * ## Mask Stacks + * + * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask + * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e. + * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target. + * @memberof PIXI + */ +var MaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function MaskSystem(renderer) { + this.renderer = renderer; + this.enableScissor = true; + this.alphaMaskPool = []; + this.maskDataPool = []; + this.maskStack = []; + this.alphaMaskIndex = 0; + } + /** + * Changes the mask stack that is used by this System. + * @param maskStack - The mask stack + */ + MaskSystem.prototype.setMaskStack = function (maskStack) { + this.maskStack = maskStack; + this.renderer.scissor.setMaskStack(maskStack); + this.renderer.stencil.setMaskStack(maskStack); + }; + /** + * Enables the mask and appends it to the current mask stack. + * + * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked. + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data. + */ + MaskSystem.prototype.push = function (target, maskDataOrTarget) { + var maskData = maskDataOrTarget; + if (!maskData.isMaskData) { + var d = this.maskDataPool.pop() || new MaskData(); + d.pooled = true; + d.maskObject = maskDataOrTarget; + maskData = d; + } + var maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + maskData.copyCountersOrReset(maskAbove); + maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf; + if (maskData.autoDetect) { + this.detect(maskData); + } + maskData._target = target; + if (maskData.type !== constants.MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + if (maskData.enabled) { + switch (maskData.type) { + case constants.MASK_TYPES.SCISSOR: + this.renderer.scissor.push(maskData); + break; + case constants.MASK_TYPES.STENCIL: + this.renderer.stencil.push(maskData); + break; + case constants.MASK_TYPES.SPRITE: + maskData.copyCountersOrReset(null); + this.pushSpriteMask(maskData); + break; + case constants.MASK_TYPES.COLOR: + this.pushColorMask(maskData); + break; + } + } + if (maskData.type === constants.MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + }; + /** + * Removes the last mask from the mask stack and doesn't return it. + * + * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed. + * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from + */ + MaskSystem.prototype.pop = function (target) { + var maskData = this.maskStack.pop(); + if (!maskData || maskData._target !== target) { + // TODO: add an assert when we have it + return; + } + if (maskData.enabled) { + switch (maskData.type) { + case constants.MASK_TYPES.SCISSOR: + this.renderer.scissor.pop(maskData); + break; + case constants.MASK_TYPES.STENCIL: + this.renderer.stencil.pop(maskData.maskObject); + break; + case constants.MASK_TYPES.SPRITE: + this.popSpriteMask(maskData); + break; + case constants.MASK_TYPES.COLOR: + this.popColorMask(maskData); + break; + } + } + maskData.reset(); + if (maskData.pooled) { + this.maskDataPool.push(maskData); + } + if (this.maskStack.length !== 0) { + var maskCurrent = this.maskStack[this.maskStack.length - 1]; + if (maskCurrent.type === constants.MASK_TYPES.SPRITE && maskCurrent._filters) { + maskCurrent._filters[0].maskSprite = maskCurrent.maskObject; + } + } + }; + /** + * Sets type of MaskData based on its maskObject. + * @param maskData + */ + MaskSystem.prototype.detect = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject) { + maskData.type = constants.MASK_TYPES.COLOR; + } + else if (maskObject.isSprite) { + maskData.type = constants.MASK_TYPES.SPRITE; + } + else if (this.enableScissor && this.renderer.scissor.testScissor(maskData)) { + maskData.type = constants.MASK_TYPES.SCISSOR; + } + else { + maskData.type = constants.MASK_TYPES.STENCIL; + } + }; + /** + * Applies the Mask and adds it to the current filter stack. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.pushSpriteMask = function (maskData) { + var _a, _b; + var maskObject = maskData.maskObject; + var target = maskData._target; + var alphaMaskFilter = maskData._filters; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()]; + } + } + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var resolution; + var multisample; + if (renderTextureSystem.current) { + var renderTexture = renderTextureSystem.current; + resolution = maskData.resolution || renderTexture.resolution; + multisample = (_a = maskData.multisample) !== null && _a !== void 0 ? _a : renderTexture.multisample; + } + else { + resolution = maskData.resolution || renderer.resolution; + multisample = (_b = maskData.multisample) !== null && _b !== void 0 ? _b : renderer.multisample; + } + alphaMaskFilter[0].resolution = resolution; + alphaMaskFilter[0].multisample = multisample; + alphaMaskFilter[0].maskSprite = maskObject; + var stashFilterArea = target.filterArea; + target.filterArea = maskObject.getBounds(true); + renderer.filter.push(target, alphaMaskFilter); + target.filterArea = stashFilterArea; + if (!maskData._filters) { + this.alphaMaskIndex++; + } + }; + /** + * Removes the last filter from the filter stack and doesn't return it. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.popSpriteMask = function (maskData) { + this.renderer.filter.pop(); + if (maskData._filters) { + maskData._filters[0].maskSprite = null; + } + else { + this.alphaMaskIndex--; + this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null; + } + }; + /** + * Pushes the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.pushColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + /** + * Pops the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.popColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = this.maskStack.length > 0 + ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + MaskSystem.prototype.destroy = function () { + this.renderer = null; + }; + return MaskSystem; +}()); + +/** + * System plugin to the renderer to manage specific types of masking operations. + * @memberof PIXI + */ +var AbstractMaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function AbstractMaskSystem(renderer) { + this.renderer = renderer; + this.maskStack = []; + this.glConst = 0; + } + /** Gets count of masks of certain type. */ + AbstractMaskSystem.prototype.getStackLength = function () { + return this.maskStack.length; + }; + /** + * Changes the mask stack that is used by this System. + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { + var gl = this.renderer.gl; + var curStackLen = this.getStackLength(); + this.maskStack = maskStack; + var newStackLen = this.getStackLength(); + if (newStackLen !== curStackLen) { + if (newStackLen === 0) { + gl.disable(this.glConst); + } + else { + gl.enable(this.glConst); + this._useCurrent(); + } + } + }; + /** + * Setup renderer to use the current mask data. + * @private + */ + AbstractMaskSystem.prototype._useCurrent = function () { + // OVERWRITE; + }; + /** Destroys the mask stack. */ + AbstractMaskSystem.prototype.destroy = function () { + this.renderer = null; + this.maskStack = null; + }; + return AbstractMaskSystem; +}()); + +var tempMatrix$1 = new math.Matrix(); +var rectPool = []; +/** + * System plugin to the renderer to manage scissor masking. + * + * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer + * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically + * by this system. + * @memberof PIXI + */ +var ScissorSystem = /** @class */ (function (_super) { + __extends(ScissorSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ScissorSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST; + return _this; + } + ScissorSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._scissorCounter; + } + return 0; + }; + /** + * evaluates _boundsTransformed, _scissorRect for MaskData + * @param maskData + */ + ScissorSystem.prototype.calcScissorRect = function (maskData) { + var _a; + if (maskData._scissorRectLocal) { + return; + } + var prevData = maskData._scissorRect; + var maskObject = maskData.maskObject; + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var rect = maskObject.getBounds(true, (_a = rectPool.pop()) !== null && _a !== void 0 ? _a : new math.Rectangle()); + this.roundFrameToPixels(rect, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + if (prevData) { + rect.fit(prevData); + } + maskData._scissorRectLocal = rect; + }; + ScissorSystem.isMatrixRotated = function (matrix) { + if (!matrix) { + return false; + } + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)); + }; + /** + * Test, whether the object can be scissor mask with current renderer projection. + * Calls "calcScissorRect()" if its true. + * @param maskData - mask data + * @returns whether Whether the object can be scissor mask + */ + ScissorSystem.prototype.testScissor = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject.isFastRect || !maskObject.isFastRect()) { + return false; + } + if (ScissorSystem.isMatrixRotated(maskObject.worldTransform)) { + return false; + } + if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform)) { + return false; + } + this.calcScissorRect(maskData); + var rect = maskData._scissorRectLocal; + return rect.width > 0 && rect.height > 0; + }; + ScissorSystem.prototype.roundFrameToPixels = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (ScissorSystem.isMatrixRotated(transform)) { + return; + } + transform = transform ? tempMatrix$1.copyFrom(transform) : tempMatrix$1.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.renderer.filter.transformAABB(transform, frame); + frame.fit(bindingDestinationFrame); + frame.x = Math.round(frame.x * resolution); + frame.y = Math.round(frame.y * resolution); + frame.width = Math.round(frame.width * resolution); + frame.height = Math.round(frame.height * resolution); + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @author alvin + * @param maskData - The mask data. + */ + ScissorSystem.prototype.push = function (maskData) { + if (!maskData._scissorRectLocal) { + this.calcScissorRect(maskData); + } + var gl = this.renderer.gl; + if (!maskData._scissorRect) { + gl.enable(gl.SCISSOR_TEST); + } + maskData._scissorCounter++; + maskData._scissorRect = maskData._scissorRectLocal; + this._useCurrent(); + }; + /** + * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the + * last mask in the stack. + * + * This can also be called when you directly modify the scissor box and want to restore PixiJS state. + * @param maskData - The mask data. + */ + ScissorSystem.prototype.pop = function (maskData) { + var gl = this.renderer.gl; + if (maskData) { + rectPool.push(maskData._scissorRectLocal); + } + if (this.getStackLength() > 0) { + this._useCurrent(); + } + else { + gl.disable(gl.SCISSOR_TEST); + } + }; + /** + * Setup renderer to use the current scissor data. + * @private + */ + ScissorSystem.prototype._useCurrent = function () { + var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; + var y; + if (this.renderer.renderTexture.current) { + y = rect.y; + } + else { + // flipY. In future we'll have it over renderTextures as an option + y = this.renderer.height - rect.height - rect.y; + } + this.renderer.gl.scissor(rect.x, y, rect.width, rect.height); + }; + return ScissorSystem; +}(AbstractMaskSystem)); + +/** + * System plugin to the renderer to manage stencils (used for masks). + * @memberof PIXI + */ +var StencilSystem = /** @class */ (function (_super) { + __extends(StencilSystem, _super); + /** + * @param renderer - The renderer this System works for. + */ + function StencilSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST; + return _this; + } + StencilSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._stencilCounter; + } + return 0; + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @param maskData - The mask data + */ + StencilSystem.prototype.push = function (maskData) { + var maskObject = maskData.maskObject; + var gl = this.renderer.gl; + var prevMaskCount = maskData._stencilCounter; + if (prevMaskCount === 0) { + // force use stencil texture in current framebuffer + this.renderer.framebuffer.forceStencil(); + gl.clearStencil(0); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.enable(gl.STENCIL_TEST); + } + maskData._stencilCounter++; + var colorMask = maskData._colorMask; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Increment the reference stencil value where the new mask overlaps with the old ones. + gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 1) !== 0, (colorMask & 2) !== 0, (colorMask & 4) !== 0, (colorMask & 8) !== 0); + } + this._useCurrent(); + }; + /** + * Pops stencil mask. MaskData is already removed from stack + * @param {PIXI.DisplayObject} maskObject - object of popped mask data + */ + StencilSystem.prototype.pop = function (maskObject) { + var gl = this.renderer.gl; + if (this.getStackLength() === 0) { + // the stack is empty! + gl.disable(gl.STENCIL_TEST); + } + else { + var maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + var colorMask = maskData ? maskData._colorMask : 0xf; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Decrement the reference stencil value where the popped mask overlaps with the other ones + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 0x1) !== 0, (colorMask & 0x2) !== 0, (colorMask & 0x4) !== 0, (colorMask & 0x8) !== 0); + } + this._useCurrent(); + } + }; + /** + * Setup renderer to use the current stencil data. + * @private + */ + StencilSystem.prototype._useCurrent = function () { + var gl = this.renderer.gl; + gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + }; + return StencilSystem; +}(AbstractMaskSystem)); + +/** + * System plugin to the renderer to manage the projection matrix. + * + * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to + * normalized device coordinates. + * @memberof PIXI + */ +var ProjectionSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ProjectionSystem(renderer) { + this.renderer = renderer; + this.destinationFrame = null; + this.sourceFrame = null; + this.defaultFrame = null; + this.projectionMatrix = new math.Matrix(); + this.transform = null; + } + /** + * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided. + * + * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because + * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates. + * + * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected + * that you dirty the current bindings when calling this manually. + * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas, + * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left. + * @param sourceFrame - The rectangle in world space that contains the contents being rendered. + * @param resolution - The resolution of the render-target, which is the ratio of + * world-space (or CSS) pixels to physical pixels. + * @param root - Whether the render-target is the screen. This is required because rendering to textures + * is y-flipped (i.e. upside down relative to the screen). + */ + ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { + this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; + this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; + // Calculate object-space to clip-space projection + this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); + if (this.transform) { + this.projectionMatrix.append(this.transform); + } + var renderer = this.renderer; + renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; + renderer.globalUniforms.update(); + // this will work for now + // but would be sweet to stick and even on the global uniforms.. + if (renderer.shader.shader) { + renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); + } + }; + /** + * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`. + * @param _destinationFrame - The destination frame in the render-target. + * @param sourceFrame - The source frame in world space. + * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels. + * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection + * is y-flipped. + */ + ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { + var pm = this.projectionMatrix; + var sign = !root ? 1 : -1; + pm.identity(); + pm.a = (1 / sourceFrame.width * 2); + pm.d = sign * (1 / sourceFrame.height * 2); + pm.tx = -1 - (sourceFrame.x * pm.a); + pm.ty = -sign - (sourceFrame.y * pm.d); + }; + /** + * Sets the transform of the active render target to the given matrix. + * @param _matrix - The transformation matrix + */ + ProjectionSystem.prototype.setTransform = function (_matrix) { + // this._activeRenderTarget.transform = matrix; + }; + ProjectionSystem.prototype.destroy = function () { + this.renderer = null; + }; + return ProjectionSystem; +}()); + +// Temporary rectangle for assigned sourceFrame or destinationFrame +var tempRect = new math.Rectangle(); +// Temporary rectangle for renderTexture destinationFrame +var tempRect2 = new math.Rectangle(); +/* eslint-disable max-len */ +/** + * System plugin to the renderer to manage render textures. + * + * Should be added after FramebufferSystem + * + * ### Frames + * + * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different + * coordinate spaces used: + * + * | Frame | Description | Coordinate System | + * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- | + * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left | + * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. | + * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. | + * @memberof PIXI + */ +var RenderTextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function RenderTextureSystem(renderer) { + this.renderer = renderer; + this.clearColor = renderer._backgroundColorRgba; + this.defaultMaskStack = []; + this.current = null; + this.sourceFrame = new math.Rectangle(); + this.destinationFrame = new math.Rectangle(); + this.viewportFrame = new math.Rectangle(); + } + /** + * Bind the current render texture. + * @param renderTexture - RenderTexture to bind, by default its `null` - the screen. + * @param sourceFrame - Part of world that is mapped to the renderTexture. + * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame. + */ + RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { + if (renderTexture === void 0) { renderTexture = null; } + var renderer = this.renderer; + this.current = renderTexture; + var baseTexture; + var framebuffer; + var resolution; + if (renderTexture) { + baseTexture = renderTexture.baseTexture; + resolution = baseTexture.resolution; + if (!sourceFrame) { + tempRect.width = renderTexture.frame.width; + tempRect.height = renderTexture.frame.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + tempRect2.x = renderTexture.frame.x; + tempRect2.y = renderTexture.frame.y; + tempRect2.width = sourceFrame.width; + tempRect2.height = sourceFrame.height; + destinationFrame = tempRect2; + } + framebuffer = baseTexture.framebuffer; + } + else { + resolution = renderer.resolution; + if (!sourceFrame) { + tempRect.width = renderer.screen.width; + tempRect.height = renderer.screen.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + destinationFrame = tempRect; + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + } + } + var viewportFrame = this.viewportFrame; + viewportFrame.x = destinationFrame.x * resolution; + viewportFrame.y = destinationFrame.y * resolution; + viewportFrame.width = destinationFrame.width * resolution; + viewportFrame.height = destinationFrame.height * resolution; + if (!renderTexture) { + viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height); + } + viewportFrame.ceil(); + this.renderer.framebuffer.bind(framebuffer, viewportFrame); + this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); + if (renderTexture) { + this.renderer.mask.setMaskStack(baseTexture.maskStack); + } + else { + this.renderer.mask.setMaskStack(this.defaultMaskStack); + } + this.sourceFrame.copyFrom(sourceFrame); + this.destinationFrame.copyFrom(destinationFrame); + }; + /** + * Erases the render texture and fills the drawing area with a colour. + * @param clearColor - The color as rgba, default to use the renderer backgroundColor + * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + RenderTextureSystem.prototype.clear = function (clearColor, mask) { + if (this.current) { + clearColor = clearColor || this.current.baseTexture.clearColor; + } + else { + clearColor = clearColor || this.clearColor; + } + var destinationFrame = this.destinationFrame; + var baseFrame = this.current ? this.current.baseTexture : this.renderer.screen; + var clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height; + if (clearMask) { + var _a = this.viewportFrame, x = _a.x, y = _a.y, width = _a.width, height = _a.height; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + // TODO: ScissorSystem should cache whether the scissor test is enabled or not. + this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST); + this.renderer.gl.scissor(x, y, width, height); + } + this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); + if (clearMask) { + // Restore the scissor box + this.renderer.scissor.pop(); + } + }; + RenderTextureSystem.prototype.resize = function () { + // resize the root only! + this.bind(null); + }; + /** Resets render-texture state. */ + RenderTextureSystem.prototype.reset = function () { + this.bind(null); + }; + RenderTextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return RenderTextureSystem; +}()); + +function uboUpdate(_ud, _uv, _renderer, _syncData, buffer) { + _renderer.buffer.update(buffer); +} +// cv = CachedValue +// v = value +// ud = uniformData +// uv = uniformValue +// l = location +var UBO_TO_SINGLE_SETTERS = { + float: "\n data[offset] = v;\n ", + vec2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n ", + vec3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ", + vec4: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ", + mat2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ", + mat3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ", + mat4: "\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n " +}; +var GLSL_TO_STD40_SIZE = { + float: 4, + vec2: 8, + vec3: 12, + vec4: 16, + int: 4, + ivec2: 8, + ivec3: 12, + ivec4: 16, + uint: 4, + uvec2: 8, + uvec3: 12, + uvec4: 16, + bool: 4, + bvec2: 8, + bvec3: 12, + bvec4: 16, + mat2: 16 * 2, + mat3: 16 * 3, + mat4: 16 * 4, +}; +/** + * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js + * rewrote it, but this was a great starting point to get a solid understanding of whats going on :) + * @ignore + * @param uniformData + */ +function createUBOElements(uniformData) { + var uboElements = uniformData.map(function (data) { + return ({ + data: data, + offset: 0, + dataLen: 0, + dirty: 0 + }); + }); + var size = 0; + var chunkSize = 0; + var offset = 0; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + size = GLSL_TO_STD40_SIZE[uboElement.data.type]; + if (uboElement.data.size > 1) { + size = Math.max(size, 16) * uboElement.data.size; + } + uboElement.dataLen = size; + // add some size offset.. + // must align to the nearest 16 bytes or internally nearest round size + if (chunkSize % size !== 0 && chunkSize < 16) { + // diff required to line up.. + var lineUpValue = (chunkSize % size) % 16; + chunkSize += lineUpValue; + offset += lineUpValue; + } + if ((chunkSize + size) > 16) { + offset = Math.ceil(offset / 16) * 16; + uboElement.offset = offset; + offset += size; + chunkSize = size; + } + else { + uboElement.offset = offset; + chunkSize += size; + offset += size; + } + } + offset = Math.ceil(offset / 16) * 16; + return { uboElements: uboElements, size: offset }; +} +function getUBOData(uniforms, uniformData) { + var usedUniformDatas = []; + // build.. + for (var i in uniforms) { + if (uniformData[i]) { + usedUniformDatas.push(uniformData[i]); + } + } + // sort them out by index! + usedUniformDatas.sort(function (a, b) { return a.index - b.index; }); + return usedUniformDatas; +} +function generateUniformBufferSync(group, uniformData) { + if (!group.autoManage) { + // if the group is nott automatically managed, we don't need to generate a special function for it... + return { size: 0, syncFunc: uboUpdate }; + } + var usedUniformDatas = getUBOData(group.uniforms, uniformData); + var _a = createUBOElements(usedUniformDatas), uboElements = _a.uboElements, size = _a.size; + var funcFragments = ["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "]; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + var uniform = group.uniforms[uboElement.data.name]; + var name = uboElement.data.name; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + var uniformParser = uniformParsers[j]; + if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform)) { + funcFragments.push("offset = " + uboElement.offset / 4 + ";", uniformParsers[j].codeUbo(uboElement.data.name, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + if (uboElement.data.size > 1) { + var size_1 = mapSize(uboElement.data.type); + var rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1); + var elementSize = size_1 / rowSize; + var remainder = (4 - (elementSize % 4)) % 4; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n\n t = 0;\n\n for(var i=0; i < " + uboElement.data.size * rowSize + "; i++)\n {\n for(var j = 0; j < " + elementSize + "; j++)\n {\n data[offset++] = v[t++];\n }\n offset += " + remainder + ";\n }\n\n "); + } + else { + var template = UBO_TO_SINGLE_SETTERS[uboElement.data.type]; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n " + template + ";\n "); + } + } + } + funcFragments.push("\n renderer.buffer.update(buffer);\n "); + return { + size: size, + // eslint-disable-next-line no-new-func + syncFunc: new Function('ud', 'uv', 'renderer', 'syncData', 'buffer', funcFragments.join('\n')) + }; +} + +/** + * @private + */ +var IGLUniformData = /** @class */ (function () { + function IGLUniformData() { + } + return IGLUniformData; +}()); +/** + * Helper class to create a WebGL Program + * @memberof PIXI + */ +var GLProgram = /** @class */ (function () { + /** + * Makes a new Pixi program. + * @param program - webgl program + * @param uniformData - uniforms + */ + function GLProgram(program, uniformData) { + this.program = program; + this.uniformData = uniformData; + this.uniformGroups = {}; + this.uniformDirtyGroups = {}; + this.uniformBufferBindings = {}; + } + /** Destroys this program. */ + GLProgram.prototype.destroy = function () { + this.uniformData = null; + this.uniformGroups = null; + this.uniformDirtyGroups = null; + this.uniformBufferBindings = null; + this.program = null; + }; + return GLProgram; +}()); + +/** + * returns the attribute data from the program + * @private + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context + * @returns {object} the attribute data for this program + */ +function getAttributeData(program, gl) { + var attributes = {}; + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + if (attribData.name.indexOf('gl_') === 0) { + continue; + } + var type = mapType(gl, attribData.type); + var data = { + type: type, + name: attribData.name, + size: mapSize(type), + location: gl.getAttribLocation(program, attribData.name), + }; + attributes[attribData.name] = data; + } + return attributes; +} + +/** + * returns the uniform data from the program + * @private + * @param program - the webgl program + * @param gl - the WebGL context + * @returns {object} the uniform data for this program + */ +function getUniformData(program, gl) { + var uniforms = {}; + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]$/, ''); + var isArray = !!(uniformData.name.match(/\[.*?\]$/)); + var type = mapType(gl, uniformData.type); + uniforms[name] = { + name: name, + index: i, + type: type, + size: uniformData.size, + isArray: isArray, + value: defaultValue(type, uniformData.size), + }; + } + return uniforms; +} + +/** + * generates a WebGL Program object from a high level Pixi Program. + * @param gl - a rendering context on which to generate the program + * @param program - the high level Pixi Program. + */ +function generateProgram(gl, program) { + var glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc); + var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc); + var webGLProgram = gl.createProgram(); + gl.attachShader(webGLProgram, glVertShader); + gl.attachShader(webGLProgram, glFragShader); + gl.linkProgram(webGLProgram); + if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) { + logProgramError(gl, webGLProgram, glVertShader, glFragShader); + } + program.attributeData = getAttributeData(webGLProgram, gl); + program.uniformData = getUniformData(webGLProgram, gl); + // GLSL 1.00: bind attributes sorted by name in ascending order + // GLSL 3.00: don't change the attribute locations that where chosen by the compiler + // or assigned by the layout specifier in the shader source code + if (!(/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m).test(program.vertexSrc)) { + var keys = Object.keys(program.attributeData); + keys.sort(function (a, b) { return (a > b) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow + for (var i = 0; i < keys.length; i++) { + program.attributeData[keys[i]].location = i; + gl.bindAttribLocation(webGLProgram, i, keys[i]); + } + gl.linkProgram(webGLProgram); + } + gl.deleteShader(glVertShader); + gl.deleteShader(glFragShader); + var uniformData = {}; + for (var i in program.uniformData) { + var data = program.uniformData[i]; + uniformData[i] = { + location: gl.getUniformLocation(webGLProgram, i), + value: defaultValue(data.type, data.size), + }; + } + var glProgram = new GLProgram(webGLProgram, uniformData); + return glProgram; +} + +var UID = 0; +// default sync data so we don't create a new one each time! +var defaultSyncData = { textureCount: 0, uboCount: 0 }; +/** + * System plugin to the renderer to manage shaders. + * @memberof PIXI + */ +var ShaderSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ShaderSystem(renderer) { + this.destroyed = false; + this.renderer = renderer; + // Validation check that this environment support `new Function` + this.systemCheck(); + this.gl = null; + this.shader = null; + this.program = null; + this.cache = {}; + this._uboCache = {}; + this.id = UID++; + } + /** + * Overrideable function by `@pixi/unsafe-eval` to silence + * throwing an error if platform doesn't support unsafe-evals. + * @private + */ + ShaderSystem.prototype.systemCheck = function () { + if (!unsafeEvalSupported()) { + throw new Error('Current environment does not allow unsafe-eval, ' + + 'please use @pixi/unsafe-eval module to enable support.'); + } + }; + ShaderSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.reset(); + }; + /** + * Changes the current shader to the one given in parameter. + * @param shader - the new shader + * @param dontSync - false if the shader should automatically sync its uniforms. + * @returns the glProgram that belongs to the shader. + */ + ShaderSystem.prototype.bind = function (shader, dontSync) { + shader.disposeRunner.add(this); + shader.uniforms.globals = this.renderer.globalUniforms; + var program = shader.program; + var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader); + this.shader = shader; + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. + if (this.program !== program) { + this.program = program; + this.gl.useProgram(glProgram.program); + } + if (!dontSync) { + defaultSyncData.textureCount = 0; + defaultSyncData.uboCount = 0; + this.syncUniformGroup(shader.uniformGroup, defaultSyncData); + } + return glProgram; + }; + /** + * Uploads the uniforms values to the currently bound shader. + * @param uniforms - the uniforms values that be applied to the current shader + */ + ShaderSystem.prototype.setUniforms = function (uniforms) { + var shader = this.shader.program; + var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; + shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); + }; + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /** + * Syncs uniforms on the group + * @param group - the uniform group to sync + * @param syncData - this is data that is passed to the sync function and any nested sync functions + */ + ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id]) { + glProgram.uniformDirtyGroups[group.id] = group.dirtyId; + this.syncUniforms(group, glProgram, syncData); + } + }; + /** + * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead. + * @param group + * @param glProgram + * @param syncData + */ + ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { + var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); + }; + ShaderSystem.prototype.createSyncGroups = function (group) { + var id = this.getSignature(group, this.shader.program.uniformData, 'u'); + if (!this.cache[id]) { + this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); + } + group.syncUniforms[this.shader.program.id] = this.cache[id]; + return group.syncUniforms[this.shader.program.id]; + }; + /** + * Syncs uniform buffers + * @param group - the uniform buffer group to sync + * @param name - the name of the uniform buffer + */ + ShaderSystem.prototype.syncUniformBufferGroup = function (group, name) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id]) { + group.dirtyId = 0; + var syncFunc = glProgram.uniformGroups[group.id] + || this.createSyncBufferGroup(group, glProgram, name); + // TODO wrap update in a cache?? + group.buffer.update(); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, defaultSyncData, group.buffer); + } + this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]); + }; + /** + * Will create a function that uploads a uniform buffer using the STD140 standard. + * The upload function will then be cached for future calls + * If a group is manually managed, then a simple upload function is generated + * @param group - the uniform buffer group to sync + * @param glProgram - the gl program to attach the uniform bindings to + * @param name - the name of the uniform buffer (must exist on the shader) + */ + ShaderSystem.prototype.createSyncBufferGroup = function (group, glProgram, name) { + var gl = this.renderer.gl; + this.renderer.buffer.bind(group.buffer); + // bind them... + var uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name); + glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount; + gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount); + this.shader.uniformBindCount++; + var id = this.getSignature(group, this.shader.program.uniformData, 'ubo'); + var uboData = this._uboCache[id]; + if (!uboData) { + uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData); + } + if (group.autoManage) { + var data = new Float32Array(uboData.size / 4); + group.buffer.update(data); + } + glProgram.uniformGroups[group.id] = uboData.syncFunc; + return glProgram.uniformGroups[group.id]; + }; + /** + * Takes a uniform group and data and generates a unique signature for them. + * @param group - The uniform group to get signature of + * @param group.uniforms + * @param uniformData - Uniform information generated by the shader + * @param preFix + * @returns Unique signature of the uniform group + */ + ShaderSystem.prototype.getSignature = function (group, uniformData, preFix) { + var uniforms = group.uniforms; + var strings = [preFix + "-"]; + for (var i in uniforms) { + strings.push(i); + if (uniformData[i]) { + strings.push(uniformData[i].type); + } + } + return strings.join('-'); + }; + /** + * Returns the underlying GLShade rof the currently bound shader. + * + * This can be handy for when you to have a little more control over the setting of your uniforms. + * @returns The glProgram for the currently bound Shader for this context + */ + ShaderSystem.prototype.getGlProgram = function () { + if (this.shader) { + return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; + } + return null; + }; + /** + * Generates a glProgram version of the Shader provided. + * @param shader - The shader that the glProgram will be based on. + * @returns A shiny new glProgram! + */ + ShaderSystem.prototype.generateProgram = function (shader) { + var gl = this.gl; + var program = shader.program; + var glProgram = generateProgram(gl, program); + program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; + return glProgram; + }; + /** Resets ShaderSystem state, does not affect WebGL state. */ + ShaderSystem.prototype.reset = function () { + this.program = null; + this.shader = null; + }; + /** + * Disposes shader. + * If disposing one equals with current shader, set current as null. + * @param shader - Shader object + */ + ShaderSystem.prototype.disposeShader = function (shader) { + if (this.shader === shader) { + this.shader = null; + } + }; + /** Destroys this System and removes all its textures. */ + ShaderSystem.prototype.destroy = function () { + this.renderer = null; + // TODO implement destroy method for ShaderSystem + this.destroyed = true; + }; + return ShaderSystem; +}()); + +/** + * Maps gl blend combinations to WebGL. + * @memberof PIXI + * @function mapWebGLBlendModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {number[][]} [array=[]] - The array to output into. + * @returns {number[][]} Mapped modes. + */ +function mapWebGLBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } + // TODO - premultiply alpha would be different. + // add a boolean for that! + array[constants.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; + array[constants.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.NONE] = [0, 0]; + // not-premultiplied blend modes + array[constants.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; + array[constants.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + // composite operations + array[constants.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; + array[constants.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; + array[constants.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; + array[constants.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; + array[constants.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; + array[constants.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; + array[constants.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + // SUBTRACT from flash + array[constants.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; + return array; +} + +var BLEND = 0; +var OFFSET = 1; +var CULLING = 2; +var DEPTH_TEST = 3; +var WINDING = 4; +var DEPTH_MASK = 5; +/** + * System plugin to the renderer to manage WebGL state machines. + * @memberof PIXI + */ +var StateSystem = /** @class */ (function () { + function StateSystem() { + this.gl = null; + this.stateId = 0; + this.polygonOffset = 0; + this.blendMode = constants.BLEND_MODES.NONE; + this._blendEq = false; + // map functions for when we set state.. + this.map = []; + this.map[BLEND] = this.setBlend; + this.map[OFFSET] = this.setOffset; + this.map[CULLING] = this.setCullFace; + this.map[DEPTH_TEST] = this.setDepthTest; + this.map[WINDING] = this.setFrontFace; + this.map[DEPTH_MASK] = this.setDepthMask; + this.checks = []; + this.defaultState = new State(); + this.defaultState.blend = true; + } + StateSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.blendModes = mapWebGLBlendModesToPixi(gl); + this.set(this.defaultState); + this.reset(); + }; + /** + * Sets the current state + * @param {*} state - The state to set. + */ + StateSystem.prototype.set = function (state) { + state = state || this.defaultState; + // TODO maybe to an object check? ( this.state === state )? + if (this.stateId !== state.data) { + var diff = this.stateId ^ state.data; + var i = 0; + // order from least to most common + while (diff) { + if (diff & 1) { + // state change! + this.map[i].call(this, !!(state.data & (1 << i))); + } + diff = diff >> 1; + i++; + } + this.stateId = state.data; + } + // based on the above settings we check for specific modes.. + // for example if blend is active we check and set the blend modes + // or of polygon offset is active we check the poly depth. + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + }; + /** + * Sets the state, when previous state is unknown. + * @param {*} state - The state to set + */ + StateSystem.prototype.forceState = function (state) { + state = state || this.defaultState; + for (var i = 0; i < this.map.length; i++) { + this.map[i].call(this, !!(state.data & (1 << i))); + } + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + this.stateId = state.data; + }; + /** + * Sets whether to enable or disable blending. + * @param value - Turn on or off WebGl blending. + */ + StateSystem.prototype.setBlend = function (value) { + this.updateCheck(StateSystem.checkBlendMode, value); + this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); + }; + /** + * Sets whether to enable or disable polygon offset fill. + * @param value - Turn on or off webgl polygon offset testing. + */ + StateSystem.prototype.setOffset = function (value) { + this.updateCheck(StateSystem.checkPolygonOffset, value); + this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); + }; + /** + * Sets whether to enable or disable depth test. + * @param value - Turn on or off webgl depth testing. + */ + StateSystem.prototype.setDepthTest = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); + }; + /** + * Sets whether to enable or disable depth mask. + * @param value - Turn on or off webgl depth mask. + */ + StateSystem.prototype.setDepthMask = function (value) { + this.gl.depthMask(value); + }; + /** + * Sets whether to enable or disable cull face. + * @param {boolean} value - Turn on or off webgl cull face. + */ + StateSystem.prototype.setCullFace = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); + }; + /** + * Sets the gl front face. + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + StateSystem.prototype.setFrontFace = function (value) { + this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); + }; + /** + * Sets the blend mode. + * @param {number} value - The blend mode to set to. + */ + StateSystem.prototype.setBlendMode = function (value) { + if (value === this.blendMode) { + return; + } + this.blendMode = value; + var mode = this.blendModes[value]; + var gl = this.gl; + if (mode.length === 2) { + gl.blendFunc(mode[0], mode[1]); + } + else { + gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); + } + if (mode.length === 6) { + this._blendEq = true; + gl.blendEquationSeparate(mode[4], mode[5]); + } + else if (this._blendEq) { + this._blendEq = false; + gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); + } + }; + /** + * Sets the polygon offset. + * @param {number} value - the polygon offset + * @param {number} scale - the polygon offset scale + */ + StateSystem.prototype.setPolygonOffset = function (value, scale) { + this.gl.polygonOffset(value, scale); + }; + // used + /** Resets all the logic and disables the VAOs. */ + StateSystem.prototype.reset = function () { + this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); + this.forceState(this.defaultState); + this._blendEq = true; + this.blendMode = -1; + this.setBlendMode(0); + }; + /** + * Checks to see which updates should be checked based on which settings have been activated. + * + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. + * The idea is that we only check what we have too. + * @param func - the checking function to add or remove + * @param value - should the check function be added or removed. + */ + StateSystem.prototype.updateCheck = function (func, value) { + var index = this.checks.indexOf(func); + if (value && index === -1) { + this.checks.push(func); + } + else if (!value && index !== -1) { + this.checks.splice(index, 1); + } + }; + /** + * A private little wrapper function that we call to check the blend mode. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkBlendMode = function (system, state) { + system.setBlendMode(state.blendMode); + }; + /** + * A private little wrapper function that we call to check the polygon offset. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkPolygonOffset = function (system, state) { + system.setPolygonOffset(1, state.polygonOffset); + }; + /** + * @ignore + */ + StateSystem.prototype.destroy = function () { + this.gl = null; + }; + return StateSystem; +}()); + +/** + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. + * @memberof PIXI + */ +var TextureGCSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function TextureGCSystem(renderer) { + this.renderer = renderer; + this.count = 0; + this.checkCount = 0; + this.maxIdle = settings.settings.GC_MAX_IDLE; + this.checkCountMax = settings.settings.GC_MAX_CHECK_COUNT; + this.mode = settings.settings.GC_MODE; + } + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.postrender = function () { + if (!this.renderer.renderingToScreen) { + return; + } + this.count++; + if (this.mode === constants.GC_MODES.MANUAL) { + return; + } + this.checkCount++; + if (this.checkCount > this.checkCountMax) { + this.checkCount = 0; + this.run(); + } + }; + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.run = function () { + var tm = this.renderer.texture; + var managedTextures = tm.managedTextures; + var wasRemoved = false; + for (var i = 0; i < managedTextures.length; i++) { + var texture = managedTextures[i]; + // only supports non generated textures at the moment! + if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { + tm.destroyTexture(texture, true); + managedTextures[i] = null; + wasRemoved = true; + } + } + if (wasRemoved) { + var j = 0; + for (var i = 0; i < managedTextures.length; i++) { + if (managedTextures[i] !== null) { + managedTextures[j++] = managedTextures[i]; + } + } + managedTextures.length = j; + } + }; + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + TextureGCSystem.prototype.unload = function (displayObject) { + var tm = this.renderer.texture; + var texture = displayObject._texture; + // only destroy non generated textures + if (texture && !texture.framebuffer) { + tm.destroyTexture(texture); + } + for (var i = displayObject.children.length - 1; i >= 0; i--) { + this.unload(displayObject.children[i]); + } + }; + TextureGCSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureGCSystem; +}()); + +/** + * Returns a lookup table that maps each type-format pair to a compatible internal format. + * @memberof PIXI + * @function mapTypeAndFormatToInternalFormat + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @returns Lookup table. + */ +function mapTypeAndFormatToInternalFormat(gl) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; + var table; + if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext) { + table = (_a = {}, + _a[constants.TYPES.UNSIGNED_BYTE] = (_b = {}, + _b[constants.FORMATS.RGBA] = gl.RGBA8, + _b[constants.FORMATS.RGB] = gl.RGB8, + _b[constants.FORMATS.RG] = gl.RG8, + _b[constants.FORMATS.RED] = gl.R8, + _b[constants.FORMATS.RGBA_INTEGER] = gl.RGBA8UI, + _b[constants.FORMATS.RGB_INTEGER] = gl.RGB8UI, + _b[constants.FORMATS.RG_INTEGER] = gl.RG8UI, + _b[constants.FORMATS.RED_INTEGER] = gl.R8UI, + _b[constants.FORMATS.ALPHA] = gl.ALPHA, + _b[constants.FORMATS.LUMINANCE] = gl.LUMINANCE, + _b[constants.FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _b), + _a[constants.TYPES.BYTE] = (_c = {}, + _c[constants.FORMATS.RGBA] = gl.RGBA8_SNORM, + _c[constants.FORMATS.RGB] = gl.RGB8_SNORM, + _c[constants.FORMATS.RG] = gl.RG8_SNORM, + _c[constants.FORMATS.RED] = gl.R8_SNORM, + _c[constants.FORMATS.RGBA_INTEGER] = gl.RGBA8I, + _c[constants.FORMATS.RGB_INTEGER] = gl.RGB8I, + _c[constants.FORMATS.RG_INTEGER] = gl.RG8I, + _c[constants.FORMATS.RED_INTEGER] = gl.R8I, + _c), + _a[constants.TYPES.UNSIGNED_SHORT] = (_d = {}, + _d[constants.FORMATS.RGBA_INTEGER] = gl.RGBA16UI, + _d[constants.FORMATS.RGB_INTEGER] = gl.RGB16UI, + _d[constants.FORMATS.RG_INTEGER] = gl.RG16UI, + _d[constants.FORMATS.RED_INTEGER] = gl.R16UI, + _d[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT16, + _d), + _a[constants.TYPES.SHORT] = (_e = {}, + _e[constants.FORMATS.RGBA_INTEGER] = gl.RGBA16I, + _e[constants.FORMATS.RGB_INTEGER] = gl.RGB16I, + _e[constants.FORMATS.RG_INTEGER] = gl.RG16I, + _e[constants.FORMATS.RED_INTEGER] = gl.R16I, + _e), + _a[constants.TYPES.UNSIGNED_INT] = (_f = {}, + _f[constants.FORMATS.RGBA_INTEGER] = gl.RGBA32UI, + _f[constants.FORMATS.RGB_INTEGER] = gl.RGB32UI, + _f[constants.FORMATS.RG_INTEGER] = gl.RG32UI, + _f[constants.FORMATS.RED_INTEGER] = gl.R32UI, + _f[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT24, + _f), + _a[constants.TYPES.INT] = (_g = {}, + _g[constants.FORMATS.RGBA_INTEGER] = gl.RGBA32I, + _g[constants.FORMATS.RGB_INTEGER] = gl.RGB32I, + _g[constants.FORMATS.RG_INTEGER] = gl.RG32I, + _g[constants.FORMATS.RED_INTEGER] = gl.R32I, + _g), + _a[constants.TYPES.FLOAT] = (_h = {}, + _h[constants.FORMATS.RGBA] = gl.RGBA32F, + _h[constants.FORMATS.RGB] = gl.RGB32F, + _h[constants.FORMATS.RG] = gl.RG32F, + _h[constants.FORMATS.RED] = gl.R32F, + _h[constants.FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT32F, + _h), + _a[constants.TYPES.HALF_FLOAT] = (_j = {}, + _j[constants.FORMATS.RGBA] = gl.RGBA16F, + _j[constants.FORMATS.RGB] = gl.RGB16F, + _j[constants.FORMATS.RG] = gl.RG16F, + _j[constants.FORMATS.RED] = gl.R16F, + _j), + _a[constants.TYPES.UNSIGNED_SHORT_5_6_5] = (_k = {}, + _k[constants.FORMATS.RGB] = gl.RGB565, + _k), + _a[constants.TYPES.UNSIGNED_SHORT_4_4_4_4] = (_l = {}, + _l[constants.FORMATS.RGBA] = gl.RGBA4, + _l), + _a[constants.TYPES.UNSIGNED_SHORT_5_5_5_1] = (_m = {}, + _m[constants.FORMATS.RGBA] = gl.RGB5_A1, + _m), + _a[constants.TYPES.UNSIGNED_INT_2_10_10_10_REV] = (_o = {}, + _o[constants.FORMATS.RGBA] = gl.RGB10_A2, + _o[constants.FORMATS.RGBA_INTEGER] = gl.RGB10_A2UI, + _o), + _a[constants.TYPES.UNSIGNED_INT_10F_11F_11F_REV] = (_p = {}, + _p[constants.FORMATS.RGB] = gl.R11F_G11F_B10F, + _p), + _a[constants.TYPES.UNSIGNED_INT_5_9_9_9_REV] = (_q = {}, + _q[constants.FORMATS.RGB] = gl.RGB9_E5, + _q), + _a[constants.TYPES.UNSIGNED_INT_24_8] = (_r = {}, + _r[constants.FORMATS.DEPTH_STENCIL] = gl.DEPTH24_STENCIL8, + _r), + _a[constants.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV] = (_s = {}, + _s[constants.FORMATS.DEPTH_STENCIL] = gl.DEPTH32F_STENCIL8, + _s), + _a); + } + else { + table = (_t = {}, + _t[constants.TYPES.UNSIGNED_BYTE] = (_u = {}, + _u[constants.FORMATS.RGBA] = gl.RGBA, + _u[constants.FORMATS.RGB] = gl.RGB, + _u[constants.FORMATS.ALPHA] = gl.ALPHA, + _u[constants.FORMATS.LUMINANCE] = gl.LUMINANCE, + _u[constants.FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _u), + _t[constants.TYPES.UNSIGNED_SHORT_5_6_5] = (_v = {}, + _v[constants.FORMATS.RGB] = gl.RGB, + _v), + _t[constants.TYPES.UNSIGNED_SHORT_4_4_4_4] = (_w = {}, + _w[constants.FORMATS.RGBA] = gl.RGBA, + _w), + _t[constants.TYPES.UNSIGNED_SHORT_5_5_5_1] = (_x = {}, + _x[constants.FORMATS.RGBA] = gl.RGBA, + _x), + _t); + } + return table; +} + +/** + * Internal texture for WebGL context. + * @memberof PIXI + */ +var GLTexture = /** @class */ (function () { + function GLTexture(texture) { + this.texture = texture; + this.width = -1; + this.height = -1; + this.dirtyId = -1; + this.dirtyStyleId = -1; + this.mipmap = false; + this.wrapMode = 33071; + this.type = constants.TYPES.UNSIGNED_BYTE; + this.internalFormat = constants.FORMATS.RGBA; + this.samplerType = 0; + } + return GLTexture; +}()); + +/** + * System plugin to the renderer to manage textures. + * @memberof PIXI + */ +var TextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this system works for. + */ + function TextureSystem(renderer) { + this.renderer = renderer; + // TODO set to max textures... + this.boundTextures = []; + this.currentLocation = -1; + this.managedTextures = []; + this._unknownBoundTextures = false; + this.unknownTexture = new BaseTexture(); + this.hasIntegerTextures = false; + } + /** Sets up the renderer context and necessary buffers. */ + TextureSystem.prototype.contextChange = function () { + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.webGLVersion = this.renderer.context.webGLVersion; + this.internalFormats = mapTypeAndFormatToInternalFormat(gl); + var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + this.boundTextures.length = maxTextures; + for (var i = 0; i < maxTextures; i++) { + this.boundTextures[i] = null; + } + // TODO move this.. to a nice make empty textures class.. + this.emptyTextures = {}; + var emptyTexture2D = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); + this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; + this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); + for (var i = 0; i < 6; i++) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + for (var i = 0; i < this.boundTextures.length; i++) { + this.bind(null, i); + } + }; + /** + * Bind a texture to a specific location + * + * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` + * @param texture - Texture to bind + * @param [location=0] - Location to bind at + */ + TextureSystem.prototype.bind = function (texture, location) { + if (location === void 0) { location = 0; } + var gl = this.gl; + texture = texture === null || texture === void 0 ? void 0 : texture.castToBaseTexture(); + // cannot bind partial texture + // TODO: report a warning + if (texture && texture.valid && !texture.parentTextureArray) { + texture.touched = this.renderer.textureGC.count; + var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); + if (this.boundTextures[location] !== texture) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(texture.target, glTexture.texture); + } + if (glTexture.dirtyId !== texture.dirtyId) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + this.updateTexture(texture); + } + else if (glTexture.dirtyStyleId !== texture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + this.boundTextures[location] = texture; + } + else { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); + this.boundTextures[location] = null; + } + }; + /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */ + TextureSystem.prototype.reset = function () { + this._unknownBoundTextures = true; + this.hasIntegerTextures = false; + this.currentLocation = -1; + for (var i = 0; i < this.boundTextures.length; i++) { + this.boundTextures[i] = this.unknownTexture; + } + }; + /** + * Unbind a texture. + * @param texture - Texture to bind + */ + TextureSystem.prototype.unbind = function (texture) { + var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; + if (this._unknownBoundTextures) { + this._unknownBoundTextures = false; + // someone changed webGL state, + // we have to be sure that our texture does not appear in multi-texture renderer samplers + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === this.unknownTexture) { + this.bind(null, i); + } + } + } + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === texture) { + if (this.currentLocation !== i) { + gl.activeTexture(gl.TEXTURE0 + i); + this.currentLocation = i; + } + gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); + boundTextures[i] = null; + } + } + }; + /** + * Ensures that current boundTextures all have FLOAT sampler type, + * see {@link PIXI.SAMPLER_TYPES} for explanation. + * @param maxTextures - number of locations to check + */ + TextureSystem.prototype.ensureSamplerType = function (maxTextures) { + var _a = this, boundTextures = _a.boundTextures, hasIntegerTextures = _a.hasIntegerTextures, CONTEXT_UID = _a.CONTEXT_UID; + if (!hasIntegerTextures) { + return; + } + for (var i = maxTextures - 1; i >= 0; --i) { + var tex = boundTextures[i]; + if (tex) { + var glTexture = tex._glTextures[CONTEXT_UID]; + if (glTexture.samplerType !== constants.SAMPLER_TYPES.FLOAT) { + this.renderer.texture.unbind(tex); + } + } + } + }; + /** + * Initialize a texture + * @private + * @param texture - Texture to initialize + */ + TextureSystem.prototype.initTexture = function (texture) { + var glTexture = new GLTexture(this.gl.createTexture()); + // guarantee an update.. + glTexture.dirtyId = -1; + texture._glTextures[this.CONTEXT_UID] = glTexture; + this.managedTextures.push(texture); + texture.on('dispose', this.destroyTexture, this); + return glTexture; + }; + TextureSystem.prototype.initTextureType = function (texture, glTexture) { + var _a, _b; + glTexture.internalFormat = (_b = (_a = this.internalFormats[texture.type]) === null || _a === void 0 ? void 0 : _a[texture.format]) !== null && _b !== void 0 ? _b : texture.format; + if (this.webGLVersion === 2 && texture.type === constants.TYPES.HALF_FLOAT) { + // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES + // we have to convert it to WebGL HALF_FLOAT + glTexture.type = this.gl.HALF_FLOAT; + } + else { + glTexture.type = texture.type; + } + }; + /** + * Update a texture + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + TextureSystem.prototype.updateTexture = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + var renderer = this.renderer; + this.initTextureType(texture, glTexture); + if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { + // texture is uploaded, dont do anything! + if (glTexture.samplerType !== constants.SAMPLER_TYPES.FLOAT) { + this.hasIntegerTextures = true; + } + } + else { + // default, renderTexture-like logic + var width = texture.realWidth; + var height = texture.realHeight; + var gl = renderer.gl; + if (glTexture.width !== width + || glTexture.height !== height + || glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); + } + } + // lets only update what changes.. + if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + glTexture.dirtyId = texture.dirtyId; + }; + /** + * Deletes the texture from WebGL + * @private + * @param texture - the texture to destroy + * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { + var gl = this.gl; + texture = texture.castToBaseTexture(); + if (texture._glTextures[this.CONTEXT_UID]) { + this.unbind(texture); + gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); + texture.off('dispose', this.destroyTexture, this); + delete texture._glTextures[this.CONTEXT_UID]; + if (!skipRemove) { + var i = this.managedTextures.indexOf(texture); + if (i !== -1) { + utils.removeItems(this.managedTextures, i, 1); + } + } + } + }; + /** + * Update texture style such as mipmap flag + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + */ + TextureSystem.prototype.updateTextureStyle = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + if ((texture.mipmap === constants.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { + glTexture.mipmap = false; + } + else { + glTexture.mipmap = texture.mipmap >= 1; + } + if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { + glTexture.wrapMode = constants.WRAP_MODES.CLAMP; + } + else { + glTexture.wrapMode = texture.wrapMode; + } + if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) ; + else { + this.setStyle(texture, glTexture); + } + glTexture.dirtyStyleId = texture.dirtyStyleId; + }; + /** + * Set style for texture + * @private + * @param texture - Texture to update + * @param glTexture + */ + TextureSystem.prototype.setStyle = function (texture, glTexture) { + var gl = this.gl; + if (glTexture.mipmap && texture.mipmap !== constants.MIPMAP_MODES.ON_MANUAL) { + gl.generateMipmap(texture.target); + } + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); + if (glTexture.mipmap) { + /* eslint-disable max-len */ + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + /* eslint-disable max-len */ + var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; + if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === constants.SCALE_MODES.LINEAR) { + var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); + gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); + } + } + else { + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + } + gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === constants.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + }; + TextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureSystem; +}()); + +var _systems = { + __proto__: null, + FilterSystem: FilterSystem, + BatchSystem: BatchSystem, + ContextSystem: ContextSystem, + FramebufferSystem: FramebufferSystem, + GeometrySystem: GeometrySystem, + MaskSystem: MaskSystem, + ScissorSystem: ScissorSystem, + StencilSystem: StencilSystem, + ProjectionSystem: ProjectionSystem, + RenderTextureSystem: RenderTextureSystem, + ShaderSystem: ShaderSystem, + StateSystem: StateSystem, + TextureGCSystem: TextureGCSystem, + TextureSystem: TextureSystem +}; + +var tempMatrix = new math.Matrix(); +/** + * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. + * @abstract + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ +var AbstractRenderer = /** @class */ (function (_super) { + __extends(AbstractRenderer, _super); + /** + * @param type - The renderer type. + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function AbstractRenderer(type, options) { + if (type === void 0) { type = constants.RENDERER_TYPE.UNKNOWN; } + var _this = _super.call(this) || this; + // Add the default render options + options = Object.assign({}, settings.settings.RENDER_OPTIONS, options); + /** + * The supplied constructor options. + * @member {object} + * @readonly + */ + _this.options = options; + /** + * The type of the renderer. + * @member {number} + * @default PIXI.RENDERER_TYPE.UNKNOWN + * @see PIXI.RENDERER_TYPE + */ + _this.type = type; + /** + * Measurements of the screen. (0, 0, screenWidth, screenHeight). + * + * Its safe to use as filterArea or hitArea for the whole stage. + * @member {PIXI.Rectangle} + */ + _this.screen = new math.Rectangle(0, 0, options.width, options.height); + /** + * The canvas element that everything is drawn to. + * @member {HTMLCanvasElement} + */ + _this.view = options.view || settings.settings.ADAPTER.createCanvas(); + /** + * The resolution / device pixel ratio of the renderer. + * @member {number} + * @default PIXI.settings.RESOLUTION + */ + _this.resolution = options.resolution || settings.settings.RESOLUTION; + /** + * Pass-thru setting for the canvas' context `alpha` property. This is typically + * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`. + * @member {boolean} + */ + _this.useContextAlpha = options.useContextAlpha; + /** + * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. + * @member {boolean} + */ + _this.autoDensity = !!options.autoDensity; + /** + * The value of the preserveDrawingBuffer flag affects whether or not the contents of + * the stencil buffer is retained after rendering. + * @member {boolean} + */ + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; + /** + * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. + * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every + * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect + * to clear the canvas every frame. Disable this by setting this to false. For example, if + * your game has a canvas filling background image you often don't need this set. + * @member {boolean} + * @default + */ + _this.clearBeforeRender = options.clearBeforeRender; + /** + * The background color as a number. + * @member {number} + * @protected + */ + _this._backgroundColor = 0x000000; + /** + * The background color as an [R, G, B, A] array. + * @member {number[]} + * @protected + */ + _this._backgroundColorRgba = [0, 0, 0, 1]; + /** + * The background color as a string. + * @member {string} + * @protected + */ + _this._backgroundColorString = '#000000'; + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter + _this.backgroundAlpha = options.backgroundAlpha; + // @deprecated + if (options.transparent !== undefined) { + utils.deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.'); + _this.useContextAlpha = options.transparent; + _this.backgroundAlpha = options.transparent ? 0 : 1; + } + /** + * The last root object that the renderer tried to render. + * @member {PIXI.DisplayObject} + * @protected + */ + _this._lastObjectRendered = null; + /** + * Collection of plugins. + * @readonly + * @member {object} + */ + _this.plugins = {}; + return _this; + } + /** + * Initialize the plugins. + * @protected + * @param {object} staticMap - The dictionary of statically saved plugins. + */ + AbstractRenderer.prototype.initPlugins = function (staticMap) { + for (var o in staticMap) { + this.plugins[o] = new (staticMap[o])(this); + } + }; + Object.defineProperty(AbstractRenderer.prototype, "width", { + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * @member {number} + * @readonly + * @default 800 + */ + get: function () { + return this.view.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "height", { + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * @member {number} + * @readonly + * @default 600 + */ + get: function () { + return this.view.height; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the screen and canvas as close as possible to the specified width and height. + * Canvas dimensions are multiplied by resolution and rounded to the nearest integers. + * The new canvas dimensions divided by the resolution become the new screen dimensions. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + AbstractRenderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + this.view.width = Math.round(desiredScreenWidth * this.resolution); + this.view.height = Math.round(desiredScreenHeight * this.resolution); + var screenWidth = this.view.width / this.resolution; + var screenHeight = this.view.height / this.resolution; + this.screen.width = screenWidth; + this.screen.height = screenHeight; + if (this.autoDensity) { + this.view.style.width = screenWidth + "px"; + this.view.style.height = screenHeight + "px"; + } + /** + * Fired after view has been resized. + * @event PIXI.Renderer#resize + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + this.emit('resize', screenWidth, screenHeight); + }; + /** + * @ignore + */ + AbstractRenderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + // @deprecated parameters spread, use options instead + if (typeof options === 'number') { + utils.deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.'); + options = { scaleMode: options, resolution: resolution, region: region }; + } + var manualRegion = options.region, textureOptions = __rest(options, ["region"]); + region = manualRegion || displayObject.getLocalBounds(null, true); + // minimum texture size is 1x1, 0x0 will throw an error + if (region.width === 0) + { region.width = 1; } + if (region.height === 0) + { region.height = 1; } + var renderTexture = RenderTexture.create(__assign({ width: region.width, height: region.height }, textureOptions)); + tempMatrix.tx = -region.x; + tempMatrix.ty = -region.y; + this.render(displayObject, { + renderTexture: renderTexture, + clear: false, + transform: tempMatrix, + skipUpdateTransform: !!displayObject.parent + }); + return renderTexture; + }; + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * @param [removeView=false] - Removes the Canvas element from the DOM. + */ + AbstractRenderer.prototype.destroy = function (removeView) { + for (var o in this.plugins) { + this.plugins[o].destroy(); + this.plugins[o] = null; + } + if (removeView && this.view.parentNode) { + this.view.parentNode.removeChild(this.view); + } + var thisAny = this; + // null-ing all objects, that's a tradition! + thisAny.plugins = null; + thisAny.type = constants.RENDERER_TYPE.UNKNOWN; + thisAny.view = null; + thisAny.screen = null; + thisAny._tempDisplayObjectParent = null; + thisAny.options = null; + this._backgroundColorRgba = null; + this._backgroundColorString = null; + this._lastObjectRendered = null; + }; + Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { + /** + * The background color to fill if not transparent + * @member {number} + */ + get: function () { + return this._backgroundColor; + }, + set: function (value) { + this._backgroundColor = value; + this._backgroundColorString = utils.hex2string(value); + utils.hex2rgb(value, this._backgroundColorRgba); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "backgroundAlpha", { + /** + * The background color alpha. Setting this to 0 will make the canvas transparent. + * @member {number} + */ + get: function () { + return this._backgroundColorRgba[3]; + }, + set: function (value) { + this._backgroundColorRgba[3] = value; + }, + enumerable: false, + configurable: true + }); + return AbstractRenderer; +}(utils.EventEmitter)); + +var GLBuffer = /** @class */ (function () { + function GLBuffer(buffer) { + this.buffer = buffer || null; + this.updateID = -1; + this.byteLength = -1; + this.refCount = 0; + } + return GLBuffer; +}()); + +/** + * System plugin to the renderer to manage buffers. + * + * WebGL uses Buffers as a way to store objects to the GPU. + * This system makes working with them a lot easier. + * + * Buffers are used in three main places in WebGL + * - geometry information + * - Uniform information (via uniform buffer objects - a WebGL 2 only feature) + * - Transform feedback information. (WebGL 2 only feature) + * + * This system will handle the binding of buffers to the GPU as well as uploading + * them. With this system, you never need to work directly with GPU buffers, but instead work with + * the PIXI.Buffer class. + * @class + * @memberof PIXI + */ +var BufferSystem = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function BufferSystem(renderer) { + this.renderer = renderer; + this.managedBuffers = {}; + this.boundBufferBases = {}; + } + /** + * @ignore + */ + BufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + /** Sets up the renderer context and necessary buffers. */ + BufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + this.gl = this.renderer.gl; + // TODO fill out... + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + }; + /** + * This binds specified buffer. On first run, it will create the webGL buffers for the context too + * @param buffer - the buffer to bind to the renderer + */ + BufferSystem.prototype.bind = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBuffer(buffer.type, glBuffer.buffer); + }; + /** + * Binds an uniform buffer to at the given index. + * + * A cache is used so a buffer will not be bound again if already bound. + * @param buffer - the buffer to bind + * @param index - the base index to bind it to. + */ + BufferSystem.prototype.bindBufferBase = function (buffer, index) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (this.boundBufferBases[index] !== buffer) { + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + this.boundBufferBases[index] = buffer; + gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer); + } + }; + /** + * Binds a buffer whilst also binding its range. + * This will make the buffer start from the offset supplied rather than 0 when it is read. + * @param buffer - the buffer to bind + * @param index - the base index to bind at, defaults to 0 + * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc + */ + BufferSystem.prototype.bindBufferRange = function (buffer, index, offset) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + offset = offset || 0; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256); + }; + /** + * Will ensure the data in the buffer is uploaded to the GPU. + * @param {PIXI.Buffer} buffer - the buffer to update + */ + BufferSystem.prototype.update = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (buffer._updateID === glBuffer.updateID) { + return; + } + glBuffer.updateID = buffer._updateID; + gl.bindBuffer(buffer.type, glBuffer.buffer); + if (glBuffer.byteLength >= buffer.data.byteLength) { + // offset is always zero for now! + gl.bufferSubData(buffer.type, 0, buffer.data); + } + else { + var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; + glBuffer.byteLength = buffer.data.byteLength; + gl.bufferData(buffer.type, buffer.data, drawType); + } + }; + /** + * Disposes buffer + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + BufferSystem.prototype.dispose = function (buffer, contextLost) { + if (!this.managedBuffers[buffer.id]) { + return; + } + delete this.managedBuffers[buffer.id]; + var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; + var gl = this.gl; + buffer.disposeRunner.remove(this); + if (!glBuffer) { + return; + } + if (!contextLost) { + gl.deleteBuffer(glBuffer.buffer); + } + delete buffer._glBuffers[this.CONTEXT_UID]; + }; + /** + * dispose all WebGL resources of all managed buffers + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + BufferSystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedBuffers); + for (var i = 0; i < all.length; i++) { + this.dispose(this.managedBuffers[all[i]], contextLost); + } + }; + /** + * creates and attaches a GLBuffer object tied to the current context. + * @param buffer + * @protected + */ + BufferSystem.prototype.createGLBuffer = function (buffer) { + var _a = this, CONTEXT_UID = _a.CONTEXT_UID, gl = _a.gl; + buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); + this.managedBuffers[buffer.id] = buffer; + buffer.disposeRunner.add(this); + return buffer._glBuffers[CONTEXT_UID]; + }; + return BufferSystem; +}()); + +/** + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! + * + * Renderer is composed of systems that manage specific tasks. The following systems are added by default + * whenever you create a renderer: + * + * | System | Description | + * | ------------------------------------ | ----------------------------------------------------------------------------- | + * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. | + * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. | + * | {@link PIXI.EventSystem} | This manages UI events. | + * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. | + * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. | + * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. | + * | {@link PIXI.MaskSystem} | This manages masking operations. | + * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. | + * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. | + * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. | + * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. | + * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. | + * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. | + * + * The breadth of the API surface provided by the renderer is contained within these systems. + * @memberof PIXI + */ +var Renderer = /** @class */ (function (_super) { + __extends(Renderer, _super); + /** + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function Renderer(options) { + var _this = _super.call(this, constants.RENDERER_TYPE.WEBGL, options) || this; + // the options will have been modified here in the super constructor with pixi's default settings.. + options = _this.options; + _this.gl = null; + _this.CONTEXT_UID = 0; + _this.runners = { + destroy: new runner.Runner('destroy'), + contextChange: new runner.Runner('contextChange'), + reset: new runner.Runner('reset'), + update: new runner.Runner('update'), + postrender: new runner.Runner('postrender'), + prerender: new runner.Runner('prerender'), + resize: new runner.Runner('resize'), + }; + _this.runners.contextChange.add(_this); + _this.globalUniforms = new UniformGroup({ + projectionMatrix: new math.Matrix(), + }, true); + _this.addSystem(MaskSystem, 'mask') + .addSystem(ContextSystem, 'context') + .addSystem(StateSystem, 'state') + .addSystem(ShaderSystem, 'shader') + .addSystem(TextureSystem, 'texture') + .addSystem(BufferSystem, 'buffer') + .addSystem(GeometrySystem, 'geometry') + .addSystem(FramebufferSystem, 'framebuffer') + .addSystem(ScissorSystem, 'scissor') + .addSystem(StencilSystem, 'stencil') + .addSystem(ProjectionSystem, 'projection') + .addSystem(TextureGCSystem, 'textureGC') + .addSystem(FilterSystem, 'filter') + .addSystem(RenderTextureSystem, 'renderTexture') + .addSystem(BatchSystem, 'batch'); + _this.initPlugins(Renderer.__plugins); + _this.multisample = undefined; + /* + * The options passed in to create a new WebGL context. + */ + if (options.context) { + _this.context.initFromContext(options.context); + } + else { + _this.context.initFromOptions({ + alpha: !!_this.useContextAlpha, + antialias: options.antialias, + premultipliedAlpha: _this.useContextAlpha && _this.useContextAlpha !== 'notMultiplied', + stencil: true, + preserveDrawingBuffer: options.preserveDrawingBuffer, + powerPreference: _this.options.powerPreference, + }); + } + _this.renderingToScreen = true; + utils.sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); + _this.resize(_this.options.width, _this.options.height); + return _this; + } + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @param options + * @private + */ + Renderer.create = function (options) { + if (utils.isWebGLSupported()) { + return new Renderer(options); + } + throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); + }; + Renderer.prototype.contextChange = function () { + var gl = this.gl; + var samples; + if (this.context.webGLVersion === 1) { + var framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + else { + var framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer); + } + if (samples >= constants.MSAA_QUALITY.HIGH) { + this.multisample = constants.MSAA_QUALITY.HIGH; + } + else if (samples >= constants.MSAA_QUALITY.MEDIUM) { + this.multisample = constants.MSAA_QUALITY.MEDIUM; + } + else if (samples >= constants.MSAA_QUALITY.LOW) { + this.multisample = constants.MSAA_QUALITY.LOW; + } + else { + this.multisample = constants.MSAA_QUALITY.NONE; + } + }; + /** + * Add a new system to the renderer. + * @param ClassRef - Class reference + * @param name - Property name for system, if not specified + * will use a static `name` property on the class itself. This + * name will be assigned as s property on the Renderer so make + * sure it doesn't collide with properties on Renderer. + * @returns Return instance of renderer + */ + Renderer.prototype.addSystem = function (ClassRef, name) { + var system = new ClassRef(this); + if (this[name]) { + throw new Error("Whoops! The name \"" + name + "\" is already in use"); + } + this[name] = system; + for (var i in this.runners) { + this.runners[i].add(system); + } + /** + * Fired after rendering finishes. + * @event PIXI.Renderer#postrender + */ + /** + * Fired before rendering starts. + * @event PIXI.Renderer#prerender + */ + /** + * Fired when the WebGL context is set. + * @event PIXI.Renderer#context + * @param {WebGLRenderingContext} gl - WebGL context. + */ + return this; + }; + /** + * @ignore + */ + Renderer.prototype.render = function (displayObject, options) { + var renderTexture; + var clear; + var transform; + var skipUpdateTransform; + if (options) { + if (options instanceof RenderTexture) { + utils.deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.'); + /* eslint-disable prefer-rest-params */ + renderTexture = options; + clear = arguments[2]; + transform = arguments[3]; + skipUpdateTransform = arguments[4]; + /* eslint-enable prefer-rest-params */ + } + else { + renderTexture = options.renderTexture; + clear = options.clear; + transform = options.transform; + skipUpdateTransform = options.skipUpdateTransform; + } + } + // can be handy to know! + this.renderingToScreen = !renderTexture; + this.runners.prerender.emit(); + this.emit('prerender'); + // apply a transform at a GPU level + this.projection.transform = transform; + // no point rendering if our context has been blown up! + if (this.context.isLost) { + return; + } + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.enableTempParent(); + displayObject.updateTransform(); + displayObject.disableTempParent(cacheParent); + // displayObject.hitArea = //TODO add a temp hit area + } + this.renderTexture.bind(renderTexture); + this.batch.currentRenderer.start(); + if (clear !== undefined ? clear : this.clearBeforeRender) { + this.renderTexture.clear(); + } + displayObject.render(this); + // apply transform.. + this.batch.currentRenderer.flush(); + if (renderTexture) { + renderTexture.baseTexture.update(); + } + this.runners.postrender.emit(); + // reset transform after render + this.projection.transform = null; + this.emit('postrender'); + }; + /** + * @override + * @ignore + */ + Renderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + var renderTexture = _super.prototype.generateTexture.call(this, displayObject, options, resolution, region); + this.framebuffer.blit(); + return renderTexture; + }; + /** + * Resizes the WebGL view to the specified width and height. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + Renderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + _super.prototype.resize.call(this, desiredScreenWidth, desiredScreenHeight); + this.runners.resize.emit(this.screen.height, this.screen.width); + }; + /** + * Resets the WebGL state so you can render things however you fancy! + * @returns Returns itself. + */ + Renderer.prototype.reset = function () { + this.runners.reset.emit(); + return this; + }; + /** Clear the frame buffer. */ + Renderer.prototype.clear = function () { + this.renderTexture.bind(); + this.renderTexture.clear(); + }; + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * @param [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + Renderer.prototype.destroy = function (removeView) { + this.runners.destroy.emit(); + for (var r in this.runners) { + this.runners[r].destroy(); + } + // call base destroy + _super.prototype.destroy.call(this, removeView); + // TODO nullify all the managers.. + this.gl = null; + }; + Object.defineProperty(Renderer.prototype, "extract", { + /** + * Please use `plugins.extract` instead. + * @member {PIXI.Extract} extract + * @deprecated since 6.0.0 + * @readonly + */ + get: function () { + utils.deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.'); + return this.plugins.extract; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param pluginName - The name of the plugin. + * @param ctor - The constructor function or class for the plugin. + */ + Renderer.registerPlugin = function (pluginName, ctor) { + utils.deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.'); + extensions.extensions.add({ + name: pluginName, + type: extensions.ExtensionType.RendererPlugin, + ref: ctor, + }); + }; + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @readonly + * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.Extract} extract Extract image data from renderer. + * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects. + * @property {PIXI.Prepare} prepare Pre-render display objects. + * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects. + * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects. + */ + Renderer.__plugins = {}; + return Renderer; +}(AbstractRenderer)); +// Handle registration of extensions +extensions.extensions.handleByMap(extensions.ExtensionType.RendererPlugin, Renderer.__plugins); + +/** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by + * the browser then this function will return a canvas renderer. + * @memberof PIXI + * @function autoDetectRenderer + * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {boolean} [options.forceCanvas=false] - + * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when + * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + * @returns {PIXI.Renderer|PIXI.CanvasRenderer} + * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}. + */ +function autoDetectRenderer(options) { + return Renderer.create(options); +} + +var $defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; + +var $defaultFilterVertex = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + +/** + * Default vertex shader + * @memberof PIXI + * @member {string} defaultVertex + */ +/** + * Default filter vertex shader + * @memberof PIXI + * @member {string} defaultFilterVertex + */ +// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types +// of defaultVertex, defaultFilterVertex. +var defaultVertex$1 = $defaultVertex; +var defaultFilterVertex = $defaultFilterVertex; + +/** + * Use the ISystem interface instead. + * @deprecated since 6.1.0 + * @memberof PIXI + */ +var System = /** @class */ (function () { + /** + * @param renderer - Reference to Renderer + */ + function System(renderer) { + utils.deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.'); + this.renderer = renderer; + } + /** Destroy and don't use after this. */ + System.prototype.destroy = function () { + this.renderer = null; + }; + return System; +}()); + +/** + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. + * @memberof PIXI + */ +var BatchDrawCall = /** @class */ (function () { + function BatchDrawCall() { + this.texArray = null; + this.blend = 0; + this.type = constants.DRAW_MODES.TRIANGLES; + this.start = 0; + this.size = 0; + this.data = null; + } + return BatchDrawCall; +}()); + +/** + * Used by the batcher to build texture batches. + * Holds list of textures and their respective locations. + * @memberof PIXI + */ +var BatchTextureArray = /** @class */ (function () { + function BatchTextureArray() { + this.elements = []; + this.ids = []; + this.count = 0; + } + BatchTextureArray.prototype.clear = function () { + for (var i = 0; i < this.count; i++) { + this.elements[i] = null; + } + this.count = 0; + }; + return BatchTextureArray; +}()); + +/** + * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand. + * @memberof PIXI + */ +var ViewableBuffer = /** @class */ (function () { + function ViewableBuffer(sizeOrBuffer) { + if (typeof sizeOrBuffer === 'number') { + this.rawBinaryData = new ArrayBuffer(sizeOrBuffer); + } + else if (sizeOrBuffer instanceof Uint8Array) { + this.rawBinaryData = sizeOrBuffer.buffer; + } + else { + this.rawBinaryData = sizeOrBuffer; + } + this.uint32View = new Uint32Array(this.rawBinaryData); + this.float32View = new Float32Array(this.rawBinaryData); + } + Object.defineProperty(ViewableBuffer.prototype, "int8View", { + /** View on the raw binary data as a `Int8Array`. */ + get: function () { + if (!this._int8View) { + this._int8View = new Int8Array(this.rawBinaryData); + } + return this._int8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint8View", { + /** View on the raw binary data as a `Uint8Array`. */ + get: function () { + if (!this._uint8View) { + this._uint8View = new Uint8Array(this.rawBinaryData); + } + return this._uint8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int16View", { + /** View on the raw binary data as a `Int16Array`. */ + get: function () { + if (!this._int16View) { + this._int16View = new Int16Array(this.rawBinaryData); + } + return this._int16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint16View", { + /** View on the raw binary data as a `Uint16Array`. */ + get: function () { + if (!this._uint16View) { + this._uint16View = new Uint16Array(this.rawBinaryData); + } + return this._uint16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int32View", { + /** View on the raw binary data as a `Int32Array`. */ + get: function () { + if (!this._int32View) { + this._int32View = new Int32Array(this.rawBinaryData); + } + return this._int32View; + }, + enumerable: false, + configurable: true + }); + /** + * Returns the view of the given type. + * @param type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @returns - typed array of given type + */ + ViewableBuffer.prototype.view = function (type) { + return this[type + "View"]; + }; + /** Destroys all buffer references. Do not use after calling this. */ + ViewableBuffer.prototype.destroy = function () { + this.rawBinaryData = null; + this._int8View = null; + this._uint8View = null; + this._int16View = null; + this._uint16View = null; + this._int32View = null; + this.uint32View = null; + this.float32View = null; + }; + ViewableBuffer.sizeOf = function (type) { + switch (type) { + case 'int8': + case 'uint8': + return 1; + case 'int16': + case 'uint16': + return 2; + case 'int32': + case 'uint32': + case 'float32': + return 4; + default: + throw new Error(type + " isn't a valid view type"); + } + }; + return ViewableBuffer; +}()); + +/** + * Renderer dedicated to drawing and batching sprites. + * + * This is the default batch renderer. It buffers objects + * with texture-based geometries and renders them in + * batches. It uploads multiple textures to the GPU to + * reduce to the number of draw calls. + * @memberof PIXI + */ +var AbstractBatchRenderer = /** @class */ (function (_super) { + __extends(AbstractBatchRenderer, _super); + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + function AbstractBatchRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = null; + _this.geometryClass = null; + _this.vertexSize = null; + _this.state = State.for2d(); + _this.size = settings.settings.SPRITE_BATCH_SIZE * 4; + _this._vertexCount = 0; + _this._indexCount = 0; + _this._bufferedElements = []; + _this._bufferedTextures = []; + _this._bufferSize = 0; + _this._shader = null; + _this._packedGeometries = []; + _this._packedGeometryPoolSize = 2; + _this._flushId = 0; + _this._aBuffers = {}; + _this._iBuffers = {}; + _this.MAX_TEXTURES = 1; + _this.renderer.on('prerender', _this.onPrerender, _this); + renderer.runners.contextChange.add(_this); + _this._dcIndex = 0; + _this._aIndex = 0; + _this._iIndex = 0; + _this._attributeBuffer = null; + _this._indexBuffer = null; + _this._tempBoundTextures = []; + return _this; + } + /** + * Handles the `contextChange` signal. + * + * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool. + */ + AbstractBatchRenderer.prototype.contextChange = function () { + var gl = this.renderer.gl; + if (settings.settings.PREFER_ENV === constants.ENV.WEBGL_LEGACY) { + this.MAX_TEXTURES = 1; + } + else { + // step 1: first check max textures the GPU can handle. + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.settings.SPRITE_MAX_TEXTURES); + // step 2: check the maximum number of if statements the shader can have too.. + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); + } + this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); + // we use the second shader as the first one depending on your browser + // may omit aTextureId as it is not used by the shader so is optimized out. + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + /* eslint-disable max-len */ + this._packedGeometries[i] = new (this.geometryClass)(); + } + this.initFlushBuffers(); + }; + /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */ + AbstractBatchRenderer.prototype.initFlushBuffers = function () { + var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; + // max draw calls + var MAX_SPRITES = this.size / 4; + // max texture arrays + var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; + while (_drawCallPool.length < MAX_SPRITES) { + _drawCallPool.push(new BatchDrawCall()); + } + while (_textureArrayPool.length < MAX_TA) { + _textureArrayPool.push(new BatchTextureArray()); + } + for (var i = 0; i < this.MAX_TEXTURES; i++) { + this._tempBoundTextures[i] = null; + } + }; + /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */ + AbstractBatchRenderer.prototype.onPrerender = function () { + this._flushId = 0; + }; + /** + * Buffers the "batchable" object. It need not be rendered immediately. + * @param {PIXI.DisplayObject} element - the element to render when + * using this renderer + */ + AbstractBatchRenderer.prototype.render = function (element) { + if (!element._texture.valid) { + return; + } + if (this._vertexCount + (element.vertexData.length / 2) > this.size) { + this.flush(); + } + this._vertexCount += element.vertexData.length / 2; + this._indexCount += element.indices.length; + this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; + this._bufferedElements[this._bufferSize++] = element; + }; + AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { + var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; + var textureArrays = AbstractBatchRenderer._textureArrayPool; + var batch = this.renderer.batch; + var boundTextures = this._tempBoundTextures; + var touch = this.renderer.textureGC.count; + var TICK = ++BaseTexture._globalBatch; + var countTexArrays = 0; + var texArray = textureArrays[0]; + var start = 0; + batch.copyBoundTextures(boundTextures, MAX_TEXTURES); + for (var i = 0; i < this._bufferSize; ++i) { + var tex = textures[i]; + textures[i] = null; + if (tex._batchEnabled === TICK) { + continue; + } + if (texArray.count >= MAX_TEXTURES) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, i); + start = i; + texArray = textureArrays[++countTexArrays]; + ++TICK; + } + tex._batchEnabled = TICK; + tex.touched = touch; + texArray.elements[texArray.count++] = tex; + } + if (texArray.count > 0) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, this._bufferSize); + ++countTexArrays; + ++TICK; + } + // Clean-up + for (var i = 0; i < boundTextures.length; i++) { + boundTextures[i] = null; + } + BaseTexture._globalBatch = TICK; + }; + /** + * Populating drawcalls for rendering + * @param texArray + * @param start + * @param finish + */ + AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { + var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var dcIndex = this._dcIndex; + var aIndex = this._aIndex; + var iIndex = this._iIndex; + var drawCall = drawCalls[dcIndex]; + drawCall.start = this._iIndex; + drawCall.texArray = texArray; + for (var i = start; i < finish; ++i) { + var sprite = elements[i]; + var tex = sprite._texture.baseTexture; + var spriteBlendMode = utils.premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; + elements[i] = null; + if (start < i && drawCall.blend !== spriteBlendMode) { + drawCall.size = iIndex - drawCall.start; + start = i; + drawCall = drawCalls[++dcIndex]; + drawCall.texArray = texArray; + drawCall.start = iIndex; + } + this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); + aIndex += sprite.vertexData.length / 2 * vertexSize; + iIndex += sprite.indices.length; + drawCall.blend = spriteBlendMode; + } + if (start < finish) { + drawCall.size = iIndex - drawCall.start; + ++dcIndex; + } + this._dcIndex = dcIndex; + this._aIndex = aIndex; + this._iIndex = iIndex; + }; + /** + * Bind textures for current rendering + * @param texArray + */ + AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { + var textureSystem = this.renderer.texture; + for (var j = 0; j < texArray.count; j++) { + textureSystem.bind(texArray.elements[j], texArray.ids[j]); + texArray.elements[j] = null; + } + texArray.count = 0; + }; + AbstractBatchRenderer.prototype.updateGeometry = function () { + var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; + if (!settings.settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't + like uploads to the same buffer in a single frame. */ + if (this._packedGeometryPoolSize <= this._flushId) { + this._packedGeometryPoolSize++; + packedGeometries[this._flushId] = new (this.geometryClass)(); + } + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.bind(packedGeometries[this._flushId]); + this.renderer.geometry.updateBuffers(); + this._flushId++; + } + else { + // lets use the faster option, always use buffer number 0 + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.updateBuffers(); + } + }; + AbstractBatchRenderer.prototype.drawBatches = function () { + var dcCount = this._dcIndex; + var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var curTexArray = null; + // Upload textures and do the draw calls + for (var i = 0; i < dcCount; i++) { + var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; + if (curTexArray !== texArray) { + curTexArray = texArray; + this.bindAndClearTexArray(texArray); + } + this.state.blendMode = blend; + stateSystem.set(this.state); + gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); + } + }; + /** Renders the content _now_ and empties the current batch. */ + AbstractBatchRenderer.prototype.flush = function () { + if (this._vertexCount === 0) { + return; + } + this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); + this._indexBuffer = this.getIndexBuffer(this._indexCount); + this._aIndex = 0; + this._iIndex = 0; + this._dcIndex = 0; + this.buildTexturesAndDrawCalls(); + this.updateGeometry(); + this.drawBatches(); + // reset elements buffer for the next flush + this._bufferSize = 0; + this._vertexCount = 0; + this._indexCount = 0; + }; + /** Starts a new sprite batch. */ + AbstractBatchRenderer.prototype.start = function () { + this.renderer.state.set(this.state); + this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES); + this.renderer.shader.bind(this._shader); + if (settings.settings.CAN_UPLOAD_SAME_BUFFER) { + // bind buffer #0, we don't need others + this.renderer.geometry.bind(this._packedGeometries[this._flushId]); + } + }; + /** Stops and flushes the current batch. */ + AbstractBatchRenderer.prototype.stop = function () { + this.flush(); + }; + /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */ + AbstractBatchRenderer.prototype.destroy = function () { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + if (this._packedGeometries[i]) { + this._packedGeometries[i].destroy(); + } + } + this.renderer.off('prerender', this.onPrerender, this); + this._aBuffers = null; + this._iBuffers = null; + this._packedGeometries = null; + this._attributeBuffer = null; + this._indexBuffer = null; + if (this._shader) { + this._shader.destroy(); + this._shader = null; + } + _super.prototype.destroy.call(this); + }; + /** + * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats. + * @param size - minimum capacity required + * @returns - buffer than can hold atleast `size` floats + */ + AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { + // 8 vertices is enough for 2 quads + var roundedP2 = utils.nextPow2(Math.ceil(size / 8)); + var roundedSizeIndex = utils.log2(roundedP2); + var roundedSize = roundedP2 * 8; + if (this._aBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._aBuffers[roundedSize]; + if (!buffer) { + this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); + } + return buffer; + }; + /** + * Fetches an index buffer from `this._iBuffers` that can + * have at least `size` capacity. + * @param size - minimum required capacity + * @returns - buffer that can fit `size` indices. + */ + AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { + // 12 indices is enough for 2 quads + var roundedP2 = utils.nextPow2(Math.ceil(size / 12)); + var roundedSizeIndex = utils.log2(roundedP2); + var roundedSize = roundedP2 * 12; + if (this._iBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._iBuffers[roundedSizeIndex]; + if (!buffer) { + this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); + } + return buffer; + }; + /** + * Takes the four batching parameters of `element`, interleaves + * and pushes them into the batching attribute/index buffers given. + * + * It uses these properties: `vertexData` `uvs`, `textureId` and + * `indicies`. It also uses the "tint" of the base-texture, if + * present. + * @param {PIXI.DisplayObject} element - element being rendered + * @param attributeBuffer - attribute buffer. + * @param indexBuffer - index buffer + * @param aIndex - number of floats already in the attribute buffer + * @param iIndex - number of indices already in `indexBuffer` + */ + AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { + var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; + var packedVertices = aIndex / this.vertexSize; + var uvs = element.uvs; + var indicies = element.indices; + var vertexData = element.vertexData; + var textureId = element._texture.baseTexture._batchLocation; + var alpha = Math.min(element.worldAlpha, 1.0); + var argb = (alpha < 1.0 + && element._texture.baseTexture.alphaMode) + ? utils.premultiplyTint(element._tintRGB, alpha) + : element._tintRGB + (alpha * 255 << 24); + // lets not worry about tint! for now.. + for (var i = 0; i < vertexData.length; i += 2) { + float32View[aIndex++] = vertexData[i]; + float32View[aIndex++] = vertexData[i + 1]; + float32View[aIndex++] = uvs[i]; + float32View[aIndex++] = uvs[i + 1]; + uint32View[aIndex++] = argb; + float32View[aIndex++] = textureId; + } + for (var i = 0; i < indicies.length; i++) { + indexBuffer[iIndex++] = packedVertices + indicies[i]; + } + }; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchDrawCall[]} + */ + AbstractBatchRenderer._drawCallPool = []; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchTextureArray[]} + */ + AbstractBatchRenderer._textureArrayPool = []; + return AbstractBatchRenderer; +}(ObjectRenderer)); + +/** + * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer + * @memberof PIXI + */ +var BatchShaderGenerator = /** @class */ (function () { + /** + * @param vertexSrc - Vertex shader + * @param fragTemplate - Fragment shader template + */ + function BatchShaderGenerator(vertexSrc, fragTemplate) { + this.vertexSrc = vertexSrc; + this.fragTemplate = fragTemplate; + this.programCache = {}; + this.defaultGroupCache = {}; + if (fragTemplate.indexOf('%count%') < 0) { + throw new Error('Fragment template must contain "%count%".'); + } + if (fragTemplate.indexOf('%forloop%') < 0) { + throw new Error('Fragment template must contain "%forloop%".'); + } + } + BatchShaderGenerator.prototype.generateShader = function (maxTextures) { + if (!this.programCache[maxTextures]) { + var sampleValues = new Int32Array(maxTextures); + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); + var fragmentSrc = this.fragTemplate; + fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new math.Matrix(), + default: this.defaultGroupCache[maxTextures], + }; + return new Shader(this.programCache[maxTextures], uniforms); + }; + BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxTextures - 1) { + src += "if(vTextureId < " + i + ".5)"; + } + src += '\n{'; + src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + }; + return BatchShaderGenerator; +}()); + +/** + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * @memberof PIXI + */ +var BatchGeometry = /** @class */ (function (_super) { + __extends(BatchGeometry, _super); + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + function BatchGeometry(_static) { + if (_static === void 0) { _static = false; } + var _this = _super.call(this) || this; + _this._buffer = new Buffer(null, _static, false); + _this._indexBuffer = new Buffer(null, _static, true); + _this.addAttribute('aVertexPosition', _this._buffer, 2, false, constants.TYPES.FLOAT) + .addAttribute('aTextureCoord', _this._buffer, 2, false, constants.TYPES.FLOAT) + .addAttribute('aColor', _this._buffer, 4, true, constants.TYPES.UNSIGNED_BYTE) + .addAttribute('aTextureId', _this._buffer, 1, true, constants.TYPES.FLOAT) + .addIndex(_this._indexBuffer); + return _this; + } + return BatchGeometry; +}(Geometry)); + +var defaultVertex = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; + +var defaultFragment = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; + +/** @memberof PIXI */ +var BatchPluginFactory = /** @class */ (function () { + function BatchPluginFactory() { + } + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.extensions.add({ + * name: 'invert', + * ref: InvertBatchRenderer, + * type: PIXI.ExtensionType.RendererPlugin, + * }); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @returns {*} New batch renderer plugin + */ + BatchPluginFactory.create = function (options) { + var _a = Object.assign({ + vertex: defaultVertex, + fragment: defaultFragment, + geometryClass: BatchGeometry, + vertexSize: 6, + }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; + return /** @class */ (function (_super) { + __extends(BatchPlugin, _super); + function BatchPlugin(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); + _this.geometryClass = geometryClass; + _this.vertexSize = vertexSize; + return _this; + } + return BatchPlugin; + }(AbstractBatchRenderer)); + }; + Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { + /** + * The default vertex shader source + * @readonly + */ + get: function () { + return defaultVertex; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { + /** + * The default fragment shader source + * @readonly + */ + get: function () { + return defaultFragment; + }, + enumerable: false, + configurable: true + }); + return BatchPluginFactory; +}()); +// Setup the default BatchRenderer plugin, this is what +// we'll actually export at the root level +var BatchRenderer = BatchPluginFactory.create(); +Object.assign(BatchRenderer, { + extension: { + name: 'batch', + type: extensions.ExtensionType.RendererPlugin, + }, +}); + +/** + * @memberof PIXI + * @namespace resources + * @see PIXI + * @deprecated since 6.0.0 + */ +var resources = {}; +var _loop_1 = function (name) { + Object.defineProperty(resources, name, { + get: function () { + utils.deprecation('6.0.0', "PIXI.systems." + name + " has moved to PIXI." + name); + return _resources[name]; + }, + }); +}; +for (var name in _resources) { + _loop_1(name); +} +/** + * @memberof PIXI + * @namespace systems + * @see PIXI + * @deprecated since 6.0.0 + */ +var systems = {}; +var _loop_2 = function (name) { + Object.defineProperty(systems, name, { + get: function () { + utils.deprecation('6.0.0', "PIXI.resources." + name + " has moved to PIXI." + name); + return _systems[name]; + }, + }); +}; +for (var name in _systems) { + _loop_2(name); +} + +/** + * @namespace PIXI + */ +/** + * String of the current PIXI version. + * @memberof PIXI + */ +var VERSION = '6.5.10'; + +exports.AbstractBatchRenderer = AbstractBatchRenderer; +exports.AbstractMultiResource = AbstractMultiResource; +exports.AbstractRenderer = AbstractRenderer; +exports.ArrayResource = ArrayResource; +exports.Attribute = Attribute; +exports.BaseImageResource = BaseImageResource; +exports.BaseRenderTexture = BaseRenderTexture; +exports.BaseTexture = BaseTexture; +exports.BatchDrawCall = BatchDrawCall; +exports.BatchGeometry = BatchGeometry; +exports.BatchPluginFactory = BatchPluginFactory; +exports.BatchRenderer = BatchRenderer; +exports.BatchShaderGenerator = BatchShaderGenerator; +exports.BatchSystem = BatchSystem; +exports.BatchTextureArray = BatchTextureArray; +exports.Buffer = Buffer; +exports.BufferResource = BufferResource; +exports.CanvasResource = CanvasResource; +exports.ContextSystem = ContextSystem; +exports.CubeResource = CubeResource; +exports.Filter = Filter; +exports.FilterState = FilterState; +exports.FilterSystem = FilterSystem; +exports.Framebuffer = Framebuffer; +exports.FramebufferSystem = FramebufferSystem; +exports.GLFramebuffer = GLFramebuffer; +exports.GLProgram = GLProgram; +exports.GLTexture = GLTexture; +exports.Geometry = Geometry; +exports.GeometrySystem = GeometrySystem; +exports.IGLUniformData = IGLUniformData; +exports.INSTALLED = INSTALLED; +exports.ImageBitmapResource = ImageBitmapResource; +exports.ImageResource = ImageResource; +exports.MaskData = MaskData; +exports.MaskSystem = MaskSystem; +exports.ObjectRenderer = ObjectRenderer; +exports.Program = Program; +exports.ProjectionSystem = ProjectionSystem; +exports.Quad = Quad; +exports.QuadUv = QuadUv; +exports.RenderTexture = RenderTexture; +exports.RenderTexturePool = RenderTexturePool; +exports.RenderTextureSystem = RenderTextureSystem; +exports.Renderer = Renderer; +exports.Resource = Resource; +exports.SVGResource = SVGResource; +exports.ScissorSystem = ScissorSystem; +exports.Shader = Shader; +exports.ShaderSystem = ShaderSystem; +exports.SpriteMaskFilter = SpriteMaskFilter; +exports.State = State; +exports.StateSystem = StateSystem; +exports.StencilSystem = StencilSystem; +exports.System = System; +exports.Texture = Texture; +exports.TextureGCSystem = TextureGCSystem; +exports.TextureMatrix = TextureMatrix; +exports.TextureSystem = TextureSystem; +exports.TextureUvs = TextureUvs; +exports.UniformGroup = UniformGroup; +exports.VERSION = VERSION; +exports.VideoResource = VideoResource; +exports.ViewableBuffer = ViewableBuffer; +exports.autoDetectRenderer = autoDetectRenderer; +exports.autoDetectResource = autoDetectResource; +exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; +exports.createUBOElements = createUBOElements; +exports.defaultFilterVertex = defaultFilterVertex; +exports.defaultVertex = defaultVertex$1; +exports.generateProgram = generateProgram; +exports.generateUniformBufferSync = generateUniformBufferSync; +exports.getTestContext = getTestContext; +exports.getUBOData = getUBOData; +exports.resources = resources; +exports.systems = systems; +exports.uniformParsers = uniformParsers; +Object.keys(extensions).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return extensions[k]; } + }); +}); +//# sourceMappingURL=core.js.map diff --git a/live2d/node_modules/@pixi/core/dist/cjs/core.js.map b/live2d/node_modules/@pixi/core/dist/cjs/core.js.map new file mode 100644 index 0000000..0561029 --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/cjs/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sources":["../../src/settings.ts","../../src/textures/resources/autoDetectResource.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/textures/resources/Resource.ts","../../src/textures/resources/BufferResource.ts","../../src/textures/BaseTexture.ts","../../src/textures/resources/AbstractMultiResource.ts","../../src/textures/resources/ArrayResource.ts","../../src/textures/resources/BaseImageResource.ts","../../src/textures/resources/CanvasResource.ts","../../src/textures/resources/CubeResource.ts","../../src/textures/resources/ImageResource.ts","../../src/textures/resources/SVGResource.ts","../../src/textures/resources/VideoResource.ts","../../src/textures/resources/ImageBitmapResource.ts","../../src/textures/resources/index.ts","../../src/textures/resources/DepthResource.ts","../../src/framebuffer/Framebuffer.ts","../../src/renderTexture/BaseRenderTexture.ts","../../src/textures/TextureUvs.ts","../../src/textures/Texture.ts","../../src/renderTexture/RenderTexture.ts","../../src/renderTexture/RenderTexturePool.ts","../../src/geometry/Attribute.ts","../../src/geometry/Buffer.ts","../../src/geometry/utils/interleaveTypedArrays.ts","../../src/geometry/Geometry.ts","../../src/utils/Quad.ts","../../src/utils/QuadUv.ts","../../src/shader/UniformGroup.ts","../../src/filters/FilterState.ts","../../src/filters/FilterSystem.ts","../../src/batch/ObjectRenderer.ts","../../src/batch/BatchSystem.ts","../../src/context/ContextSystem.ts","../../src/framebuffer/GLFramebuffer.ts","../../src/framebuffer/FramebufferSystem.ts","../../src/geometry/GeometrySystem.ts","../../src/mask/MaskData.ts","../../src/shader/utils/compileShader.ts","../../src/shader/utils/logProgramError.ts","../../src/shader/utils/defaultValue.ts","../../src/shader/utils/getTestContext.ts","../../src/shader/utils/getMaxFragmentPrecision.ts","../../src/shader/utils/setPrecision.ts","../../src/shader/utils/mapSize.ts","../../src/shader/utils/mapType.ts","../../src/shader/utils/uniformParsers.ts","../../src/shader/utils/generateUniformsSync.ts","../../src/shader/utils/checkMaxIfStatementsInShader.ts","../../src/shader/utils/unsafeEvalSupported.ts","../../src/shader/Program.ts","../../src/shader/Shader.ts","../../src/state/State.ts","../../src/filters/Filter.ts","../../src/textures/TextureMatrix.ts","../../src/filters/spriteMask/SpriteMaskFilter.ts","../../src/mask/MaskSystem.ts","../../src/mask/AbstractMaskSystem.ts","../../src/mask/ScissorSystem.ts","../../src/mask/StencilSystem.ts","../../src/projection/ProjectionSystem.ts","../../src/renderTexture/RenderTextureSystem.ts","../../src/shader/utils/generateUniformBufferSync.ts","../../src/shader/GLProgram.ts","../../src/shader/utils/getAttributeData.ts","../../src/shader/utils/getUniformData.ts","../../src/shader/utils/generateProgram.ts","../../src/shader/ShaderSystem.ts","../../src/state/utils/mapWebGLBlendModesToPixi.ts","../../src/state/StateSystem.ts","../../src/textures/TextureGCSystem.ts","../../src/textures/utils/mapTypeAndFormatToInternalFormat.ts","../../src/textures/GLTexture.ts","../../src/textures/TextureSystem.ts","../../src/AbstractRenderer.ts","../../src/geometry/GLBuffer.ts","../../src/geometry/BufferSystem.ts","../../src/Renderer.ts","../../src/autoDetectRenderer.ts","../../src/fragments/index.ts","../../src/ISystem.ts","../../src/batch/BatchDrawCall.ts","../../src/batch/BatchTextureArray.ts","../../src/geometry/ViewableBuffer.ts","../../src/batch/AbstractBatchRenderer.ts","../../src/batch/BatchShaderGenerator.ts","../../src/batch/BatchGeometry.ts","../../src/batch/BatchPluginFactory.ts","../../src/deprecations.ts","../../src/index.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import type { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n| ICubeResourceOptions\n| IImageResourceOptions\n| ISVGResourceOptions\n| IVideoResourceOptions\n| IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import $defaultVertex from './default.vert';\nimport $defaultFilterVertex from './defaultFilter.vert';\n\n/**\n * Default vertex shader\n * @memberof PIXI\n * @member {string} defaultVertex\n */\n\n/**\n * Default filter vertex shader\n * @memberof PIXI\n * @member {string} defaultFilterVertex\n */\n\n// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types\n// of defaultVertex, defaultFilterVertex.\nconst defaultVertex: string = $defaultVertex;\nconst defaultFilterVertex: string = $defaultFilterVertex;\n\nexport { defaultVertex, defaultFilterVertex };\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n"],"names":["settings","isMobile","ENV","arguments","Runner","ALPHA_MODES","SCALE_MODES","FORMATS","TYPES","TARGETS","uid","isPow2","BaseTextureCache","TextureCache","EventEmitter","determineCrossOrigin","Ticker","MSAA_QUALITY","MIPMAP_MODES","groupD8","Rectangle","Point","getResolutionOfUrl","deprecation","nextPow2","UID","BUFFER_TYPE","map","getBufferType","byteSizeMap","tempMatrix","Matrix","CLEAR_MODES","DRAW_MODES","BUFFER_BITS","MASK_TYPES","PRECISION","defaultVertex","defaultFragment","ProgramCache","BLEND","OFFSET","CULLING","DEPTH_TEST","WINDING","DEPTH_MASK","BLEND_MODES","GC_MODES","SAMPLER_TYPES","removeItems","WRAP_MODES","RENDERER_TYPE","hex2string","hex2rgb","sayHello","isWebGLSupported","extensions","ExtensionType","premultiplyBlendMode","log2","premultiplyTint"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;;;;;;AAcG;AACHA,iBAAQ,CAAC,UAAU,GAAGC,cAAQ,CAAC,GAAG,GAAGC,aAAG,CAAC,KAAK,GAAGA,aAAG,C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;;;;;AAKG;AACG,IAAA,OAAO,GAAG,GAAG;wBAER,IAAI,EAAA;AAEX,IAAA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAC/B;AACI,QAAA,GAAG,EAAH,YAAA;YAGIA,iBAAW,CAAC,OAAO,EAAE,iBAAA,GAAkB,IAAI,GAAsB,qBAAA,GAAA,IAAM,CAAC,CAAC;AAGzE,YAAA,OAAQ,QAAgB,CAAC,IAAI,CAAC,CAAC;SAClC;AACJ,KAAA,CAAC,CAAC;;AAZX,KAAK,IAAM,IAAI,IAAI,QAAQ,EAAA;YAAhB,IAAI,CAAA,CAAA;AAad;;AC9CD;;AAEG;AAEH;;;AAGG;AACU,IAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/dist/cjs/core.min.js b/live2d/node_modules/@pixi/core/dist/cjs/core.min.js new file mode 100644 index 0000000..15ce5e8 --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/cjs/core.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/settings"),t=require("@pixi/constants"),r=require("@pixi/utils"),i=require("@pixi/extensions"),n=require("@pixi/runner"),o=require("@pixi/ticker"),s=require("@pixi/math");e.settings.PREFER_ENV=r.isMobile.any?t.ENV.WEBGL:t.ENV.WEBGL2,e.settings.STRICT_TEXTURE_CACHE=!1;var a=[];function u(e,t){if(!e)return null;var r="";if("string"==typeof e){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(e);i&&(r=i[1].toLowerCase())}for(var n=a.length-1;n>=0;--n){var o=a[n];if(o.test&&o.test(e,r))return new o(e,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},h(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f=function(){return f=Object.assign||function(e){for(var t,r=arguments,i=1,n=arguments.length;i0&&p>0,s.textureCacheIds=[],s.destroyed=!1,s.resource=null,s._batchEnabled=0,s._batchLocation=0,s.parentTextureArray=null,s.setResource(n),s}return l(n,i),Object.defineProperty(n.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),n.prototype.setStyle=function(e,t){var r;return void 0!==e&&e!==this.scaleMode&&(this.scaleMode=e,r=!0),void 0!==t&&t!==this.mipmap&&(this.mipmap=t,r=!0),r&&this.dirtyStyleId++,this},n.prototype.setSize=function(e,t,r){return r=r||this.resolution,this.setRealSize(e*r,t*r,r)},n.prototype.setRealSize=function(e,t,r){return this.resolution=r||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this},n.prototype._refreshPOT=function(){this.isPowerOfTwo=r.isPow2(this.realWidth)&&r.isPow2(this.realHeight)},n.prototype.setResolution=function(e){var t=this.resolution;return t===e||(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT()),this},n.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},n.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},n.prototype.onError=function(e){this.emit("error",this,e)},n.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete r.BaseTextureCache[this.cacheId],delete r.TextureCache[this.cacheId],this.cacheId=null),this.dispose(),n.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},n.prototype.dispose=function(){this.emit("dispose",this)},n.prototype.castToBaseTexture=function(){return this},n.from=function(t,i,o){void 0===o&&(o=e.settings.STRICT_TEXTURE_CACHE);var s="string"==typeof t,a=null;if(s)a=t;else{if(!t._pixiId){var u=i&&i.pixiIdPrefix||"pixiid";t._pixiId=u+"_"+r.uid()}a=t._pixiId}var h=r.BaseTextureCache[a];if(s&&o&&!h)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return h||((h=new n(t,i)).cacheId=a,n.addToCache(h,a)),h},n.fromBuffer=function(e,r,i,o){e=e||new Float32Array(r*i*4);var s=new c(e,{width:r,height:i}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new n(s,Object.assign({},p,o||{width:r,height:i,type:a}))},n.addToCache=function(e,t){t&&(-1===e.textureCacheIds.indexOf(t)&&e.textureCacheIds.push(t),r.BaseTextureCache[t]&&console.warn("BaseTexture added to the cache with an id ["+t+"] that already had an entry"),r.BaseTextureCache[t]=e)},n.removeFromCache=function(e){if("string"==typeof e){var t=r.BaseTextureCache[e];if(t){var i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete r.BaseTextureCache[e],t}}else if(e&&e.textureCacheIds){for(var n=0;n0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,r)}else e.target=t.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this},r.prototype.upload=function(e,t,i){for(var n=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,i}(_),b=function(e){function t(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];_.crossOrigin(o,s,i.crossorigin);for(var a=0;a2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(o.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(o.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(o.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(o.Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(o.Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(r)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(_),S=function(e){function t(t){return e.call(this,t)||this}return l(t,e),t.test=function(e){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap},t}(_);a.push(T,S,y,b,x,c,E,g);var R={__proto__:null,Resource:d,BaseImageResource:_,INSTALLED:a,autoDetectResource:u,AbstractMultiResource:m,ArrayResource:g,BufferResource:c,CanvasResource:y,CubeResource:E,ImageResource:T,SVGResource:x,VideoResource:b,ImageBitmapResource:S},A=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return l(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK);var o=r.realWidth,s=r.realHeight;return i.width===o&&i.height===s?n.texSubImage2D(r.target,0,0,0,o,s,r.format,i.type,this.data):(i.width=o,i.height=s,n.texImage2D(r.target,0,i.internalFormat,o,s,0,r.format,i.type,this.data)),!0},r}(c),M=function(){function e(e,r){this.width=Math.round(e||100),this.height=Math.round(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new n.Runner("disposeFramebuffer"),this.multisample=t.MSAA_QUALITY.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,r){return void 0===e&&(e=0),this.colorTextures[e]=r||new v(null,{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,mipmap:t.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new v(new A(null,{width:this.width,height:this.height}),{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:t.MIPMAP_MODES.OFF,format:t.FORMATS.DEPTH_COMPONENT,type:t.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),e!==this.width||t!==this.height){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&t.textureCacheIds.splice(i,1),delete r.TextureCache[e],t}}else if(e&&e.textureCacheIds){for(var n=0;nthis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",u="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,h="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+a+" "+h)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),i.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(i,"EMPTY",{get:function(){return i._EMPTY||(i._EMPTY=new i(new v),O(i._EMPTY),O(i._EMPTY.baseTexture)),i._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(i,"WHITE",{get:function(){if(!i._WHITE){var t=e.settings.ADAPTER.createCanvas(16,16),r=t.getContext("2d");t.width=16,t.height=16,r.fillStyle="white",r.fillRect(0,0,16,16),i._WHITE=new i(v.from(t)),O(i._WHITE),O(i._WHITE.baseTexture)}return i._WHITE},enumerable:!1,configurable:!0}),i}(r.EventEmitter),P=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return l(t,e),Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t,r){void 0===r&&(r=!0);var i=this.baseTexture.resolution,n=Math.round(e*i)/i,o=Math.round(t*i)/i;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,r&&this.baseTexture.resize(n,o),this.updateUvs()},t.prototype.setResolution=function(e){var t=this.baseTexture;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))},t.create=function(e){for(var r=arguments,i=[],n=1;n1?-o:-1:(s=((65535&(e=r.nextPow2(e)))<<16|65535&(i=r.nextPow2(i)))>>>0,o>1&&(s+=4294967296*o)),this.texturePool[s]||(this.texturePool[s]=[]);var a=this.texturePool[s].pop();return a||(a=this.createTexture(e,i,o)),a.filterPoolKey=s,a.setResolution(n),a},e.prototype.getFilterTexture=function(e,r,i){var n=this.getOptimalTexture(e.width,e.height,r||e.resolution,i||t.MSAA_QUALITY.NONE);return n.filterFrame=e.filterFrame,n},e.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},e.prototype.returnFilterTexture=function(e){this.returnTexture(e)},e.prototype.clear=function(e){if(e=!1!==e)for(var t in this.texturePool){var r=this.texturePool[t];if(r)for(var i=0;i0&&e.height>0,this.texturePool)if(Number(t)<0){var r=this.texturePool[t];if(r)for(var i=0;i1){for(var h=0;h1&&((f=this.getOptimalFilterTexture(l.width,l.height,r.resolution)).filterFrame=l.filterFrame),i[d].apply(this,l,f,t.CLEAR_MODES.CLEAR,r);var c=l;l=f,f=c}i[d].apply(this,l,h.renderTexture,t.CLEAR_MODES.BLEND,r),d>1&&r.multisample>1&&this.returnFilterTexture(r.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(f)}r.clear(),this.statePool.push(r)},e.prototype.bindAndClear=function(e,r){void 0===r&&(r=t.CLEAR_MODES.CLEAR);var i=this.renderer,n=i.renderTexture,o=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=e.filterFrame.width,s.height=e.filterFrame.height,n.bind(e,e.filterFrame,s)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=1&o.stateId||this.forceClear;(r===t.CLEAR_MODES.CLEAR||r===t.CLEAR_MODES.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},e.prototype.applyFilter=function(e,r,i,n){var o=this.renderer;o.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=r,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(r._frame,r.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(t.DRAW_MODES.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(t.DRAW_MODES.TRIANGLE_STRIP))},e.prototype.calculateSpriteMatrix=function(e,t){var r=this.activeState,i=r.sourceFrame,n=r.destinationFrame,o=t._texture.orig,a=e.set(n.width,0,0,n.height,i.x,i.y),u=t.worldTransform.copyTo(s.Matrix.TEMP_MATRIX);return u.invert(),a.prepend(u),a.scale(1/o.width,1/o.height),a.translate(t.anchor.x,t.anchor.y),a},e.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},e.prototype.getOptimalFilterTexture=function(e,r,i,n){return void 0===i&&(i=1),void 0===n&&(n=t.MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(e,r,i,n)},e.prototype.getFilterTexture=function(e,r,i){if("number"==typeof e){var n=e;e=r,r=n}e=e||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(e.width,e.height,r||e.resolution,i||t.MSAA_QUALITY.NONE);return o.filterFrame=e.filterFrame,o},e.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},e.prototype.emptyPool=function(){this.texturePool.clear(!0)},e.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},e.prototype.transformAABB=function(e,t){var r=K[0],i=K[1],n=K[2],o=K[3];r.set(t.left,t.top),i.set(t.left,t.bottom),n.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(r,r),e.apply(i,i),e.apply(n,n),e.apply(o,o);var s=Math.min(r.x,i.x,n.x,o.x),a=Math.min(r.y,i.y,n.y,o.y),u=Math.max(r.x,i.x,n.x,o.x),h=Math.max(r.y,i.y,n.y,o.y);t.x=s,t.y=a,t.width=u-s,t.height=h-a},e.prototype.roundFrame=function(e,t,r,i,n){if(!(e.width<=0||e.height<=0||r.width<=0||r.height<=0)){if(n){var o=n.a,s=n.b,a=n.c,u=n.d;if((Math.abs(s)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}(n=n?Q.copyFrom(n):Q.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}},e}(),Z=function(){function e(e){this.renderer=e}return e.prototype.flush=function(){},e.prototype.destroy=function(){this.renderer=null},e.prototype.start=function(){},e.prototype.stop=function(){this.flush()},e.prototype.render=function(e){},e}(),$=function(){function e(e){this.renderer=e,this.emptyRenderer=new Z(e),this.currentRenderer=this.emptyRenderer}return e.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},e.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.copyBoundTextures=function(e,t){for(var r=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=r[i]||null,e[i]&&(e[i]._batchLocation=i)},e.prototype.boundArray=function(e,t,r,i){for(var n=e.elements,o=e.ids,s=e.count,a=0,u=0;u=0&&l=t.ENV.WEBGL2&&(n=r.getContext("webgl2",i)),n)this.webGLVersion=2;else if(this.webGLVersion=1,!(n=r.getContext("webgl",i)||r.getContext("experimental-webgl",i)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout((function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()}),0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),te=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=t.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},re=new s.Rectangle,ie=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new M(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var r=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new s.Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){var i=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;e.settings.PREFER_ENV===t.ENV.WEBGL_LEGACY&&(i=null,n=null),i?r.drawBuffers=function(e){return i.drawBuffersWEBGL(e)}:(this.hasMRT=!1,r.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=r.getInternalformatParameter(r.RENDERBUFFER,r.RGBA8,r.SAMPLES)},r.prototype.bind=function(e,t,r){void 0===r&&(r=0);var i=this.gl;if(e){var n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var o=0;o>r,u=t.height>>r,h=a/t.width;this.setViewport(t.x*h,t.y*h,a,u)}else{a=e.width>>r,u=e.height>>r;this.setViewport(0,0,a,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,r,i){var n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===e&&n.y===t||(n.x=e,n.y=t,n.width=r,n.height=i,this.gl.viewport(e,t,r,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,r,i,n,o){void 0===o&&(o=t.BUFFER_BITS.COLOR|t.BUFFER_BITS.DEPTH);var s=this.gl;s.clearColor(e,r,i,n),s.clear(o)},r.prototype.initFramebuffer=function(e){var t=this.gl,r=new te(t.createFramebuffer());return r.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(e),e.disposeRunner.add(this),r},r.prototype.resizeFramebuffer=function(e){var t=this.gl,r=e.glFramebuffers[this.CONTEXT_UID];r.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,r.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.RGBA8,e.width,e.height)),r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,n=i.length;t.drawBuffers||(n=Math.min(n,1));for(var o=0;o1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.RGBA8,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],a=0;a1&&r.drawBuffers(s),e.depthTexture)&&this.writeDepthTexture){var l=e.depthTexture;this.renderer.texture.bind(l,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,t)}!e.stencil&&!e.depth||e.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))},r.prototype.canMultisampleFramebuffer=function(e){return 1!==this.renderer.context.webGLVersion&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var r=this.msaaSamples,i=t.MSAA_QUALITY.NONE;if(e<=1||null===r)return i;for(var n=0;n=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=t.ENV.WEBGL2&&(i=r.getContext("webgl2",{})),i||((i=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}))?i.getExtension("WEBGL_draw_buffers"):i=null),ce=i}return ce}function ve(e,r,i){if("precision"!==e.substring(0,9)){var n=r;return r===t.PRECISION.HIGH&&i!==t.PRECISION.HIGH&&(n=t.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==t.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var me={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function ge(e){return me[e]}var _e=null,ye={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Ee(e,t){if(!_e){var r=Object.keys(ye);_e={};for(var i=0;i0&&(t+="\nelse "),r0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==t&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))},e.prototype.destroy=function(){this.renderer=null},e}(),Ue=function(){function e(e){this.renderer=e,this.maskStack=[],this.glConst=0}return e.prototype.getStackLength=function(){return this.maskStack.length},e.prototype.setMaskStack=function(e){var t=this.renderer.gl,r=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==r&&(0===i?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},e.prototype._useCurrent=function(){},e.prototype.destroy=function(){this.renderer=null,this.maskStack=null},e}(),Ge=new s.Matrix,ke=[],Ve=function(t){function r(r){var i=t.call(this,r)||this;return i.glConst=e.settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return l(r,t),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},r.prototype.calcScissorRect=function(e){var t;if(!e._scissorRectLocal){var r=e._scissorRect,i=e.maskObject,n=this.renderer,o=n.renderTexture,a=i.getBounds(!0,null!==(t=ke.pop())&&void 0!==t?t:new s.Rectangle);this.roundFrameToPixels(a,o.current?o.current.resolution:n.resolution,o.sourceFrame,o.destinationFrame,n.projection.transform),r&&a.fit(r),e._scissorRectLocal=a}},r.isMatrixRotated=function(e){if(!e)return!1;var t=e.a,r=e.b,i=e.c,n=e.d;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(n)>1e-4)},r.prototype.testScissor=function(e){var t=e.maskObject;if(!t.isFastRect||!t.isFastRect())return!1;if(r.isMatrixRotated(t.worldTransform))return!1;if(r.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var i=e._scissorRectLocal;return i.width>0&&i.height>0},r.prototype.roundFrameToPixels=function(e,t,i,n,o){r.isMatrixRotated(o)||((o=o?Ge.copyFrom(o):Ge.identity()).translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.renderer.filter.transformAABB(o,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))},r.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var t=this.renderer.gl;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;e&&ke.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)},r.prototype._useCurrent=function(){var e,t=this.maskStack[this.maskStack.length-1]._scissorRect;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)},r}(Ue),He=function(t){function r(r){var i=t.call(this,r)||this;return i.glConst=e.settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return l(r,t),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},r.prototype.push=function(e){var t=e.maskObject,r=this.renderer.gl,i=e._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),e._stencilCounter++;var n=e._colorMask;0!==n&&(e._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==n&&(e._colorMask=n,r.colorMask(0!=(1&n),0!=(2&n),0!=(4&n),0!=(8&n))),this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;if(0===this.getStackLength())t.disable(t.STENCIL_TEST);else{var r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==i&&(r._colorMask=i,t.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}},r.prototype._useCurrent=function(){var e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},r}(Ue),je=function(){function e(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new s.Matrix,this.transform=null}return e.prototype.update=function(e,t,r,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},e.prototype.calculateProjection=function(e,t,r,i){var n=this.projectionMatrix,o=i?-1:1;n.identity(),n.a=1/t.width*2,n.d=o*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-o-t.y*n.d},e.prototype.setTransform=function(e){},e.prototype.destroy=function(){this.renderer=null},e}(),ze=new s.Rectangle,Xe=new s.Rectangle,Ye=function(){function e(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new s.Rectangle,this.destinationFrame=new s.Rectangle,this.viewportFrame=new s.Rectangle}return e.prototype.bind=function(e,t,r){void 0===e&&(e=null);var i,n,o,s=this.renderer;this.current=e,e?(o=(i=e.baseTexture).resolution,t||(ze.width=e.frame.width,ze.height=e.frame.height,t=ze),r||(Xe.x=e.frame.x,Xe.y=e.frame.y,Xe.width=t.width,Xe.height=t.height,r=Xe),n=i.framebuffer):(o=s.resolution,t||(ze.width=s.screen.width,ze.height=s.screen.height,t=ze),r||((r=ze).width=t.width,r.height=t.height));var a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,e||(a.y=s.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(r,t,o,!n),e?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(r)},e.prototype.clear=function(e,t){e=this.current?e||this.current.baseTexture.clearColor:e||this.clearColor;var r=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,n=r.width!==i.width||r.height!==i.height;if(n){var o=this.viewportFrame,s=o.x,a=o.y,u=o.width,h=o.height;s=Math.round(s),a=Math.round(a),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,a,u,h)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),n&&this.renderer.scissor.pop()},e.prototype.resize=function(){this.bind(null)},e.prototype.reset=function(){this.bind(null)},e.prototype.destroy=function(){this.renderer=null},e}();function We(e,t,r,i,n){r.buffer.update(n)}var Ke={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},Qe={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function qe(e){for(var t=e.map((function(e){return{data:e,offset:0,dataLen:0,dirty:0}})),r=0,i=0,n=0,o=0;o1&&(r=Math.max(r,16)*s.data.size),s.dataLen=r,i%r!=0&&i<16){var a=i%r%16;i+=a,n+=a}i+r>16?(n=16*Math.ceil(n/16),s.offset=n,n+=r,i=r):(s.offset=n,i+=r,n+=r)}return{uboElements:t,size:n=16*Math.ceil(n/16)}}function Ze(e,t){var r=[];for(var i in e)t[i]&&r.push(t[i]);return r.sort((function(e,t){return e.index-t.index})),r}function $e(e,t){if(!e.autoManage)return{size:0,syncFunc:We};for(var r=qe(Ze(e.uniforms,t)),i=r.uboElements,n=r.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],s=0;s1){var c=ge(a.data.type),p=Math.max(Qe[a.data.type]/16,1),v=c/p,m=(4-v%4)%4;o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*p+"; i++)\n {\n for(var j = 0; j < "+v+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+m+";\n }\n\n ")}else{var g=Ke[a.data.type];o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n "+g+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var Je=function(){},et=function(){function e(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return e.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},e}();function tt(e,t){var r=ae(e,e.VERTEX_SHADER,t.vertexSrc),i=ae(e,e.FRAGMENT_SHADER,t.fragmentSrc),n=e.createProgram();if(e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||function(e,t,r,i){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||ue(e,r),e.getShaderParameter(i,e.COMPILE_STATUS)||ue(e,i),console.error("PixiJS Error: Could not initialize shader."),""!==e.getProgramInfoLog(t)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}(e,n,r,i),t.attributeData=function(e,t){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;nt?1:-1}));for(var s=0;s>=1,r++;this.stateId=e.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),t[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(e.children[i])},r.prototype.destroy=function(){this.renderer=null},r}();var at=function(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=t.TYPES.UNSIGNED_BYTE,this.internalFormat=t.FORMATS.RGBA,this.samplerType=0},ut=function(){function e(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new v,this.hasIntegerTextures=!1}return e.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(e){var r,i,n,o,s,a,u,h,l,f,d,c,p,v,m,g,_,y,E,T,x,b,S;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?((r={})[t.TYPES.UNSIGNED_BYTE]=((i={})[t.FORMATS.RGBA]=e.RGBA8,i[t.FORMATS.RGB]=e.RGB8,i[t.FORMATS.RG]=e.RG8,i[t.FORMATS.RED]=e.R8,i[t.FORMATS.RGBA_INTEGER]=e.RGBA8UI,i[t.FORMATS.RGB_INTEGER]=e.RGB8UI,i[t.FORMATS.RG_INTEGER]=e.RG8UI,i[t.FORMATS.RED_INTEGER]=e.R8UI,i[t.FORMATS.ALPHA]=e.ALPHA,i[t.FORMATS.LUMINANCE]=e.LUMINANCE,i[t.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,i),r[t.TYPES.BYTE]=((n={})[t.FORMATS.RGBA]=e.RGBA8_SNORM,n[t.FORMATS.RGB]=e.RGB8_SNORM,n[t.FORMATS.RG]=e.RG8_SNORM,n[t.FORMATS.RED]=e.R8_SNORM,n[t.FORMATS.RGBA_INTEGER]=e.RGBA8I,n[t.FORMATS.RGB_INTEGER]=e.RGB8I,n[t.FORMATS.RG_INTEGER]=e.RG8I,n[t.FORMATS.RED_INTEGER]=e.R8I,n),r[t.TYPES.UNSIGNED_SHORT]=((o={})[t.FORMATS.RGBA_INTEGER]=e.RGBA16UI,o[t.FORMATS.RGB_INTEGER]=e.RGB16UI,o[t.FORMATS.RG_INTEGER]=e.RG16UI,o[t.FORMATS.RED_INTEGER]=e.R16UI,o[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT16,o),r[t.TYPES.SHORT]=((s={})[t.FORMATS.RGBA_INTEGER]=e.RGBA16I,s[t.FORMATS.RGB_INTEGER]=e.RGB16I,s[t.FORMATS.RG_INTEGER]=e.RG16I,s[t.FORMATS.RED_INTEGER]=e.R16I,s),r[t.TYPES.UNSIGNED_INT]=((a={})[t.FORMATS.RGBA_INTEGER]=e.RGBA32UI,a[t.FORMATS.RGB_INTEGER]=e.RGB32UI,a[t.FORMATS.RG_INTEGER]=e.RG32UI,a[t.FORMATS.RED_INTEGER]=e.R32UI,a[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT24,a),r[t.TYPES.INT]=((u={})[t.FORMATS.RGBA_INTEGER]=e.RGBA32I,u[t.FORMATS.RGB_INTEGER]=e.RGB32I,u[t.FORMATS.RG_INTEGER]=e.RG32I,u[t.FORMATS.RED_INTEGER]=e.R32I,u),r[t.TYPES.FLOAT]=((h={})[t.FORMATS.RGBA]=e.RGBA32F,h[t.FORMATS.RGB]=e.RGB32F,h[t.FORMATS.RG]=e.RG32F,h[t.FORMATS.RED]=e.R32F,h[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT32F,h),r[t.TYPES.HALF_FLOAT]=((l={})[t.FORMATS.RGBA]=e.RGBA16F,l[t.FORMATS.RGB]=e.RGB16F,l[t.FORMATS.RG]=e.RG16F,l[t.FORMATS.RED]=e.R16F,l),r[t.TYPES.UNSIGNED_SHORT_5_6_5]=((f={})[t.FORMATS.RGB]=e.RGB565,f),r[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=((d={})[t.FORMATS.RGBA]=e.RGBA4,d),r[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=((c={})[t.FORMATS.RGBA]=e.RGB5_A1,c),r[t.TYPES.UNSIGNED_INT_2_10_10_10_REV]=((p={})[t.FORMATS.RGBA]=e.RGB10_A2,p[t.FORMATS.RGBA_INTEGER]=e.RGB10_A2UI,p),r[t.TYPES.UNSIGNED_INT_10F_11F_11F_REV]=((v={})[t.FORMATS.RGB]=e.R11F_G11F_B10F,v),r[t.TYPES.UNSIGNED_INT_5_9_9_9_REV]=((m={})[t.FORMATS.RGB]=e.RGB9_E5,m),r[t.TYPES.UNSIGNED_INT_24_8]=((g={})[t.FORMATS.DEPTH_STENCIL]=e.DEPTH24_STENCIL8,g),r[t.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=((_={})[t.FORMATS.DEPTH_STENCIL]=e.DEPTH32F_STENCIL8,_),S=r):((y={})[t.TYPES.UNSIGNED_BYTE]=((E={})[t.FORMATS.RGBA]=e.RGBA,E[t.FORMATS.RGB]=e.RGB,E[t.FORMATS.ALPHA]=e.ALPHA,E[t.FORMATS.LUMINANCE]=e.LUMINANCE,E[t.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,E),y[t.TYPES.UNSIGNED_SHORT_5_6_5]=((T={})[t.FORMATS.RGB]=e.RGB,T),y[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=((x={})[t.FORMATS.RGBA]=e.RGBA,x),y[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=((b={})[t.FORMATS.RGBA]=e.RGBA,b),S=y),S}(e);var r=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(var i=0;i=0;--s){var a=i[s];if(a)a._glTextures[o].samplerType!==t.SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(a)}},e.prototype.initTexture=function(e){var t=new at(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},e.prototype.initTextureType=function(e,r){var i,n;r.internalFormat=null!==(n=null===(i=this.internalFormats[e.type])||void 0===i?void 0:i[e.format])&&void 0!==n?n:e.format,2===this.webGLVersion&&e.type===t.TYPES.HALF_FLOAT?r.type=this.gl.HALF_FLOAT:r.type=e.type},e.prototype.updateTexture=function(e){var r=e._glTextures[this.CONTEXT_UID];if(r){var i=this.renderer;if(this.initTextureType(e,r),e.resource&&e.resource.upload(i,e,r))r.samplerType!==t.SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,o=e.realHeight,s=i.gl;(r.width!==n||r.height!==o||r.dirtyId<0)&&(r.width=n,r.height=o,s.texImage2D(e.target,0,r.internalFormat,n,o,0,e.format,r.type,null))}e.dirtyStyleId!==r.dirtyStyleId&&this.updateTextureStyle(e),r.dirtyId=e.dirtyId}},e.prototype.destroyTexture=function(e,t){var i=this.gl;if((e=e.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var n=this.managedTextures.indexOf(e);-1!==n&&r.removeItems(this.managedTextures,n,1)}},e.prototype.updateTextureStyle=function(e){var r=e._glTextures[this.CONTEXT_UID];r&&(e.mipmap!==t.MIPMAP_MODES.POW2&&2===this.webGLVersion||e.isPowerOfTwo?r.mipmap=e.mipmap>=1:r.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?r.wrapMode=e.wrapMode:r.wrapMode=t.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},e.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&e.mipmap!==t.MIPMAP_MODES.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===t.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST)},e.prototype.destroy=function(){this.renderer=null},e}(),ht={__proto__:null,FilterSystem:q,BatchSystem:$,ContextSystem:ee,FramebufferSystem:ie,GeometrySystem:oe,MaskSystem:Le,ScissorSystem:Ve,StencilSystem:He,ProjectionSystem:je,RenderTextureSystem:Ye,ShaderSystem:nt,StateSystem:ot,TextureGCSystem:st,TextureSystem:ut},lt=new s.Matrix,ft=function(i){function n(r,n){void 0===r&&(r=t.RENDERER_TYPE.UNKNOWN);var o=i.call(this)||this;return n=Object.assign({},e.settings.RENDER_OPTIONS,n),o.options=n,o.type=r,o.screen=new s.Rectangle(0,0,n.width,n.height),o.view=n.view||e.settings.ADAPTER.createCanvas(),o.resolution=n.resolution||e.settings.RESOLUTION,o.useContextAlpha=n.useContextAlpha,o.autoDensity=!!n.autoDensity,o.preserveDrawingBuffer=n.preserveDrawingBuffer,o.clearBeforeRender=n.clearBeforeRender,o._backgroundColor=0,o._backgroundColorRgba=[0,0,0,1],o._backgroundColorString="#000000",o.backgroundColor=n.backgroundColor||o._backgroundColor,o.backgroundAlpha=n.backgroundAlpha,void 0!==n.transparent&&(o.useContextAlpha=n.transparent,o.backgroundAlpha=n.transparent?0:1),o._lastObjectRendered=null,o.plugins={},o}return l(n,i),n.prototype.initPlugins=function(e){for(var t in e)this.plugins[t]=new e[t](this)},Object.defineProperty(n.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),n.prototype.resize=function(e,t){this.view.width=Math.round(e*this.resolution),this.view.height=Math.round(t*this.resolution);var r=this.view.width/this.resolution,i=this.view.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.view.style.width=r+"px",this.view.style.height=i+"px"),this.emit("resize",r,i)},n.prototype.generateTexture=function(e,t,r,i){void 0===t&&(t={}),"number"==typeof t&&(t={scaleMode:t,resolution:r,region:i});var n=t.region,o=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{var n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;i.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}},e.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var r=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),r&&(t||i.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID])}},e.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),r=0;r=t.MSAA_QUALITY.HIGH?this.multisample=t.MSAA_QUALITY.HIGH:e>=t.MSAA_QUALITY.MEDIUM?this.multisample=t.MSAA_QUALITY.MEDIUM:e>=t.MSAA_QUALITY.LOW?this.multisample=t.MSAA_QUALITY.LOW:this.multisample=t.MSAA_QUALITY.NONE},o.prototype.addSystem=function(e,t){var r=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(var i in this[t]=r,this.runners)this.runners[i].add(r);return this},o.prototype.render=function(e,t){var r,i,n,o;if(t&&(t instanceof P?(r=t,i=arguments[2],n=arguments[3],o=arguments[4]):(r=t.renderTexture,i=t.clear,n=t.transform,o=t.skipUpdateTransform)),this.renderingToScreen=!r,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(r||(this._lastObjectRendered=e),!o){var s=e.enableTempParent();e.updateTransform(),e.disableTempParent(s)}this.renderTexture.bind(r),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),r&&r.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},o.prototype.generateTexture=function(t,r,i,n){void 0===r&&(r={});var o=e.prototype.generateTexture.call(this,t,r,i,n);return this.framebuffer.blit(),o},o.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(this.screen.height,this.screen.width)},o.prototype.reset=function(){return this.runners.reset.emit(),this},o.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},o.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(o.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),o.registerPlugin=function(e,t){i.extensions.add({name:e,type:i.ExtensionType.RendererPlugin,ref:t})},o.__plugins={},o}(ft);i.extensions.handleByMap(i.ExtensionType.RendererPlugin,pt.__plugins);var vt=function(){function e(e){this.renderer=e}return e.prototype.destroy=function(){this.renderer=null},e}(),mt=function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},gt=function(){function e(){this.elements=[],this.ids=[],this.count=0}return e.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},n.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=n._textureArrayPool,i=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++v._globalBatch,u=0,h=r[0],l=0;i.copyBoundTextures(o,t);for(var f=0;f=t&&(i.boundArray(h,o,a,t),this.buildDrawCalls(h,l,f),l=f,h=r[++u],++a),d._batchEnabled=a,d.touched=s,h.elements[h.count++]=d)}h.count>0&&(i.boundArray(h,o,a,t),this.buildDrawCalls(h,l,this._bufferSize),++u,++a);for(f=0;f0&&(t+="\nelse "),r\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n"],"names":["settings","PREFER_ENV","isMobile","any","ENV","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","source","options","extension","result","exec","toLowerCase","i","length","ResourcePlugin","test","Error","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__assign","assign","t","s","n","arguments","call","apply","Resource","width","height","_width","_height","destroyed","internal","onResize","Runner","onUpdate","onError","bind","baseTexture","add","emit","unbind","remove","resize","defineProperty","get","update","load","Promise","resolve","style","_renderer","_baseTexture","_glTexture","dispose","destroy","removeAll","_source","_extension","BufferResource","_super","_this","_a","data","upload","renderer","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","alphaMode","ALPHA_MODES","UNPACK","realWidth","realHeight","texSubImage2D","target","format","type","texImage2D","internalFormat","Float32Array","Uint8Array","Uint32Array","defaultBufferOptions","scaleMode","SCALE_MODES","NEAREST","FORMATS","RGBA","NPM","BaseTexture","resource","mipmap","anisotropicLevel","wrapMode","resolution","resourceOptions","RESOLUTION","Math","round","_mipmap","undefined","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","_wrapMode","WRAP_MODE","_scaleMode","SCALE_MODE","TYPES","UNSIGNED_BYTE","TARGETS","TEXTURE_2D","uid","touched","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","valid","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","set","value","setStyle","dirty","setSize","desiredWidth","desiredHeight","setRealSize","isPow2","setResolution","oldResolution","event","BaseTextureCache","TextureCache","removeFromCache","castToBaseTexture","from","strict","isFrame","_pixiId","prefix","pixiIdPrefix","addToCache","fromBuffer","buffer","FLOAT","id","indexOf","push","console","warn","baseTextureFromCache","index","splice","_globalBatch","EventEmitter","AbstractMultiResource","items","itemDirtyIds","partTexture","_load","initFromArray","resources","addBaseTextureAt","addResourceAt","len","on","off","promises","map","item","filter","all","then","ArrayResource","urls","isArray","TEXTURE_2D_ARRAY","texture","texImage3D","texSubImage3D","BaseImageResource","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","crossOrigin","element","url","crossorigin","determineCrossOrigin","HTMLImageElement","complete","HTMLVideoElement","readyState","CanvasResource","OffscreenCanvas","globalThis","HTMLCanvasElement","CubeResource","autoLoad","linkBaseTexture","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","keys","side","ImageResource","imageElement","Image","src","_process","preserveBitmap","createBitmap","CREATE_IMAGE_BITMAP","createImageBitmap","bitmap","reject","completed","onload","onerror","process","cors","fetch","mode","r","blob","premultiplyAlpha","flag","glTextures","key","otherTex","close","SVGResource","sourceBase64","ADAPTER","createCanvas","svg","scale","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVG_XML","trim","btoa","unescape","encodeURIComponent","_loadSvg","tempImage","svgWidth","svgHeight","canvas","getContext","drawImage","getSize","svgString","sizeMatch","SVG_SIZE","size","parseFloat","startsWith","VideoResource","videoElement","document","createElement","setAttribute","firstSrc","sourceElement","mime","baseSrc","split","shift","ext","slice","lastIndexOf","MIME_TYPES","appendChild","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","_deltaTime","elapsedMS","Ticker","shared","playbackRate","floor","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","addEventListener","_onPlayStart","_onPlayStop","_isSourceReady","removeEventListener","_isSourcePlaying","paused","ended","autoUpdate","play","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","DepthResource","Framebuffer","stencil","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","MSAA_QUALITY","NONE","addColorTexture","MIPMAP_MODES","OFF","addDepthTexture","DEPTH_COMPONENT","UNSIGNED_SHORT","enableDepth","enableStencil","destroyDepthTexture","BaseRenderTexture","clearColor","framebuffer","maskStack","filterStack","TextureUvs","x0","y0","x1","y1","x2","y2","x3","y3","uvsFloat32","frame","baseFrame","rotate","tw","th","w2","h2","cX","x","cY","y","groupD8","NW","uX","uY","DEFAULT_UVS","removeAllHandlers","tex","once","Texture","orig","anchor","noFrame","Rectangle","_frame","_uvs","uvMatrix","_rotate","Number","defaultAnchor","Point","_updateID","onBaseTextureUpdated","updateUvs","destroyBase","clone","clonedFrame","clonedOrig","clonedTexture","getResolutionOfUrl","fromURL","fromLoader","imageUrl","name","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","_EMPTY","_WHITE","context","fillStyle","fillRect","RenderTexture","baseRenderTexture","filterFrame","filterPoolKey","resizeBaseTexture","rest","_i","RenderTexturePool","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","createTexture","getOptimalTexture","minWidth","minHeight","ceil","nextPow2","renderTexture","pop","getFilterTexture","input","filterTexture","returnTexture","returnFilterTexture","clear","destroyTextures","textures","j","setScreenSize","SCREEN_KEY","Attribute","normalized","stride","start","instance","UID","Buffer","_static","_glBuffers","static","BUFFER_TYPE","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","Int32Array","byteSizeMap","Uint16Array","Geometry","buffers","attributes","indexBuffer","glVertexArrayObjects","instanced","instanceCount","refCount","addAttribute","ids","bufferIndex","getAttribute","getBuffer","addIndex","getIndex","interleave","arrays","sizes","interleavedBuffer","attribute","outSize","views","ArrayBuffer","out","littleOffset","array","getBufferType","interleaveTypedArrays","geometry","attrib","merge","geometries","geometryOut","offsets","offset","offset2","bufferIndexToCount","indexBufferData","Quad","QuadUv","vertices","uvs","vertexBuffer","uvBuffer","targetTextureFrame","destinationFrame","invalidate","UniformGroup","uniforms","isStatic","isUbo","group","syncUniforms","ubo","UNIFORM_BUFFER","autoManage","_ubo","uboFrom","FilterState","legacy","sourceFrame","bindingSourceFrame","bindingDestinationFrame","filters","transform","tempPoints","tempMatrix","Matrix","FilterSystem","defaultFilterStack","view","statePool","quad","quadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterArea","filterClamp","forceClear","useMaxPadding","state","renderTextureSystem","padding","autoFit","min","max","_b","current","copyFrom","getBounds","pad","sourceFrameProjected","projection","transformAABB","invert","fit","intersects","roundFrame","getOptimalFilterTexture","lastState","blit","CLEAR_MODES","BLEND","flip","flop","CLEAR","bindAndClear","clearMode","stateSystem","autoClear","stateId","BLIT","applyFilter","output","uSampler","filterGlobals","shader","program","attributeData","aTextureCoord","draw","DRAW_MODES","TRIANGLES","TRIANGLE_STRIP","calculateSpriteMatrix","outputMatrix","sprite","_texture","mappedMatrix","worldTransform","copyTo","TEMP_MATRIX","prepend","translate","swap","emptyPool","matrix","rect","lt","lb","rt","rb","left","top","bottom","right","a","c","abs","identity","ObjectRenderer","flush","stop","render","_object","BatchSystem","emptyRenderer","currentRenderer","setObjectRenderer","objectRenderer","reset","copyBoundTextures","arr","maxTextures","boundTextures","boundArray","texArray","batchId","elements","count","loc","bound","CONTEXT_UID_COUNTER","ContextSystem","webGLVersion","extensions","supports","uint32Indices","handleContextLost","handleContextRestored","isContextLost","contextChange","CONTEXT_UID","initFromContext","validateContext","runners","initFromOptions","createContext","getExtensions","common","loseContext","getExtension","anisotropicFiltering","floatTextureLinear","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","drawBuffers","vertexArrayObject","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","preventDefault","setTimeout","restoreContext","useProgram","postrender","renderingToScreen","getContextAttributes","isWebGl2","WebGL2RenderingContext","hasuint32","GLFramebuffer","msaaBuffer","blitFramebuffer","mipLevel","tempRectangle","FramebufferSystem","managedFramebuffers","unknownFramebuffer","msaaSamples","disposeAll","viewport","hasMRT","writeDepthTexture","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","mipWidth","mipHeight","setViewport","v","g","mask","BUFFER_BITS","COLOR","DEPTH","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorageMultisample","DEPTH24_STENCIL8","renderbufferStorage","DEPTH_STENCIL","parentTexture","canMultisampleFramebuffer","createRenderbuffer","framebufferRenderbuffer","COLOR_ATTACHMENT0","deleteRenderbuffer","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","res","sourcePixels","destPixels","colorTexture","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","LINEAR","disposeFramebuffer","contextLost","deleteFramebuffer","list","forceStencil","w","h","GeometrySystem","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","e","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","initGeometryVao","activateVao","updateBuffers","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","location","join","glPrograms","generateProgram","signature","vaoObjectHash","tempStride","tempStart","attribSize","disposeGeometry","buf","vaoId","lastBuffer","glBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","BYTES_PER_ELEMENT","glType","UNSIGNED_INT","drawElements","drawArrays","MaskData","maskObject","MASK_TYPES","autoDetect","pooled","isMaskData","FILTER_MULTISAMPLE","enabled","colorMask","_filters","_stencilCounter","_scissorCounter","_scissorRect","_scissorRectLocal","_colorMask","_target","copyCountersOrReset","maskAbove","compileShader","createShader","shaderSource","logPrettyShaderError","shaderSrc","getShaderSource","line","shaderLog","getShaderInfoLog","splitShader","dedupe","lineNumbers","replace","logArgs","forEach","number","fragmentSourceToLog","error","groupCollapsed","groupEnd","booleanArray","defaultValue","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","substring","precision","PRECISION","HIGH","MEDIUM","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","uint","uvec2","uvec3","uvec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","codeUbo","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","FRAGMENT_SHADER","fragmentSrc","getShaderParameter","COMPILE_STATUS","nameCache","Program","vertexSrc","defaultVertexSrc","defaultFragmentSrc","PRECISION_VERTEX","PRECISION_FRAGMENT","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","ProgramCache","Shader","uniformBindCount","uniformGroup","checkUniformExists","State","blendMode","BLEND_MODES","NORMAL","polygonOffset","blend","depthMask","_blendMode","_polygonOffset","for2d","depthTest","Filter","FILTER_RESOLUTION","filterManager","_currentState","_resolution","tempMat","TextureMatrix","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","clampOffset","isSimple","multiplyUvs","mat","tx","ty","forceUpdate","append","texBase","margin","SpriteMaskFilter","maskSprite","maskMatrix","_maskSprite","renderable","npmAlpha","otherMatrix","alpha","worldAlpha","maskClamp","MaskSystem","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","setMaskStack","scissor","maskDataOrTarget","maskData","detect","SPRITE","SCISSOR","STENCIL","pushSpriteMask","pushColorMask","popSpriteMask","popColorMask","maskCurrent","isSprite","testScissor","alphaMaskFilter","stashFilterArea","currColorMask","nextColorMask","AbstractMaskSystem","glConst","getStackLength","curStackLen","newStackLen","disable","enable","_useCurrent","rectPool","ScissorSystem","getWebGLRenderingContext","SCISSOR_TEST","calcScissorRect","prevData","roundFrameToPixels","isMatrixRotated","isFastRect","StencilSystem","STENCIL_TEST","prevMaskCount","clearStencil","STENCIL_BUFFER_BIT","stencilFunc","EQUAL","stencilOp","KEEP","INCR","batch","DECR","ProjectionSystem","defaultFrame","projectionMatrix","root","calculateProjection","syncUniformGroup","globals","_destinationFrame","pm","sign","setTransform","_matrix","tempRect2","RenderTextureSystem","_backgroundColorRgba","defaultMaskStack","viewportFrame","screen","clearMask","uboUpdate","_ud","_uv","_syncData","UBO_TO_SINGLE_SETTERS","GLSL_TO_STD40_SIZE","createUBOElements","uniformData","uboElements","dataLen","chunkSize","uboElement","lineUpValue","getUBOData","usedUniformDatas","sort","generateUniformBufferSync","syncFunc","funcFragments","parsed","uniformParser","size_1","rowSize","elementSize","remainder","template","Function","IGLUniformData","GLProgram","uniformGroups","uniformDirtyGroups","uniformBufferBindings","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getProgramInfoLog","logProgramError","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","getAttribLocation","getAttributeData","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","match","getUniformData","bindAttribLocation","deleteShader","getUniformLocation","defaultSyncData","textureCount","uboCount","ShaderSystem","systemCheck","cache","_uboCache","func","unsafeEvalSupported","dontSync","glProgram","setUniforms","syncData","getGlProgram","createSyncGroups","generateUniformsSync","syncUniformBufferGroup","createSyncBufferGroup","bindBufferBase","uniformBlockIndex","getUniformBlockIndex","uniformBlockBinding","uboData","preFix","disposeShader","StateSystem","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","blendModes","ONE","ONE_MINUS_SRC_ALPHA","ADD","MULTIPLY","DST_COLOR","SCREEN","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","NORMAL_NPM","SRC_ALPHA","ADD_NPM","SCREEN_NPM","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","forceState","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","setBlendMode","blendFunc","blendFuncSeparate","blendEquationSeparate","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","system","TextureGCSystem","checkCount","maxIdle","GC_MAX_IDLE","checkCountMax","GC_MAX_CHECK_COUNT","GC_MODE","GC_MODES","MANUAL","run","tm","managedTextures","wasRemoved","destroyTexture","unload","displayObject","children","GLTexture","samplerType","TextureSystem","currentLocation","_unknownBoundTextures","unknownTexture","hasIntegerTextures","internalFormats","table","RGB","RGB8","RG","RG8","RED","R8","RGBA_INTEGER","RGBA8UI","RGB_INTEGER","RGB8UI","RG_INTEGER","RG8UI","RED_INTEGER","R8UI","ALPHA","LUMINANCE","LUMINANCE_ALPHA","BYTE","_c","RGBA8_SNORM","RGB8_SNORM","RG8_SNORM","R8_SNORM","RGBA8I","RGB8I","RG8I","R8I","_d","RGBA16UI","RGB16UI","RG16UI","R16UI","DEPTH_COMPONENT16","SHORT","_e","RGBA16I","RGB16I","RG16I","R16I","_f","RGBA32UI","RGB32UI","RG32UI","R32UI","DEPTH_COMPONENT24","_g","RGBA32I","RGB32I","RG32I","R32I","_h","RGBA32F","RGB32F","RG32F","R32F","DEPTH_COMPONENT32F","HALF_FLOAT","_j","RGBA16F","RGB16F","RG16F","R16F","UNSIGNED_SHORT_5_6_5","_k","RGB565","UNSIGNED_SHORT_4_4_4_4","_l","RGBA4","UNSIGNED_SHORT_5_5_5_1","_m","RGB5_A1","UNSIGNED_INT_2_10_10_10_REV","_o","RGB10_A2","RGB10_A2UI","UNSIGNED_INT_10F_11F_11F_REV","_p","R11F_G11F_B10F","UNSIGNED_INT_5_9_9_9_REV","_q","RGB9_E5","UNSIGNED_INT_24_8","_r","FLOAT_32_UNSIGNED_INT_24_8_REV","_s","DEPTH32F_STENCIL8","_t","_u","_v","_w","_x","mapTypeAndFormatToInternalFormat","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","updateTextureStyle","ensureSamplerType","SAMPLER_TYPES","initTextureType","skipRemove","deleteTexture","removeItems","POW2","WRAP_MODES","CLAMP","ON_MANUAL","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","AbstractRenderer","RENDERER_TYPE","UNKNOWN","RENDER_OPTIONS","useContextAlpha","autoDensity","preserveDrawingBuffer","clearBeforeRender","_backgroundColor","_backgroundColorString","backgroundColor","backgroundAlpha","transparent","_lastObjectRendered","plugins","initPlugins","staticMap","o","desiredScreenWidth","desiredScreenHeight","screenWidth","screenHeight","generateTexture","region","manualRegion","getOwnPropertySymbols","propertyIsEnumerable","__rest","getLocalBounds","skipUpdateTransform","parent","removeView","parentNode","removeChild","thisAny","_tempDisplayObjectParent","hex2string","hex2rgb","GLBuffer","updateID","byteLength","BufferSystem","managedBuffers","boundBufferBases","createGLBuffer","bindBuffer","bindBufferRange","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","deleteBuffer","createBuffer","Renderer","prerender","addSystem","__plugins","antialias","premultipliedAlpha","powerPreference","sayHello","isWebGLSupported","FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER","LOW","ClassRef","isLost","cacheParent","enableTempParent","updateTransform","disableTempParent","extract","registerPlugin","pluginName","ctor","ExtensionType","RendererPlugin","ref","handleByMap","System","BatchDrawCall","BatchTextureArray","ViewableBuffer","sizeOrBuffer","rawBinaryData","uint32View","float32View","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","sizeOf","AbstractBatchRenderer","shaderGenerator","geometryClass","vertexSize","SPRITE_BATCH_SIZE","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","SPRITE_MAX_TEXTURES","generateShader","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","vertexData","indices","buildTexturesAndDrawCalls","textureArrays","touch","TICK","countTexArrays","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","premultiplyBlendMode","packInterleavedGeometry","bindAndClearTexArray","textureSystem","updateGeometry","packedGeometries","attributeBuffer","CAN_UPLOAD_SAME_BUFFER","_buffer","drawBatches","dcCount","curTexArray","getAttributeBuffer","getIndexBuffer","roundedP2","roundedSizeIndex","log2","roundedSize","packedVertices","indicies","textureId","argb","premultiplyTint","_tintRGB","BatchShaderGenerator","programCache","defaultGroupCache","sampleValues","uSamplers","generateSampleSrc","tint","translationMatrix","default","BatchGeometry","BatchPluginFactory","vertex","defaultVertex","fragment","defaultFragment","BatchPlugin","BatchRenderer","_resources","systems","_systems"],"mappings":";;;;;;;oQAmBAA,EAAAA,SAASC,WAAaC,EAAAA,SAASC,IAAMC,EAAGA,IAACC,MAAQD,EAAGA,IAACE,OAiBrDN,EAAQA,SAACO,sBAAuB,ECsBnB,IAAAC,EAA8C,GAgC3C,SAAAC,EAA2CC,EAAiBC,GAExE,IAAKD,EAED,OAAO,KAGX,IAAIE,EAAY,GAEhB,GAAsB,iBAAXF,EACX,CAEI,IAAMG,EAAS,yBAA2BC,KAAKJ,GAE3CG,IAEAD,EAAYC,EAAO,GAAGE,eAI9B,IAAK,IAAIC,EAAIR,EAAUS,OAAS,EAAGD,GAAK,IAAKA,EAC7C,CACI,IAAME,EAAiBV,EAAUQ,GAEjC,GAAIE,EAAeC,MAAQD,EAAeC,KAAKT,EAAQE,GAEnD,OAAO,IAAIM,EAAeR,EAAQC,GAI1C,MAAM,IAAIS,MAAM,oDCxGpB,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,KAClEP,EAAcC,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOC,KAAKC,YAAcX,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEY,UAAkB,OAANX,EAAaC,OAAOW,OAAOZ,IAAMQ,EAAGG,UAAYX,EAAEW,UAAW,IAAIH,GAG5E,IAAIK,EAAW,WAQlB,OAPAA,EAAWZ,OAAOa,QAAU,SAAkBC,GAC1C,QAASC,cAAGvB,EAAI,EAAGwB,EAAIC,UAAUxB,OAAQD,EAAIwB,EAAGxB,IAE5C,IAAK,IAAIY,KADTW,EAAI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4nC,MAAR5nC,+7CCzBY,sFCkDjB,SAA6BtZ,GAE/B,OAAO84C,GAASt3C,OAAOxB"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/dist/esm/core.min.mjs b/live2d/node_modules/@pixi/core/dist/esm/core.min.mjs new file mode 100644 index 0000000..7e5ba26 --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/esm/core.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{settings as e}from"@pixi/settings";import{ENV as t,ALPHA_MODES as r,SCALE_MODES as i,FORMATS as n,TYPES as o,TARGETS as s,MIPMAP_MODES as a,MSAA_QUALITY as u,BUFFER_TYPE as h,CLEAR_MODES as l,DRAW_MODES as f,BUFFER_BITS as d,MASK_TYPES as c,PRECISION as p,BLEND_MODES as v,GC_MODES as m,SAMPLER_TYPES as g,WRAP_MODES as y,RENDERER_TYPE as _}from"@pixi/constants";import{isMobile as b,isPow2 as x,BaseTextureCache as T,TextureCache as E,uid as R,EventEmitter as S,determineCrossOrigin as w,getResolutionOfUrl as A,nextPow2 as I,getBufferType as C,ProgramCache as F,removeItems as N,hex2string as O,hex2rgb as M,sayHello as P,isWebGLSupported as B,premultiplyBlendMode as U,log2 as L,premultiplyTint as D}from"@pixi/utils";import{extensions as G,ExtensionType as k}from"@pixi/extensions";export*from"@pixi/extensions";import{Runner as V}from"@pixi/runner";import{Ticker as H}from"@pixi/ticker";import{groupD8 as j,Rectangle as z,Point as X,Matrix as W}from"@pixi/math";e.PREFER_ENV=b.any?t.WEBGL:t.WEBGL2,e.STRICT_TEXTURE_CACHE=!1;var Y=[];function K(e,t){if(!e)return null;var r="";if("string"==typeof e){var i=/\.(\w{3,4})(?:$|\?|#)/i.exec(e);i&&(r=i[1].toLowerCase())}for(var n=Y.length-1;n>=0;--n){var o=Y[n];if(o.test&&o.test(e,r))return new o(e,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var q=function(e,t){return q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},q(e,t)};function Z(e,t){function r(){this.constructor=e}q(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $=function(){return $=Object.assign||function(e){for(var t,r=arguments,i=1,n=arguments.length;i0&&p>0,u.textureCacheIds=[],u.destroyed=!1,u.resource=null,u._batchEnabled=0,u._batchLocation=0,u.parentTextureArray=null,u.setResource(i),u}return Z(i,t),Object.defineProperty(i.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),i.prototype.setStyle=function(e,t){var r;return void 0!==e&&e!==this.scaleMode&&(this.scaleMode=e,r=!0),void 0!==t&&t!==this.mipmap&&(this.mipmap=t,r=!0),r&&this.dirtyStyleId++,this},i.prototype.setSize=function(e,t,r){return r=r||this.resolution,this.setRealSize(e*r,t*r,r)},i.prototype.setRealSize=function(e,t,r){return this.resolution=r||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this},i.prototype._refreshPOT=function(){this.isPowerOfTwo=x(this.realWidth)&&x(this.realHeight)},i.prototype.setResolution=function(e){var t=this.resolution;return t===e||(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT()),this},i.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},i.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},i.prototype.onError=function(e){this.emit("error",this,e)},i.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete T[this.cacheId],delete E[this.cacheId],this.cacheId=null),this.dispose(),i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},i.prototype.dispose=function(){this.emit("dispose",this)},i.prototype.castToBaseTexture=function(){return this},i.from=function(t,r,n){void 0===n&&(n=e.STRICT_TEXTURE_CACHE);var o="string"==typeof t,s=null;if(o)s=t;else{if(!t._pixiId){var a=r&&r.pixiIdPrefix||"pixiid";t._pixiId=a+"_"+R()}s=t._pixiId}var u=T[s];if(o&&n&&!u)throw new Error('The cacheId "'+s+'" does not exist in BaseTextureCache.');return u||((u=new i(t,r)).cacheId=s,i.addToCache(u,s)),u},i.fromBuffer=function(e,t,r,n){e=e||new Float32Array(t*r*4);var s=new Q(e,{width:t,height:r}),a=e instanceof Float32Array?o.FLOAT:o.UNSIGNED_BYTE;return new i(s,Object.assign({},ee,n||{width:t,height:r,type:a}))},i.addToCache=function(e,t){t&&(-1===e.textureCacheIds.indexOf(t)&&e.textureCacheIds.push(t),T[t]&&console.warn("BaseTexture added to the cache with an id ["+t+"] that already had an entry"),T[t]=e)},i.removeFromCache=function(e){if("string"==typeof e){var t=T[e];if(t){var r=t.textureCacheIds.indexOf(e);return r>-1&&t.textureCacheIds.splice(r,1),delete T[e],t}}else if(e&&e.textureCacheIds){for(var i=0;i0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,t)}else e.target=s.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this},t.prototype.upload=function(e,r,i){for(var n=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,r}(ne),he=function(e){function t(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];ne.crossOrigin(o,s,i.crossorigin);for(var a=0;a2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(H.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(H.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var t=this.valid;this.resize(e.videoWidth,e.videoHeight),!t&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(H.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(H.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(H.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,r){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(r)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(ne),le=function(e){function t(t){return e.call(this,t)||this}return Z(t,e),t.test=function(e){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap},t}(ne);Y.push(ae,le,oe,he,ue,Q,se,ie);var fe={__proto__:null,Resource:J,BaseImageResource:ne,INSTALLED:Y,autoDetectResource:K,AbstractMultiResource:re,ArrayResource:ie,BufferResource:Q,CanvasResource:oe,CubeResource:se,ImageResource:ae,SVGResource:ue,VideoResource:he,ImageBitmapResource:le},de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z(t,e),t.prototype.upload=function(e,t,i){var n=e.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===r.UNPACK);var o=t.realWidth,s=t.realHeight;return i.width===o&&i.height===s?n.texSubImage2D(t.target,0,0,0,o,s,t.format,i.type,this.data):(i.width=o,i.height=s,n.texImage2D(t.target,0,i.internalFormat,o,s,0,t.format,i.type,this.data)),!0},t}(Q),ce=function(){function e(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new V("disposeFramebuffer"),this.multisample=u.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,t){return void 0===e&&(e=0),this.colorTextures[e]=t||new te(null,{scaleMode:i.NEAREST,resolution:1,mipmap:a.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new te(new de(null,{width:this.width,height:this.height}),{scaleMode:i.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:a.OFF,format:n.DEPTH_COMPONENT,type:o.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),e!==this.width||t!==this.height){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&t.textureCacheIds.splice(r,1),delete E[e],t}}else if(e&&e.textureCacheIds){for(var i=0;ithis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",u="X: "+t+" + "+i+" = "+(t+i)+" > "+this.baseTexture.width,h="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+u+" "+a+" "+h)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),r.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(r,"EMPTY",{get:function(){return r._EMPTY||(r._EMPTY=new r(new te),ge(r._EMPTY),ge(r._EMPTY.baseTexture)),r._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(r,"WHITE",{get:function(){if(!r._WHITE){var t=e.ADAPTER.createCanvas(16,16),i=t.getContext("2d");t.width=16,t.height=16,i.fillStyle="white",i.fillRect(0,0,16,16),r._WHITE=new r(te.from(t)),ge(r._WHITE),ge(r._WHITE.baseTexture)}return r._WHITE},enumerable:!1,configurable:!0}),r}(S),_e=function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Z(t,e),Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t,r){void 0===r&&(r=!0);var i=this.baseTexture.resolution,n=Math.round(e*i)/i,o=Math.round(t*i)/i;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,r&&this.baseTexture.resize(n,o),this.updateUvs()},t.prototype.setResolution=function(e){var t=this.baseTexture;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))},t.create=function(e){for(var r=arguments,i=[],n=1;n1?-i:-1:(n=((65535&(e=I(e)))<<16|65535&(t=I(t)))>>>0,i>1&&(n+=4294967296*i)),this.texturePool[n]||(this.texturePool[n]=[]);var o=this.texturePool[n].pop();return o||(o=this.createTexture(e,t,i)),o.filterPoolKey=n,o.setResolution(r),o},e.prototype.getFilterTexture=function(e,t,r){var i=this.getOptimalTexture(e.width,e.height,t||e.resolution,r||u.NONE);return i.filterFrame=e.filterFrame,i},e.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},e.prototype.returnFilterTexture=function(e){this.returnTexture(e)},e.prototype.clear=function(e){if(e=!1!==e)for(var t in this.texturePool){var r=this.texturePool[t];if(r)for(var i=0;i0&&e.height>0,this.texturePool)if(Number(t)<0){var r=this.texturePool[t];if(r)for(var i=0;i1){for(var h=0;h1&&((f=this.getOptimalFilterTexture(h.width,h.height,t.resolution)).filterFrame=h.filterFrame),r[d].apply(this,h,f,l.CLEAR,t);var c=h;h=f,f=c}r[d].apply(this,h,u.renderTexture,l.BLEND,t),d>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(h),this.returnFilterTexture(f)}t.clear(),this.statePool.push(t)},e.prototype.bindAndClear=function(e,t){void 0===t&&(t=l.CLEAR);var r=this.renderer,i=r.renderTexture,n=r.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,i.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var s=1&n.stateId||this.forceClear;(t===l.CLEAR||t===l.BLIT&&s)&&this.renderer.framebuffer.clear(0,0,0,0)},e.prototype.applyFilter=function(e,t,r,i){var n=this.renderer;n.state.set(e.state),this.bindAndClear(r,i),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(f.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(f.TRIANGLE_STRIP))},e.prototype.calculateSpriteMatrix=function(e,t){var r=this.activeState,i=r.sourceFrame,n=r.destinationFrame,o=t._texture.orig,s=e.set(n.width,0,0,n.height,i.x,i.y),a=t.worldTransform.copyTo(W.TEMP_MATRIX);return a.invert(),s.prepend(a),s.scale(1/o.width,1/o.height),s.translate(t.anchor.x,t.anchor.y),s},e.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},e.prototype.getOptimalFilterTexture=function(e,t,r,i){return void 0===r&&(r=1),void 0===i&&(i=u.NONE),this.texturePool.getOptimalTexture(e,t,r,i)},e.prototype.getFilterTexture=function(e,t,r){if("number"==typeof e){var i=e;e=t,t=i}e=e||this.activeState.renderTexture;var n=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,r||u.NONE);return n.filterFrame=e.filterFrame,n},e.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},e.prototype.emptyPool=function(){this.texturePool.clear(!0)},e.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},e.prototype.transformAABB=function(e,t){var r=Pe[0],i=Pe[1],n=Pe[2],o=Pe[3];r.set(t.left,t.top),i.set(t.left,t.bottom),n.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(r,r),e.apply(i,i),e.apply(n,n),e.apply(o,o);var s=Math.min(r.x,i.x,n.x,o.x),a=Math.min(r.y,i.y,n.y,o.y),u=Math.max(r.x,i.x,n.x,o.x),h=Math.max(r.y,i.y,n.y,o.y);t.x=s,t.y=a,t.width=u-s,t.height=h-a},e.prototype.roundFrame=function(e,t,r,i,n){if(!(e.width<=0||e.height<=0||r.width<=0||r.height<=0)){if(n){var o=n.a,s=n.b,a=n.c,u=n.d;if((Math.abs(s)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}(n=n?Be.copyFrom(n):Be.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}},e}(),Le=function(){function e(e){this.renderer=e}return e.prototype.flush=function(){},e.prototype.destroy=function(){this.renderer=null},e.prototype.start=function(){},e.prototype.stop=function(){this.flush()},e.prototype.render=function(e){},e}(),De=function(){function e(e){this.renderer=e,this.emptyRenderer=new Le(e),this.currentRenderer=this.emptyRenderer}return e.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},e.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},e.prototype.copyBoundTextures=function(e,t){for(var r=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=r[i]||null,e[i]&&(e[i]._batchLocation=i)},e.prototype.boundArray=function(e,t,r,i){for(var n=e.elements,o=e.ids,s=e.count,a=0,u=0;u=0&&l=t.WEBGL2&&(n=r.getContext("webgl2",i)),n)this.webGLVersion=2;else if(this.webGLVersion=1,!(n=r.getContext("webgl",i)||r.getContext("experimental-webgl",i)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout((function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()}),0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Ve=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=u.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},He=new z,je=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new ce(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var r=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new z,this.hasMRT=!0,this.writeDepthTexture=!0,1===this.renderer.context.webGLVersion){var i=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;e.PREFER_ENV===t.WEBGL_LEGACY&&(i=null,n=null),i?r.drawBuffers=function(e){return i.drawBuffersWEBGL(e)}:(this.hasMRT=!1,r.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=r.getInternalformatParameter(r.RENDERBUFFER,r.RGBA8,r.SAMPLES)},r.prototype.bind=function(e,t,r){void 0===r&&(r=0);var i=this.gl;if(e){var n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var o=0;o>r,u=t.height>>r,h=a/t.width;this.setViewport(t.x*h,t.y*h,a,u)}else{a=e.width>>r,u=e.height>>r;this.setViewport(0,0,a,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,r,i){var n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===e&&n.y===t||(n.x=e,n.y=t,n.width=r,n.height=i,this.gl.viewport(e,t,r,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,r,i,n){void 0===n&&(n=d.COLOR|d.DEPTH);var o=this.gl;o.clearColor(e,t,r,i),o.clear(n)},r.prototype.initFramebuffer=function(e){var t=this.gl,r=new Ve(t.createFramebuffer());return r.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(e),e.disposeRunner.add(this),r},r.prototype.resizeFramebuffer=function(e){var t=this.gl,r=e.glFramebuffers[this.CONTEXT_UID];r.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,r.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.RGBA8,e.width,e.height)),r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,n=i.length;t.drawBuffers||(n=Math.min(n,1));for(var o=0;o1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.RGBA8,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],a=0;a1&&r.drawBuffers(s),e.depthTexture)&&this.writeDepthTexture){var l=e.depthTexture;this.renderer.texture.bind(l,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,t)}!e.stencil&&!e.depth||e.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))},r.prototype.canMultisampleFramebuffer=function(e){return 1!==this.renderer.context.webGLVersion&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,r=u.NONE;if(e<=1||null===t)return r;for(var i=0;i=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=t.WEBGL2&&(i=r.getContext("webgl2",{})),i||((i=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}))?i.getExtension("WEBGL_draw_buffers"):i=null),Qe=i}return Qe}function tt(e,t,r){if("precision"!==e.substring(0,9)){var i=t;return t===p.HIGH&&r!==p.HIGH&&(i=p.MEDIUM),"precision "+i+" float;\n"+e}return r!==p.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var rt={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function it(e){return rt[e]}var nt=null,ot={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function st(e,t){if(!nt){var r=Object.keys(ot);nt={};for(var i=0;i0&&(t+="\nelse "),r0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==t&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))},e.prototype.destroy=function(){this.renderer=null},e}(),Rt=function(){function e(e){this.renderer=e,this.maskStack=[],this.glConst=0}return e.prototype.getStackLength=function(){return this.maskStack.length},e.prototype.setMaskStack=function(e){var t=this.renderer.gl,r=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==r&&(0===i?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},e.prototype._useCurrent=function(){},e.prototype.destroy=function(){this.renderer=null,this.maskStack=null},e}(),St=new W,wt=[],At=function(t){function r(r){var i=t.call(this,r)||this;return i.glConst=e.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,i}return Z(r,t),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0},r.prototype.calcScissorRect=function(e){var t;if(!e._scissorRectLocal){var r=e._scissorRect,i=e.maskObject,n=this.renderer,o=n.renderTexture,s=i.getBounds(!0,null!==(t=wt.pop())&&void 0!==t?t:new z);this.roundFrameToPixels(s,o.current?o.current.resolution:n.resolution,o.sourceFrame,o.destinationFrame,n.projection.transform),r&&s.fit(r),e._scissorRectLocal=s}},r.isMatrixRotated=function(e){if(!e)return!1;var t=e.a,r=e.b,i=e.c,n=e.d;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(n)>1e-4)},r.prototype.testScissor=function(e){var t=e.maskObject;if(!t.isFastRect||!t.isFastRect())return!1;if(r.isMatrixRotated(t.worldTransform))return!1;if(r.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);var i=e._scissorRectLocal;return i.width>0&&i.height>0},r.prototype.roundFrameToPixels=function(e,t,i,n,o){r.isMatrixRotated(o)||((o=o?St.copyFrom(o):St.identity()).translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.renderer.filter.transformAABB(o,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))},r.prototype.push=function(e){e._scissorRectLocal||this.calcScissorRect(e);var t=this.renderer.gl;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;e&&wt.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)},r.prototype._useCurrent=function(){var e,t=this.maskStack[this.maskStack.length-1]._scissorRect;e=this.renderer.renderTexture.current?t.y:this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)},r}(Rt),It=function(t){function r(r){var i=t.call(this,r)||this;return i.glConst=e.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,i}return Z(r,t),r.prototype.getStackLength=function(){var e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0},r.prototype.push=function(e){var t=e.maskObject,r=this.renderer.gl,i=e._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),e._stencilCounter++;var n=e._colorMask;0!==n&&(e._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==n&&(e._colorMask=n,r.colorMask(0!=(1&n),0!=(2&n),0!=(4&n),0!=(8&n))),this._useCurrent()},r.prototype.pop=function(e){var t=this.renderer.gl;if(0===this.getStackLength())t.disable(t.STENCIL_TEST);else{var r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==i&&(r._colorMask=i,t.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}},r.prototype._useCurrent=function(){var e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)},r}(Rt),Ct=function(){function e(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new W,this.transform=null}return e.prototype.update=function(e,t,r,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},e.prototype.calculateProjection=function(e,t,r,i){var n=this.projectionMatrix,o=i?-1:1;n.identity(),n.a=1/t.width*2,n.d=o*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-o-t.y*n.d},e.prototype.setTransform=function(e){},e.prototype.destroy=function(){this.renderer=null},e}(),Ft=new z,Nt=new z,Ot=function(){function e(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new z,this.destinationFrame=new z,this.viewportFrame=new z}return e.prototype.bind=function(e,t,r){void 0===e&&(e=null);var i,n,o,s=this.renderer;this.current=e,e?(o=(i=e.baseTexture).resolution,t||(Ft.width=e.frame.width,Ft.height=e.frame.height,t=Ft),r||(Nt.x=e.frame.x,Nt.y=e.frame.y,Nt.width=t.width,Nt.height=t.height,r=Nt),n=i.framebuffer):(o=s.resolution,t||(Ft.width=s.screen.width,Ft.height=s.screen.height,t=Ft),r||((r=Ft).width=t.width,r.height=t.height));var a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,e||(a.y=s.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(r,t,o,!n),e?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(r)},e.prototype.clear=function(e,t){e=this.current?e||this.current.baseTexture.clearColor:e||this.clearColor;var r=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,n=r.width!==i.width||r.height!==i.height;if(n){var o=this.viewportFrame,s=o.x,a=o.y,u=o.width,h=o.height;s=Math.round(s),a=Math.round(a),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,a,u,h)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),n&&this.renderer.scissor.pop()},e.prototype.resize=function(){this.bind(null)},e.prototype.reset=function(){this.bind(null)},e.prototype.destroy=function(){this.renderer=null},e}();function Mt(e,t,r,i,n){r.buffer.update(n)}var Pt={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},Bt={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function Ut(e){for(var t=e.map((function(e){return{data:e,offset:0,dataLen:0,dirty:0}})),r=0,i=0,n=0,o=0;o1&&(r=Math.max(r,16)*s.data.size),s.dataLen=r,i%r!=0&&i<16){var a=i%r%16;i+=a,n+=a}i+r>16?(n=16*Math.ceil(n/16),s.offset=n,n+=r,i=r):(s.offset=n,i+=r,n+=r)}return{uboElements:t,size:n=16*Math.ceil(n/16)}}function Lt(e,t){var r=[];for(var i in e)t[i]&&r.push(t[i]);return r.sort((function(e,t){return e.index-t.index})),r}function Dt(e,t){if(!e.autoManage)return{size:0,syncFunc:Mt};for(var r=Ut(Lt(e.uniforms,t)),i=r.uboElements,n=r.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],s=0;s1){var c=it(a.data.type),p=Math.max(Bt[a.data.type]/16,1),v=c/p,m=(4-v%4)%4;o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*p+"; i++)\n {\n for(var j = 0; j < "+v+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+m+";\n }\n\n ")}else{var g=Pt[a.data.type];o.push("\n cv = ud."+h+".value;\n v = uv."+h+";\n offset = "+a.offset/4+";\n "+g+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var Gt=function(){},kt=function(){function e(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return e.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},e}();function Vt(e,t){var r=Ye(e,e.VERTEX_SHADER,t.vertexSrc),i=Ye(e,e.FRAGMENT_SHADER,t.fragmentSrc),n=e.createProgram();if(e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)||function(e,t,r,i){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(r,e.COMPILE_STATUS)||Ke(e,r),e.getShaderParameter(i,e.COMPILE_STATUS)||Ke(e,i),console.error("PixiJS Error: Could not initialize shader."),""!==e.getProgramInfoLog(t)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",e.getProgramInfoLog(t)))}(e,n,r,i),t.attributeData=function(e,t){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;nt?1:-1}));for(var s=0;s>=1,r++;this.stateId=e.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},t.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),t[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(e.children[i])},t.prototype.destroy=function(){this.renderer=null},t}();var Yt=function(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=o.UNSIGNED_BYTE,this.internalFormat=n.RGBA,this.samplerType=0},Kt=function(){function e(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new te,this.hasIntegerTextures=!1}return e.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(e){var t,r,i,s,a,u,h,l,f,d,c,p,v,m,g,y,_,b,x,T,E,R,S;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?((t={})[o.UNSIGNED_BYTE]=((r={})[n.RGBA]=e.RGBA8,r[n.RGB]=e.RGB8,r[n.RG]=e.RG8,r[n.RED]=e.R8,r[n.RGBA_INTEGER]=e.RGBA8UI,r[n.RGB_INTEGER]=e.RGB8UI,r[n.RG_INTEGER]=e.RG8UI,r[n.RED_INTEGER]=e.R8UI,r[n.ALPHA]=e.ALPHA,r[n.LUMINANCE]=e.LUMINANCE,r[n.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,r),t[o.BYTE]=((i={})[n.RGBA]=e.RGBA8_SNORM,i[n.RGB]=e.RGB8_SNORM,i[n.RG]=e.RG8_SNORM,i[n.RED]=e.R8_SNORM,i[n.RGBA_INTEGER]=e.RGBA8I,i[n.RGB_INTEGER]=e.RGB8I,i[n.RG_INTEGER]=e.RG8I,i[n.RED_INTEGER]=e.R8I,i),t[o.UNSIGNED_SHORT]=((s={})[n.RGBA_INTEGER]=e.RGBA16UI,s[n.RGB_INTEGER]=e.RGB16UI,s[n.RG_INTEGER]=e.RG16UI,s[n.RED_INTEGER]=e.R16UI,s[n.DEPTH_COMPONENT]=e.DEPTH_COMPONENT16,s),t[o.SHORT]=((a={})[n.RGBA_INTEGER]=e.RGBA16I,a[n.RGB_INTEGER]=e.RGB16I,a[n.RG_INTEGER]=e.RG16I,a[n.RED_INTEGER]=e.R16I,a),t[o.UNSIGNED_INT]=((u={})[n.RGBA_INTEGER]=e.RGBA32UI,u[n.RGB_INTEGER]=e.RGB32UI,u[n.RG_INTEGER]=e.RG32UI,u[n.RED_INTEGER]=e.R32UI,u[n.DEPTH_COMPONENT]=e.DEPTH_COMPONENT24,u),t[o.INT]=((h={})[n.RGBA_INTEGER]=e.RGBA32I,h[n.RGB_INTEGER]=e.RGB32I,h[n.RG_INTEGER]=e.RG32I,h[n.RED_INTEGER]=e.R32I,h),t[o.FLOAT]=((l={})[n.RGBA]=e.RGBA32F,l[n.RGB]=e.RGB32F,l[n.RG]=e.RG32F,l[n.RED]=e.R32F,l[n.DEPTH_COMPONENT]=e.DEPTH_COMPONENT32F,l),t[o.HALF_FLOAT]=((f={})[n.RGBA]=e.RGBA16F,f[n.RGB]=e.RGB16F,f[n.RG]=e.RG16F,f[n.RED]=e.R16F,f),t[o.UNSIGNED_SHORT_5_6_5]=((d={})[n.RGB]=e.RGB565,d),t[o.UNSIGNED_SHORT_4_4_4_4]=((c={})[n.RGBA]=e.RGBA4,c),t[o.UNSIGNED_SHORT_5_5_5_1]=((p={})[n.RGBA]=e.RGB5_A1,p),t[o.UNSIGNED_INT_2_10_10_10_REV]=((v={})[n.RGBA]=e.RGB10_A2,v[n.RGBA_INTEGER]=e.RGB10_A2UI,v),t[o.UNSIGNED_INT_10F_11F_11F_REV]=((m={})[n.RGB]=e.R11F_G11F_B10F,m),t[o.UNSIGNED_INT_5_9_9_9_REV]=((g={})[n.RGB]=e.RGB9_E5,g),t[o.UNSIGNED_INT_24_8]=((y={})[n.DEPTH_STENCIL]=e.DEPTH24_STENCIL8,y),t[o.FLOAT_32_UNSIGNED_INT_24_8_REV]=((_={})[n.DEPTH_STENCIL]=e.DEPTH32F_STENCIL8,_),S=t):((b={})[o.UNSIGNED_BYTE]=((x={})[n.RGBA]=e.RGBA,x[n.RGB]=e.RGB,x[n.ALPHA]=e.ALPHA,x[n.LUMINANCE]=e.LUMINANCE,x[n.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,x),b[o.UNSIGNED_SHORT_5_6_5]=((T={})[n.RGB]=e.RGB,T),b[o.UNSIGNED_SHORT_4_4_4_4]=((E={})[n.RGBA]=e.RGBA,E),b[o.UNSIGNED_SHORT_5_5_5_1]=((R={})[n.RGBA]=e.RGBA,R),S=b),S}(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var r=0;r=0;--o){var s=r[o];if(s)s._glTextures[n].samplerType!==g.FLOAT&&this.renderer.texture.unbind(s)}},e.prototype.initTexture=function(e){var t=new Yt(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},e.prototype.initTextureType=function(e,t){var r,i;t.internalFormat=null!==(i=null===(r=this.internalFormats[e.type])||void 0===r?void 0:r[e.format])&&void 0!==i?i:e.format,2===this.webGLVersion&&e.type===o.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},e.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var r=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(r,e,t))t.samplerType!==g.FLOAT&&(this.hasIntegerTextures=!0);else{var i=e.realWidth,n=e.realHeight,o=r.gl;(t.width!==i||t.height!==n||t.dirtyId<0)&&(t.width=i,t.height=n,o.texImage2D(e.target,0,t.internalFormat,i,n,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},e.prototype.destroyTexture=function(e,t){var r=this.gl;if((e=e.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(e),r.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var i=this.managedTextures.indexOf(e);-1!==i&&N(this.managedTextures,i,1)}},e.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&(e.mipmap!==a.POW2&&2===this.webGLVersion||e.isPowerOfTwo?t.mipmap=e.mipmap>=1:t.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?t.wrapMode=e.wrapMode:t.wrapMode=y.CLAMP,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},e.prototype.setStyle=function(e,t){var r=this.gl;if(t.mipmap&&e.mipmap!==a.ON_MANUAL&&r.generateMipmap(e.target),r.texParameteri(e.target,r.TEXTURE_WRAP_S,t.wrapMode),r.texParameteri(e.target,r.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===i.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===i.LINEAR){var o=Math.min(e.anisotropicLevel,r.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===i.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(e.target,r.TEXTURE_MAG_FILTER,e.scaleMode===i.LINEAR?r.LINEAR:r.NEAREST)},e.prototype.destroy=function(){this.renderer=null},e}(),qt={__proto__:null,FilterSystem:Ue,BatchSystem:De,ContextSystem:ke,FramebufferSystem:je,GeometrySystem:Xe,MaskSystem:Et,ScissorSystem:At,StencilSystem:It,ProjectionSystem:Ct,RenderTextureSystem:Ot,ShaderSystem:zt,StateSystem:Xt,TextureGCSystem:Wt,TextureSystem:Kt},Zt=new W,$t=function(t){function r(r,i){void 0===r&&(r=_.UNKNOWN);var n=t.call(this)||this;return i=Object.assign({},e.RENDER_OPTIONS,i),n.options=i,n.type=r,n.screen=new z(0,0,i.width,i.height),n.view=i.view||e.ADAPTER.createCanvas(),n.resolution=i.resolution||e.RESOLUTION,n.useContextAlpha=i.useContextAlpha,n.autoDensity=!!i.autoDensity,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n.backgroundAlpha=i.backgroundAlpha,void 0!==i.transparent&&(n.useContextAlpha=i.transparent,n.backgroundAlpha=i.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return Z(r,t),r.prototype.initPlugins=function(e){for(var t in e)this.plugins[t]=new e[t](this)},Object.defineProperty(r.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),r.prototype.resize=function(e,t){this.view.width=Math.round(e*this.resolution),this.view.height=Math.round(t*this.resolution);var r=this.view.width/this.resolution,i=this.view.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.view.style.width=r+"px",this.view.style.height=i+"px"),this.emit("resize",r,i)},r.prototype.generateTexture=function(e,t,r,i){void 0===t&&(t={}),"number"==typeof t&&(t={scaleMode:t,resolution:r,region:i});var n=t.region,o=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{var n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;i.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}},e.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var r=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),r&&(t||i.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID])}},e.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),r=0;r=u.HIGH?this.multisample=u.HIGH:e>=u.MEDIUM?this.multisample=u.MEDIUM:e>=u.LOW?this.multisample=u.LOW:this.multisample=u.NONE},t.prototype.addSystem=function(e,t){var r=new e(this);if(this[t])throw new Error('Whoops! The name "'+t+'" is already in use');for(var i in this[t]=r,this.runners)this.runners[i].add(r);return this},t.prototype.render=function(e,t){var r,i,n,o;if(t&&(t instanceof _e?(r=t,i=arguments[2],n=arguments[3],o=arguments[4]):(r=t.renderTexture,i=t.clear,n=t.transform,o=t.skipUpdateTransform)),this.renderingToScreen=!r,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(r||(this._lastObjectRendered=e),!o){var s=e.enableTempParent();e.updateTransform(),e.disableTempParent(s)}this.renderTexture.bind(r),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),e.render(this),this.batch.currentRenderer.flush(),r&&r.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},t.prototype.generateTexture=function(t,r,i,n){void 0===r&&(r={});var o=e.prototype.generateTexture.call(this,t,r,i,n);return this.framebuffer.blit(),o},t.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(this.screen.height,this.screen.width)},t.prototype.reset=function(){return this.runners.reset.emit(),this},t.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},t.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(t.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),t.registerPlugin=function(e,t){G.add({name:e,type:k.RendererPlugin,ref:t})},t.__plugins={},t}($t);function tr(e){return er.create(e)}G.handleByMap(k.RendererPlugin,er.__plugins);var rr="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",ir="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",nr=function(){function e(e){this.renderer=e}return e.prototype.destroy=function(){this.renderer=null},e}(),or=function(){this.texArray=null,this.blend=0,this.type=f.TRIANGLES,this.start=0,this.size=0,this.data=null},sr=function(){function e(){this.elements=[],this.ids=[],this.count=0}return e.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},i.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=i._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++te._globalBatch,u=0,h=r[0],l=0;n.copyBoundTextures(o,t);for(var f=0;f=t&&(n.boundArray(h,o,a,t),this.buildDrawCalls(h,l,f),l=f,h=r[++u],++a),d._batchEnabled=a,d.touched=s,h.elements[h.count++]=d)}h.count>0&&(n.boundArray(h,o,a,t),this.buildDrawCalls(h,l,this._bufferSize),++u,++a);for(f=0;f0&&(t+="\nelse "),r\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import $defaultVertex from './default.vert';\nimport $defaultFilterVertex from './defaultFilter.vert';\n\n/**\n * Default vertex shader\n * @memberof PIXI\n * @member {string} defaultVertex\n */\n\n/**\n * Default filter vertex shader\n * @memberof PIXI\n * @member {string} defaultFilterVertex\n */\n\n// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types\n// of defaultVertex, defaultFilterVertex.\nconst defaultVertex: string = $defaultVertex;\nconst defaultFilterVertex: string = $defaultFilterVertex;\n\nexport { defaultVertex, defaultFilterVertex };\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n"],"names":["settings","PREFER_ENV","isMobile","any","ENV","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","source","options","extension","result","exec","toLowerCase","i","length","ResourcePlugin","test","Error","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","this","constructor","prototype","create","__assign","assign","t","s","n","arguments","call","apply","Resource","width","height","_width","_height","destroyed","internal","onResize","Runner","onUpdate","onError","bind","baseTexture","add","emit","unbind","remove","resize","defineProperty","get","update","load","Promise","resolve","style","_renderer","_baseTexture","_glTexture","dispose","destroy","removeAll","_source","_extension","BufferResource","_super","_this","_a","data","upload","renderer","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","alphaMode","ALPHA_MODES","UNPACK","realWidth","realHeight","texSubImage2D","target","format","type","texImage2D","internalFormat","Float32Array","Uint8Array","Uint32Array","defaultBufferOptions","scaleMode","SCALE_MODES","NEAREST","FORMATS","RGBA","NPM","BaseTexture","resource","mipmap","anisotropicLevel","wrapMode","resolution","resourceOptions","RESOLUTION","Math","round","_mipmap","undefined","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","_wrapMode","WRAP_MODE","_scaleMode","SCALE_MODE","TYPES","UNSIGNED_BYTE","TARGETS","TEXTURE_2D","uid","touched","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","valid","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","set","value","setStyle","dirty","setSize","desiredWidth","desiredHeight","setRealSize","isPow2","setResolution","oldResolution","event","BaseTextureCache","TextureCache","removeFromCache","castToBaseTexture","from","strict","isFrame","_pixiId","prefix","pixiIdPrefix","addToCache","fromBuffer","buffer","FLOAT","id","indexOf","push","console","warn","baseTextureFromCache","index","splice","_globalBatch","EventEmitter","AbstractMultiResource","items","itemDirtyIds","partTexture","_load","initFromArray","resources","addBaseTextureAt","addResourceAt","len","on","off","promises","map","item","filter","all","then","ArrayResource","urls","isArray","TEXTURE_2D_ARRAY","texture","texImage3D","texSubImage3D","BaseImageResource","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","crossOrigin","element","url","crossorigin","determineCrossOrigin","HTMLImageElement","complete","HTMLVideoElement","readyState","CanvasResource","OffscreenCanvas","globalThis","HTMLCanvasElement","CubeResource","autoLoad","linkBaseTexture","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","keys","side","ImageResource","imageElement","Image","src","_process","preserveBitmap","createBitmap","CREATE_IMAGE_BITMAP","createImageBitmap","bitmap","reject","completed","onload","onerror","process","cors","fetch","mode","r","blob","premultiplyAlpha","flag","glTextures","key","otherTex","close","SVGResource","sourceBase64","ADAPTER","createCanvas","svg","scale","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVG_XML","trim","btoa","unescape","encodeURIComponent","_loadSvg","tempImage","svgWidth","svgHeight","canvas","getContext","drawImage","getSize","svgString","sizeMatch","SVG_SIZE","size","parseFloat","startsWith","VideoResource","videoElement","document","createElement","setAttribute","firstSrc","sourceElement","mime","baseSrc","split","shift","ext","slice","lastIndexOf","MIME_TYPES","appendChild","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","_deltaTime","elapsedMS","Ticker","shared","playbackRate","floor","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","addEventListener","_onPlayStart","_onPlayStop","_isSourceReady","removeEventListener","_isSourcePlaying","paused","ended","autoUpdate","play","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","DepthResource","Framebuffer","stencil","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","MSAA_QUALITY","NONE","addColorTexture","MIPMAP_MODES","OFF","addDepthTexture","DEPTH_COMPONENT","UNSIGNED_SHORT","enableDepth","enableStencil","destroyDepthTexture","BaseRenderTexture","clearColor","framebuffer","maskStack","filterStack","TextureUvs","x0","y0","x1","y1","x2","y2","x3","y3","uvsFloat32","frame","baseFrame","rotate","tw","th","w2","h2","cX","x","cY","y","groupD8","NW","uX","uY","DEFAULT_UVS","removeAllHandlers","tex","once","Texture","orig","anchor","noFrame","Rectangle","_frame","_uvs","uvMatrix","_rotate","Number","defaultAnchor","Point","_updateID","onBaseTextureUpdated","updateUvs","destroyBase","clone","clonedFrame","clonedOrig","clonedTexture","getResolutionOfUrl","fromURL","fromLoader","imageUrl","name","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","_EMPTY","_WHITE","context","fillStyle","fillRect","RenderTexture","baseRenderTexture","filterFrame","filterPoolKey","resizeBaseTexture","rest","_i","RenderTexturePool","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","createTexture","getOptimalTexture","minWidth","minHeight","ceil","nextPow2","renderTexture","pop","getFilterTexture","input","filterTexture","returnTexture","returnFilterTexture","clear","destroyTextures","textures","j","setScreenSize","SCREEN_KEY","Attribute","normalized","stride","start","instance","UID","Buffer","_static","_glBuffers","static","BUFFER_TYPE","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","Int32Array","byteSizeMap","Uint16Array","Geometry","buffers","attributes","indexBuffer","glVertexArrayObjects","instanced","instanceCount","refCount","addAttribute","ids","bufferIndex","getAttribute","getBuffer","addIndex","getIndex","interleave","arrays","sizes","interleavedBuffer","attribute","outSize","views","ArrayBuffer","out","littleOffset","array","getBufferType","interleaveTypedArrays","geometry","attrib","merge","geometries","geometryOut","offsets","offset","offset2","bufferIndexToCount","indexBufferData","Quad","QuadUv","vertices","uvs","vertexBuffer","uvBuffer","targetTextureFrame","destinationFrame","invalidate","UniformGroup","uniforms","isStatic","isUbo","group","syncUniforms","ubo","UNIFORM_BUFFER","autoManage","_ubo","uboFrom","FilterState","legacy","sourceFrame","bindingSourceFrame","bindingDestinationFrame","filters","transform","tempPoints","tempMatrix","Matrix","FilterSystem","defaultFilterStack","view","statePool","quad","quadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterArea","filterClamp","forceClear","useMaxPadding","state","renderTextureSystem","padding","autoFit","min","max","_b","current","copyFrom","getBounds","pad","sourceFrameProjected","projection","transformAABB","invert","fit","intersects","roundFrame","getOptimalFilterTexture","lastState","blit","CLEAR_MODES","BLEND","flip","flop","CLEAR","bindAndClear","clearMode","stateSystem","autoClear","stateId","BLIT","applyFilter","output","uSampler","filterGlobals","shader","program","attributeData","aTextureCoord","draw","DRAW_MODES","TRIANGLES","TRIANGLE_STRIP","calculateSpriteMatrix","outputMatrix","sprite","_texture","mappedMatrix","worldTransform","copyTo","TEMP_MATRIX","prepend","translate","swap","emptyPool","matrix","rect","lt","lb","rt","rb","left","top","bottom","right","a","c","abs","identity","ObjectRenderer","flush","stop","render","_object","BatchSystem","emptyRenderer","currentRenderer","setObjectRenderer","objectRenderer","reset","copyBoundTextures","arr","maxTextures","boundTextures","boundArray","texArray","batchId","elements","count","loc","bound","CONTEXT_UID_COUNTER","ContextSystem","webGLVersion","extensions","supports","uint32Indices","handleContextLost","handleContextRestored","isContextLost","contextChange","CONTEXT_UID","initFromContext","validateContext","runners","initFromOptions","createContext","getExtensions","common","loseContext","getExtension","anisotropicFiltering","floatTextureLinear","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","drawBuffers","vertexArrayObject","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","preventDefault","setTimeout","restoreContext","useProgram","postrender","renderingToScreen","getContextAttributes","isWebGl2","WebGL2RenderingContext","hasuint32","GLFramebuffer","msaaBuffer","blitFramebuffer","mipLevel","tempRectangle","FramebufferSystem","managedFramebuffers","unknownFramebuffer","msaaSamples","disposeAll","viewport","hasMRT","writeDepthTexture","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","mipWidth","mipHeight","setViewport","v","g","mask","BUFFER_BITS","COLOR","DEPTH","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorageMultisample","DEPTH24_STENCIL8","renderbufferStorage","DEPTH_STENCIL","parentTexture","canMultisampleFramebuffer","createRenderbuffer","framebufferRenderbuffer","COLOR_ATTACHMENT0","deleteRenderbuffer","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","res","sourcePixels","destPixels","colorTexture","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","LINEAR","disposeFramebuffer","contextLost","deleteFramebuffer","list","forceStencil","w","h","GeometrySystem","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","e","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","initGeometryVao","activateVao","updateBuffers","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","location","join","glPrograms","generateProgram","signature","vaoObjectHash","tempStride","tempStart","attribSize","disposeGeometry","buf","vaoId","lastBuffer","glBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","BYTES_PER_ELEMENT","glType","UNSIGNED_INT","drawElements","drawArrays","MaskData","maskObject","MASK_TYPES","autoDetect","pooled","isMaskData","FILTER_MULTISAMPLE","enabled","colorMask","_filters","_stencilCounter","_scissorCounter","_scissorRect","_scissorRectLocal","_colorMask","_target","copyCountersOrReset","maskAbove","compileShader","createShader","shaderSource","logPrettyShaderError","shaderSrc","getShaderSource","line","shaderLog","getShaderInfoLog","splitShader","dedupe","lineNumbers","replace","logArgs","forEach","number","fragmentSourceToLog","error","groupCollapsed","groupEnd","booleanArray","defaultValue","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","substring","precision","PRECISION","HIGH","MEDIUM","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","uint","uvec2","uvec3","uvec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","codeUbo","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","FRAGMENT_SHADER","fragmentSrc","getShaderParameter","COMPILE_STATUS","nameCache","Program","vertexSrc","defaultVertexSrc","defaultFragmentSrc","PRECISION_VERTEX","PRECISION_FRAGMENT","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","ProgramCache","Shader","uniformBindCount","uniformGroup","checkUniformExists","State","blendMode","BLEND_MODES","NORMAL","polygonOffset","blend","depthMask","_blendMode","_polygonOffset","for2d","depthTest","Filter","FILTER_RESOLUTION","filterManager","_currentState","_resolution","tempMat","TextureMatrix","clampMargin","mapCoord","uClampFrame","uClampOffset","_textureID","clampOffset","isSimple","multiplyUvs","mat","tx","ty","forceUpdate","append","texBase","margin","SpriteMaskFilter","maskSprite","maskMatrix","_maskSprite","renderable","npmAlpha","otherMatrix","alpha","worldAlpha","maskClamp","MaskSystem","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","setMaskStack","scissor","maskDataOrTarget","maskData","detect","SPRITE","SCISSOR","STENCIL","pushSpriteMask","pushColorMask","popSpriteMask","popColorMask","maskCurrent","isSprite","testScissor","alphaMaskFilter","stashFilterArea","currColorMask","nextColorMask","AbstractMaskSystem","glConst","getStackLength","curStackLen","newStackLen","disable","enable","_useCurrent","rectPool","ScissorSystem","getWebGLRenderingContext","SCISSOR_TEST","calcScissorRect","prevData","roundFrameToPixels","isMatrixRotated","isFastRect","StencilSystem","STENCIL_TEST","prevMaskCount","clearStencil","STENCIL_BUFFER_BIT","stencilFunc","EQUAL","stencilOp","KEEP","INCR","batch","DECR","ProjectionSystem","defaultFrame","projectionMatrix","root","calculateProjection","syncUniformGroup","globals","_destinationFrame","pm","sign","setTransform","_matrix","tempRect2","RenderTextureSystem","_backgroundColorRgba","defaultMaskStack","viewportFrame","screen","clearMask","uboUpdate","_ud","_uv","_syncData","UBO_TO_SINGLE_SETTERS","GLSL_TO_STD40_SIZE","createUBOElements","uniformData","uboElements","dataLen","chunkSize","uboElement","lineUpValue","getUBOData","usedUniformDatas","sort","generateUniformBufferSync","syncFunc","funcFragments","parsed","uniformParser","size_1","rowSize","elementSize","remainder","template","Function","IGLUniformData","GLProgram","uniformGroups","uniformDirtyGroups","uniformBufferBindings","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getProgramInfoLog","logProgramError","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","getAttribLocation","getAttributeData","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","match","getUniformData","bindAttribLocation","deleteShader","getUniformLocation","defaultSyncData","textureCount","uboCount","ShaderSystem","systemCheck","cache","_uboCache","func","unsafeEvalSupported","dontSync","glProgram","setUniforms","syncData","getGlProgram","createSyncGroups","generateUniformsSync","syncUniformBufferGroup","createSyncBufferGroup","bindBufferBase","uniformBlockIndex","getUniformBlockIndex","uniformBlockBinding","uboData","preFix","disposeShader","StateSystem","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","blendModes","ONE","ONE_MINUS_SRC_ALPHA","ADD","MULTIPLY","DST_COLOR","SCREEN","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","NORMAL_NPM","SRC_ALPHA","ADD_NPM","SCREEN_NPM","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","forceState","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","setBlendMode","blendFunc","blendFuncSeparate","blendEquationSeparate","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","system","TextureGCSystem","checkCount","maxIdle","GC_MAX_IDLE","checkCountMax","GC_MAX_CHECK_COUNT","GC_MODE","GC_MODES","MANUAL","run","tm","managedTextures","wasRemoved","destroyTexture","unload","displayObject","children","GLTexture","samplerType","TextureSystem","currentLocation","_unknownBoundTextures","unknownTexture","hasIntegerTextures","internalFormats","table","RGB","RGB8","RG","RG8","RED","R8","RGBA_INTEGER","RGBA8UI","RGB_INTEGER","RGB8UI","RG_INTEGER","RG8UI","RED_INTEGER","R8UI","ALPHA","LUMINANCE","LUMINANCE_ALPHA","BYTE","_c","RGBA8_SNORM","RGB8_SNORM","RG8_SNORM","R8_SNORM","RGBA8I","RGB8I","RG8I","R8I","_d","RGBA16UI","RGB16UI","RG16UI","R16UI","DEPTH_COMPONENT16","SHORT","_e","RGBA16I","RGB16I","RG16I","R16I","_f","RGBA32UI","RGB32UI","RG32UI","R32UI","DEPTH_COMPONENT24","_g","RGBA32I","RGB32I","RG32I","R32I","_h","RGBA32F","RGB32F","RG32F","R32F","DEPTH_COMPONENT32F","HALF_FLOAT","_j","RGBA16F","RGB16F","RG16F","R16F","UNSIGNED_SHORT_5_6_5","_k","RGB565","UNSIGNED_SHORT_4_4_4_4","_l","RGBA4","UNSIGNED_SHORT_5_5_5_1","_m","RGB5_A1","UNSIGNED_INT_2_10_10_10_REV","_o","RGB10_A2","RGB10_A2UI","UNSIGNED_INT_10F_11F_11F_REV","_p","R11F_G11F_B10F","UNSIGNED_INT_5_9_9_9_REV","_q","RGB9_E5","UNSIGNED_INT_24_8","_r","FLOAT_32_UNSIGNED_INT_24_8_REV","_s","DEPTH32F_STENCIL8","_t","_u","_v","_w","_x","mapTypeAndFormatToInternalFormat","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","updateTextureStyle","ensureSamplerType","SAMPLER_TYPES","initTextureType","skipRemove","deleteTexture","removeItems","POW2","WRAP_MODES","CLAMP","ON_MANUAL","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","AbstractRenderer","RENDERER_TYPE","UNKNOWN","RENDER_OPTIONS","useContextAlpha","autoDensity","preserveDrawingBuffer","clearBeforeRender","_backgroundColor","_backgroundColorString","backgroundColor","backgroundAlpha","transparent","_lastObjectRendered","plugins","initPlugins","staticMap","o","desiredScreenWidth","desiredScreenHeight","screenWidth","screenHeight","generateTexture","region","manualRegion","getOwnPropertySymbols","propertyIsEnumerable","__rest","getLocalBounds","skipUpdateTransform","parent","removeView","parentNode","removeChild","thisAny","_tempDisplayObjectParent","hex2string","hex2rgb","GLBuffer","updateID","byteLength","BufferSystem","managedBuffers","boundBufferBases","createGLBuffer","bindBuffer","bindBufferRange","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","deleteBuffer","createBuffer","Renderer","prerender","addSystem","__plugins","antialias","premultipliedAlpha","powerPreference","sayHello","isWebGLSupported","FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER","LOW","ClassRef","isLost","cacheParent","enableTempParent","updateTransform","disableTempParent","extract","registerPlugin","pluginName","ctor","ExtensionType","RendererPlugin","ref","autoDetectRenderer","handleByMap","defaultVertex","defaultFilterVertex","System","BatchDrawCall","BatchTextureArray","ViewableBuffer","sizeOrBuffer","rawBinaryData","uint32View","float32View","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","sizeOf","AbstractBatchRenderer","shaderGenerator","geometryClass","vertexSize","SPRITE_BATCH_SIZE","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","SPRITE_MAX_TEXTURES","generateShader","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","vertexData","indices","buildTexturesAndDrawCalls","textureArrays","touch","TICK","countTexArrays","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","premultiplyBlendMode","packInterleavedGeometry","bindAndClearTexArray","textureSystem","updateGeometry","packedGeometries","attributeBuffer","CAN_UPLOAD_SAME_BUFFER","_buffer","drawBatches","dcCount","curTexArray","getAttributeBuffer","getIndexBuffer","roundedP2","roundedSizeIndex","log2","roundedSize","packedVertices","indicies","textureId","argb","premultiplyTint","_tintRGB","BatchShaderGenerator","programCache","defaultGroupCache","sampleValues","uSamplers","generateSampleSrc","tint","translationMatrix","default","BatchGeometry","BatchPluginFactory","vertex","fragment","defaultFragment","BatchPlugin","BatchRenderer","_resources","systems","_systems","VERSION"],"mappings":";;;;;;;88BAmBAA,EAASC,WAAaC,EAASC,IAAMC,EAAIC,MAAQD,EAAIE,OAiBrDN,EAASO,sBAAuB,ECsBnB,IAAAC,EAA8C,GAgC3C,SAAAC,EAA2CC,EAAiBC,GAExE,IAAKD,EAED,OAAO,KAGX,IAAIE,EAAY,GAEhB,GAAsB,iBAAXF,EACX,CAEI,IAAMG,EAAS,yBAA2BC,KAAKJ,GAE3CG,IAEAD,EAAYC,EAAO,GAAGE,eAI9B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QnG,GACRoG,SAAUC,GACVjF,cAAe6E,GACf5E,WAAY,GACb/7C,GALK6gD,WAAQC,EAAQz8C,EAAAy8C,SAAE/E,EAAU13C,EAAA03C,WAAED,kBAOtC,OAAA,SAAA33C,GAEI,SAAA68C,EAAYx8C,GAAZ,IAEIJ,EAAAD,EAAApC,KAAAV,KAAMmD,IAKTnD,YAHG+C,EAAKy3C,gBAAkB,IAAIqE,GAAqBW,EAAQC,GACxD18C,EAAK03C,cAAgBA,EACrB13C,EAAK23C,WAAaA,IAE1B,OAViC56C,EAAqB6/C,EAAA78C,GAUrD68C,EAVD,CAAiCpF,KAiBrC/6C,OAAAsC,eAAWy9C,EAAgB,mBAAA,CAA3Bx9C,IAAA,WAEI,OAAOs3C,oCAOX75C,OAAAsC,eAAWy9C,EAAuB,0BAAA,CAAlCx9C,IAAA,WAEI,OAAO29C,oCAEdH,KAIYK,GAAgBL,GAAmBp/C,SAEhDX,OAAOa,OAAOu/C,GAAe,CACzBhhD,UAAW,CACPqZ,KAAM,QACNjU,KAAMg1C,EAAcC,kBC3FtB,IAAAtvC,GAAY,eAEPsO,GAEPzY,OAAOsC,eAAe6H,GAAWsO,EAC7B,CACIlW,IAAA,WAMI,OAAQ89C,GAAmB5nC,OAV3C,IAAK,IAAMA,MAAQ4nC,MAAR5nC,IAqBL,IAAA6nC,GAAU,eAEL7nC,GAEPzY,OAAOsC,eAAeg+C,GAAS7nC,EAC3B,CACIlW,IAAA,WAMI,OAAQg+C,GAAiB9nC,OAVzC,IAAK,IAAMA,MAAQ8nC,MAAR9nC,ICzBE,IAAA+nC,GAAU"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/dist/esm/core.mjs b/live2d/node_modules/@pixi/core/dist/esm/core.mjs new file mode 100644 index 0000000..5def0ed --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/esm/core.mjs @@ -0,0 +1,10371 @@ +/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { settings } from '@pixi/settings'; +import { ENV, ALPHA_MODES, SCALE_MODES, FORMATS, TYPES, TARGETS, MIPMAP_MODES, MSAA_QUALITY, BUFFER_TYPE, CLEAR_MODES, DRAW_MODES, BUFFER_BITS, MASK_TYPES, PRECISION, BLEND_MODES, GC_MODES, SAMPLER_TYPES, WRAP_MODES, RENDERER_TYPE } from '@pixi/constants'; +import { isMobile, isPow2, BaseTextureCache, TextureCache, uid, EventEmitter, determineCrossOrigin, getResolutionOfUrl, deprecation, nextPow2, getBufferType, ProgramCache, removeItems, hex2string, hex2rgb, sayHello, isWebGLSupported, premultiplyBlendMode, log2, premultiplyTint } from '@pixi/utils'; +import { extensions as extensions$1, ExtensionType } from '@pixi/extensions'; +export * from '@pixi/extensions'; +import { Runner } from '@pixi/runner'; +import { Ticker } from '@pixi/ticker'; +import { groupD8, Rectangle, Point, Matrix } from '@pixi/math'; + +/** + * The maximum support for using WebGL. If a device does not + * support WebGL version, for instance WebGL 2, it will still + * attempt to fallback support to WebGL 1. If you want to + * explicitly remove feature support to target a more stable + * baseline, prefer a lower environment. + * + * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} + * we disable webgl2 by default for all non-apple mobile devices. + * @static + * @name PREFER_ENV + * @memberof PIXI.settings + * @type {number} + * @default PIXI.ENV.WEBGL2 + */ +settings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2; +/** + * If set to `true`, *only* Textures and BaseTexture objects stored + * in the caches ({@link PIXI.utils.TextureCache TextureCache} and + * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be + * used when calling {@link PIXI.Texture.from Texture.from} or + * {@link PIXI.BaseTexture.from BaseTexture.from}. + * Otherwise, these `from` calls throw an exception. Using this property + * can be useful if you want to enforce preloading all assets with + * {@link PIXI.Loader Loader}. + * @static + * @name STRICT_TEXTURE_CACHE + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.STRICT_TEXTURE_CACHE = false; + +/** + * Collection of installed resource types, class must extend {@link PIXI.Resource}. + * @example + * class CustomResource extends PIXI.Resource { + * // MUST have source, options constructor signature + * // for auto-detected resources to be created. + * constructor(source, options) { + * super(); + * } + * upload(renderer, baseTexture, glTexture) { + * // upload with GL + * return true; + * } + * // used to auto-detect resource + * static test(source, extension) { + * return extension === 'xyz'|| source instanceof SomeClass; + * } + * } + * // Install the new resource type + * PIXI.INSTALLED.push(CustomResource); + * @memberof PIXI + * @type {Array} + * @static + * @readonly + */ +var INSTALLED = []; +/** + * Create a resource element from a single source element. This + * auto-detects which type of resource to create. All resources that + * are auto-detectable must have a static `test` method and a constructor + * with the arguments `(source, options?)`. Currently, the supported + * resources for auto-detection include: + * - {@link PIXI.ImageResource} + * - {@link PIXI.CanvasResource} + * - {@link PIXI.VideoResource} + * - {@link PIXI.SVGResource} + * - {@link PIXI.BufferResource} + * @static + * @memberof PIXI + * @function autoDetectResource + * @param {string|*} source - Resource source, this can be the URL to the resource, + * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri + * or any other resource that can be auto-detected. If not resource is + * detected, it's assumed to be an ImageResource. + * @param {object} [options] - Pass-through options to use for Resource + * @param {number} [options.width] - Width of BufferResource or SVG rasterization + * @param {number} [options.height] - Height of BufferResource or SVG rasterization + * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading + * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object + * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin + * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately + * @param {number} [options.updateFPS=0] - Video option to update how many times a second the + * texture should be updated from the video. Leave at 0 to update at every render + * @returns {PIXI.Resource} The created resource. + */ +function autoDetectResource(source, options) { + if (!source) { + return null; + } + var extension = ''; + if (typeof source === 'string') { + // search for file extension: period, 3-4 chars, then ?, # or EOL + var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); + if (result) { + extension = result[1].toLowerCase(); + } + } + for (var i = INSTALLED.length - 1; i >= 0; --i) { + var ResourcePlugin = INSTALLED[i]; + if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { + return new ResourcePlugin(source, options); + } + } + throw new Error('Unrecognized source type to auto-detect Resource'); +} + +/*! ***************************************************************************** +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 __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); +}; + +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; +} + +/** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * @memberof PIXI + */ +var Resource = /** @class */ (function () { + /** + * @param width - Width of the resource + * @param height - Height of the resource + */ + function Resource(width, height) { + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this._width = width; + this._height = height; + this.destroyed = false; + this.internal = false; + this.onResize = new Runner('setRealSize'); + this.onUpdate = new Runner('update'); + this.onError = new Runner('onError'); + } + /** + * Bind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.bind = function (baseTexture) { + this.onResize.add(baseTexture); + this.onUpdate.add(baseTexture); + this.onError.add(baseTexture); + // Call a resize immediate if we already + // have the width and height of the resource + if (this._width || this._height) { + this.onResize.emit(this._width, this._height); + } + }; + /** + * Unbind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + Resource.prototype.unbind = function (baseTexture) { + this.onResize.remove(baseTexture); + this.onUpdate.remove(baseTexture); + this.onError.remove(baseTexture); + }; + /** + * Trigger a resize event + * @param width - X dimension + * @param height - Y dimension + */ + Resource.prototype.resize = function (width, height) { + if (width !== this._width || height !== this._height) { + this._width = width; + this._height = height; + this.onResize.emit(width, height); + } + }; + Object.defineProperty(Resource.prototype, "valid", { + /** + * Has been validated + * @readonly + */ + get: function () { + return !!this._width && !!this._height; + }, + enumerable: false, + configurable: true + }); + /** Has been updated trigger event. */ + Resource.prototype.update = function () { + if (!this.destroyed) { + this.onUpdate.emit(); + } + }; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @returns Handle the validate event + */ + Resource.prototype.load = function () { + return Promise.resolve(this); + }; + Object.defineProperty(Resource.prototype, "width", { + /** + * The width of the resource. + * @readonly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resource.prototype, "height", { + /** + * The height of the resource. + * @readonly + */ + get: function () { + return this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Set the style, optional to override + * @param _renderer - yeah, renderer! + * @param _baseTexture - the texture + * @param _glTexture - texture instance for this webgl context + * @returns - `true` is success + */ + Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { + return false; + }; + /** Clean up anything, this happens when destroying is ready. */ + Resource.prototype.dispose = function () { + // override + }; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + Resource.prototype.destroy = function () { + if (!this.destroyed) { + this.destroyed = true; + this.dispose(); + this.onError.removeAll(); + this.onError = null; + this.onResize.removeAll(); + this.onResize = null; + this.onUpdate.removeAll(); + this.onUpdate = null; + } + }; + /** + * Abstract, used to auto-detect resource type. + * @param {*} _source - The source object + * @param {string} _extension - The extension of source, if set + */ + Resource.test = function (_source, _extension) { + return false; + }; + return Resource; +}()); + +/** + * @interface SharedArrayBuffer + */ +/** + * Buffer resource with data of typed array. + * @memberof PIXI + */ +var BufferResource = /** @class */ (function (_super) { + __extends(BufferResource, _super); + /** + * @param source - Source buffer + * @param options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + function BufferResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + if (!width || !height) { + throw new Error('BufferResource width or height invalid'); + } + _this = _super.call(this, width, height) || this; + _this.data = source; + return _this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + /** Destroy and don't use after this. */ + BufferResource.prototype.dispose = function () { + this.data = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if + */ + BufferResource.test = function (source) { + return source instanceof Float32Array + || source instanceof Uint8Array + || source instanceof Uint32Array; + }; + return BufferResource; +}(Resource)); + +var defaultBufferOptions = { + scaleMode: SCALE_MODES.NEAREST, + format: FORMATS.RGBA, + alphaMode: ALPHA_MODES.NPM, +}; +/** + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + * @typeParam RO - The options for constructing resource. + */ +var BaseTexture = /** @class */ (function (_super) { + __extends(BaseTexture, _super); + /** + * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - + * The current resource to use, for things that aren't Resource objects, will be converted + * into a Resource. + * @param options - Collection of options + * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture + * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture + * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type + * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha + * @param {number} [options.width=0] - Width of the texture + * @param {number} [options.height=0] - Height of the texture + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture + * @param {object} [options.resourceOptions] - Optional resource options, + * see {@link PIXI.autoDetectResource autoDetectResource} + */ + function BaseTexture(resource, options) { + if (resource === void 0) { resource = null; } + if (options === void 0) { options = null; } + var _this = _super.call(this) || this; + options = options || {}; + var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; + // Convert the resource to a Resource object + if (resource && !(resource instanceof Resource)) { + resource = autoDetectResource(resource, resourceOptions); + resource.internal = true; + } + _this.resolution = resolution || settings.RESOLUTION; + _this.width = Math.round((width || 0) * _this.resolution) / _this.resolution; + _this.height = Math.round((height || 0) * _this.resolution) / _this.resolution; + _this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; + _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; + _this._wrapMode = wrapMode || settings.WRAP_MODE; + _this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; + _this.format = format || FORMATS.RGBA; + _this.type = type || TYPES.UNSIGNED_BYTE; + _this.target = target || TARGETS.TEXTURE_2D; + _this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK; + _this.uid = uid(); + _this.touched = 0; + _this.isPowerOfTwo = false; + _this._refreshPOT(); + _this._glTextures = {}; + _this.dirtyId = 0; + _this.dirtyStyleId = 0; + _this.cacheId = null; + _this.valid = width > 0 && height > 0; + _this.textureCacheIds = []; + _this.destroyed = false; + _this.resource = null; + _this._batchEnabled = 0; + _this._batchLocation = 0; + _this.parentTextureArray = null; + /** + * Fired when a not-immediately-available source finishes loading. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when a not-immediately-available source fails to load. + * @protected + * @event PIXI.BaseTexture#error + * @param {PIXI.BaseTexture} baseTexture - Resource errored. + * @param {ErrorEvent} event - Load error event. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when BaseTexture is updated. + * @protected + * @event PIXI.BaseTexture#update + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. + */ + /** + * Fired when BaseTexture is destroyed. + * @protected + * @event PIXI.BaseTexture#dispose + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. + */ + // Set the resource + _this.setResource(resource); + return _this; + } + Object.defineProperty(BaseTexture.prototype, "realWidth", { + /** + * Pixel width of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.width * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "realHeight", { + /** + * Pixel height of the source of this texture + * @readonly + */ + get: function () { + return Math.round(this.height * this.resolution); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "mipmap", { + /** + * Mipmap mode of the texture, affects downscaled images + * @default PIXI.settings.MIPMAP_TEXTURES + */ + get: function () { + return this._mipmap; + }, + set: function (value) { + if (this._mipmap !== value) { + this._mipmap = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "scaleMode", { + /** + * The scale mode to apply when scaling this texture + * @default PIXI.settings.SCALE_MODE + */ + get: function () { + return this._scaleMode; + }, + set: function (value) { + if (this._scaleMode !== value) { + this._scaleMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "wrapMode", { + /** + * How the texture wraps + * @default PIXI.settings.WRAP_MODE + */ + get: function () { + return this._wrapMode; + }, + set: function (value) { + if (this._wrapMode !== value) { + this._wrapMode = value; + this.dirtyStyleId++; + } + }, + enumerable: false, + configurable: true + }); + /** + * Changes style options of BaseTexture + * @param scaleMode - Pixi scalemode + * @param mipmap - enable mipmaps + * @returns - this + */ + BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { + var dirty; + if (scaleMode !== undefined && scaleMode !== this.scaleMode) { + this.scaleMode = scaleMode; + dirty = true; + } + if (mipmap !== undefined && mipmap !== this.mipmap) { + this.mipmap = mipmap; + dirty = true; + } + if (dirty) { + this.dirtyStyleId++; + } + return this; + }; + /** + * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. + * @param desiredWidth - Desired visual width + * @param desiredHeight - Desired visual height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setSize = function (desiredWidth, desiredHeight, resolution) { + resolution = resolution || this.resolution; + return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution); + }; + /** + * Sets real size of baseTexture, preserves current resolution. + * @param realWidth - Full rendered width + * @param realHeight - Full rendered height + * @param resolution - Optionally set resolution + * @returns - this + */ + BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { + this.resolution = resolution || this.resolution; + this.width = Math.round(realWidth) / this.resolution; + this.height = Math.round(realHeight) / this.resolution; + this._refreshPOT(); + this.update(); + return this; + }; + /** + * Refresh check for isPowerOfTwo texture based on size + * @private + */ + BaseTexture.prototype._refreshPOT = function () { + this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight); + }; + /** + * Changes resolution + * @param resolution - res + * @returns - this + */ + BaseTexture.prototype.setResolution = function (resolution) { + var oldResolution = this.resolution; + if (oldResolution === resolution) { + return this; + } + this.resolution = resolution; + if (this.valid) { + this.width = Math.round(this.width * oldResolution) / resolution; + this.height = Math.round(this.height * oldResolution) / resolution; + this.emit('update', this); + } + this._refreshPOT(); + return this; + }; + /** + * Sets the resource if it wasn't set. Throws error if resource already present + * @param resource - that is managing this BaseTexture + * @returns - this + */ + BaseTexture.prototype.setResource = function (resource) { + if (this.resource === resource) { + return this; + } + if (this.resource) { + throw new Error('Resource can be set only once'); + } + resource.bind(this); + this.resource = resource; + return this; + }; + /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */ + BaseTexture.prototype.update = function () { + if (!this.valid) { + if (this.width > 0 && this.height > 0) { + this.valid = true; + this.emit('loaded', this); + this.emit('update', this); + } + } + else { + this.dirtyId++; + this.dirtyStyleId++; + this.emit('update', this); + } + }; + /** + * Handle errors with resources. + * @private + * @param event - Error event emitted. + */ + BaseTexture.prototype.onError = function (event) { + this.emit('error', this, event); + }; + /** + * Destroys this base texture. + * The method stops if resource doesn't want this texture to be destroyed. + * Removes texture from all caches. + */ + BaseTexture.prototype.destroy = function () { + // remove and destroy the resource + if (this.resource) { + this.resource.unbind(this); + // only destroy resourced created internally + if (this.resource.internal) { + this.resource.destroy(); + } + this.resource = null; + } + if (this.cacheId) { + delete BaseTextureCache[this.cacheId]; + delete TextureCache[this.cacheId]; + this.cacheId = null; + } + // finally let the WebGL renderer know.. + this.dispose(); + BaseTexture.removeFromCache(this); + this.textureCacheIds = null; + this.destroyed = true; + }; + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseTexture.prototype.dispose = function () { + this.emit('dispose', this); + }; + /** Utility function for BaseTexture|Texture cast. */ + BaseTexture.prototype.castToBaseTexture = function () { + return this; + }; + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * @static + * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The + * source to create base texture from. + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.BaseTexture} The new base texture. + */ + BaseTexture.from = function (source, options, strict) { + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + uid(); + } + cacheId = source._pixiId; + } + var baseTexture = BaseTextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !baseTexture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); + } + if (!baseTexture) { + baseTexture = new BaseTexture(source, options); + baseTexture.cacheId = cacheId; + BaseTexture.addToCache(baseTexture, cacheId); + } + return baseTexture; + }; + /** + * Create a new BaseTexture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * Default properties are different from the constructor's defaults. + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default + * @returns - The resulting new BaseTexture + */ + BaseTexture.fromBuffer = function (buffer, width, height, options) { + buffer = buffer || new Float32Array(width * height * 4); + var resource = new BufferResource(buffer, { width: width, height: height }); + var type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE; + return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width: width, height: height, type: type })); + }; + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + BaseTexture.addToCache = function (baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { + baseTexture.textureCacheIds.push(id); + } + if (BaseTextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); + } + BaseTextureCache[id] = baseTexture; + } + }; + /** + * Remove a BaseTexture from the global BaseTextureCache. + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + BaseTexture.removeFromCache = function (baseTexture) { + if (typeof baseTexture === 'string') { + var baseTextureFromCache = BaseTextureCache[baseTexture]; + if (baseTextureFromCache) { + var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); + if (index > -1) { + baseTextureFromCache.textureCacheIds.splice(index, 1); + } + delete BaseTextureCache[baseTexture]; + return baseTextureFromCache; + } + } + else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { + delete BaseTextureCache[baseTexture.textureCacheIds[i]]; + } + baseTexture.textureCacheIds.length = 0; + return baseTexture; + } + return null; + }; + /** Global number of the texture batch, used by multi-texture renderers. */ + BaseTexture._globalBatch = 0; + return BaseTexture; +}(EventEmitter)); + +/** + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource + * @memberof PIXI + */ +var AbstractMultiResource = /** @class */ (function (_super) { + __extends(AbstractMultiResource, _super); + /** + * @param length + * @param options - Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function AbstractMultiResource(length, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + _this = _super.call(this, width, height) || this; + _this.items = []; + _this.itemDirtyIds = []; + for (var i = 0; i < length; i++) { + var partTexture = new BaseTexture(); + _this.items.push(partTexture); + // -2 - first run of texture array upload + // -1 - texture item was allocated + // >=0 - texture item uploaded , in sync with items[i].dirtyId + _this.itemDirtyIds.push(-2); + } + _this.length = length; + _this._load = null; + _this.baseTexture = null; + return _this; + } + /** + * Used from ArrayResource and CubeResource constructors. + * @param resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param options - Detect options for resources + */ + AbstractMultiResource.prototype.initFromArray = function (resources, options) { + for (var i = 0; i < this.length; i++) { + if (!resources[i]) { + continue; + } + if (resources[i].castToBaseTexture) { + this.addBaseTextureAt(resources[i].castToBaseTexture(), i); + } + else if (resources[i] instanceof Resource) { + this.addResourceAt(resources[i], i); + } + else { + this.addResourceAt(autoDetectResource(resources[i], options), i); + } + } + }; + /** Destroy this BaseImageResource. */ + AbstractMultiResource.prototype.dispose = function () { + for (var i = 0, len = this.length; i < len; i++) { + this.items[i].destroy(); + } + this.items = null; + this.itemDirtyIds = null; + this._load = null; + }; + /** + * Set a resource by ID + * @param resource + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + AbstractMultiResource.prototype.addResourceAt = function (resource, index) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + // Inherit the first resource dimensions + if (resource.valid && !this.valid) { + this.resize(resource.width, resource.height); + } + this.items[index].setResource(resource); + return this; + }; + /** + * Set the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.bind = function (baseTexture) { + if (this.baseTexture !== null) { + throw new Error('Only one base texture per TextureArray is allowed'); + } + _super.prototype.bind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = baseTexture; + this.items[i].on('update', baseTexture.update, baseTexture); + } + }; + /** + * Unset the parent base texture. + * @param baseTexture + */ + AbstractMultiResource.prototype.unbind = function (baseTexture) { + _super.prototype.unbind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = null; + this.items[i].off('update', baseTexture.update, baseTexture); + } + }; + /** + * Load all the resources simultaneously + * @returns - When load is resolved + */ + AbstractMultiResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); + // TODO: also implement load part-by-part strategy + var promises = resources.map(function (item) { return item.load(); }); + this._load = Promise.all(promises) + .then(function () { + var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; + _this.resize(realWidth, realHeight); + return Promise.resolve(_this); + }); + return this._load; + }; + return AbstractMultiResource; +}(Resource)); + +/** + * A resource that contains a number of sources. + * @memberof PIXI + */ +var ArrayResource = /** @class */ (function (_super) { + __extends(ArrayResource, _super); + /** + * @param source - Number of items in array or the collection + * of image URLs to use. Can also be resources, image elements, canvas, etc. + * @param options - Options to apply to {@link PIXI.autoDetectResource} + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + function ArrayResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + var urls; + var length; + if (Array.isArray(source)) { + urls = source; + length = source.length; + } + else { + length = source; + } + _this = _super.call(this, length, { width: width, height: height }) || this; + if (urls) { + _this.initFromArray(urls, options); + } + return _this; + } + /** + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more + * @param baseTexture + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error('ArrayResource does not support RenderTexture'); + } + return this; + }; + /** + * Add binding + * @param baseTexture + */ + ArrayResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = TARGETS.TEXTURE_2D_ARRAY; + }; + /** + * Upload the resources to the GPU. + * @param renderer + * @param texture + * @param glTexture + * @returns - whether texture was uploaded + */ + ArrayResource.prototype.upload = function (renderer, texture, glTexture) { + var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; + var gl = renderer.gl; + if (glTexture.dirtyId < 0) { + gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, glTexture.internalFormat, this._width, this._height, length, 0, texture.format, glTexture.type, null); + } + for (var i = 0; i < length; i++) { + var item = items[i]; + if (itemDirtyIds[i] < item.dirtyId) { + itemDirtyIds[i] = item.dirtyId; + if (item.valid) { + gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset + 0, // yoffset + i, // zoffset + item.resource.width, item.resource.height, 1, texture.format, glTexture.type, item.resource.source); + } + } + } + return true; + }; + return ArrayResource; +}(AbstractMultiResource)); + +/** + * Base for all the image/canvas resources. + * @memberof PIXI + */ +var BaseImageResource = /** @class */ (function (_super) { + __extends(BaseImageResource, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + function BaseImageResource(source) { + var _this = this; + var sourceAny = source; + var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; + var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; + _this = _super.call(this, width, height) || this; + _this.source = source; + _this.noSubImage = false; + return _this; + } + /** + * Set cross origin based detecting the url and the crossorigin + * @param element - Element to apply crossOrigin + * @param url - URL to check + * @param crossorigin - Cross origin value to use + */ + BaseImageResource.crossOrigin = function (element, url, crossorigin) { + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + element.crossOrigin = determineCrossOrigin(url); + } + else if (crossorigin !== false) { + element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + }; + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional) + * @returns - true is success + */ + BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { + var gl = renderer.gl; + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + source = source || this.source; + if (source instanceof HTMLImageElement) { + if (!source.complete || source.naturalWidth === 0) { + return false; + } + } + else if (source instanceof HTMLVideoElement) { + if (source.readyState <= 1) { + return false; + } + } + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK); + if (!this.noSubImage + && baseTexture.target === gl.TEXTURE_2D + && glTexture.width === width + && glTexture.height === height) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source); + } + return true; + }; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + BaseImageResource.prototype.update = function () { + if (this.destroyed) { + return; + } + var source = this.source; + var width = source.naturalWidth || source.videoWidth || source.width; + var height = source.naturalHeight || source.videoHeight || source.height; + this.resize(width, height); + _super.prototype.update.call(this); + }; + /** Destroy this {@link BaseImageResource} */ + BaseImageResource.prototype.dispose = function () { + this.source = null; + }; + return BaseImageResource; +}(Resource)); + +/** + * @interface OffscreenCanvas + */ +/** + * Resource type for HTMLCanvasElement. + * @memberof PIXI + */ +var CanvasResource = /** @class */ (function (_super) { + __extends(CanvasResource, _super); + /** + * @param source - Canvas element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function CanvasResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + CanvasResource.test = function (source) { + var OffscreenCanvas = globalThis.OffscreenCanvas; + // Check for browsers that don't yet support OffscreenCanvas + if (OffscreenCanvas && source instanceof OffscreenCanvas) { + return true; + } + return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement; + }; + return CanvasResource; +}(BaseImageResource)); + +/** + * Resource for a CubeTexture which contains six resources. + * @memberof PIXI + */ +var CubeResource = /** @class */ (function (_super) { + __extends(CubeResource, _super); + /** + * @param {Array} [source] - Collection of URLs or resources + * to use as the sides of the cube. + * @param options - ImageResource options + * @param {number} [options.width] - Width of resource + * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use + */ + function CubeResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; + if (source && source.length !== CubeResource.SIDES) { + throw new Error("Invalid length. Got " + source.length + ", expected 6"); + } + _this = _super.call(this, 6, { width: width, height: height }) || this; + for (var i = 0; i < CubeResource.SIDES; i++) { + _this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; + } + _this.linkBaseTexture = linkBaseTexture !== false; + if (source) { + _this.initFromArray(source, options); + } + if (autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Add binding. + * @param baseTexture - parent base texture + */ + CubeResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = TARGETS.TEXTURE_CUBE_MAP; + }; + CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + if (!this.linkBaseTexture + || baseTexture.parentTextureArray + || Object.keys(baseTexture._glTextures).length > 0) { + // copy mode + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error("CubeResource does not support copying of renderTexture."); + } + } + else { + // link mode, the difficult one! + baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; + baseTexture.parentTextureArray = this.baseTexture; + this.items[index] = baseTexture; + } + if (baseTexture.valid && !this.valid) { + this.resize(baseTexture.realWidth, baseTexture.realHeight); + } + this.items[index] = baseTexture; + return this; + }; + /** + * Upload the resource + * @param renderer + * @param _baseTexture + * @param glTexture + * @returns {boolean} true is success + */ + CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { + var dirty = this.itemDirtyIds; + for (var i = 0; i < CubeResource.SIDES; i++) { + var side = this.items[i]; + if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId) { + if (side.valid && side.resource) { + side.resource.upload(renderer, side, glTexture); + dirty[i] = side.dirtyId; + } + else if (dirty[i] < -1) { + // either item is not valid yet, either its a renderTexture + // allocate the memory + renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); + dirty[i] = -1; + } + } + } + return true; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an array of 6 elements + */ + CubeResource.test = function (source) { + return Array.isArray(source) && source.length === CubeResource.SIDES; + }; + /** Number of texture sides to store for CubeResources. */ + CubeResource.SIDES = 6; + return CubeResource; +}(AbstractMultiResource)); + +/** + * Resource type for HTMLImageElement. + * @memberof PIXI + */ +var ImageResource = /** @class */ (function (_super) { + __extends(ImageResource, _super); + /** + * @param source - image source or URL + * @param options + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + function ImageResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLImageElement)) { + var imageElement = new Image(); + BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); + imageElement.src = source; + source = imageElement; + } + _this = _super.call(this, source) || this; + // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height + // to non-zero values before its loading completes if images are in a cache. + // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. + // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). + if (!source.complete && !!_this._width && !!_this._height) { + _this._width = 0; + _this._height = 0; + } + _this.url = source.src; + _this._process = null; + _this.preserveBitmap = false; + _this.createBitmap = (options.createBitmap !== undefined + ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap; + _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; + _this.bitmap = null; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Returns a promise when image will be loaded and processed. + * @param createBitmap - whether process image into bitmap + */ + ImageResource.prototype.load = function (createBitmap) { + var _this = this; + if (this._load) { + return this._load; + } + if (createBitmap !== undefined) { + this.createBitmap = createBitmap; + } + this._load = new Promise(function (resolve, reject) { + var source = _this.source; + _this.url = source.src; + var completed = function () { + if (_this.destroyed) { + return; + } + source.onload = null; + source.onerror = null; + _this.resize(source.width, source.height); + _this._load = null; + if (_this.createBitmap) { + resolve(_this.process()); + } + else { + resolve(_this); + } + }; + if (source.complete && source.src) { + completed(); + } + else { + source.onload = completed; + source.onerror = function (event) { + // Avoids Promise freezing when resource broken + reject(event); + _this.onError.emit(event); + }; + } + }); + return this._load; + }; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * @returns - Cached promise to fill that bitmap + */ + ImageResource.prototype.process = function () { + var _this = this; + var source = this.source; + if (this._process !== null) { + return this._process; + } + if (this.bitmap !== null || !globalThis.createImageBitmap) { + return Promise.resolve(this); + } + var createImageBitmap = globalThis.createImageBitmap; + var cors = !source.crossOrigin || source.crossOrigin === 'anonymous'; + this._process = fetch(source.src, { + mode: cors ? 'cors' : 'no-cors' + }) + .then(function (r) { return r.blob(); }) + .then(function (blob) { return createImageBitmap(blob, 0, 0, source.width, source.height, { + premultiplyAlpha: _this.alphaMode === null || _this.alphaMode === ALPHA_MODES.UNPACK + ? 'premultiply' : 'none', + }); }) + .then(function (bitmap) { + if (_this.destroyed) { + return Promise.reject(); + } + _this.bitmap = bitmap; + _this.update(); + _this._process = null; + return Promise.resolve(_this); + }); + return this._process; + }; + /** + * Upload the image resource to GPU. + * @param renderer - Renderer to upload to + * @param baseTexture - BaseTexture for this resource + * @param glTexture - GLTexture to use + * @returns {boolean} true is success + */ + ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { + if (typeof this.alphaMode === 'number') { + // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it + baseTexture.alphaMode = this.alphaMode; + } + if (!this.createBitmap) { + return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); + } + if (!this.bitmap) { + // yeah, ignore the output + this.process(); + if (!this.bitmap) { + return false; + } + } + _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); + if (!this.preserveBitmap) { + // checks if there are other renderers that possibly need this bitmap + var flag = true; + var glTextures = baseTexture._glTextures; + for (var key in glTextures) { + var otherTex = glTextures[key]; + if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { + flag = false; + break; + } + } + if (flag) { + if (this.bitmap.close) { + this.bitmap.close(); + } + this.bitmap = null; + } + } + return true; + }; + /** Destroys this resource. */ + ImageResource.prototype.dispose = function () { + this.source.onload = null; + this.source.onerror = null; + _super.prototype.dispose.call(this); + if (this.bitmap) { + this.bitmap.close(); + this.bitmap = null; + } + this._process = null; + this._load = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is string or HTMLImageElement + */ + ImageResource.test = function (source) { + return typeof source === 'string' || source instanceof HTMLImageElement; + }; + return ImageResource; +}(BaseImageResource)); + +/** + * Resource type for SVG elements and graphics. + * @memberof PIXI + */ +var SVGResource = /** @class */ (function (_super) { + __extends(SVGResource, _super); + /** + * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file. + * @param {object} [options] - Options to use + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. + */ + function SVGResource(sourceBase64, options) { + var _this = this; + options = options || {}; + _this = _super.call(this, settings.ADAPTER.createCanvas()) || this; + _this._width = 0; + _this._height = 0; + _this.svg = sourceBase64; + _this.scale = options.scale || 1; + _this._overrideWidth = options.width; + _this._overrideHeight = options.height; + _this._resolve = null; + _this._crossorigin = options.crossorigin; + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + SVGResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + this._load = new Promise(function (resolve) { + // Save this until after load is finished + _this._resolve = function () { + _this.resize(_this.source.width, _this.source.height); + resolve(_this); + }; + // Convert SVG inline string to data-uri + if (SVGResource.SVG_XML.test(_this.svg.trim())) { + if (!btoa) { + throw new Error('Your browser doesn\'t support base64 conversions.'); + } + _this.svg = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(_this.svg))); + } + _this._loadSvg(); + }); + return this._load; + }; + /** Loads an SVG image from `imageUrl` or `data URL`. */ + SVGResource.prototype._loadSvg = function () { + var _this = this; + var tempImage = new Image(); + BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin); + tempImage.src = this.svg; + tempImage.onerror = function (event) { + if (!_this._resolve) { + return; + } + tempImage.onerror = null; + _this.onError.emit(event); + }; + tempImage.onload = function () { + if (!_this._resolve) { + return; + } + var svgWidth = tempImage.width; + var svgHeight = tempImage.height; + if (!svgWidth || !svgHeight) { + throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.'); + } + // Set render size + var width = svgWidth * _this.scale; + var height = svgHeight * _this.scale; + if (_this._overrideWidth || _this._overrideHeight) { + width = _this._overrideWidth || _this._overrideHeight / svgHeight * svgWidth; + height = _this._overrideHeight || _this._overrideWidth / svgWidth * svgHeight; + } + width = Math.round(width); + height = Math.round(height); + // Create a canvas element + var canvas = _this.source; + canvas.width = width; + canvas.height = height; + canvas._pixiId = "canvas_" + uid(); + // Draw the Svg to the canvas + canvas + .getContext('2d') + .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height); + _this._resolve(); + _this._resolve = null; + }; + }; + /** + * Get size from an svg string using a regular expression. + * @param svgString - a serialized svg element + * @returns - image extension + */ + SVGResource.getSize = function (svgString) { + var sizeMatch = SVGResource.SVG_SIZE.exec(svgString); + var size = {}; + if (sizeMatch) { + size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3])); + size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7])); + } + return size; + }; + /** Destroys this texture. */ + SVGResource.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this._resolve = null; + this._crossorigin = null; + }; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} - If the source is a SVG source or data file + */ + SVGResource.test = function (source, extension) { + // url file extension is SVG + return extension === 'svg' + // source is SVG data-uri + || (typeof source === 'string' && source.startsWith('data:image/svg+xml')) + // source is SVG inline + || (typeof source === 'string' && SVGResource.SVG_XML.test(source)); + }; + /** + * Regular expression for SVG XML document. + * @example <?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg + * @readonly + */ + SVGResource.SVG_XML = /^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len + return SVGResource; +}(BaseImageResource)); + +/** + * Resource type for {@code HTMLVideoElement}. + * @memberof PIXI + */ +var VideoResource = /** @class */ (function (_super) { + __extends(VideoResource, _super); + /** + * @param {HTMLVideoElement|object|string|Array} source - Video element to use. + * @param {object} [options] - Options to use + * @param {boolean} [options.autoLoad=true] - Start loading the video immediately + * @param {boolean} [options.autoPlay=true] - Start playing video immediately + * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. + * Leave at 0 to update at every render. + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + */ + function VideoResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLVideoElement)) { + var videoElement = document.createElement('video'); + // workaround for https://github.com/pixijs/pixi.js/issues/5996 + videoElement.setAttribute('preload', 'auto'); + videoElement.setAttribute('webkit-playsinline', ''); + videoElement.setAttribute('playsinline', ''); + if (typeof source === 'string') { + source = [source]; + } + var firstSrc = source[0].src || source[0]; + BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); + // array of objects or strings + for (var i = 0; i < source.length; ++i) { + var sourceElement = document.createElement('source'); + var _a = source[i], src = _a.src, mime = _a.mime; + src = src || source[i]; + var baseSrc = src.split('?').shift().toLowerCase(); + var ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1); + mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; + sourceElement.src = src; + sourceElement.type = mime; + videoElement.appendChild(sourceElement); + } + // Override the source + source = videoElement; + } + _this = _super.call(this, source) || this; + _this.noSubImage = true; + _this._autoUpdate = true; + _this._isConnectedToTicker = false; + _this._updateFPS = options.updateFPS || 0; + _this._msToNextUpdate = 0; + _this.autoPlay = options.autoPlay !== false; + _this._load = null; + _this._resolve = null; + // Bind for listeners + _this._onCanPlay = _this._onCanPlay.bind(_this); + _this._onError = _this._onError.bind(_this); + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Trigger updating of the texture. + * @param _deltaTime - time delta since last tick + */ + VideoResource.prototype.update = function (_deltaTime) { + if (!this.destroyed) { + // account for if video has had its playbackRate changed + var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate; + this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); + if (!this._updateFPS || this._msToNextUpdate <= 0) { + _super.prototype.update.call(this); + this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; + } + } + }; + /** + * Start preloading the video resource. + * @returns {Promise} Handle the validate event + */ + VideoResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var source = this.source; + if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) + && source.width && source.height) { + source.complete = true; + } + source.addEventListener('play', this._onPlayStart.bind(this)); + source.addEventListener('pause', this._onPlayStop.bind(this)); + if (!this._isSourceReady()) { + source.addEventListener('canplay', this._onCanPlay); + source.addEventListener('canplaythrough', this._onCanPlay); + source.addEventListener('error', this._onError, true); + } + else { + this._onCanPlay(); + } + this._load = new Promise(function (resolve) { + if (_this.valid) { + resolve(_this); + } + else { + _this._resolve = resolve; + source.load(); + } + }); + return this._load; + }; + /** + * Handle video error events. + * @param event + */ + VideoResource.prototype._onError = function (event) { + this.source.removeEventListener('error', this._onError, true); + this.onError.emit(event); + }; + /** + * Returns true if the underlying source is playing. + * @returns - True if playing. + */ + VideoResource.prototype._isSourcePlaying = function () { + var source = this.source; + return (!source.paused && !source.ended && this._isSourceReady()); + }; + /** + * Returns true if the underlying source is ready for playing. + * @returns - True if ready. + */ + VideoResource.prototype._isSourceReady = function () { + var source = this.source; + return source.readyState > 2; + }; + /** Runs the update loop when the video is ready to play. */ + VideoResource.prototype._onPlayStart = function () { + // Just in case the video has not received its can play even yet.. + if (!this.valid) { + this._onCanPlay(); + } + if (this.autoUpdate && !this._isConnectedToTicker) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + }; + /** Fired when a pause event is triggered, stops the update loop. */ + VideoResource.prototype._onPlayStop = function () { + if (this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + }; + /** Fired when the video is loaded and ready to play. */ + VideoResource.prototype._onCanPlay = function () { + var source = this.source; + source.removeEventListener('canplay', this._onCanPlay); + source.removeEventListener('canplaythrough', this._onCanPlay); + var valid = this.valid; + this.resize(source.videoWidth, source.videoHeight); + // prevent multiple loaded dispatches.. + if (!valid && this._resolve) { + this._resolve(this); + this._resolve = null; + } + if (this._isSourcePlaying()) { + this._onPlayStart(); + } + else if (this.autoPlay) { + source.play(); + } + }; + /** Destroys this texture. */ + VideoResource.prototype.dispose = function () { + if (this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + var source = this.source; + if (source) { + source.removeEventListener('error', this._onError, true); + source.pause(); + source.src = ''; + source.load(); + } + _super.prototype.dispose.call(this); + }; + Object.defineProperty(VideoResource.prototype, "autoUpdate", { + /** Should the base texture automatically update itself, set to true by default. */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VideoResource.prototype, "updateFPS", { + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + */ + get: function () { + return this._updateFPS; + }, + set: function (value) { + if (value !== this._updateFPS) { + this._updateFPS = value; + } + }, + enumerable: false, + configurable: true + }); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} `true` if video source + */ + VideoResource.test = function (source, extension) { + return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement) + || VideoResource.TYPES.indexOf(extension) > -1; + }; + /** + * List of common video file extensions supported by VideoResource. + * @readonly + */ + VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @readonly + */ + VideoResource.MIME_TYPES = { + ogv: 'video/ogg', + mov: 'video/quicktime', + m4v: 'video/mp4', + }; + return VideoResource; +}(BaseImageResource)); + +/** + * Resource type for ImageBitmap. + * @memberof PIXI + */ +var ImageBitmapResource = /** @class */ (function (_super) { + __extends(ImageBitmapResource, _super); + /** + * @param source - Image element to use + */ + // eslint-disable-next-line @typescript-eslint/no-useless-constructor + function ImageBitmapResource(source) { + return _super.call(this, source) || this; + } + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an ImageBitmap + */ + ImageBitmapResource.test = function (source) { + return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap; + }; + return ImageBitmapResource; +}(BaseImageResource)); + +INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); + +var _resources = { + __proto__: null, + Resource: Resource, + BaseImageResource: BaseImageResource, + INSTALLED: INSTALLED, + autoDetectResource: autoDetectResource, + AbstractMultiResource: AbstractMultiResource, + ArrayResource: ArrayResource, + BufferResource: BufferResource, + CanvasResource: CanvasResource, + CubeResource: CubeResource, + ImageResource: ImageResource, + SVGResource: SVGResource, + VideoResource: VideoResource, + ImageBitmapResource: ImageBitmapResource +}; + +/** + * Resource type for DepthTexture. + * @memberof PIXI + */ +var DepthResource = /** @class */ (function (_super) { + __extends(DepthResource, _super); + function DepthResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK); + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + if (glTexture.width === width && glTexture.height === height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + return DepthResource; +}(BufferResource)); + +/** + * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses + * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer. + * + * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES. + * @memberof PIXI + */ +var Framebuffer = /** @class */ (function () { + /** + * @param width - Width of the frame buffer + * @param height - Height of the frame buffer + */ + function Framebuffer(width, height) { + this.width = Math.round(width || 100); + this.height = Math.round(height || 100); + this.stencil = false; + this.depth = false; + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + this.depthTexture = null; + this.colorTextures = []; + this.glFramebuffers = {}; + this.disposeRunner = new Runner('disposeFramebuffer'); + this.multisample = MSAA_QUALITY.NONE; + } + Object.defineProperty(Framebuffer.prototype, "colorTexture", { + /** + * Reference to the colorTexture. + * @readonly + */ + get: function () { + return this.colorTextures[0]; + }, + enumerable: false, + configurable: true + }); + /** + * Add texture to the colorTexture array. + * @param index - Index of the array to add the texture to + * @param texture - Texture to add to the array + */ + Framebuffer.prototype.addColorTexture = function (index, texture) { + if (index === void 0) { index = 0; } + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index] = texture || new BaseTexture(null, { + scaleMode: SCALE_MODES.NEAREST, + resolution: 1, + mipmap: MIPMAP_MODES.OFF, + width: this.width, + height: this.height, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Add a depth texture to the frame buffer. + * @param texture - Texture to add. + */ + Framebuffer.prototype.addDepthTexture = function (texture) { + /* eslint-disable max-len */ + this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { + scaleMode: SCALE_MODES.NEAREST, + resolution: 1, + width: this.width, + height: this.height, + mipmap: MIPMAP_MODES.OFF, + format: FORMATS.DEPTH_COMPONENT, + type: TYPES.UNSIGNED_SHORT, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable depth on the frame buffer. */ + Framebuffer.prototype.enableDepth = function () { + this.depth = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** Enable stencil on the frame buffer. */ + Framebuffer.prototype.enableStencil = function () { + this.stencil = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Resize the frame buffer + * @param width - Width of the frame buffer to resize to + * @param height - Height of the frame buffer to resize to + */ + Framebuffer.prototype.resize = function (width, height) { + width = Math.round(width); + height = Math.round(height); + if (width === this.width && height === this.height) + { return; } + this.width = width; + this.height = height; + this.dirtyId++; + this.dirtySize++; + for (var i = 0; i < this.colorTextures.length; i++) { + var texture = this.colorTextures[i]; + var resolution = texture.resolution; + // take into account the fact the texture may have a different resolution.. + texture.setSize(width / resolution, height / resolution); + } + if (this.depthTexture) { + var resolution = this.depthTexture.resolution; + this.depthTexture.setSize(width / resolution, height / resolution); + } + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Framebuffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys and removes the depth texture added to this framebuffer. */ + Framebuffer.prototype.destroyDepthTexture = function () { + if (this.depthTexture) { + this.depthTexture.destroy(); + this.depthTexture = null; + ++this.dirtyId; + ++this.dirtyFormat; + } + }; + return Framebuffer; +}()); + +/** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +var BaseRenderTexture = /** @class */ (function (_super) { + __extends(BaseRenderTexture, _super); + /** + * @param options + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} + * for possible values. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio + * of the texture being generated. + * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer. + */ + function BaseRenderTexture(options) { + if (options === void 0) { options = {}; } + var _this = this; + if (typeof options === 'number') { + /* eslint-disable prefer-rest-params */ + // Backward compatibility of signature + var width = arguments[0]; + var height = arguments[1]; + var scaleMode = arguments[2]; + var resolution = arguments[3]; + options = { width: width, height: height, scaleMode: scaleMode, resolution: resolution }; + /* eslint-enable prefer-rest-params */ + } + options.width = options.width || 100; + options.height = options.height || 100; + options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE; + _this = _super.call(this, null, options) || this; + // Set defaults + _this.mipmap = MIPMAP_MODES.OFF; + _this.valid = true; + _this.clearColor = [0, 0, 0, 0]; + _this.framebuffer = new Framebuffer(_this.realWidth, _this.realHeight) + .addColorTexture(0, _this); + _this.framebuffer.multisample = options.multisample; + // TODO - could this be added the systems? + _this.maskStack = []; + _this.filterStack = [{}]; + return _this; + } + /** + * Resizes the BaseRenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + */ + BaseRenderTexture.prototype.resize = function (desiredWidth, desiredHeight) { + this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution); + this.setRealSize(this.framebuffer.width, this.framebuffer.height); + }; + /** + * Frees the texture and framebuffer from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + BaseRenderTexture.prototype.dispose = function () { + this.framebuffer.dispose(); + _super.prototype.dispose.call(this); + }; + /** Destroys this texture. */ + BaseRenderTexture.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.framebuffer.destroyDepthTexture(); + this.framebuffer = null; + }; + return BaseRenderTexture; +}(BaseTexture)); + +/** + * Stores a texture's frame in UV coordinates, in + * which everything lies in the rectangle `[(0,0), (1,0), + * (1,1), (0,1)]`. + * + * | Corner | Coordinates | + * |--------------|-------------| + * | Top-Left | `(x0,y0)` | + * | Top-Right | `(x1,y1)` | + * | Bottom-Right | `(x2,y2)` | + * | Bottom-Left | `(x3,y3)` | + * @protected + * @memberof PIXI + */ +var TextureUvs = /** @class */ (function () { + function TextureUvs() { + this.x0 = 0; + this.y0 = 0; + this.x1 = 1; + this.y1 = 0; + this.x2 = 1; + this.y2 = 1; + this.x3 = 0; + this.y3 = 1; + this.uvsFloat32 = new Float32Array(8); + } + /** + * Sets the texture Uvs based on the given frame information. + * @protected + * @param frame - The frame of the texture + * @param baseFrame - The base frame of the texture + * @param rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + TextureUvs.prototype.set = function (frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + // coordinates of center + var cX = (frame.x / tw) + w2; + var cY = (frame.y / th) + h2; + rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner + this.x0 = cX + (w2 * groupD8.uX(rotate)); + this.y0 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + (w2 * groupD8.uX(rotate)); + this.y1 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x2 = cX + (w2 * groupD8.uX(rotate)); + this.y2 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x3 = cX + (w2 * groupD8.uX(rotate)); + this.y3 = cY + (h2 * groupD8.uY(rotate)); + } + else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + this.uvsFloat32[0] = this.x0; + this.uvsFloat32[1] = this.y0; + this.uvsFloat32[2] = this.x1; + this.uvsFloat32[3] = this.y1; + this.uvsFloat32[4] = this.x2; + this.uvsFloat32[5] = this.y2; + this.uvsFloat32[6] = this.x3; + this.uvsFloat32[7] = this.y3; + }; + TextureUvs.prototype.toString = function () { + return "[@pixi/core:TextureUvs " + + ("x0=" + this.x0 + " y0=" + this.y0 + " ") + + ("x1=" + this.x1 + " y1=" + this.y1 + " x2=" + this.x2 + " ") + + ("y2=" + this.y2 + " x3=" + this.x3 + " y3=" + this.y3) + + "]"; + }; + return TextureUvs; +}()); + +var DEFAULT_UVS = new TextureUvs(); +/** + * Used to remove listeners from WHITE and EMPTY Textures + * @ignore + */ +function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() { }; + tex.on = function _emptyOn() { }; + tex.once = function _emptyOnce() { }; + tex.emit = function _emptyEmit() { }; +} +/** + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.from('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: + * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.from('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + */ +var Texture = /** @class */ (function (_super) { + __extends(Texture, _super); + /** + * @param baseTexture - The base texture source to create the texture from + * @param frame - The rectangle frame of the texture to show + * @param orig - The area of original texture + * @param trim - Trimmed rectangle of original texture + * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param anchor - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + var _this = _super.call(this) || this; + _this.noFrame = false; + if (!frame) { + _this.noFrame = true; + frame = new Rectangle(0, 0, 1, 1); + } + if (baseTexture instanceof Texture) { + baseTexture = baseTexture.baseTexture; + } + _this.baseTexture = baseTexture; + _this._frame = frame; + _this.trim = trim; + _this.valid = false; + _this._uvs = DEFAULT_UVS; + _this.uvMatrix = null; + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + _this._rotate = Number(rotate || 0); + if (rotate === true) { + // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures + _this._rotate = 2; + } + else if (_this._rotate % 2 !== 0) { + throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); + } + _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); + _this._updateID = 0; + _this.textureCacheIds = []; + if (!baseTexture.valid) { + baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); + } + else if (_this.noFrame) { + // if there is no frame we should monitor for any base texture changes.. + if (baseTexture.valid) { + _this.onBaseTextureUpdated(baseTexture); + } + } + else { + _this.frame = frame; + } + if (_this.noFrame) { + baseTexture.on('update', _this.onBaseTextureUpdated, _this); + } + return _this; + } + /** + * Updates this texture on the gpu. + * + * Calls the TextureResource update. + * + * If you adjusted `frame` manually, please call `updateUvs()` instead. + */ + Texture.prototype.update = function () { + if (this.baseTexture.resource) { + this.baseTexture.resource.update(); + } + }; + /** + * Called when the base texture is updated + * @protected + * @param baseTexture - The base texture. + */ + Texture.prototype.onBaseTextureUpdated = function (baseTexture) { + if (this.noFrame) { + if (!this.baseTexture.valid) { + return; + } + this._frame.width = baseTexture.width; + this._frame.height = baseTexture.height; + this.valid = true; + this.updateUvs(); + } + else { + // TODO this code looks confusing.. boo to abusing getters and setters! + // if user gave us frame that has bigger size than resized texture it can be a problem + this.frame = this._frame; + } + this.emit('update', this); + }; + /** + * Destroys this texture + * @param [destroyBase=false] - Whether to destroy the base texture as well + */ + Texture.prototype.destroy = function (destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + var resource = this.baseTexture.resource; + // delete the texture if it exists in the texture cache.. + // this only needs to be removed if the base texture is actually destroyed too.. + if (resource && resource.url && TextureCache[resource.url]) { + Texture.removeFromCache(resource.url); + } + this.baseTexture.destroy(); + } + this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); + this.baseTexture.off('update', this.onBaseTextureUpdated, this); + this.baseTexture = null; + } + this._frame = null; + this._uvs = null; + this.trim = null; + this.orig = null; + this.valid = false; + Texture.removeFromCache(this); + this.textureCacheIds = null; + }; + /** + * Creates a new texture object that acts the same as this one. + * @returns - The new texture + */ + Texture.prototype.clone = function () { + var clonedFrame = this._frame.clone(); + var clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone(); + var clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); + if (this.noFrame) { + clonedTexture._frame = clonedFrame; + } + return clonedTexture; + }; + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + * Call it after changing the frame + */ + Texture.prototype.updateUvs = function () { + if (this._uvs === DEFAULT_UVS) { + this._uvs = new TextureUvs(); + } + this._uvs.set(this._frame, this.baseTexture, this.rotate); + this._updateID++; + }; + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - + * Source or array of sources to create texture from + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.Texture} The newly created texture + */ + Texture.from = function (source, options, strict) { + if (options === void 0) { options = {}; } + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else if (source instanceof BaseTexture) { + if (!source.cacheId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source.cacheId = prefix + "-" + uid(); + BaseTexture.addToCache(source, source.cacheId); + } + cacheId = source.cacheId; + } + else { + if (!source._pixiId) { + var prefix = (options && options.pixiIdPrefix) || 'pixiid'; + source._pixiId = prefix + "_" + uid(); + } + cacheId = source._pixiId; + } + var texture = TextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !texture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); + } + if (!texture && !(source instanceof BaseTexture)) { + if (!options.resolution) { + options.resolution = getResolutionOfUrl(source); + } + texture = new Texture(new BaseTexture(source, options)); + texture.baseTexture.cacheId = cacheId; + BaseTexture.addToCache(texture.baseTexture, cacheId); + Texture.addToCache(texture, cacheId); + } + else if (!texture && (source instanceof BaseTexture)) { + texture = new Texture(source); + Texture.addToCache(texture, cacheId); + } + // lets assume its a base texture! + return texture; + }; + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param url - The remote URL or array of URLs to load. + * @param options - Optional options to include + * @returns - A Promise that resolves to a Texture. + */ + Texture.fromURL = function (url, options) { + var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); + var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); + var resource = texture.baseTexture.resource; + // The texture was already loaded + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // Manually load the texture, this should allow users to handle load errors + return resource.load().then(function () { return Promise.resolve(texture); }); + }; + /** + * Create a new Texture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns - The resulting new BaseTexture + */ + Texture.fromBuffer = function (buffer, width, height, options) { + return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); + }; + /** + * Create a texture from a source and add to the cache. + * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source. + * @param imageUrl - File name of texture, for cache and resolving resolution. + * @param name - Human readable name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @param options + * @returns - Output texture + */ + Texture.fromLoader = function (source, imageUrl, name, options) { + var baseTexture = new BaseTexture(source, Object.assign({ + scaleMode: settings.SCALE_MODE, + resolution: getResolutionOfUrl(imageUrl), + }, options)); + var resource = baseTexture.resource; + if (resource instanceof ImageResource) { + resource.url = imageUrl; + } + var texture = new Texture(baseTexture); + // No name, use imageUrl instead + if (!name) { + name = imageUrl; + } + // lets also add the frame to pixi's global cache for 'fromLoader' function + BaseTexture.addToCache(texture.baseTexture, name); + Texture.addToCache(texture, name); + // also add references by url if they are different. + if (name !== imageUrl) { + BaseTexture.addToCache(texture.baseTexture, imageUrl); + Texture.addToCache(texture, imageUrl); + } + // Generally images are valid right away + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // SVG assets need to be parsed async, let's wait + return new Promise(function (resolve) { + texture.baseTexture.once('loaded', function () { return resolve(texture); }); + }); + }; + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * @param texture - The Texture to add to the cache. + * @param id - The id that the Texture will be stored against. + */ + Texture.addToCache = function (texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { + texture.textureCacheIds.push(id); + } + if (TextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); + } + TextureCache[id] = texture; + } + }; + /** + * Remove a Texture from the global TextureCache. + * @param texture - id of a Texture to be removed, or a Texture instance itself + * @returns - The Texture that was removed + */ + Texture.removeFromCache = function (texture) { + if (typeof texture === 'string') { + var textureFromCache = TextureCache[texture]; + if (textureFromCache) { + var index = textureFromCache.textureCacheIds.indexOf(texture); + if (index > -1) { + textureFromCache.textureCacheIds.splice(index, 1); + } + delete TextureCache[texture]; + return textureFromCache; + } + } + else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { + // Check that texture matches the one being passed in before deleting it from the cache. + if (TextureCache[texture.textureCacheIds[i]] === texture) { + delete TextureCache[texture.textureCacheIds[i]]; + } + } + texture.textureCacheIds.length = 0; + return texture; + } + return null; + }; + Object.defineProperty(Texture.prototype, "resolution", { + /** + * Returns resolution of baseTexture + * @readonly + */ + get: function () { + return this.baseTexture.resolution; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "frame", { + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + */ + get: function () { + return this._frame; + }, + set: function (frame) { + this._frame = frame; + this.noFrame = false; + var x = frame.x, y = frame.y, width = frame.width, height = frame.height; + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; + var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + + (errorX + " " + relationship + " " + errorY)); + } + this.valid = width && height && this.baseTexture.valid; + if (!this.trim && !this.rotate) { + this.orig = frame; + } + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "rotate", { + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + */ + get: function () { + return this._rotate; + }, + set: function (rotate) { + this._rotate = rotate; + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "width", { + /** The width of the Texture in pixels. */ + get: function () { + return this.orig.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "height", { + /** The height of the Texture in pixels. */ + get: function () { + return this.orig.height; + }, + enumerable: false, + configurable: true + }); + /** Utility function for BaseTexture|Texture cast. */ + Texture.prototype.castToBaseTexture = function () { + return this.baseTexture; + }; + Object.defineProperty(Texture, "EMPTY", { + /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */ + get: function () { + if (!Texture._EMPTY) { + Texture._EMPTY = new Texture(new BaseTexture()); + removeAllHandlers(Texture._EMPTY); + removeAllHandlers(Texture._EMPTY.baseTexture); + } + return Texture._EMPTY; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture, "WHITE", { + /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */ + get: function () { + if (!Texture._WHITE) { + var canvas = settings.ADAPTER.createCanvas(16, 16); + var context = canvas.getContext('2d'); + canvas.width = 16; + canvas.height = 16; + context.fillStyle = 'white'; + context.fillRect(0, 0, 16, 16); + Texture._WHITE = new Texture(BaseTexture.from(canvas)); + removeAllHandlers(Texture._WHITE); + removeAllHandlers(Texture._WHITE.baseTexture); + } + return Texture._WHITE; + }, + enumerable: false, + configurable: true + }); + return Texture; +}(EventEmitter)); + +/** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * __Hint-2__: The actual memory allocation will happen on first render. + * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * Note that you should not create a new renderer, but reuse the same one as the rest of the application. + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 }); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +var RenderTexture = /** @class */ (function (_super) { + __extends(RenderTexture, _super); + /** + * @param baseRenderTexture - The base texture object that this texture uses. + * @param frame - The rectangle frame of the texture to show. + */ + function RenderTexture(baseRenderTexture, frame) { + var _this = _super.call(this, baseRenderTexture, frame) || this; + _this.valid = true; + _this.filterFrame = null; + _this.filterPoolKey = null; + _this.updateUvs(); + return _this; + } + Object.defineProperty(RenderTexture.prototype, "framebuffer", { + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @readonly + */ + get: function () { + return this.baseTexture.framebuffer; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(RenderTexture.prototype, "multisample", { + /** + * Shortcut to `this.framebuffer.multisample`. + * @default PIXI.MSAA_QUALITY.NONE + */ + get: function () { + return this.framebuffer.multisample; + }, + set: function (value) { + this.framebuffer.multisample = value; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the RenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well? + */ + RenderTexture.prototype.resize = function (desiredWidth, desiredHeight, resizeBaseTexture) { + if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } + var resolution = this.baseTexture.resolution; + var width = Math.round(desiredWidth * resolution) / resolution; + var height = Math.round(desiredHeight * resolution) / resolution; + // TODO - could be not required.. + this.valid = (width > 0 && height > 0); + this._frame.width = this.orig.width = width; + this._frame.height = this.orig.height = height; + if (resizeBaseTexture) { + this.baseTexture.resize(width, height); + } + this.updateUvs(); + }; + /** + * Changes the resolution of baseTexture, but does not change framebuffer size. + * @param resolution - The new resolution to apply to RenderTexture + */ + RenderTexture.prototype.setResolution = function (resolution) { + var baseTexture = this.baseTexture; + if (baseTexture.resolution === resolution) { + return; + } + baseTexture.setResolution(resolution); + this.resize(baseTexture.width, baseTexture.height, false); + }; + RenderTexture.create = function (options) { + var arguments$1 = arguments; + + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments$1[_i]; + } + // @deprecated fallback, old-style: create(width, height, scaleMode, resolution) + if (typeof options === 'number') { + deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.'); + /* eslint-disable prefer-rest-params */ + options = { + width: options, + height: rest[0], + scaleMode: rest[1], + resolution: rest[2], + }; + /* eslint-enable prefer-rest-params */ + } + return new RenderTexture(new BaseRenderTexture(options)); + }; + return RenderTexture; +}(Texture)); + +/** + * Texture pool, used by FilterSystem and plugins. + * + * Stores collection of temporary pow2 or screen-sized renderTextures + * + * If you use custom RenderTexturePool for your filters, you can use methods + * `getFilterTexture` and `returnFilterTexture` same as in + * @memberof PIXI + */ +var RenderTexturePool = /** @class */ (function () { + /** + * @param textureOptions - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + */ + function RenderTexturePool(textureOptions) { + this.texturePool = {}; + this.textureOptions = textureOptions || {}; + this.enableFullScreen = false; + this._pixelsWidth = 0; + this._pixelsHeight = 0; + } + /** + * Creates texture with params that were specified in pool constructor. + * @param realWidth - Width of texture in pixels. + * @param realHeight - Height of texture in pixels. + * @param multisample - Number of samples of the framebuffer. + */ + RenderTexturePool.prototype.createTexture = function (realWidth, realHeight, multisample) { + if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; } + var baseRenderTexture = new BaseRenderTexture(Object.assign({ + width: realWidth, + height: realHeight, + resolution: 1, + multisample: multisample, + }, this.textureOptions)); + return new RenderTexture(baseRenderTexture); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture. + * @param minHeight - The minimum height of the render texture. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns The new render texture. + */ + RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; } + var key; + minWidth = Math.ceil((minWidth * resolution) - 1e-6); + minHeight = Math.ceil((minHeight * resolution) - 1e-6); + if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { + minWidth = nextPow2(minWidth); + minHeight = nextPow2(minHeight); + key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0; + if (multisample > 1) { + key += multisample * 0x100000000; + } + } + else { + key = multisample > 1 ? -multisample : -1; + } + if (!this.texturePool[key]) { + this.texturePool[key] = []; + } + var renderTexture = this.texturePool[key].pop(); + if (!renderTexture) { + renderTexture = this.createTexture(minWidth, minHeight, multisample); + } + renderTexture.filterPoolKey = key; + renderTexture.setResolution(resolution); + return renderTexture; + }; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * It overrides, it does not multiply + * @param multisample - number of samples of the renderTexture + */ + RenderTexturePool.prototype.getFilterTexture = function (input, resolution, multisample) { + var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Place a render texture back into the pool. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnTexture = function (renderTexture) { + var key = renderTexture.filterPoolKey; + renderTexture.filterFrame = null; + this.texturePool[key].push(renderTexture); + }; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface. + * @param renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { + this.returnTexture(renderTexture); + }; + /** + * Clears the pool. + * @param destroyTextures - Destroy all stored textures. + */ + RenderTexturePool.prototype.clear = function (destroyTextures) { + destroyTextures = destroyTextures !== false; + if (destroyTextures) { + for (var i in this.texturePool) { + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + } + } + this.texturePool = {}; + }; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * @param size - Initial size of screen. + */ + RenderTexturePool.prototype.setScreenSize = function (size) { + if (size.width === this._pixelsWidth + && size.height === this._pixelsHeight) { + return; + } + this.enableFullScreen = size.width > 0 && size.height > 0; + for (var i in this.texturePool) { + if (!(Number(i) < 0)) { + continue; + } + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.texturePool[i] = []; + } + this._pixelsWidth = size.width; + this._pixelsHeight = size.height; + }; + /** + * Key that is used to store fullscreen renderTextures in a pool + * @constant + */ + RenderTexturePool.SCREEN_KEY = -1; + return RenderTexturePool; +}()); + +/* eslint-disable max-len */ +/** + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. + * @memberof PIXI + */ +var Attribute = /** @class */ (function () { + /** + * @param buffer - the id of the buffer that this attribute will look for + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param normalized - should the data be normalized. + * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param [instance=false] - Whether the geometry is instanced. + */ + function Attribute(buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (type === void 0) { type = TYPES.FLOAT; } + this.buffer = buffer; + this.size = size; + this.normalized = normalized; + this.type = type; + this.stride = stride; + this.start = start; + this.instance = instance; + } + /** Destroys the Attribute. */ + Attribute.prototype.destroy = function () { + this.buffer = null; + }; + /** + * Helper function that creates an Attribute based on the information provided + * @param buffer - the id of the buffer that this attribute will look for + * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param [normalized=false] - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @returns - A new {@link PIXI.Attribute} based on the information provided + */ + Attribute.from = function (buffer, size, normalized, type, stride) { + return new Attribute(buffer, size, normalized, type, stride); + }; + return Attribute; +}()); + +var UID$4 = 0; +/** + * A wrapper for data so that it can be used and uploaded by WebGL + * @memberof PIXI + */ +var Buffer = /** @class */ (function () { + /** + * @param {PIXI.IArrayBuffer} data - the data to store in the buffer. + * @param _static - `true` for static buffer + * @param index - `true` for index buffer + */ + function Buffer(data, _static, index) { + if (_static === void 0) { _static = true; } + if (index === void 0) { index = false; } + this.data = (data || new Float32Array(1)); + this._glBuffers = {}; + this._updateID = 0; + this.index = index; + this.static = _static; + this.id = UID$4++; + this.disposeRunner = new Runner('disposeBuffer'); + } + // TODO could explore flagging only a partial upload? + /** + * Flags this buffer as requiring an upload to the GPU. + * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer. + */ + Buffer.prototype.update = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + this.data = data || this.data; + this._updateID++; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Buffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the buffer. */ + Buffer.prototype.destroy = function () { + this.dispose(); + this.data = null; + }; + Object.defineProperty(Buffer.prototype, "index", { + get: function () { + return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + }, + /** + * Flags whether this is an index buffer. + * + * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make + * the buffer of type `ARRAY_BUFFER`. + * + * For backwards compatibility. + */ + set: function (value) { + this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER; + }, + enumerable: false, + configurable: true + }); + /** + * Helper function that creates a buffer based on an array or TypedArray + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @returns - A new Buffer based on the data provided. + */ + Buffer.from = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + return new Buffer(data); + }; + return Buffer; +}()); + +/* eslint-disable object-shorthand */ +var map$1 = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, +}; +function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map$1[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); +} + +var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; +var UID$3 = 0; +/* eslint-disable object-shorthand */ +var map = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + Uint16Array: Uint16Array, +}; +/* eslint-disable max-len */ +/** + * The Geometry represents a model. It consists of two components: + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. + * + * Geometry can be defined without passing in a style or data if required (thats how I prefer!) + * + * ```js + * let geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) + * geometry.addIndex([0,1,2,1,3,2]) + * ``` + * @memberof PIXI + */ +var Geometry = /** @class */ (function () { + /** + * @param buffers - An array of buffers. optional. + * @param attributes - Of the geometry, optional structure of the attributes layout + */ + function Geometry(buffers, attributes) { + if (buffers === void 0) { buffers = []; } + if (attributes === void 0) { attributes = {}; } + this.buffers = buffers; + this.indexBuffer = null; + this.attributes = attributes; + this.glVertexArrayObjects = {}; + this.id = UID$3++; + this.instanced = false; + this.instanceCount = 1; + this.disposeRunner = new Runner('disposeGeometry'); + this.refCount = 0; + } + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * @param id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param normalized - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param instance - Instancing flag + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (instance === void 0) { instance = false; } + if (!buffer) { + throw new Error('You must pass a buffer when creating an attribute'); + } + // check if this is a buffer! + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Float32Array(buffer); + } + buffer = new Buffer(buffer); + } + var ids = id.split('|'); + if (ids.length > 1) { + for (var i = 0; i < ids.length; i++) { + this.addAttribute(ids[i], buffer, size, normalized, type); + } + return this; + } + var bufferIndex = this.buffers.indexOf(buffer); + if (bufferIndex === -1) { + this.buffers.push(buffer); + bufferIndex = this.buffers.length - 1; + } + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); + // assuming that if there is instanced data then this will be drawn with instancing! + this.instanced = this.instanced || instance; + return this; + }; + /** + * Returns the requested attribute. + * @param id - The name of the attribute required + * @returns - The attribute requested. + */ + Geometry.prototype.getAttribute = function (id) { + return this.attributes[id]; + }; + /** + * Returns the requested buffer. + * @param id - The name of the buffer required. + * @returns - The buffer requested. + */ + Geometry.prototype.getBuffer = function (id) { + return this.buffers[this.getAttribute(id).buffer]; + }; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.addIndex = function (buffer) { + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Uint16Array(buffer); + } + buffer = new Buffer(buffer); + } + buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + this.indexBuffer = buffer; + if (this.buffers.indexOf(buffer) === -1) { + this.buffers.push(buffer); + } + return this; + }; + /** + * Returns the index buffer + * @returns - The index buffer. + */ + Geometry.prototype.getIndex = function () { + return this.indexBuffer; + }; + /** + * This function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * @returns - Returns self, useful for chaining. + */ + Geometry.prototype.interleave = function () { + // a simple check to see if buffers are already interleaved.. + if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) + { return this; } + // assume already that no buffers are interleaved + var arrays = []; + var sizes = []; + var interleavedBuffer = new Buffer(); + var i; + for (i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + arrays.push(buffer.data); + sizes.push((attribute.size * byteSizeMap$1[attribute.type]) / 4); + attribute.buffer = 0; + } + interleavedBuffer.data = interleaveTypedArrays(arrays, sizes); + for (i = 0; i < this.buffers.length; i++) { + if (this.buffers[i] !== this.indexBuffer) { + this.buffers[i].destroy(); + } + } + this.buffers = [interleavedBuffer]; + if (this.indexBuffer) { + this.buffers.push(this.indexBuffer); + } + return this; + }; + /** Get the size of the geometries, in vertices. */ + Geometry.prototype.getSize = function () { + for (var i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + return buffer.data.length / ((attribute.stride / 4) || attribute.size); + } + return 0; + }; + /** Disposes WebGL resources that are connected to this geometry. */ + Geometry.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** Destroys the geometry. */ + Geometry.prototype.destroy = function () { + this.dispose(); + this.buffers = null; + this.indexBuffer = null; + this.attributes = null; + }; + /** + * Returns a clone of the geometry. + * @returns - A new clone of this geometry. + */ + Geometry.prototype.clone = function () { + var geometry = new Geometry(); + for (var i = 0; i < this.buffers.length; i++) { + geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); + } + for (var i in this.attributes) { + var attrib = this.attributes[i]; + geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); + } + if (this.indexBuffer) { + geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; + geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + } + return geometry; + }; + /** + * Merges an array of geometries into a new single one. + * + * Geometry attribute styles must match for this operation to work. + * @param geometries - array of geometries to merge + * @returns - Shiny new geometry! + */ + Geometry.merge = function (geometries) { + // todo add a geometry check! + // also a size check.. cant be too big!] + var geometryOut = new Geometry(); + var arrays = []; + var sizes = []; + var offsets = []; + var geometry; + // pass one.. get sizes.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + sizes[j] = sizes[j] || 0; + sizes[j] += geometry.buffers[j].data.length; + offsets[j] = 0; + } + } + // build the correct size arrays.. + for (var i = 0; i < geometry.buffers.length; i++) { + // TODO types! + arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]); + geometryOut.buffers[i] = new Buffer(arrays[i]); + } + // pass to set data.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + arrays[j].set(geometry.buffers[j].data, offsets[j]); + offsets[j] += geometry.buffers[j].data.length; + } + } + geometryOut.attributes = geometry.attributes; + if (geometry.indexBuffer) { + geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; + geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER; + var offset = 0; + var stride = 0; + var offset2 = 0; + var bufferIndexToCount = 0; + // get a buffer + for (var i = 0; i < geometry.buffers.length; i++) { + if (geometry.buffers[i] !== geometry.indexBuffer) { + bufferIndexToCount = i; + break; + } + } + // figure out the stride of one buffer.. + for (var i in geometry.attributes) { + var attribute = geometry.attributes[i]; + if ((attribute.buffer | 0) === bufferIndexToCount) { + stride += ((attribute.size * byteSizeMap$1[attribute.type]) / 4); + } + } + // time to off set all indexes.. + for (var i = 0; i < geometries.length; i++) { + var indexBufferData = geometries[i].indexBuffer.data; + for (var j = 0; j < indexBufferData.length; j++) { + geometryOut.indexBuffer.data[j + offset2] += offset; + } + offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride); + offset2 += indexBufferData.length; + } + } + return geometryOut; + }; + return Geometry; +}()); + +/** + * Helper class to create a quad + * @memberof PIXI + */ +var Quad = /** @class */ (function (_super) { + __extends(Quad, _super); + function Quad() { + var _this = _super.call(this) || this; + _this.addAttribute('aVertexPosition', new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ])) + .addIndex([0, 1, 3, 2]); + return _this; + } + return Quad; +}(Geometry)); + +/** + * Helper class to create a quad with uvs like in v4 + * @memberof PIXI + */ +var QuadUv = /** @class */ (function (_super) { + __extends(QuadUv, _super); + function QuadUv() { + var _this = _super.call(this) || this; + _this.vertices = new Float32Array([ + -1, -1, + 1, -1, + 1, 1, + -1, 1 ]); + _this.uvs = new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ]); + _this.vertexBuffer = new Buffer(_this.vertices); + _this.uvBuffer = new Buffer(_this.uvs); + _this.addAttribute('aVertexPosition', _this.vertexBuffer) + .addAttribute('aTextureCoord', _this.uvBuffer) + .addIndex([0, 1, 2, 0, 2, 3]); + return _this; + } + /** + * Maps two Rectangle to the quad. + * @param targetTextureFrame - The first rectangle + * @param destinationFrame - The second rectangle + * @returns - Returns itself. + */ + QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { + var x = 0; // destinationFrame.x / targetTextureFrame.width; + var y = 0; // destinationFrame.y / targetTextureFrame.height; + this.uvs[0] = x; + this.uvs[1] = y; + this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[3] = y; + this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); + this.uvs[6] = x; + this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); + x = destinationFrame.x; + y = destinationFrame.y; + this.vertices[0] = x; + this.vertices[1] = y; + this.vertices[2] = x + destinationFrame.width; + this.vertices[3] = y; + this.vertices[4] = x + destinationFrame.width; + this.vertices[5] = y + destinationFrame.height; + this.vertices[6] = x; + this.vertices[7] = y + destinationFrame.height; + this.invalidate(); + return this; + }; + /** + * Legacy upload method, just marks buffers dirty. + * @returns - Returns itself. + */ + QuadUv.prototype.invalidate = function () { + this.vertexBuffer._updateID++; + this.uvBuffer._updateID++; + return this; + }; + return QuadUv; +}(Geometry)); + +var UID$2 = 0; +/** + * Uniform group holds uniform map and some ID's for work + * + * `UniformGroup` has two modes: + * + * 1: Normal mode + * Normal mode will upload the uniforms with individual function calls as required + * + * 2: Uniform buffer mode + * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or + * or a generic object that PixiJS will automatically map to a buffer for you. + * For maximum benefits, make Ubo UniformGroups static, and only update them each frame. + * + * Rules of UBOs: + * - UBOs only work with WebGL2, so make sure you have a fallback! + * - Only floats are supported (including vec[2,3,4], mat[2,3,4]) + * - Samplers cannot be used in ubo's (a GPU limitation) + * - You must ensure that the object you pass in exactly matches in the shader ubo structure. + * Otherwise, weirdness will ensue! + * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader. + * + * ``` + * // ubo in shader: + * uniform myCoolData { // declaring a ubo.. + * mat4 uCoolMatrix; + * float uFloatyMcFloatFace + * + * + * // a new uniform buffer object.. + * const myCoolData = new UniformBufferGroup({ + * uCoolMatrix: new Matrix(), + * uFloatyMcFloatFace: 23, + * }} + * + * // build a shader... + * const shader = Shader.from(srcVert, srcFrag, { + * myCoolData // name matches the ubo name in the shader. will be processed accordingly. + * }) + * + * ``` + * @memberof PIXI + */ +var UniformGroup = /** @class */ (function () { + /** + * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer. + * @param isStatic - Uniforms wont be changed after creation. + * @param isUbo - If true, will treat this uniform group as a uniform buffer object. + */ + function UniformGroup(uniforms, isStatic, isUbo) { + this.group = true; + // lets generate this when the shader ? + this.syncUniforms = {}; + this.dirtyId = 0; + this.id = UID$2++; + this.static = !!isStatic; + this.ubo = !!isUbo; + if (uniforms instanceof Buffer) { + this.buffer = uniforms; + this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = false; + this.ubo = true; + } + else { + this.uniforms = uniforms; + if (this.ubo) { + this.buffer = new Buffer(new Float32Array(1)); + this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER; + this.autoManage = true; + } + } + } + UniformGroup.prototype.update = function () { + this.dirtyId++; + if (!this.autoManage && this.buffer) { + this.buffer.update(); + } + }; + UniformGroup.prototype.add = function (name, uniforms, _static) { + if (!this.ubo) { + this.uniforms[name] = new UniformGroup(uniforms, _static); + } + else { + // eslint-disable-next-line max-len + throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them'); + } + }; + UniformGroup.from = function (uniforms, _static, _ubo) { + return new UniformGroup(uniforms, _static, _ubo); + }; + /** + * A short hand function for creating a static UBO UniformGroup. + * @param uniforms - the ubo item + * @param _static - should this be updated each time it is used? defaults to true here! + */ + UniformGroup.uboFrom = function (uniforms, _static) { + return new UniformGroup(uniforms, _static !== null && _static !== void 0 ? _static : true, true); + }; + return UniformGroup; +}()); + +/** + * System plugin to the renderer to manage filter states. + * @ignore + */ +var FilterState = /** @class */ (function () { + function FilterState() { + this.renderTexture = null; + this.target = null; + this.legacy = false; + this.resolution = 1; + this.multisample = MSAA_QUALITY.NONE; + // next three fields are created only for root + // re-assigned for everything else + this.sourceFrame = new Rectangle(); + this.destinationFrame = new Rectangle(); + this.bindingSourceFrame = new Rectangle(); + this.bindingDestinationFrame = new Rectangle(); + this.filters = []; + this.transform = null; + } + /** Clears the state */ + FilterState.prototype.clear = function () { + this.target = null; + this.filters = null; + this.renderTexture = null; + }; + return FilterState; +}()); + +var tempPoints = [new Point(), new Point(), new Point(), new Point()]; +var tempMatrix$2 = new Matrix(); +/** + * System plugin to the renderer to manage filters. + * + * ## Pipeline + * + * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its + * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target. + * + * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into + * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called + * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame` + * in the final render-target. + * + * ## Usage + * + * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process: + * + * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target. + * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents + * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is + * illegal during an existing render cycle, and it may reset the filter system. + * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them + * serially and output to the bounds of the filter-target. + * @memberof PIXI + */ +var FilterSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FilterSystem(renderer) { + this.renderer = renderer; + this.defaultFilterStack = [{}]; + this.texturePool = new RenderTexturePool(); + this.texturePool.setScreenSize(renderer.view); + this.statePool = []; + this.quad = new Quad(); + this.quadUv = new QuadUv(); + this.tempRect = new Rectangle(); + this.activeState = {}; + this.globalUniforms = new UniformGroup({ + outputFrame: new Rectangle(), + inputSize: new Float32Array(4), + inputPixel: new Float32Array(4), + inputClamp: new Float32Array(4), + resolution: 1, + // legacy variables + filterArea: new Float32Array(4), + filterClamp: new Float32Array(4), + }, true); + this.forceClear = false; + this.useMaxPadding = false; + } + /** + * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an + * input render-texture for the rest of the filtering pipeline. + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param filters - The filters to apply. + */ + FilterSystem.prototype.push = function (target, filters) { + var _a, _b; + var renderer = this.renderer; + var filterStack = this.defaultFilterStack; + var state = this.statePool.pop() || new FilterState(); + var renderTextureSystem = this.renderer.renderTexture; + var resolution = filters[0].resolution; + var multisample = filters[0].multisample; + var padding = filters[0].padding; + var autoFit = filters[0].autoFit; + // We don't know whether it's a legacy filter until it was bound for the first time, + // therefore we have to assume that it is if legacy is undefined. + var legacy = (_a = filters[0].legacy) !== null && _a !== void 0 ? _a : true; + for (var i = 1; i < filters.length; i++) { + var filter = filters[i]; + // let's use the lowest resolution + resolution = Math.min(resolution, filter.resolution); + // let's use the lowest number of samples + multisample = Math.min(multisample, filter.multisample); + // figure out the padding required for filters + padding = this.useMaxPadding + // old behavior: use largest amount of padding! + ? Math.max(padding, filter.padding) + // new behavior: sum the padding + : padding + filter.padding; + // only auto fit if all filters are autofit + autoFit = autoFit && filter.autoFit; + legacy = legacy || ((_b = filter.legacy) !== null && _b !== void 0 ? _b : true); + } + if (filterStack.length === 1) { + this.defaultFilterStack[0].renderTexture = renderTextureSystem.current; + } + filterStack.push(state); + state.resolution = resolution; + state.multisample = multisample; + state.legacy = legacy; + state.target = target; + state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); + state.sourceFrame.pad(padding); + var sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame); + // Project source frame into world space (if projection is applied) + if (renderer.projection.transform) { + this.transformAABB(tempMatrix$2.copyFrom(renderer.projection.transform).invert(), sourceFrameProjected); + } + if (autoFit) { + state.sourceFrame.fit(sourceFrameProjected); + if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + } + else if (!state.sourceFrame.intersects(sourceFrameProjected)) { + state.sourceFrame.width = 0; + state.sourceFrame.height = 0; + } + // Round sourceFrame in screen space based on render-texture. + this.roundFrame(state.sourceFrame, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution, multisample); + state.filters = filters; + state.destinationFrame.width = state.renderTexture.width; + state.destinationFrame.height = state.renderTexture.height; + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = state.sourceFrame.width; + destinationFrame.height = state.sourceFrame.height; + state.renderTexture.filterFrame = state.sourceFrame; + state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame); + state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame); + state.transform = renderer.projection.transform; + renderer.projection.transform = null; + renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame); + renderer.framebuffer.clear(0, 0, 0, 0); + }; + /** Pops off the filter and applies it. */ + FilterSystem.prototype.pop = function () { + var filterStack = this.defaultFilterStack; + var state = filterStack.pop(); + var filters = state.filters; + this.activeState = state; + var globalUniforms = this.globalUniforms.uniforms; + globalUniforms.outputFrame = state.sourceFrame; + globalUniforms.resolution = state.resolution; + var inputSize = globalUniforms.inputSize; + var inputPixel = globalUniforms.inputPixel; + var inputClamp = globalUniforms.inputClamp; + inputSize[0] = state.destinationFrame.width; + inputSize[1] = state.destinationFrame.height; + inputSize[2] = 1.0 / inputSize[0]; + inputSize[3] = 1.0 / inputSize[1]; + inputPixel[0] = Math.round(inputSize[0] * state.resolution); + inputPixel[1] = Math.round(inputSize[1] * state.resolution); + inputPixel[2] = 1.0 / inputPixel[0]; + inputPixel[3] = 1.0 / inputPixel[1]; + inputClamp[0] = 0.5 * inputPixel[2]; + inputClamp[1] = 0.5 * inputPixel[3]; + inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); + inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); + // only update the rect if its legacy.. + if (state.legacy) { + var filterArea = globalUniforms.filterArea; + filterArea[0] = state.destinationFrame.width; + filterArea[1] = state.destinationFrame.height; + filterArea[2] = state.sourceFrame.x; + filterArea[3] = state.sourceFrame.y; + globalUniforms.filterClamp = globalUniforms.inputClamp; + } + this.globalUniforms.update(); + var lastState = filterStack[filterStack.length - 1]; + this.renderer.framebuffer.blit(); + if (filters.length === 1) { + filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state); + this.returnFilterTexture(state.renderTexture); + } + else { + var flip = state.renderTexture; + var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + var i = 0; + for (i = 0; i < filters.length - 1; ++i) { + if (i === 1 && state.multisample > 1) { + flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + } + filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state); + var t = flip; + flip = flop; + flop = t; + } + filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state); + if (i > 1 && state.multisample > 1) { + this.returnFilterTexture(state.renderTexture); + } + this.returnFilterTexture(flip); + this.returnFilterTexture(flop); + } + // lastState.renderTexture is blitted when lastState is popped + state.clear(); + this.statePool.push(state); + }; + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { + if (clearMode === void 0) { clearMode = CLEAR_MODES.CLEAR; } + var _a = this.renderer, renderTextureSystem = _a.renderTexture, stateSystem = _a.state; + if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + // Restore projection transform if rendering into the output render-target. + this.renderer.projection.transform = this.activeState.transform; + } + else { + // Prevent projection within filtering pipeline. + this.renderer.projection.transform = null; + } + if (filterTexture && filterTexture.filterFrame) { + var destinationFrame = this.tempRect; + destinationFrame.x = 0; + destinationFrame.y = 0; + destinationFrame.width = filterTexture.filterFrame.width; + destinationFrame.height = filterTexture.filterFrame.height; + renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame); + } + else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) { + renderTextureSystem.bind(filterTexture); + } + else { + // Restore binding for output render-target. + this.renderer.renderTexture.bind(filterTexture, this.activeState.bindingSourceFrame, this.activeState.bindingDestinationFrame); + } + // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending + // is stored in the 0th bit of the state. + var autoClear = (stateSystem.stateId & 1) || this.forceClear; + if (clearMode === CLEAR_MODES.CLEAR + || (clearMode === CLEAR_MODES.BLIT && autoClear)) { + // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering + // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur) + // instead of clamping their arithmetic. + this.renderer.framebuffer.clear(0, 0, 0, 0); + } + }; + /** + * Draws a filter using the default rendering process. + * + * This should be called only by {@link Filter#apply}. + * @param filter - The filter to draw. + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it + */ + FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { + var renderer = this.renderer; + // Set state before binding, so bindAndClear gets the blend mode. + renderer.state.set(filter.state); + this.bindAndClear(output, clearMode); + // set the uniforms.. + filter.uniforms.uSampler = input; + filter.uniforms.filterGlobals = this.globalUniforms; + // TODO make it so that the order of this does not matter.. + // because it does at the moment cos of global uniforms. + // they need to get resynced + renderer.shader.bind(filter); + // check to see if the filter is a legacy one.. + filter.legacy = !!filter.program.attributeData.aTextureCoord; + if (filter.legacy) { + this.quadUv.map(input._frame, input.filterFrame); + renderer.geometry.bind(this.quadUv); + renderer.geometry.draw(DRAW_MODES.TRIANGLES); + } + else { + renderer.geometry.bind(this.quad); + renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP); + } + }; + /** + * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. + * + * Use `outputMatrix * vTextureCoord` in the shader. + * @param outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @returns The mapped matrix. + */ + FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); + var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX); + worldTransform.invert(); + mappedMatrix.prepend(worldTransform); + mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); + mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); + return mappedMatrix; + }; + /** Destroys this Filter System. */ + FilterSystem.prototype.destroy = function () { + this.renderer = null; + // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem + this.texturePool.clear(false); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture in real pixels. + * @param minHeight - The minimum height of the render texture in real pixels. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns - The new render texture. + */ + FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution, multisample) { + if (resolution === void 0) { resolution = 1; } + if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; } + return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample); + }; + /** + * Gets extra render texture to use inside current filter + * To be compliant with older filters, you can use params in any order + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * @param multisample - number of samples of the renderTexture + */ + FilterSystem.prototype.getFilterTexture = function (input, resolution, multisample) { + if (typeof input === 'number') { + var swap = input; + input = resolution; + resolution = swap; + } + input = input || this.activeState.renderTexture; + var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || MSAA_QUALITY.NONE); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Frees a render texture back into the pool. + * @param renderTexture - The renderTarget to free + */ + FilterSystem.prototype.returnFilterTexture = function (renderTexture) { + this.texturePool.returnTexture(renderTexture); + }; + /** Empties the texture pool. */ + FilterSystem.prototype.emptyPool = function () { + this.texturePool.clear(true); + }; + /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */ + FilterSystem.prototype.resize = function () { + this.texturePool.setScreenSize(this.renderer.view); + }; + /** + * @param matrix - first param + * @param rect - second param + */ + FilterSystem.prototype.transformAABB = function (matrix, rect) { + var lt = tempPoints[0]; + var lb = tempPoints[1]; + var rt = tempPoints[2]; + var rb = tempPoints[3]; + lt.set(rect.left, rect.top); + lb.set(rect.left, rect.bottom); + rt.set(rect.right, rect.top); + rb.set(rect.right, rect.bottom); + matrix.apply(lt, lt); + matrix.apply(lb, lb); + matrix.apply(rt, rt); + matrix.apply(rb, rb); + var x0 = Math.min(lt.x, lb.x, rt.x, rb.x); + var y0 = Math.min(lt.y, lb.y, rt.y, rb.y); + var x1 = Math.max(lt.x, lb.x, rt.x, rb.x); + var y1 = Math.max(lt.y, lb.y, rt.y, rb.y); + rect.x = x0; + rect.y = y0; + rect.width = x1 - x0; + rect.height = y1 - y0; + }; + FilterSystem.prototype.roundFrame = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0) { + return; + } + if (transform) { + var a = transform.a, b = transform.b, c = transform.c, d = transform.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)) { + return; + } + } + transform = transform ? tempMatrix$2.copyFrom(transform) : tempMatrix$2.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.transformAABB(transform, frame); + // Round frame in screen space + frame.ceil(resolution); + // Project back into world space. + this.transformAABB(transform.invert(), frame); + }; + return FilterSystem; +}()); + +/** + * Base for a common object renderer that can be used as a + * system renderer plugin. + * @memberof PIXI + */ +var ObjectRenderer = /** @class */ (function () { + /** + * @param renderer - The renderer this manager works for. + */ + function ObjectRenderer(renderer) { + this.renderer = renderer; + } + /** Stub method that should be used to empty the current batch by rendering objects now. */ + ObjectRenderer.prototype.flush = function () { + // flush! + }; + /** Generic destruction method that frees all resources. This should be called by subclasses. */ + ObjectRenderer.prototype.destroy = function () { + this.renderer = null; + }; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + ObjectRenderer.prototype.start = function () { + // set the shader.. + }; + /** Stops the renderer. It should free up any state and become dormant. */ + ObjectRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * @param {PIXI.DisplayObject} _object - The object to render. + */ + ObjectRenderer.prototype.render = function (_object) { + // render the object + }; + return ObjectRenderer; +}()); + +/** + * System plugin to the renderer to manage batching. + * @memberof PIXI + */ +var BatchSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function BatchSystem(renderer) { + this.renderer = renderer; + this.emptyRenderer = new ObjectRenderer(renderer); + this.currentRenderer = this.emptyRenderer; + } + /** + * Changes the current renderer to the one given in parameter + * @param objectRenderer - The object renderer to use. + */ + BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { + if (this.currentRenderer === objectRenderer) { + return; + } + this.currentRenderer.stop(); + this.currentRenderer = objectRenderer; + this.currentRenderer.start(); + }; + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + */ + BatchSystem.prototype.flush = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** Reset the system to an empty renderer */ + BatchSystem.prototype.reset = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** + * Handy function for batch renderers: copies bound textures in first maxTextures locations to array + * sets actual _batchLocation for them + * @param arr - arr copy destination + * @param maxTextures - number of copied elements + */ + BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { + var boundTextures = this.renderer.texture.boundTextures; + for (var i = maxTextures - 1; i >= 0; --i) { + arr[i] = boundTextures[i] || null; + if (arr[i]) { + arr[i]._batchLocation = i; + } + } + }; + /** + * Assigns batch locations to textures in array based on boundTextures state. + * All textures in texArray should have `_batchEnabled = _batchId`, + * and their count should be less than `maxTextures`. + * @param texArray - textures to bound + * @param boundTextures - current state of bound textures + * @param batchId - marker for _batchEnabled param of textures in texArray + * @param maxTextures - number of texture locations to manipulate + */ + BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { + var elements = texArray.elements, ids = texArray.ids, count = texArray.count; + var j = 0; + for (var i = 0; i < count; i++) { + var tex = elements[i]; + var loc = tex._batchLocation; + if (loc >= 0 && loc < maxTextures + && boundTextures[loc] === tex) { + ids[i] = loc; + continue; + } + while (j < maxTextures) { + var bound = boundTextures[j]; + if (bound && bound._batchEnabled === batchId + && bound._batchLocation === j) { + j++; + continue; + } + ids[i] = j; + tex._batchLocation = j; + boundTextures[j] = tex; + break; + } + } + }; + /** + * @ignore + */ + BatchSystem.prototype.destroy = function () { + this.renderer = null; + }; + return BatchSystem; +}()); + +var CONTEXT_UID_COUNTER = 0; +/** + * System plugin to the renderer to manage the context. + * @memberof PIXI + */ +var ContextSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ContextSystem(renderer) { + this.renderer = renderer; + this.webGLVersion = 1; + this.extensions = {}; + this.supports = { + uint32Indices: false, + }; + // Bind functions + this.handleContextLost = this.handleContextLost.bind(this); + this.handleContextRestored = this.handleContextRestored.bind(this); + renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false); + renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); + } + Object.defineProperty(ContextSystem.prototype, "isLost", { + /** + * `true` if the context is lost + * @readonly + */ + get: function () { + return (!this.gl || this.gl.isContextLost()); + }, + enumerable: false, + configurable: true + }); + /** + * Handles the context change event. + * @param {WebGLRenderingContext} gl - New WebGL context. + */ + ContextSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + }; + /** + * Initializes the context. + * @protected + * @param {WebGLRenderingContext} gl - WebGL context + */ + ContextSystem.prototype.initFromContext = function (gl) { + this.gl = gl; + this.validateContext(gl); + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + this.renderer.runners.contextChange.emit(gl); + }; + /** + * Initialize from context options + * @protected + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext + * @param {object} options - context attributes + */ + ContextSystem.prototype.initFromOptions = function (options) { + var gl = this.createContext(this.renderer.view, options); + this.initFromContext(gl); + }; + /** + * Helper class to create a WebGL Context + * @param canvas - the canvas element that we will get the context from + * @param options - An options object that gets passed in to the canvas element containing the + * context attributes + * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext + * @returns {WebGLRenderingContext} the WebGL context + */ + ContextSystem.prototype.createContext = function (canvas, options) { + var gl; + if (settings.PREFER_ENV >= ENV.WEBGL2) { + gl = canvas.getContext('webgl2', options); + } + if (gl) { + this.webGLVersion = 2; + } + else { + this.webGLVersion = 1; + gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options); + if (!gl) { + // fail, not able to get a context + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); + } + } + this.gl = gl; + this.getExtensions(); + return this.gl; + }; + /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */ + ContextSystem.prototype.getExtensions = function () { + // time to set up default extensions that Pixi uses. + var gl = this.gl; + var common = { + loseContext: gl.getExtension('WEBGL_lose_context'), + anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'), + s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), + etc: gl.getExtension('WEBGL_compressed_texture_etc'), + etc1: gl.getExtension('WEBGL_compressed_texture_etc1'), + pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc') + || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'), + atc: gl.getExtension('WEBGL_compressed_texture_atc'), + astc: gl.getExtension('WEBGL_compressed_texture_astc') + }; + if (this.webGLVersion === 1) { + Object.assign(this.extensions, common, { + drawBuffers: gl.getExtension('WEBGL_draw_buffers'), + depthTexture: gl.getExtension('WEBGL_depth_texture'), + vertexArrayObject: gl.getExtension('OES_vertex_array_object') + || gl.getExtension('MOZ_OES_vertex_array_object') + || gl.getExtension('WEBKIT_OES_vertex_array_object'), + uint32ElementIndex: gl.getExtension('OES_element_index_uint'), + // Floats and half-floats + floatTexture: gl.getExtension('OES_texture_float'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + textureHalfFloat: gl.getExtension('OES_texture_half_float'), + textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), + }); + } + else if (this.webGLVersion === 2) { + Object.assign(this.extensions, common, { + // Floats and half-floats + colorBufferFloat: gl.getExtension('EXT_color_buffer_float') + }); + } + }; + /** + * Handles a lost webgl context + * @param {WebGLContextEvent} event - The context lost event. + */ + ContextSystem.prototype.handleContextLost = function (event) { + var _this = this; + // Prevent default to be able to restore the context + event.preventDefault(); + // Restore the context after this event has exited + setTimeout(function () { + if (_this.gl.isContextLost() && _this.extensions.loseContext) { + _this.extensions.loseContext.restoreContext(); + } + }, 0); + }; + /** Handles a restored webgl context. */ + ContextSystem.prototype.handleContextRestored = function () { + this.renderer.runners.contextChange.emit(this.gl); + }; + ContextSystem.prototype.destroy = function () { + var view = this.renderer.view; + this.renderer = null; + // remove listeners + view.removeEventListener('webglcontextlost', this.handleContextLost); + view.removeEventListener('webglcontextrestored', this.handleContextRestored); + this.gl.useProgram(null); + if (this.extensions.loseContext) { + this.extensions.loseContext.loseContext(); + } + }; + /** Handle the post-render runner event. */ + ContextSystem.prototype.postrender = function () { + if (this.renderer.renderingToScreen) { + this.gl.flush(); + } + }; + /** + * Validate context. + * @param {WebGLRenderingContext} gl - Render context. + */ + ContextSystem.prototype.validateContext = function (gl) { + var attributes = gl.getContextAttributes(); + var isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext; + if (isWebGl2) { + this.webGLVersion = 2; + } + // this is going to be fairly simple for now.. but at least we have room to grow! + if (attributes && !attributes.stencil) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); + /* eslint-enable max-len, no-console */ + } + var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); + this.supports.uint32Indices = hasuint32; + if (!hasuint32) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); + /* eslint-enable max-len, no-console */ + } + }; + return ContextSystem; +}()); + +/** + * Internal framebuffer for WebGL context. + * @memberof PIXI + */ +var GLFramebuffer = /** @class */ (function () { + function GLFramebuffer(framebuffer) { + this.framebuffer = framebuffer; + this.stencil = null; + this.dirtyId = -1; + this.dirtyFormat = -1; + this.dirtySize = -1; + this.multisample = MSAA_QUALITY.NONE; + this.msaaBuffer = null; + this.blitFramebuffer = null; + this.mipLevel = 0; + } + return GLFramebuffer; +}()); + +var tempRectangle = new Rectangle(); +/** + * System plugin to the renderer to manage framebuffers. + * @memberof PIXI + */ +var FramebufferSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function FramebufferSystem(renderer) { + this.renderer = renderer; + this.managedFramebuffers = []; + this.unknownFramebuffer = new Framebuffer(10, 10); + this.msaaSamples = null; + } + /** Sets up the renderer context and necessary buffers. */ + FramebufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.current = this.unknownFramebuffer; + this.viewport = new Rectangle(); + this.hasMRT = true; + this.writeDepthTexture = true; + // webgl2 + if (this.renderer.context.webGLVersion === 1) { + // webgl 1! + var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; + var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; + if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) { + nativeDrawBuffersExtension_1 = null; + nativeDepthTextureExtension = null; + } + if (nativeDrawBuffersExtension_1) { + gl.drawBuffers = function (activeTextures) { + return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); + }; + } + else { + this.hasMRT = false; + gl.drawBuffers = function () { + // empty + }; + } + if (!nativeDepthTextureExtension) { + this.writeDepthTexture = false; + } + } + else { + // WebGL2 + // cache possible MSAA samples + this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); + } + }; + /** + * Bind a framebuffer. + * @param framebuffer + * @param frame - frame, default is framebuffer size + * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0 + */ + FramebufferSystem.prototype.bind = function (framebuffer, frame, mipLevel) { + if (mipLevel === void 0) { mipLevel = 0; } + var gl = this.gl; + if (framebuffer) { + // TODO caching layer! + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + if (this.current !== framebuffer) { + this.current = framebuffer; + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); + } + // make sure all textures are unbound.. + if (fbo.mipLevel !== mipLevel) { + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + fbo.mipLevel = mipLevel; + } + // now check for updates... + if (fbo.dirtyId !== framebuffer.dirtyId) { + fbo.dirtyId = framebuffer.dirtyId; + if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { + fbo.dirtyFormat = framebuffer.dirtyFormat; + fbo.dirtySize = framebuffer.dirtySize; + this.updateFramebuffer(framebuffer, mipLevel); + } + else if (fbo.dirtySize !== framebuffer.dirtySize) { + fbo.dirtySize = framebuffer.dirtySize; + this.resizeFramebuffer(framebuffer); + } + } + for (var i = 0; i < framebuffer.colorTextures.length; i++) { + var tex = framebuffer.colorTextures[i]; + this.renderer.texture.unbind(tex.parentTextureArray || tex); + } + if (framebuffer.depthTexture) { + this.renderer.texture.unbind(framebuffer.depthTexture); + } + if (frame) { + var mipWidth = (frame.width >> mipLevel); + var mipHeight = (frame.height >> mipLevel); + var scale = mipWidth / frame.width; + this.setViewport(frame.x * scale, frame.y * scale, mipWidth, mipHeight); + } + else { + var mipWidth = (framebuffer.width >> mipLevel); + var mipHeight = (framebuffer.height >> mipLevel); + this.setViewport(0, 0, mipWidth, mipHeight); + } + } + else { + if (this.current) { + this.current = null; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + if (frame) { + this.setViewport(frame.x, frame.y, frame.width, frame.height); + } + else { + this.setViewport(0, 0, this.renderer.width, this.renderer.height); + } + } + }; + /** + * Set the WebGLRenderingContext's viewport. + * @param x - X position of viewport + * @param y - Y position of viewport + * @param width - Width of viewport + * @param height - Height of viewport + */ + FramebufferSystem.prototype.setViewport = function (x, y, width, height) { + var v = this.viewport; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { + v.x = x; + v.y = y; + v.width = width; + v.height = height; + this.gl.viewport(x, y, width, height); + } + }; + Object.defineProperty(FramebufferSystem.prototype, "size", { + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * @readonly + */ + get: function () { + if (this.current) { + // TODO store temp + return { x: 0, y: 0, width: this.current.width, height: this.current.height }; + } + return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; + }, + enumerable: false, + configurable: true + }); + /** + * Clear the color of the context + * @param r - Red value from 0 to 1 + * @param g - Green value from 0 to 1 + * @param b - Blue value from 0 to 1 + * @param a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { + if (mask === void 0) { mask = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH; } + var gl = this.gl; + // TODO clear color can be set only one right? + gl.clearColor(r, g, b, a); + gl.clear(mask); + }; + /** + * Initialize framebuffer for this context + * @protected + * @param framebuffer + * @returns - created GLFramebuffer + */ + FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = new GLFramebuffer(gl.createFramebuffer()); + fbo.multisample = this.detectSamples(framebuffer.multisample); + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; + this.managedFramebuffers.push(framebuffer); + framebuffer.disposeRunner.add(this); + return fbo; + }; + /** + * Resize the framebuffer + * @param framebuffer + * @protected + */ + FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (fbo.msaaBuffer) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + } + if (fbo.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + } + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + } + if (framebuffer.depthTexture && this.writeDepthTexture) { + this.renderer.texture.bind(framebuffer.depthTexture, 0); + } + }; + /** + * Update the framebuffer + * @param framebuffer + * @param mipLevel + * @protected + */ + FramebufferSystem.prototype.updateFramebuffer = function (framebuffer, mipLevel) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + // bind the color texture + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer)) { + fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); + } + else if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + fbo.msaaBuffer = null; + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + fbo.blitFramebuffer = null; + } + } + var activeTextures = []; + for (var i = 0; i < count; i++) { + var texture = colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + if (i === 0 && fbo.msaaBuffer) { + continue; + } + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + activeTextures.push(gl.COLOR_ATTACHMENT0 + i); + } + if (activeTextures.length > 1) { + gl.drawBuffers(activeTextures); + } + if (framebuffer.depthTexture) { + var writeDepthTexture = this.writeDepthTexture; + if (writeDepthTexture) { + var depthTexture = framebuffer.depthTexture; + this.renderer.texture.bind(depthTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, mipLevel); + } + } + if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture)) { + fbo.stencil = fbo.stencil || gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); + } + else if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + fbo.stencil = null; + } + }; + /** + * Returns true if the frame buffer can be multisampled. + * @param framebuffer + */ + FramebufferSystem.prototype.canMultisampleFramebuffer = function (framebuffer) { + return this.renderer.context.webGLVersion !== 1 + && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture; + }; + /** + * Detects number of samples that is not more than a param but as close to it as possible + * @param samples - number of samples + * @returns - recommended number of samples + */ + FramebufferSystem.prototype.detectSamples = function (samples) { + var msaaSamples = this.msaaSamples; + var res = MSAA_QUALITY.NONE; + if (samples <= 1 || msaaSamples === null) { + return res; + } + for (var i = 0; i < msaaSamples.length; i++) { + if (msaaSamples[i] <= samples) { + res = msaaSamples[i]; + break; + } + } + if (res === 1) { + res = MSAA_QUALITY.NONE; + } + return res; + }; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * @param framebuffer - by default it blits "into itself", from renderBuffer to texture. + * @param sourcePixels - source rectangle in pixels + * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { + var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (renderer.context.webGLVersion !== 2) { + return; + } + if (!current) { + return; + } + var fbo = current.glFramebuffers[CONTEXT_UID]; + if (!fbo) { + return; + } + if (!framebuffer) { + if (!fbo.msaaBuffer) { + return; + } + var colorTexture = current.colorTextures[0]; + if (!colorTexture) { + return; + } + if (!fbo.blitFramebuffer) { + fbo.blitFramebuffer = new Framebuffer(current.width, current.height); + fbo.blitFramebuffer.addColorTexture(0, colorTexture); + } + framebuffer = fbo.blitFramebuffer; + if (framebuffer.colorTextures[0] !== colorTexture) { + framebuffer.colorTextures[0] = colorTexture; + framebuffer.dirtyId++; + framebuffer.dirtyFormat++; + } + if (framebuffer.width !== current.width || framebuffer.height !== current.height) { + framebuffer.width = current.width; + framebuffer.height = current.height; + framebuffer.dirtyId++; + framebuffer.dirtySize++; + } + } + if (!sourcePixels) { + sourcePixels = tempRectangle; + sourcePixels.width = current.width; + sourcePixels.height = current.height; + } + if (!destPixels) { + destPixels = sourcePixels; + } + var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; + this.bind(framebuffer); + gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); + gl.blitFramebuffer(sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom, destPixels.left, destPixels.top, destPixels.right, destPixels.bottom, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); + }; + /** + * Disposes framebuffer. + * @param framebuffer - framebuffer that has to be disposed of + * @param contextLost - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + var gl = this.gl; + if (!fbo) { + return; + } + delete framebuffer.glFramebuffers[this.CONTEXT_UID]; + var index = this.managedFramebuffers.indexOf(framebuffer); + if (index >= 0) { + this.managedFramebuffers.splice(index, 1); + } + framebuffer.disposeRunner.remove(this); + if (!contextLost) { + gl.deleteFramebuffer(fbo.framebuffer); + if (fbo.msaaBuffer) { + gl.deleteRenderbuffer(fbo.msaaBuffer); + } + if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + } + } + if (fbo.blitFramebuffer) { + fbo.blitFramebuffer.dispose(); + } + }; + /** + * Disposes all framebuffers, but not textures bound to them. + * @param [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeAll = function (contextLost) { + var list = this.managedFramebuffers; + this.managedFramebuffers = []; + for (var i = 0; i < list.length; i++) { + this.disposeFramebuffer(list[i], contextLost); + } + }; + /** + * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. + * Used by MaskSystem, when its time to use stencil mask for Graphics element. + * + * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. + * @private + */ + FramebufferSystem.prototype.forceStencil = function () { + var framebuffer = this.current; + if (!framebuffer) { + return; + } + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (!fbo || fbo.stencil) { + return; + } + framebuffer.stencil = true; + var w = framebuffer.width; + var h = framebuffer.height; + var gl = this.gl; + var stencil = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); + if (fbo.msaaBuffer) { + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h); + } + else { + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); + } + fbo.stencil = stencil; + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); + }; + /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */ + FramebufferSystem.prototype.reset = function () { + this.current = this.unknownFramebuffer; + this.viewport = new Rectangle(); + }; + FramebufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + return FramebufferSystem; +}()); + +var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; +/** + * System plugin to the renderer to manage geometry. + * @memberof PIXI + */ +var GeometrySystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function GeometrySystem(renderer) { + this.renderer = renderer; + this._activeGeometry = null; + this._activeVao = null; + this.hasVao = true; + this.hasInstance = true; + this.canUseUInt32ElementIndex = false; + this.managedGeometries = {}; + } + /** Sets up the renderer context and necessary buffers. */ + GeometrySystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + var context = this.renderer.context; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + // webgl2 + if (context.webGLVersion !== 2) { + // webgl 1! + var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; + if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) { + nativeVaoExtension_1 = null; + } + if (nativeVaoExtension_1) { + gl.createVertexArray = function () { + return nativeVaoExtension_1.createVertexArrayOES(); + }; + gl.bindVertexArray = function (vao) { + return nativeVaoExtension_1.bindVertexArrayOES(vao); + }; + gl.deleteVertexArray = function (vao) { + return nativeVaoExtension_1.deleteVertexArrayOES(vao); + }; + } + else { + this.hasVao = false; + gl.createVertexArray = function () { + return null; + }; + gl.bindVertexArray = function () { + return null; + }; + gl.deleteVertexArray = function () { + return null; + }; + } + } + if (context.webGLVersion !== 2) { + var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); + if (instanceExt_1) { + gl.vertexAttribDivisor = function (a, b) { + return instanceExt_1.vertexAttribDivisorANGLE(a, b); + }; + gl.drawElementsInstanced = function (a, b, c, d, e) { + return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); + }; + gl.drawArraysInstanced = function (a, b, c, d) { + return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); + }; + } + else { + this.hasInstance = false; + } + } + this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; + }; + /** + * Binds geometry so that is can be drawn. Creating a Vao if required + * @param geometry - Instance of geometry to bind. + * @param shader - Instance of shader to use vao for. + */ + GeometrySystem.prototype.bind = function (geometry, shader) { + shader = shader || this.renderer.shader.shader; + var gl = this.gl; + // not sure the best way to address this.. + // currently different shaders require different VAOs for the same geometry + // Still mulling over the best way to solve this one.. + // will likely need to modify the shader attribute locations at run time! + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var incRefCount = false; + if (!vaos) { + this.managedGeometries[geometry.id] = geometry; + geometry.disposeRunner.add(this); + geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; + incRefCount = true; + } + var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount); + this._activeGeometry = geometry; + if (this._activeVao !== vao) { + this._activeVao = vao; + if (this.hasVao) { + gl.bindVertexArray(vao); + } + else { + this.activateVao(geometry, shader.program); + } + } + // TODO - optimise later! + // don't need to loop through if nothing changed! + // maybe look to add an 'autoupdate' to geometry? + this.updateBuffers(); + }; + /** Reset and unbind any active VAO and geometry. */ + GeometrySystem.prototype.reset = function () { + this.unbind(); + }; + /** Update buffers of the currently bound geometry. */ + GeometrySystem.prototype.updateBuffers = function () { + var geometry = this._activeGeometry; + var bufferSystem = this.renderer.buffer; + for (var i = 0; i < geometry.buffers.length; i++) { + var buffer = geometry.buffers[i]; + bufferSystem.update(buffer); + } + }; + /** + * Check compatibility between a geometry and a program + * @param geometry - Geometry instance. + * @param program - Program instance. + */ + GeometrySystem.prototype.checkCompatibility = function (geometry, program) { + // geometry must have at least all the attributes that the shader requires. + var geometryAttributes = geometry.attributes; + var shaderAttributes = program.attributeData; + for (var j in shaderAttributes) { + if (!geometryAttributes[j]) { + throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); + } + } + }; + /** + * Takes a geometry and program and generates a unique signature for them. + * @param geometry - To get signature from. + * @param program - To test geometry against. + * @returns - Unique signature of the geometry and program + */ + GeometrySystem.prototype.getSignature = function (geometry, program) { + var attribs = geometry.attributes; + var shaderAttributes = program.attributeData; + var strings = ['g', geometry.id]; + for (var i in attribs) { + if (shaderAttributes[i]) { + strings.push(i, shaderAttributes[i].location); + } + } + return strings.join('-'); + }; + /** + * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. + * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the + * attribute locations. + * @param geometry - Instance of geometry to to generate Vao for. + * @param shader - Instance of the shader. + * @param incRefCount - Increment refCount of all geometry buffers. + */ + GeometrySystem.prototype.initGeometryVao = function (geometry, shader, incRefCount) { + if (incRefCount === void 0) { incRefCount = true; } + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var program = shader.program; + if (!program.glPrograms[CONTEXT_UID]) { + this.renderer.shader.generateProgram(shader); + } + this.checkCompatibility(geometry, program); + var signature = this.getSignature(geometry, program); + var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var vao = vaoObjectHash[signature]; + if (vao) { + // this will give us easy access to the vao + vaoObjectHash[program.id] = vao; + return vao; + } + var buffers = geometry.buffers; + var attributes = geometry.attributes; + var tempStride = {}; + var tempStart = {}; + for (var j in buffers) { + tempStride[j] = 0; + tempStart[j] = 0; + } + for (var j in attributes) { + if (!attributes[j].size && program.attributeData[j]) { + attributes[j].size = program.attributeData[j].size; + } + else if (!attributes[j].size) { + console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line + } + tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type]; + } + for (var j in attributes) { + var attribute = attributes[j]; + var attribSize = attribute.size; + if (attribute.stride === undefined) { + if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type]) { + attribute.stride = 0; + } + else { + attribute.stride = tempStride[attribute.buffer]; + } + } + if (attribute.start === undefined) { + attribute.start = tempStart[attribute.buffer]; + tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type]; + } + } + vao = gl.createVertexArray(); + gl.bindVertexArray(vao); + // first update - and create the buffers! + // only create a gl buffer if it actually gets + for (var i = 0; i < buffers.length; i++) { + var buffer = buffers[i]; + bufferSystem.bind(buffer); + if (incRefCount) { + buffer._glBuffers[CONTEXT_UID].refCount++; + } + } + // TODO - maybe make this a data object? + // lets wait to see if we need to first! + this.activateVao(geometry, program); + this._activeVao = vao; + // add it to the cache! + vaoObjectHash[program.id] = vao; + vaoObjectHash[signature] = vao; + return vao; + }; + /** + * Disposes geometry. + * @param geometry - Geometry with buffers. Only VAO will be disposed + * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { + var _a; + if (!this.managedGeometries[geometry.id]) { + return; + } + delete this.managedGeometries[geometry.id]; + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var gl = this.gl; + var buffers = geometry.buffers; + var bufferSystem = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.buffer; + geometry.disposeRunner.remove(this); + if (!vaos) { + return; + } + // bufferSystem may have already been destroyed.. + // if this is the case, there is no need to destroy the geometry buffers... + // they already have been! + if (bufferSystem) { + for (var i = 0; i < buffers.length; i++) { + var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; + // my be null as context may have changed right before the dispose is called + if (buf) { + buf.refCount--; + if (buf.refCount === 0 && !contextLost) { + bufferSystem.dispose(buffers[i], contextLost); + } + } + } + } + if (!contextLost) { + for (var vaoId in vaos) { + // delete only signatures, everything else are copies + if (vaoId[0] === 'g') { + var vao = vaos[vaoId]; + if (this._activeVao === vao) { + this.unbind(); + } + gl.deleteVertexArray(vao); + } + } + } + delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; + }; + /** + * Dispose all WebGL resources of all managed geometries. + * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + GeometrySystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedGeometries); + for (var i = 0; i < all.length; i++) { + this.disposeGeometry(this.managedGeometries[all[i]], contextLost); + } + }; + /** + * Activate vertex array object. + * @param geometry - Geometry instance. + * @param program - Shader program instance. + */ + GeometrySystem.prototype.activateVao = function (geometry, program) { + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var bufferSystem = this.renderer.buffer; + var buffers = geometry.buffers; + var attributes = geometry.attributes; + if (geometry.indexBuffer) { + // first update the index buffer if we have one.. + bufferSystem.bind(geometry.indexBuffer); + } + var lastBuffer = null; + // add a new one! + for (var j in attributes) { + var attribute = attributes[j]; + var buffer = buffers[attribute.buffer]; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (program.attributeData[j]) { + if (lastBuffer !== glBuffer) { + bufferSystem.bind(buffer); + lastBuffer = glBuffer; + } + var location = program.attributeData[j].location; + // TODO introduce state again + // we can optimise this for older devices that have no VAOs + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); + if (attribute.instance) { + // TODO calculate instance count based of this... + if (this.hasInstance) { + gl.vertexAttribDivisor(location, 1); + } + else { + throw new Error('geometry error, GPU Instancing is not supported on this device'); + } + } + } + } + }; + /** + * Draws the currently bound geometry. + * @param type - The type primitive to render. + * @param size - The number of elements to be rendered. If not specified, all vertices after the + * starting vertex will be drawn. + * @param start - The starting vertex in the geometry to start drawing from. If not specified, + * drawing will start from the first vertex. + * @param instanceCount - The number of instances of the set of elements to execute. If not specified, + * all instances will be drawn. + */ + GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { + var gl = this.gl; + var geometry = this._activeGeometry; + // TODO.. this should not change so maybe cache the function? + if (geometry.indexBuffer) { + var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; + var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; + if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { + if (geometry.instanced) { + /* eslint-disable max-len */ + gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); + /* eslint-enable max-len */ + } + else { + /* eslint-disable max-len */ + gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); + /* eslint-enable max-len */ + } + } + else { + console.warn('unsupported index buffer type: uint32'); + } + } + else if (geometry.instanced) { + // TODO need a better way to calculate size.. + gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); + } + else { + gl.drawArrays(type, start, size || geometry.getSize()); + } + return this; + }; + /** Unbind/reset everything. */ + GeometrySystem.prototype.unbind = function () { + this.gl.bindVertexArray(null); + this._activeVao = null; + this._activeGeometry = null; + }; + GeometrySystem.prototype.destroy = function () { + this.renderer = null; + }; + return GeometrySystem; +}()); + +/** + * Component for masked elements. + * + * Holds mask mode and temporary data about current mask. + * @memberof PIXI + */ +var MaskData = /** @class */ (function () { + /** + * Create MaskData + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask + */ + function MaskData(maskObject) { + if (maskObject === void 0) { maskObject = null; } + this.type = MASK_TYPES.NONE; + this.autoDetect = true; + this.maskObject = maskObject || null; + this.pooled = false; + this.isMaskData = true; + this.resolution = null; + this.multisample = settings.FILTER_MULTISAMPLE; + this.enabled = true; + this.colorMask = 0xf; + this._filters = null; + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + this._scissorRectLocal = null; + this._colorMask = 0xf; + this._target = null; + } + Object.defineProperty(MaskData.prototype, "filter", { + /** + * The sprite mask filter. + * If set to `null`, the default sprite mask filter is used. + * @default null + */ + get: function () { + return this._filters ? this._filters[0] : null; + }, + set: function (value) { + if (value) { + if (this._filters) { + this._filters[0] = value; + } + else { + this._filters = [value]; + } + } + else { + this._filters = null; + } + }, + enumerable: false, + configurable: true + }); + /** Resets the mask data after popMask(). */ + MaskData.prototype.reset = function () { + if (this.pooled) { + this.maskObject = null; + this.type = MASK_TYPES.NONE; + this.autoDetect = true; + } + this._target = null; + this._scissorRectLocal = null; + }; + /** + * Copies counters from maskData above, called from pushMask(). + * @param maskAbove + */ + MaskData.prototype.copyCountersOrReset = function (maskAbove) { + if (maskAbove) { + this._stencilCounter = maskAbove._stencilCounter; + this._scissorCounter = maskAbove._scissorCounter; + this._scissorRect = maskAbove._scissorRect; + } + else { + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + } + }; + return MaskData; +}()); + +/** + * @private + * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram} + * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param {string} src - The vertex shader source as an array of strings. + * @returns {WebGLShader} the shader + */ +function compileShader(gl, type, src) { + var shader = gl.createShader(type); + gl.shaderSource(shader, src); + gl.compileShader(shader); + return shader; +} + +/** + * will log a shader error highlighting the lines with the error + * also will add numbers along the side. + * @param gl - the WebGLContext + * @param shader - the shader to log errors for + */ +function logPrettyShaderError(gl, shader) { + var shaderSrc = gl.getShaderSource(shader) + .split('\n') + .map(function (line, index) { return index + ": " + line; }); + var shaderLog = gl.getShaderInfoLog(shader); + var splitShader = shaderLog.split('\n'); + var dedupe = {}; + var lineNumbers = splitShader.map(function (line) { return parseFloat(line.replace(/^ERROR\: 0\:([\d]+)\:.*$/, '$1')); }) + .filter(function (n) { + if (n && !dedupe[n]) { + dedupe[n] = true; + return true; + } + return false; + }); + var logArgs = ['']; + lineNumbers.forEach(function (number) { + shaderSrc[number - 1] = "%c" + shaderSrc[number - 1] + "%c"; + logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px'); + }); + var fragmentSourceToLog = shaderSrc + .join('\n'); + logArgs[0] = fragmentSourceToLog; + console.error(shaderLog); + // eslint-disable-next-line no-console + console.groupCollapsed('click to view full shader code'); + console.warn.apply(console, logArgs); + // eslint-disable-next-line no-console + console.groupEnd(); +} +/** + * + * logs out any program errors + * @param gl - The current WebGL context + * @param program - the WebGL program to display errors for + * @param vertexShader - the fragment WebGL shader program + * @param fragmentShader - the vertex WebGL shader program + */ +function logProgramError(gl, program, vertexShader, fragmentShader) { + // if linking fails, then log and cleanup + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, vertexShader); + } + if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) { + logPrettyShaderError(gl, fragmentShader); + } + console.error('PixiJS Error: Could not initialize shader.'); + // if there is a program info log, log it + if (gl.getProgramInfoLog(program) !== '') { + console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); + } + } +} + +function booleanArray(size) { + var array = new Array(size); + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + return array; +} +/** + * @method defaultValue + * @memberof PIXI.glCore.shader + * @param {string} type - Type of value + * @param {number} size + * @private + */ +function defaultValue(type, size) { + switch (type) { + case 'float': + return 0; + case 'vec2': + return new Float32Array(2 * size); + case 'vec3': + return new Float32Array(3 * size); + case 'vec4': + return new Float32Array(4 * size); + case 'int': + case 'uint': + case 'sampler2D': + case 'sampler2DArray': + return 0; + case 'ivec2': + return new Int32Array(2 * size); + case 'ivec3': + return new Int32Array(3 * size); + case 'ivec4': + return new Int32Array(4 * size); + case 'uvec2': + return new Uint32Array(2 * size); + case 'uvec3': + return new Uint32Array(3 * size); + case 'uvec4': + return new Uint32Array(4 * size); + case 'bool': + return false; + case 'bvec2': + return booleanArray(2 * size); + case 'bvec3': + return booleanArray(3 * size); + case 'bvec4': + return booleanArray(4 * size); + case 'mat2': + return new Float32Array([1, 0, + 0, 1]); + case 'mat3': + return new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + case 'mat4': + return new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + } + return null; +} + +var unknownContext = {}; +var context = unknownContext; +/** + * returns a little WebGL context to use for program inspection. + * @static + * @private + * @returns {WebGLRenderingContext} a gl context to test with + */ +function getTestContext() { + if (context === unknownContext || (context && context.isContextLost())) { + var canvas = settings.ADAPTER.createCanvas(); + var gl = void 0; + if (settings.PREFER_ENV >= ENV.WEBGL2) { + gl = canvas.getContext('webgl2', {}); + } + if (!gl) { + gl = (canvas.getContext('webgl', {}) + || canvas.getContext('experimental-webgl', {})); + if (!gl) { + // fail, not able to get a context + gl = null; + } + else { + // for shader testing.. + gl.getExtension('WEBGL_draw_buffers'); + } + } + context = gl; + } + return context; +} + +var maxFragmentPrecision; +function getMaxFragmentPrecision() { + if (!maxFragmentPrecision) { + maxFragmentPrecision = PRECISION.MEDIUM; + var gl = getTestContext(); + if (gl) { + if (gl.getShaderPrecisionFormat) { + var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); + maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM; + } + } + } + return maxFragmentPrecision; +} + +/** + * Sets the float precision on the shader, ensuring the device supports the request precision. + * If the precision is already present, it just ensures that the device is able to handle it. + * @private + * @param {string} src - The shader source + * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader. + * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports. + * @returns {string} modified shader source + */ +function setPrecision(src, requestedPrecision, maxSupportedPrecision) { + if (src.substring(0, 9) !== 'precision') { + // no precision supplied, so PixiJS will add the requested level. + var precision = requestedPrecision; + // If highp is requested but not supported, downgrade precision to a level all devices support. + if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH) { + precision = PRECISION.MEDIUM; + } + return "precision " + precision + " float;\n" + src; + } + else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { + // precision was supplied, but at a level this device does not support, so downgrading to mediump. + return src.replace('precision highp', 'precision mediump'); + } + return src; +} + +var GLSL_TO_SIZE = { + float: 1, + vec2: 2, + vec3: 3, + vec4: 4, + int: 1, + ivec2: 2, + ivec3: 3, + ivec4: 4, + uint: 1, + uvec2: 2, + uvec3: 3, + uvec4: 4, + bool: 1, + bvec2: 2, + bvec3: 3, + bvec4: 4, + mat2: 4, + mat3: 9, + mat4: 16, + sampler2D: 1, +}; +/** + * @private + * @method mapSize + * @memberof PIXI.glCore.shader + * @param {string} type + */ +function mapSize(type) { + return GLSL_TO_SIZE[type]; +} + +var GL_TABLE = null; +var GL_TO_GLSL_TYPES = { + FLOAT: 'float', + FLOAT_VEC2: 'vec2', + FLOAT_VEC3: 'vec3', + FLOAT_VEC4: 'vec4', + INT: 'int', + INT_VEC2: 'ivec2', + INT_VEC3: 'ivec3', + INT_VEC4: 'ivec4', + UNSIGNED_INT: 'uint', + UNSIGNED_INT_VEC2: 'uvec2', + UNSIGNED_INT_VEC3: 'uvec3', + UNSIGNED_INT_VEC4: 'uvec4', + BOOL: 'bool', + BOOL_VEC2: 'bvec2', + BOOL_VEC3: 'bvec3', + BOOL_VEC4: 'bvec4', + FLOAT_MAT2: 'mat2', + FLOAT_MAT3: 'mat3', + FLOAT_MAT4: 'mat4', + SAMPLER_2D: 'sampler2D', + INT_SAMPLER_2D: 'sampler2D', + UNSIGNED_INT_SAMPLER_2D: 'sampler2D', + SAMPLER_CUBE: 'samplerCube', + INT_SAMPLER_CUBE: 'samplerCube', + UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', + SAMPLER_2D_ARRAY: 'sampler2DArray', + INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', +}; +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function mapType(gl, type) { + if (!GL_TABLE) { + var typeNames = Object.keys(GL_TO_GLSL_TYPES); + GL_TABLE = {}; + for (var i = 0; i < typeNames.length; ++i) { + var tn = typeNames[i]; + GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; + } + } + return GL_TABLE[type]; +} + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +// Parsers, each one of these will take a look at the type of shader property and uniform. +// if they pass the test function then the code function is called that returns a the shader upload code for that uniform. +// Shader upload code is automagically generated with these parsers. +// If no parser is valid then the default upload functions are used. +// exposing Parsers means that custom upload logic can be added to pixi's shaders. +// A good example would be a pixi rectangle can be directly set on a uniform. +// If the shader sees it it knows how to upload the rectangle structure as a vec4 +// format is as follows: +// +// { +// test: (data, uniform) => {} <--- test is this code should be used for this uniform +// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform +// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the +// uniform to a uniform buffer +// } +var uniformParsers = [ + // a float cache layer + { + test: function (data) { + return data.type === 'float' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; + }, + }, + // handling samplers + { + test: function (data, uniform) { + // eslint-disable-next-line max-len,no-eq-null,eqeqeq + return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined); + }, + code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, + }, + // uploading pixi matrix object to mat3 + { + test: function (data, uniform) { + return data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined; + }, + code: function (name) { + // TODO and some smart caching dirty ids here! + return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; + }, + codeUbo: function (name) { + return "\n var " + name + "_matrix = uv." + name + ".toArray(true);\n\n data[offset] = " + name + "_matrix[0];\n data[offset+1] = " + name + "_matrix[1];\n data[offset+2] = " + name + "_matrix[2];\n \n data[offset + 4] = " + name + "_matrix[3];\n data[offset + 5] = " + name + "_matrix[4];\n data[offset + 6] = " + name + "_matrix[5];\n \n data[offset + 8] = " + name + "_matrix[6];\n data[offset + 9] = " + name + "_matrix[7];\n data[offset + 10] = " + name + "_matrix[8];\n "; + }, + }, + // uploading a pixi point as a vec2 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "; + } + }, + // caching layer for a vec2 + { + test: function (data) { + return data.type === 'vec2' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; + }, + }, + // upload a pixi rectangle as a vec4 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; + }, + codeUbo: function (name) { + return "\n v = uv." + name + ";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "; + } + }, + // a caching layer for vec4 uploading + { + test: function (data) { + return data.type === 'vec4' && data.size === 1 && !data.isArray; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; + }, + } ]; + +// cu = Cached value's uniform data field +// cv = Cached value +// v = value to upload +// ud = uniformData +// uv = uniformValue +// l = location +var GLSL_TO_SINGLE_SETTERS_CACHED = { + float: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }", + vec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }", + vec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", + vec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }", + int: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + ivec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + ivec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + ivec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + uint: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }", + uvec2: "\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }", + uvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }", + uvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }", + bool: "\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }", + bvec2: "\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }", + bvec3: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }", + bvec4: "\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }", + mat2: 'gl.uniformMatrix2fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + sampler2D: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + samplerCube: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", + sampler2DArray: "\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }", +}; +var GLSL_TO_ARRAY_SETTERS = { + float: "gl.uniform1fv(location, v)", + vec2: "gl.uniform2fv(location, v)", + vec3: "gl.uniform3fv(location, v)", + vec4: 'gl.uniform4fv(location, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + int: 'gl.uniform1iv(location, v)', + ivec2: 'gl.uniform2iv(location, v)', + ivec3: 'gl.uniform3iv(location, v)', + ivec4: 'gl.uniform4iv(location, v)', + uint: 'gl.uniform1uiv(location, v)', + uvec2: 'gl.uniform2uiv(location, v)', + uvec3: 'gl.uniform3uiv(location, v)', + uvec4: 'gl.uniform4uiv(location, v)', + bool: 'gl.uniform1iv(location, v)', + bvec2: 'gl.uniform2iv(location, v)', + bvec3: 'gl.uniform3iv(location, v)', + bvec4: 'gl.uniform4iv(location, v)', + sampler2D: 'gl.uniform1iv(location, v)', + samplerCube: 'gl.uniform1iv(location, v)', + sampler2DArray: 'gl.uniform1iv(location, v)', +}; +function generateUniformsSync(group, uniformData) { + var _a; + var funcFragments = ["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "]; + for (var i in group.uniforms) { + var data = uniformData[i]; + if (!data) { + if ((_a = group.uniforms[i]) === null || _a === void 0 ? void 0 : _a.group) { + if (group.uniforms[i].ubo) { + funcFragments.push("\n renderer.shader.syncUniformBufferGroup(uv." + i + ", '" + i + "');\n "); + } + else { + funcFragments.push("\n renderer.shader.syncUniformGroup(uv." + i + ", syncData);\n "); + } + } + continue; + } + var uniform = group.uniforms[i]; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + if (uniformParsers[j].test(data, uniform)) { + funcFragments.push(uniformParsers[j].code(i, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + var templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; + var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); + funcFragments.push("\n cu = ud[\"" + i + "\"];\n cv = cu.value;\n v = uv[\"" + i + "\"];\n " + template + ";"); + } + } + /* + * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly + * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used + * no matter which group is being used + * + */ + // eslint-disable-next-line no-new-func + return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); +} + +var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' ].join('\n'); +function generateIfTestSrc(maxIfs) { + var src = ''; + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxIfs - 1) { + src += "if(test == " + i + ".0){}"; + } + } + return src; +} +function checkMaxIfStatementsInShader(maxIfs, gl) { + if (maxIfs === 0) { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + var shader = gl.createShader(gl.FRAGMENT_SHADER); + while (true) // eslint-disable-line no-constant-condition + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + maxIfs = (maxIfs / 2) | 0; + } + else { + // valid! + break; + } + } + return maxIfs; +} + +// Cache the result to prevent running this over and over +var unsafeEval; +/** + * Not all platforms allow to generate function code (e.g., `new Function`). + * this provides the platform-level detection. + * @private + * @returns {boolean} `true` if `new Function` is supported. + */ +function unsafeEvalSupported() { + if (typeof unsafeEval === 'boolean') { + return unsafeEval; + } + try { + /* eslint-disable no-new-func */ + var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); + /* eslint-enable no-new-func */ + unsafeEval = func({ a: 'b' }, 'a', 'b') === true; + } + catch (e) { + unsafeEval = false; + } + return unsafeEval; +} + +var defaultFragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; + +var defaultVertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; + +var UID$1 = 0; +var nameCache = {}; +/** + * Helper class to create a shader program. + * @memberof PIXI + */ +var Program = /** @class */ (function () { + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + */ + function Program(vertexSrc, fragmentSrc, name) { + if (name === void 0) { name = 'pixi-shader'; } + this.id = UID$1++; + this.vertexSrc = vertexSrc || Program.defaultVertexSrc; + this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; + this.vertexSrc = this.vertexSrc.trim(); + this.fragmentSrc = this.fragmentSrc.trim(); + if (this.vertexSrc.substring(0, 8) !== '#version') { + name = name.replace(/\s+/g, '-'); + if (nameCache[name]) { + nameCache[name]++; + name += "-" + nameCache[name]; + } + else { + nameCache[name] = 1; + } + this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; + this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; + this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH); + this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); + } + // currently this does not extract structs only default types + // this is where we store shader references.. + this.glPrograms = {}; + this.syncUniforms = null; + } + Object.defineProperty(Program, "defaultVertexSrc", { + /** + * The default vertex shader source. + * @constant + */ + get: function () { + return defaultVertex$3; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Program, "defaultFragmentSrc", { + /** + * The default fragment shader source. + * @constant + */ + get: function () { + return defaultFragment$2; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a program based of a vertex and fragment shader. + * + * This method will also check to see if there is a cached program. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + * @returns A shiny new PixiJS shader program! + */ + Program.from = function (vertexSrc, fragmentSrc, name) { + var key = vertexSrc + fragmentSrc; + var program = ProgramCache[key]; + if (!program) { + ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); + } + return program; + }; + return Program; +}()); + +/** + * A helper class for shaders. + * @memberof PIXI + */ +var Shader = /** @class */ (function () { + /** + * @param program - The program the shader will use. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Shader(program, uniforms) { + /** + * Used internally to bind uniform buffer objects. + * @ignore + */ + this.uniformBindCount = 0; + this.program = program; + // lets see whats been passed in + // uniforms should be converted to a uniform group + if (uniforms) { + if (uniforms instanceof UniformGroup) { + this.uniformGroup = uniforms; + } + else { + this.uniformGroup = new UniformGroup(uniforms); + } + } + else { + this.uniformGroup = new UniformGroup({}); + } + this.disposeRunner = new Runner('disposeShader'); + } + // TODO move to shader system.. + Shader.prototype.checkUniformExists = function (name, group) { + if (group.uniforms[name]) { + return true; + } + for (var i in group.uniforms) { + var uniform = group.uniforms[i]; + if (uniform.group) { + if (this.checkUniformExists(name, uniform)) { + return true; + } + } + } + return false; + }; + Shader.prototype.destroy = function () { + // usage count on programs? + // remove if not used! + this.uniformGroup = null; + this.disposeRunner.emit(this); + this.disposeRunner.destroy(); + }; + Object.defineProperty(Shader.prototype, "uniforms", { + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms`. + * @readonly + */ + get: function () { + return this.uniformGroup.uniforms; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a shader based of a vertex and fragment shader. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + * @returns A shiny new PixiJS shader! + */ + Shader.from = function (vertexSrc, fragmentSrc, uniforms) { + var program = Program.from(vertexSrc, fragmentSrc); + return new Shader(program, uniforms); + }; + return Shader; +}()); + +/* eslint-disable max-len */ +var BLEND$1 = 0; +var OFFSET$1 = 1; +var CULLING$1 = 2; +var DEPTH_TEST$1 = 3; +var WINDING$1 = 4; +var DEPTH_MASK$1 = 5; +/** + * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}. + * + * Each mesh rendered may require WebGL to be in a different state. + * For example you may want different blend mode or to enable polygon offsets + * @memberof PIXI + */ +var State = /** @class */ (function () { + function State() { + this.data = 0; + this.blendMode = BLEND_MODES.NORMAL; + this.polygonOffset = 0; + this.blend = true; + this.depthMask = true; + // this.depthTest = true; + } + Object.defineProperty(State.prototype, "blend", { + /** + * Activates blending of the computed fragment color values. + * @default true + */ + get: function () { + return !!(this.data & (1 << BLEND$1)); + }, + set: function (value) { + if (!!(this.data & (1 << BLEND$1)) !== value) { + this.data ^= (1 << BLEND$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "offsets", { + /** + * Activates adding an offset to depth values of polygon's fragments + * @default false + */ + get: function () { + return !!(this.data & (1 << OFFSET$1)); + }, + set: function (value) { + if (!!(this.data & (1 << OFFSET$1)) !== value) { + this.data ^= (1 << OFFSET$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "culling", { + /** + * Activates culling of polygons. + * @default false + */ + get: function () { + return !!(this.data & (1 << CULLING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << CULLING$1)) !== value) { + this.data ^= (1 << CULLING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthTest", { + /** + * Activates depth comparisons and updates to the depth buffer. + * @default false + */ + get: function () { + return !!(this.data & (1 << DEPTH_TEST$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_TEST$1)) !== value) { + this.data ^= (1 << DEPTH_TEST$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthMask", { + /** + * Enables or disables writing to the depth buffer. + * @default true + */ + get: function () { + return !!(this.data & (1 << DEPTH_MASK$1)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_MASK$1)) !== value) { + this.data ^= (1 << DEPTH_MASK$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "clockwiseFrontFace", { + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @default false + */ + get: function () { + return !!(this.data & (1 << WINDING$1)); + }, + set: function (value) { + if (!!(this.data & (1 << WINDING$1)) !== value) { + this.data ^= (1 << WINDING$1); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "blendMode", { + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this._blendMode; + }, + set: function (value) { + this.blend = (value !== BLEND_MODES.NONE); + this._blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "polygonOffset", { + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * @default 0 + */ + get: function () { + return this._polygonOffset; + }, + set: function (value) { + this.offsets = !!value; + this._polygonOffset = value; + }, + enumerable: false, + configurable: true + }); + State.prototype.toString = function () { + return "[@pixi/core:State " + + ("blendMode=" + this.blendMode + " ") + + ("clockwiseFrontFace=" + this.clockwiseFrontFace + " ") + + ("culling=" + this.culling + " ") + + ("depthMask=" + this.depthMask + " ") + + ("polygonOffset=" + this.polygonOffset) + + "]"; + }; + State.for2d = function () { + var state = new State(); + state.depthTest = false; + state.blend = true; + return state; + }; + return State; +}()); + +var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; + +var defaultVertex$2 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + +/** + * A filter is a special shader that applies post-processing effects to an input texture and writes into an output + * render-target. + * + * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the + * {@link PIXI.filters.BlurFilter BlurFilter}. + * + * ### Usage + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. + * + * ``` + * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); + * const container = new PIXI.Container(); + * container.filters = [filter]; + * ``` + * + * ### Previous Version Differences + * + * In PixiJS **v3**, a filter was always applied to _whole screen_. + * + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers had to create a set of uniforms to deal with coordinates. + * + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. + * + * Also be aware that we have changed default vertex shader, please consult + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * ### Frames + * + * The following table summarizes the coordinate spaces used in the filtering pipeline: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Coordinate SpaceDescription
Texture Coordinates + * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along + * both axes. + *
World Space + * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space). + *
Physical Pixels + * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture + * coordinates by the dimensions of the texture. + *
+ * + * ### Built-in Uniforms + * + * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, + * and `projectionMatrix` uniform maps it to the gl viewport. + * + * **uSampler** + * + * The most important uniform is the input texture that container was rendered into. + * _Important note: as with all Framebuffers in PixiJS, both input and output are + * premultiplied by alpha._ + * + * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. + * Use it to sample the input. + * + * ``` + * const fragment = ` + * varying vec2 vTextureCoord; + * uniform sampler2D uSampler; + * void main(void) + * { + * gl_FragColor = texture2D(uSampler, vTextureCoord); + * } + * `; + * + * const myFilter = new PIXI.Filter(null, fragment); + * ``` + * + * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. + * + * **outputFrame** + * + * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. + * It's the same as `renderer.screen` for a fullscreen filter. + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, + * `(0, 0, outputFrame.width, outputFrame.height)`, + * + * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. + * To calculate vertex position in screen space using normalized (0-1) space: + * + * ``` + * vec4 filterVertexPosition( void ) + * { + * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + * } + * ``` + * + * **inputSize** + * + * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary framebuffer that holds input. + * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. + * + * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. + * + * To calculate input normalized coordinate, you have to map it to filter normalized space. + * Multiply by `outputFrame.zw` to get input coordinate. + * Divide by `inputSize.xy` to get input normalized coordinate. + * + * ``` + * vec2 filterTextureCoord( void ) + * { + * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy + * } + * ``` + * **resolution** + * + * The `resolution` is the ratio of screen (CSS) pixels to real pixels. + * + * **inputPixel** + * + * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` + * `inputPixel.zw` is inverted `inputPixel.xy`. + * + * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. + * + * **inputClamp** + * + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. + * For displacements, coordinates has to be clamped. + * + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer + * `inputClamp.zw` is bottom-right pixel center. + * + * ``` + * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw)) + * ``` + * OR + * ``` + * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) + * ``` + * + * ### Additional Information + * + * Complete documentation on Filter usage is located in the + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. + * @memberof PIXI + */ +var Filter = /** @class */ (function (_super) { + __extends(Filter, _super); + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); + _this = _super.call(this, program, uniforms) || this; + _this.padding = 0; + _this.resolution = settings.FILTER_RESOLUTION; + _this.multisample = settings.FILTER_MULTISAMPLE; + _this.enabled = true; + _this.autoFit = true; + _this.state = new State(); + return _this; + } + /** + * Applies the filter + * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it. + * @param {object} [_currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { + // do as you please! + filterManager.applyFilter(this, input, output, clearMode); + // or just do a regular render.. + }; + Object.defineProperty(Filter.prototype, "blendMode", { + /** + * Sets the blend mode of the filter. + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.state.blendMode; + }, + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter.prototype, "resolution", { + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + */ + get: function () { + return this._resolution; + }, + set: function (value) { + this._resolution = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultVertexSrc", { + /** + * The default vertex shader source + * @constant + */ + get: function () { + return defaultVertex$2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultFragmentSrc", { + /** + * The default fragment shader source + * @constant + */ + get: function () { + return defaultFragment$1; + }, + enumerable: false, + configurable: true + }); + return Filter; +}(Shader)); + +var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; + +var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; + +var tempMat = new Matrix(); +/** + * Class controls uv mapping from Texture normal space to BaseTexture normal space. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. + * + * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * Takes track of Texture changes through `_lastTextureID` private field. + * Use `update()` method call to track it from outside. + * @see PIXI.Texture + * @see PIXI.Mesh + * @see PIXI.TilingSprite + * @memberof PIXI + */ +var TextureMatrix = /** @class */ (function () { + /** + * @param texture - observed texture + * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + */ + function TextureMatrix(texture, clampMargin) { + this._texture = texture; + this.mapCoord = new Matrix(); + this.uClampFrame = new Float32Array(4); + this.uClampOffset = new Float32Array(2); + this._textureID = -1; + this._updateID = 0; + this.clampOffset = 0; + this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; + this.isSimple = false; + } + Object.defineProperty(TextureMatrix.prototype, "texture", { + /** Texture property. */ + get: function () { + return this._texture; + }, + set: function (value) { + this._texture = value; + this._textureID = -1; + }, + enumerable: false, + configurable: true + }); + /** + * Multiplies uvs array to transform + * @param uvs - mesh uvs + * @param [out=uvs] - output + * @returns - output + */ + TextureMatrix.prototype.multiplyUvs = function (uvs, out) { + if (out === undefined) { + out = uvs; + } + var mat = this.mapCoord; + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + out[i] = (x * mat.a) + (y * mat.c) + mat.tx; + out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; + } + return out; + }; + /** + * Updates matrices if texture was changed. + * @param [forceUpdate=false] - if true, matrices will be updated any case + * @returns - Whether or not it was updated + */ + TextureMatrix.prototype.update = function (forceUpdate) { + var tex = this._texture; + if (!tex || !tex.valid) { + return false; + } + if (!forceUpdate + && this._textureID === tex._updateID) { + return false; + } + this._textureID = tex._updateID; + this._updateID++; + var uvs = tex._uvs; + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + var orig = tex.orig; + var trim = tex.trim; + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + this.isSimple = tex._frame.width === texBase.width + && tex._frame.height === texBase.height + && tex.rotate === 0; + return true; + }; + return TextureMatrix; +}()); + +/** + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. + * @memberof PIXI + */ +var SpriteMaskFilter = /** @class */ (function (_super) { + __extends(SpriteMaskFilter, _super); + /** @ignore */ + function SpriteMaskFilter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var sprite = null; + if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined) { + sprite = vertexSrc; + vertexSrc = undefined; + fragmentSrc = undefined; + uniforms = undefined; + } + _this = _super.call(this, vertexSrc || vertex, fragmentSrc || fragment, uniforms) || this; + _this.maskSprite = sprite; + _this.maskMatrix = new Matrix(); + return _this; + } + Object.defineProperty(SpriteMaskFilter.prototype, "maskSprite", { + /** + * Sprite mask + * @type {PIXI.DisplayObject} + */ + get: function () { + return this._maskSprite; + }, + set: function (value) { + this._maskSprite = value; + if (this._maskSprite) { + this._maskSprite.renderable = false; + } + }, + enumerable: false, + configurable: true + }); + /** + * Applies the filter + * @param filterManager - The renderer to retrieve the filter from + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it. + */ + SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { + var maskSprite = this._maskSprite; + var tex = maskSprite._texture; + if (!tex.valid) { + return; + } + if (!tex.uvMatrix) { + // margin = 0.0, let it bleed a bit, shader code becomes easier + // assuming that atlas textures were made with 1-pixel padding + tex.uvMatrix = new TextureMatrix(tex, 0.0); + } + tex.uvMatrix.update(); + this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; + this.uniforms.mask = tex; + // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` + this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) + .prepend(tex.uvMatrix.mapCoord); + this.uniforms.alpha = maskSprite.worldAlpha; + this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; + filterManager.applyFilter(this, input, output, clearMode); + }; + return SpriteMaskFilter; +}(Filter)); + +/** + * System plugin to the renderer to manage masks. + * + * There are three built-in types of masking: + * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is + * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular. + * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil + * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does + * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks. + * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's + * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this + * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins. + * + * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics` + * object with just a rectangle drawn. + * + * ## Mask Stacks + * + * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask + * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e. + * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target. + * @memberof PIXI + */ +var MaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function MaskSystem(renderer) { + this.renderer = renderer; + this.enableScissor = true; + this.alphaMaskPool = []; + this.maskDataPool = []; + this.maskStack = []; + this.alphaMaskIndex = 0; + } + /** + * Changes the mask stack that is used by this System. + * @param maskStack - The mask stack + */ + MaskSystem.prototype.setMaskStack = function (maskStack) { + this.maskStack = maskStack; + this.renderer.scissor.setMaskStack(maskStack); + this.renderer.stencil.setMaskStack(maskStack); + }; + /** + * Enables the mask and appends it to the current mask stack. + * + * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked. + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data. + */ + MaskSystem.prototype.push = function (target, maskDataOrTarget) { + var maskData = maskDataOrTarget; + if (!maskData.isMaskData) { + var d = this.maskDataPool.pop() || new MaskData(); + d.pooled = true; + d.maskObject = maskDataOrTarget; + maskData = d; + } + var maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + maskData.copyCountersOrReset(maskAbove); + maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf; + if (maskData.autoDetect) { + this.detect(maskData); + } + maskData._target = target; + if (maskData.type !== MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + if (maskData.enabled) { + switch (maskData.type) { + case MASK_TYPES.SCISSOR: + this.renderer.scissor.push(maskData); + break; + case MASK_TYPES.STENCIL: + this.renderer.stencil.push(maskData); + break; + case MASK_TYPES.SPRITE: + maskData.copyCountersOrReset(null); + this.pushSpriteMask(maskData); + break; + case MASK_TYPES.COLOR: + this.pushColorMask(maskData); + break; + } + } + if (maskData.type === MASK_TYPES.SPRITE) { + this.maskStack.push(maskData); + } + }; + /** + * Removes the last mask from the mask stack and doesn't return it. + * + * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed. + * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from + */ + MaskSystem.prototype.pop = function (target) { + var maskData = this.maskStack.pop(); + if (!maskData || maskData._target !== target) { + // TODO: add an assert when we have it + return; + } + if (maskData.enabled) { + switch (maskData.type) { + case MASK_TYPES.SCISSOR: + this.renderer.scissor.pop(maskData); + break; + case MASK_TYPES.STENCIL: + this.renderer.stencil.pop(maskData.maskObject); + break; + case MASK_TYPES.SPRITE: + this.popSpriteMask(maskData); + break; + case MASK_TYPES.COLOR: + this.popColorMask(maskData); + break; + } + } + maskData.reset(); + if (maskData.pooled) { + this.maskDataPool.push(maskData); + } + if (this.maskStack.length !== 0) { + var maskCurrent = this.maskStack[this.maskStack.length - 1]; + if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters) { + maskCurrent._filters[0].maskSprite = maskCurrent.maskObject; + } + } + }; + /** + * Sets type of MaskData based on its maskObject. + * @param maskData + */ + MaskSystem.prototype.detect = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject) { + maskData.type = MASK_TYPES.COLOR; + } + else if (maskObject.isSprite) { + maskData.type = MASK_TYPES.SPRITE; + } + else if (this.enableScissor && this.renderer.scissor.testScissor(maskData)) { + maskData.type = MASK_TYPES.SCISSOR; + } + else { + maskData.type = MASK_TYPES.STENCIL; + } + }; + /** + * Applies the Mask and adds it to the current filter stack. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.pushSpriteMask = function (maskData) { + var _a, _b; + var maskObject = maskData.maskObject; + var target = maskData._target; + var alphaMaskFilter = maskData._filters; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()]; + } + } + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var resolution; + var multisample; + if (renderTextureSystem.current) { + var renderTexture = renderTextureSystem.current; + resolution = maskData.resolution || renderTexture.resolution; + multisample = (_a = maskData.multisample) !== null && _a !== void 0 ? _a : renderTexture.multisample; + } + else { + resolution = maskData.resolution || renderer.resolution; + multisample = (_b = maskData.multisample) !== null && _b !== void 0 ? _b : renderer.multisample; + } + alphaMaskFilter[0].resolution = resolution; + alphaMaskFilter[0].multisample = multisample; + alphaMaskFilter[0].maskSprite = maskObject; + var stashFilterArea = target.filterArea; + target.filterArea = maskObject.getBounds(true); + renderer.filter.push(target, alphaMaskFilter); + target.filterArea = stashFilterArea; + if (!maskData._filters) { + this.alphaMaskIndex++; + } + }; + /** + * Removes the last filter from the filter stack and doesn't return it. + * @param maskData - Sprite to be used as the mask. + */ + MaskSystem.prototype.popSpriteMask = function (maskData) { + this.renderer.filter.pop(); + if (maskData._filters) { + maskData._filters[0].maskSprite = null; + } + else { + this.alphaMaskIndex--; + this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null; + } + }; + /** + * Pushes the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.pushColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + /** + * Pops the color mask. + * @param maskData - The mask data + */ + MaskSystem.prototype.popColorMask = function (maskData) { + var currColorMask = maskData._colorMask; + var nextColorMask = this.maskStack.length > 0 + ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf; + if (nextColorMask !== currColorMask) { + this.renderer.gl.colorMask((nextColorMask & 0x1) !== 0, (nextColorMask & 0x2) !== 0, (nextColorMask & 0x4) !== 0, (nextColorMask & 0x8) !== 0); + } + }; + MaskSystem.prototype.destroy = function () { + this.renderer = null; + }; + return MaskSystem; +}()); + +/** + * System plugin to the renderer to manage specific types of masking operations. + * @memberof PIXI + */ +var AbstractMaskSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function AbstractMaskSystem(renderer) { + this.renderer = renderer; + this.maskStack = []; + this.glConst = 0; + } + /** Gets count of masks of certain type. */ + AbstractMaskSystem.prototype.getStackLength = function () { + return this.maskStack.length; + }; + /** + * Changes the mask stack that is used by this System. + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { + var gl = this.renderer.gl; + var curStackLen = this.getStackLength(); + this.maskStack = maskStack; + var newStackLen = this.getStackLength(); + if (newStackLen !== curStackLen) { + if (newStackLen === 0) { + gl.disable(this.glConst); + } + else { + gl.enable(this.glConst); + this._useCurrent(); + } + } + }; + /** + * Setup renderer to use the current mask data. + * @private + */ + AbstractMaskSystem.prototype._useCurrent = function () { + // OVERWRITE; + }; + /** Destroys the mask stack. */ + AbstractMaskSystem.prototype.destroy = function () { + this.renderer = null; + this.maskStack = null; + }; + return AbstractMaskSystem; +}()); + +var tempMatrix$1 = new Matrix(); +var rectPool = []; +/** + * System plugin to the renderer to manage scissor masking. + * + * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer + * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically + * by this system. + * @memberof PIXI + */ +var ScissorSystem = /** @class */ (function (_super) { + __extends(ScissorSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ScissorSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST; + return _this; + } + ScissorSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._scissorCounter; + } + return 0; + }; + /** + * evaluates _boundsTransformed, _scissorRect for MaskData + * @param maskData + */ + ScissorSystem.prototype.calcScissorRect = function (maskData) { + var _a; + if (maskData._scissorRectLocal) { + return; + } + var prevData = maskData._scissorRect; + var maskObject = maskData.maskObject; + var renderer = this.renderer; + var renderTextureSystem = renderer.renderTexture; + var rect = maskObject.getBounds(true, (_a = rectPool.pop()) !== null && _a !== void 0 ? _a : new Rectangle()); + this.roundFrameToPixels(rect, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform); + if (prevData) { + rect.fit(prevData); + } + maskData._scissorRectLocal = rect; + }; + ScissorSystem.isMatrixRotated = function (matrix) { + if (!matrix) { + return false; + } + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d; + // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation + // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0). + return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4) + && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)); + }; + /** + * Test, whether the object can be scissor mask with current renderer projection. + * Calls "calcScissorRect()" if its true. + * @param maskData - mask data + * @returns whether Whether the object can be scissor mask + */ + ScissorSystem.prototype.testScissor = function (maskData) { + var maskObject = maskData.maskObject; + if (!maskObject.isFastRect || !maskObject.isFastRect()) { + return false; + } + if (ScissorSystem.isMatrixRotated(maskObject.worldTransform)) { + return false; + } + if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform)) { + return false; + } + this.calcScissorRect(maskData); + var rect = maskData._scissorRectLocal; + return rect.width > 0 && rect.height > 0; + }; + ScissorSystem.prototype.roundFrameToPixels = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) { + if (ScissorSystem.isMatrixRotated(transform)) { + return; + } + transform = transform ? tempMatrix$1.copyFrom(transform) : tempMatrix$1.identity(); + // Get forward transform from world space to screen space + transform + .translate(-bindingSourceFrame.x, -bindingSourceFrame.y) + .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height) + .translate(bindingDestinationFrame.x, bindingDestinationFrame.y); + // Convert frame to screen space + this.renderer.filter.transformAABB(transform, frame); + frame.fit(bindingDestinationFrame); + frame.x = Math.round(frame.x * resolution); + frame.y = Math.round(frame.y * resolution); + frame.width = Math.round(frame.width * resolution); + frame.height = Math.round(frame.height * resolution); + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @author alvin + * @param maskData - The mask data. + */ + ScissorSystem.prototype.push = function (maskData) { + if (!maskData._scissorRectLocal) { + this.calcScissorRect(maskData); + } + var gl = this.renderer.gl; + if (!maskData._scissorRect) { + gl.enable(gl.SCISSOR_TEST); + } + maskData._scissorCounter++; + maskData._scissorRect = maskData._scissorRectLocal; + this._useCurrent(); + }; + /** + * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the + * last mask in the stack. + * + * This can also be called when you directly modify the scissor box and want to restore PixiJS state. + * @param maskData - The mask data. + */ + ScissorSystem.prototype.pop = function (maskData) { + var gl = this.renderer.gl; + if (maskData) { + rectPool.push(maskData._scissorRectLocal); + } + if (this.getStackLength() > 0) { + this._useCurrent(); + } + else { + gl.disable(gl.SCISSOR_TEST); + } + }; + /** + * Setup renderer to use the current scissor data. + * @private + */ + ScissorSystem.prototype._useCurrent = function () { + var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; + var y; + if (this.renderer.renderTexture.current) { + y = rect.y; + } + else { + // flipY. In future we'll have it over renderTextures as an option + y = this.renderer.height - rect.height - rect.y; + } + this.renderer.gl.scissor(rect.x, y, rect.width, rect.height); + }; + return ScissorSystem; +}(AbstractMaskSystem)); + +/** + * System plugin to the renderer to manage stencils (used for masks). + * @memberof PIXI + */ +var StencilSystem = /** @class */ (function (_super) { + __extends(StencilSystem, _super); + /** + * @param renderer - The renderer this System works for. + */ + function StencilSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST; + return _this; + } + StencilSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._stencilCounter; + } + return 0; + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * @param maskData - The mask data + */ + StencilSystem.prototype.push = function (maskData) { + var maskObject = maskData.maskObject; + var gl = this.renderer.gl; + var prevMaskCount = maskData._stencilCounter; + if (prevMaskCount === 0) { + // force use stencil texture in current framebuffer + this.renderer.framebuffer.forceStencil(); + gl.clearStencil(0); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.enable(gl.STENCIL_TEST); + } + maskData._stencilCounter++; + var colorMask = maskData._colorMask; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Increment the reference stencil value where the new mask overlaps with the old ones. + gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 1) !== 0, (colorMask & 2) !== 0, (colorMask & 4) !== 0, (colorMask & 8) !== 0); + } + this._useCurrent(); + }; + /** + * Pops stencil mask. MaskData is already removed from stack + * @param {PIXI.DisplayObject} maskObject - object of popped mask data + */ + StencilSystem.prototype.pop = function (maskObject) { + var gl = this.renderer.gl; + if (this.getStackLength() === 0) { + // the stack is empty! + gl.disable(gl.STENCIL_TEST); + } + else { + var maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null; + var colorMask = maskData ? maskData._colorMask : 0xf; + if (colorMask !== 0) { + maskData._colorMask = 0; + gl.colorMask(false, false, false, false); + } + // Decrement the reference stencil value where the popped mask overlaps with the other ones + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + if (colorMask !== 0) { + maskData._colorMask = colorMask; + gl.colorMask((colorMask & 0x1) !== 0, (colorMask & 0x2) !== 0, (colorMask & 0x4) !== 0, (colorMask & 0x8) !== 0); + } + this._useCurrent(); + } + }; + /** + * Setup renderer to use the current stencil data. + * @private + */ + StencilSystem.prototype._useCurrent = function () { + var gl = this.renderer.gl; + gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + }; + return StencilSystem; +}(AbstractMaskSystem)); + +/** + * System plugin to the renderer to manage the projection matrix. + * + * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to + * normalized device coordinates. + * @memberof PIXI + */ +var ProjectionSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ProjectionSystem(renderer) { + this.renderer = renderer; + this.destinationFrame = null; + this.sourceFrame = null; + this.defaultFrame = null; + this.projectionMatrix = new Matrix(); + this.transform = null; + } + /** + * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided. + * + * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because + * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates. + * + * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected + * that you dirty the current bindings when calling this manually. + * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas, + * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left. + * @param sourceFrame - The rectangle in world space that contains the contents being rendered. + * @param resolution - The resolution of the render-target, which is the ratio of + * world-space (or CSS) pixels to physical pixels. + * @param root - Whether the render-target is the screen. This is required because rendering to textures + * is y-flipped (i.e. upside down relative to the screen). + */ + ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { + this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; + this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; + // Calculate object-space to clip-space projection + this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); + if (this.transform) { + this.projectionMatrix.append(this.transform); + } + var renderer = this.renderer; + renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; + renderer.globalUniforms.update(); + // this will work for now + // but would be sweet to stick and even on the global uniforms.. + if (renderer.shader.shader) { + renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); + } + }; + /** + * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`. + * @param _destinationFrame - The destination frame in the render-target. + * @param sourceFrame - The source frame in world space. + * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels. + * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection + * is y-flipped. + */ + ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { + var pm = this.projectionMatrix; + var sign = !root ? 1 : -1; + pm.identity(); + pm.a = (1 / sourceFrame.width * 2); + pm.d = sign * (1 / sourceFrame.height * 2); + pm.tx = -1 - (sourceFrame.x * pm.a); + pm.ty = -sign - (sourceFrame.y * pm.d); + }; + /** + * Sets the transform of the active render target to the given matrix. + * @param _matrix - The transformation matrix + */ + ProjectionSystem.prototype.setTransform = function (_matrix) { + // this._activeRenderTarget.transform = matrix; + }; + ProjectionSystem.prototype.destroy = function () { + this.renderer = null; + }; + return ProjectionSystem; +}()); + +// Temporary rectangle for assigned sourceFrame or destinationFrame +var tempRect = new Rectangle(); +// Temporary rectangle for renderTexture destinationFrame +var tempRect2 = new Rectangle(); +/* eslint-disable max-len */ +/** + * System plugin to the renderer to manage render textures. + * + * Should be added after FramebufferSystem + * + * ### Frames + * + * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different + * coordinate spaces used: + * + * | Frame | Description | Coordinate System | + * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- | + * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left | + * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. | + * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. | + * @memberof PIXI + */ +var RenderTextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this System works for. + */ + function RenderTextureSystem(renderer) { + this.renderer = renderer; + this.clearColor = renderer._backgroundColorRgba; + this.defaultMaskStack = []; + this.current = null; + this.sourceFrame = new Rectangle(); + this.destinationFrame = new Rectangle(); + this.viewportFrame = new Rectangle(); + } + /** + * Bind the current render texture. + * @param renderTexture - RenderTexture to bind, by default its `null` - the screen. + * @param sourceFrame - Part of world that is mapped to the renderTexture. + * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame. + */ + RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { + if (renderTexture === void 0) { renderTexture = null; } + var renderer = this.renderer; + this.current = renderTexture; + var baseTexture; + var framebuffer; + var resolution; + if (renderTexture) { + baseTexture = renderTexture.baseTexture; + resolution = baseTexture.resolution; + if (!sourceFrame) { + tempRect.width = renderTexture.frame.width; + tempRect.height = renderTexture.frame.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + tempRect2.x = renderTexture.frame.x; + tempRect2.y = renderTexture.frame.y; + tempRect2.width = sourceFrame.width; + tempRect2.height = sourceFrame.height; + destinationFrame = tempRect2; + } + framebuffer = baseTexture.framebuffer; + } + else { + resolution = renderer.resolution; + if (!sourceFrame) { + tempRect.width = renderer.screen.width; + tempRect.height = renderer.screen.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + destinationFrame = tempRect; + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + } + } + var viewportFrame = this.viewportFrame; + viewportFrame.x = destinationFrame.x * resolution; + viewportFrame.y = destinationFrame.y * resolution; + viewportFrame.width = destinationFrame.width * resolution; + viewportFrame.height = destinationFrame.height * resolution; + if (!renderTexture) { + viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height); + } + viewportFrame.ceil(); + this.renderer.framebuffer.bind(framebuffer, viewportFrame); + this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); + if (renderTexture) { + this.renderer.mask.setMaskStack(baseTexture.maskStack); + } + else { + this.renderer.mask.setMaskStack(this.defaultMaskStack); + } + this.sourceFrame.copyFrom(sourceFrame); + this.destinationFrame.copyFrom(destinationFrame); + }; + /** + * Erases the render texture and fills the drawing area with a colour. + * @param clearColor - The color as rgba, default to use the renderer backgroundColor + * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + RenderTextureSystem.prototype.clear = function (clearColor, mask) { + if (this.current) { + clearColor = clearColor || this.current.baseTexture.clearColor; + } + else { + clearColor = clearColor || this.clearColor; + } + var destinationFrame = this.destinationFrame; + var baseFrame = this.current ? this.current.baseTexture : this.renderer.screen; + var clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height; + if (clearMask) { + var _a = this.viewportFrame, x = _a.x, y = _a.y, width = _a.width, height = _a.height; + x = Math.round(x); + y = Math.round(y); + width = Math.round(width); + height = Math.round(height); + // TODO: ScissorSystem should cache whether the scissor test is enabled or not. + this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST); + this.renderer.gl.scissor(x, y, width, height); + } + this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); + if (clearMask) { + // Restore the scissor box + this.renderer.scissor.pop(); + } + }; + RenderTextureSystem.prototype.resize = function () { + // resize the root only! + this.bind(null); + }; + /** Resets render-texture state. */ + RenderTextureSystem.prototype.reset = function () { + this.bind(null); + }; + RenderTextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return RenderTextureSystem; +}()); + +function uboUpdate(_ud, _uv, _renderer, _syncData, buffer) { + _renderer.buffer.update(buffer); +} +// cv = CachedValue +// v = value +// ud = uniformData +// uv = uniformValue +// l = location +var UBO_TO_SINGLE_SETTERS = { + float: "\n data[offset] = v;\n ", + vec2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n ", + vec3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ", + vec4: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ", + mat2: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ", + mat3: "\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ", + mat4: "\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n " +}; +var GLSL_TO_STD40_SIZE = { + float: 4, + vec2: 8, + vec3: 12, + vec4: 16, + int: 4, + ivec2: 8, + ivec3: 12, + ivec4: 16, + uint: 4, + uvec2: 8, + uvec3: 12, + uvec4: 16, + bool: 4, + bvec2: 8, + bvec3: 12, + bvec4: 16, + mat2: 16 * 2, + mat3: 16 * 3, + mat4: 16 * 4, +}; +/** + * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js + * rewrote it, but this was a great starting point to get a solid understanding of whats going on :) + * @ignore + * @param uniformData + */ +function createUBOElements(uniformData) { + var uboElements = uniformData.map(function (data) { + return ({ + data: data, + offset: 0, + dataLen: 0, + dirty: 0 + }); + }); + var size = 0; + var chunkSize = 0; + var offset = 0; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + size = GLSL_TO_STD40_SIZE[uboElement.data.type]; + if (uboElement.data.size > 1) { + size = Math.max(size, 16) * uboElement.data.size; + } + uboElement.dataLen = size; + // add some size offset.. + // must align to the nearest 16 bytes or internally nearest round size + if (chunkSize % size !== 0 && chunkSize < 16) { + // diff required to line up.. + var lineUpValue = (chunkSize % size) % 16; + chunkSize += lineUpValue; + offset += lineUpValue; + } + if ((chunkSize + size) > 16) { + offset = Math.ceil(offset / 16) * 16; + uboElement.offset = offset; + offset += size; + chunkSize = size; + } + else { + uboElement.offset = offset; + chunkSize += size; + offset += size; + } + } + offset = Math.ceil(offset / 16) * 16; + return { uboElements: uboElements, size: offset }; +} +function getUBOData(uniforms, uniformData) { + var usedUniformDatas = []; + // build.. + for (var i in uniforms) { + if (uniformData[i]) { + usedUniformDatas.push(uniformData[i]); + } + } + // sort them out by index! + usedUniformDatas.sort(function (a, b) { return a.index - b.index; }); + return usedUniformDatas; +} +function generateUniformBufferSync(group, uniformData) { + if (!group.autoManage) { + // if the group is nott automatically managed, we don't need to generate a special function for it... + return { size: 0, syncFunc: uboUpdate }; + } + var usedUniformDatas = getUBOData(group.uniforms, uniformData); + var _a = createUBOElements(usedUniformDatas), uboElements = _a.uboElements, size = _a.size; + var funcFragments = ["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "]; + for (var i = 0; i < uboElements.length; i++) { + var uboElement = uboElements[i]; + var uniform = group.uniforms[uboElement.data.name]; + var name = uboElement.data.name; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + var uniformParser = uniformParsers[j]; + if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform)) { + funcFragments.push("offset = " + uboElement.offset / 4 + ";", uniformParsers[j].codeUbo(uboElement.data.name, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + if (uboElement.data.size > 1) { + var size_1 = mapSize(uboElement.data.type); + var rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1); + var elementSize = size_1 / rowSize; + var remainder = (4 - (elementSize % 4)) % 4; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n\n t = 0;\n\n for(var i=0; i < " + uboElement.data.size * rowSize + "; i++)\n {\n for(var j = 0; j < " + elementSize + "; j++)\n {\n data[offset++] = v[t++];\n }\n offset += " + remainder + ";\n }\n\n "); + } + else { + var template = UBO_TO_SINGLE_SETTERS[uboElement.data.type]; + funcFragments.push("\n cv = ud." + name + ".value;\n v = uv." + name + ";\n offset = " + uboElement.offset / 4 + ";\n " + template + ";\n "); + } + } + } + funcFragments.push("\n renderer.buffer.update(buffer);\n "); + return { + size: size, + // eslint-disable-next-line no-new-func + syncFunc: new Function('ud', 'uv', 'renderer', 'syncData', 'buffer', funcFragments.join('\n')) + }; +} + +/** + * @private + */ +var IGLUniformData = /** @class */ (function () { + function IGLUniformData() { + } + return IGLUniformData; +}()); +/** + * Helper class to create a WebGL Program + * @memberof PIXI + */ +var GLProgram = /** @class */ (function () { + /** + * Makes a new Pixi program. + * @param program - webgl program + * @param uniformData - uniforms + */ + function GLProgram(program, uniformData) { + this.program = program; + this.uniformData = uniformData; + this.uniformGroups = {}; + this.uniformDirtyGroups = {}; + this.uniformBufferBindings = {}; + } + /** Destroys this program. */ + GLProgram.prototype.destroy = function () { + this.uniformData = null; + this.uniformGroups = null; + this.uniformDirtyGroups = null; + this.uniformBufferBindings = null; + this.program = null; + }; + return GLProgram; +}()); + +/** + * returns the attribute data from the program + * @private + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context + * @returns {object} the attribute data for this program + */ +function getAttributeData(program, gl) { + var attributes = {}; + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + if (attribData.name.indexOf('gl_') === 0) { + continue; + } + var type = mapType(gl, attribData.type); + var data = { + type: type, + name: attribData.name, + size: mapSize(type), + location: gl.getAttribLocation(program, attribData.name), + }; + attributes[attribData.name] = data; + } + return attributes; +} + +/** + * returns the uniform data from the program + * @private + * @param program - the webgl program + * @param gl - the WebGL context + * @returns {object} the uniform data for this program + */ +function getUniformData(program, gl) { + var uniforms = {}; + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]$/, ''); + var isArray = !!(uniformData.name.match(/\[.*?\]$/)); + var type = mapType(gl, uniformData.type); + uniforms[name] = { + name: name, + index: i, + type: type, + size: uniformData.size, + isArray: isArray, + value: defaultValue(type, uniformData.size), + }; + } + return uniforms; +} + +/** + * generates a WebGL Program object from a high level Pixi Program. + * @param gl - a rendering context on which to generate the program + * @param program - the high level Pixi Program. + */ +function generateProgram(gl, program) { + var glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc); + var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc); + var webGLProgram = gl.createProgram(); + gl.attachShader(webGLProgram, glVertShader); + gl.attachShader(webGLProgram, glFragShader); + gl.linkProgram(webGLProgram); + if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) { + logProgramError(gl, webGLProgram, glVertShader, glFragShader); + } + program.attributeData = getAttributeData(webGLProgram, gl); + program.uniformData = getUniformData(webGLProgram, gl); + // GLSL 1.00: bind attributes sorted by name in ascending order + // GLSL 3.00: don't change the attribute locations that where chosen by the compiler + // or assigned by the layout specifier in the shader source code + if (!(/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m).test(program.vertexSrc)) { + var keys = Object.keys(program.attributeData); + keys.sort(function (a, b) { return (a > b) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow + for (var i = 0; i < keys.length; i++) { + program.attributeData[keys[i]].location = i; + gl.bindAttribLocation(webGLProgram, i, keys[i]); + } + gl.linkProgram(webGLProgram); + } + gl.deleteShader(glVertShader); + gl.deleteShader(glFragShader); + var uniformData = {}; + for (var i in program.uniformData) { + var data = program.uniformData[i]; + uniformData[i] = { + location: gl.getUniformLocation(webGLProgram, i), + value: defaultValue(data.type, data.size), + }; + } + var glProgram = new GLProgram(webGLProgram, uniformData); + return glProgram; +} + +var UID = 0; +// default sync data so we don't create a new one each time! +var defaultSyncData = { textureCount: 0, uboCount: 0 }; +/** + * System plugin to the renderer to manage shaders. + * @memberof PIXI + */ +var ShaderSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function ShaderSystem(renderer) { + this.destroyed = false; + this.renderer = renderer; + // Validation check that this environment support `new Function` + this.systemCheck(); + this.gl = null; + this.shader = null; + this.program = null; + this.cache = {}; + this._uboCache = {}; + this.id = UID++; + } + /** + * Overrideable function by `@pixi/unsafe-eval` to silence + * throwing an error if platform doesn't support unsafe-evals. + * @private + */ + ShaderSystem.prototype.systemCheck = function () { + if (!unsafeEvalSupported()) { + throw new Error('Current environment does not allow unsafe-eval, ' + + 'please use @pixi/unsafe-eval module to enable support.'); + } + }; + ShaderSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.reset(); + }; + /** + * Changes the current shader to the one given in parameter. + * @param shader - the new shader + * @param dontSync - false if the shader should automatically sync its uniforms. + * @returns the glProgram that belongs to the shader. + */ + ShaderSystem.prototype.bind = function (shader, dontSync) { + shader.disposeRunner.add(this); + shader.uniforms.globals = this.renderer.globalUniforms; + var program = shader.program; + var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader); + this.shader = shader; + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. + if (this.program !== program) { + this.program = program; + this.gl.useProgram(glProgram.program); + } + if (!dontSync) { + defaultSyncData.textureCount = 0; + defaultSyncData.uboCount = 0; + this.syncUniformGroup(shader.uniformGroup, defaultSyncData); + } + return glProgram; + }; + /** + * Uploads the uniforms values to the currently bound shader. + * @param uniforms - the uniforms values that be applied to the current shader + */ + ShaderSystem.prototype.setUniforms = function (uniforms) { + var shader = this.shader.program; + var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; + shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); + }; + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /** + * Syncs uniforms on the group + * @param group - the uniform group to sync + * @param syncData - this is data that is passed to the sync function and any nested sync functions + */ + ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id]) { + glProgram.uniformDirtyGroups[group.id] = group.dirtyId; + this.syncUniforms(group, glProgram, syncData); + } + }; + /** + * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead. + * @param group + * @param glProgram + * @param syncData + */ + ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { + var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); + }; + ShaderSystem.prototype.createSyncGroups = function (group) { + var id = this.getSignature(group, this.shader.program.uniformData, 'u'); + if (!this.cache[id]) { + this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); + } + group.syncUniforms[this.shader.program.id] = this.cache[id]; + return group.syncUniforms[this.shader.program.id]; + }; + /** + * Syncs uniform buffers + * @param group - the uniform buffer group to sync + * @param name - the name of the uniform buffer + */ + ShaderSystem.prototype.syncUniformBufferGroup = function (group, name) { + var glProgram = this.getGlProgram(); + if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id]) { + group.dirtyId = 0; + var syncFunc = glProgram.uniformGroups[group.id] + || this.createSyncBufferGroup(group, glProgram, name); + // TODO wrap update in a cache?? + group.buffer.update(); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, defaultSyncData, group.buffer); + } + this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]); + }; + /** + * Will create a function that uploads a uniform buffer using the STD140 standard. + * The upload function will then be cached for future calls + * If a group is manually managed, then a simple upload function is generated + * @param group - the uniform buffer group to sync + * @param glProgram - the gl program to attach the uniform bindings to + * @param name - the name of the uniform buffer (must exist on the shader) + */ + ShaderSystem.prototype.createSyncBufferGroup = function (group, glProgram, name) { + var gl = this.renderer.gl; + this.renderer.buffer.bind(group.buffer); + // bind them... + var uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name); + glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount; + gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount); + this.shader.uniformBindCount++; + var id = this.getSignature(group, this.shader.program.uniformData, 'ubo'); + var uboData = this._uboCache[id]; + if (!uboData) { + uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData); + } + if (group.autoManage) { + var data = new Float32Array(uboData.size / 4); + group.buffer.update(data); + } + glProgram.uniformGroups[group.id] = uboData.syncFunc; + return glProgram.uniformGroups[group.id]; + }; + /** + * Takes a uniform group and data and generates a unique signature for them. + * @param group - The uniform group to get signature of + * @param group.uniforms + * @param uniformData - Uniform information generated by the shader + * @param preFix + * @returns Unique signature of the uniform group + */ + ShaderSystem.prototype.getSignature = function (group, uniformData, preFix) { + var uniforms = group.uniforms; + var strings = [preFix + "-"]; + for (var i in uniforms) { + strings.push(i); + if (uniformData[i]) { + strings.push(uniformData[i].type); + } + } + return strings.join('-'); + }; + /** + * Returns the underlying GLShade rof the currently bound shader. + * + * This can be handy for when you to have a little more control over the setting of your uniforms. + * @returns The glProgram for the currently bound Shader for this context + */ + ShaderSystem.prototype.getGlProgram = function () { + if (this.shader) { + return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; + } + return null; + }; + /** + * Generates a glProgram version of the Shader provided. + * @param shader - The shader that the glProgram will be based on. + * @returns A shiny new glProgram! + */ + ShaderSystem.prototype.generateProgram = function (shader) { + var gl = this.gl; + var program = shader.program; + var glProgram = generateProgram(gl, program); + program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; + return glProgram; + }; + /** Resets ShaderSystem state, does not affect WebGL state. */ + ShaderSystem.prototype.reset = function () { + this.program = null; + this.shader = null; + }; + /** + * Disposes shader. + * If disposing one equals with current shader, set current as null. + * @param shader - Shader object + */ + ShaderSystem.prototype.disposeShader = function (shader) { + if (this.shader === shader) { + this.shader = null; + } + }; + /** Destroys this System and removes all its textures. */ + ShaderSystem.prototype.destroy = function () { + this.renderer = null; + // TODO implement destroy method for ShaderSystem + this.destroyed = true; + }; + return ShaderSystem; +}()); + +/** + * Maps gl blend combinations to WebGL. + * @memberof PIXI + * @function mapWebGLBlendModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {number[][]} [array=[]] - The array to output into. + * @returns {number[][]} Mapped modes. + */ +function mapWebGLBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } + // TODO - premultiply alpha would be different. + // add a boolean for that! + array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; + array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.NONE] = [0, 0]; + // not-premultiplied blend modes + array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; + array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + // composite operations + array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; + array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; + array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; + array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; + array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; + array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; + array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + // SUBTRACT from flash + array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; + return array; +} + +var BLEND = 0; +var OFFSET = 1; +var CULLING = 2; +var DEPTH_TEST = 3; +var WINDING = 4; +var DEPTH_MASK = 5; +/** + * System plugin to the renderer to manage WebGL state machines. + * @memberof PIXI + */ +var StateSystem = /** @class */ (function () { + function StateSystem() { + this.gl = null; + this.stateId = 0; + this.polygonOffset = 0; + this.blendMode = BLEND_MODES.NONE; + this._blendEq = false; + // map functions for when we set state.. + this.map = []; + this.map[BLEND] = this.setBlend; + this.map[OFFSET] = this.setOffset; + this.map[CULLING] = this.setCullFace; + this.map[DEPTH_TEST] = this.setDepthTest; + this.map[WINDING] = this.setFrontFace; + this.map[DEPTH_MASK] = this.setDepthMask; + this.checks = []; + this.defaultState = new State(); + this.defaultState.blend = true; + } + StateSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.blendModes = mapWebGLBlendModesToPixi(gl); + this.set(this.defaultState); + this.reset(); + }; + /** + * Sets the current state + * @param {*} state - The state to set. + */ + StateSystem.prototype.set = function (state) { + state = state || this.defaultState; + // TODO maybe to an object check? ( this.state === state )? + if (this.stateId !== state.data) { + var diff = this.stateId ^ state.data; + var i = 0; + // order from least to most common + while (diff) { + if (diff & 1) { + // state change! + this.map[i].call(this, !!(state.data & (1 << i))); + } + diff = diff >> 1; + i++; + } + this.stateId = state.data; + } + // based on the above settings we check for specific modes.. + // for example if blend is active we check and set the blend modes + // or of polygon offset is active we check the poly depth. + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + }; + /** + * Sets the state, when previous state is unknown. + * @param {*} state - The state to set + */ + StateSystem.prototype.forceState = function (state) { + state = state || this.defaultState; + for (var i = 0; i < this.map.length; i++) { + this.map[i].call(this, !!(state.data & (1 << i))); + } + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + this.stateId = state.data; + }; + /** + * Sets whether to enable or disable blending. + * @param value - Turn on or off WebGl blending. + */ + StateSystem.prototype.setBlend = function (value) { + this.updateCheck(StateSystem.checkBlendMode, value); + this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); + }; + /** + * Sets whether to enable or disable polygon offset fill. + * @param value - Turn on or off webgl polygon offset testing. + */ + StateSystem.prototype.setOffset = function (value) { + this.updateCheck(StateSystem.checkPolygonOffset, value); + this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); + }; + /** + * Sets whether to enable or disable depth test. + * @param value - Turn on or off webgl depth testing. + */ + StateSystem.prototype.setDepthTest = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); + }; + /** + * Sets whether to enable or disable depth mask. + * @param value - Turn on or off webgl depth mask. + */ + StateSystem.prototype.setDepthMask = function (value) { + this.gl.depthMask(value); + }; + /** + * Sets whether to enable or disable cull face. + * @param {boolean} value - Turn on or off webgl cull face. + */ + StateSystem.prototype.setCullFace = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); + }; + /** + * Sets the gl front face. + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + StateSystem.prototype.setFrontFace = function (value) { + this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); + }; + /** + * Sets the blend mode. + * @param {number} value - The blend mode to set to. + */ + StateSystem.prototype.setBlendMode = function (value) { + if (value === this.blendMode) { + return; + } + this.blendMode = value; + var mode = this.blendModes[value]; + var gl = this.gl; + if (mode.length === 2) { + gl.blendFunc(mode[0], mode[1]); + } + else { + gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); + } + if (mode.length === 6) { + this._blendEq = true; + gl.blendEquationSeparate(mode[4], mode[5]); + } + else if (this._blendEq) { + this._blendEq = false; + gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); + } + }; + /** + * Sets the polygon offset. + * @param {number} value - the polygon offset + * @param {number} scale - the polygon offset scale + */ + StateSystem.prototype.setPolygonOffset = function (value, scale) { + this.gl.polygonOffset(value, scale); + }; + // used + /** Resets all the logic and disables the VAOs. */ + StateSystem.prototype.reset = function () { + this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); + this.forceState(this.defaultState); + this._blendEq = true; + this.blendMode = -1; + this.setBlendMode(0); + }; + /** + * Checks to see which updates should be checked based on which settings have been activated. + * + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. + * The idea is that we only check what we have too. + * @param func - the checking function to add or remove + * @param value - should the check function be added or removed. + */ + StateSystem.prototype.updateCheck = function (func, value) { + var index = this.checks.indexOf(func); + if (value && index === -1) { + this.checks.push(func); + } + else if (!value && index !== -1) { + this.checks.splice(index, 1); + } + }; + /** + * A private little wrapper function that we call to check the blend mode. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkBlendMode = function (system, state) { + system.setBlendMode(state.blendMode); + }; + /** + * A private little wrapper function that we call to check the polygon offset. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + StateSystem.checkPolygonOffset = function (system, state) { + system.setPolygonOffset(1, state.polygonOffset); + }; + /** + * @ignore + */ + StateSystem.prototype.destroy = function () { + this.gl = null; + }; + return StateSystem; +}()); + +/** + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. + * @memberof PIXI + */ +var TextureGCSystem = /** @class */ (function () { + /** @param renderer - The renderer this System works for. */ + function TextureGCSystem(renderer) { + this.renderer = renderer; + this.count = 0; + this.checkCount = 0; + this.maxIdle = settings.GC_MAX_IDLE; + this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + this.mode = settings.GC_MODE; + } + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.postrender = function () { + if (!this.renderer.renderingToScreen) { + return; + } + this.count++; + if (this.mode === GC_MODES.MANUAL) { + return; + } + this.checkCount++; + if (this.checkCount > this.checkCountMax) { + this.checkCount = 0; + this.run(); + } + }; + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.run = function () { + var tm = this.renderer.texture; + var managedTextures = tm.managedTextures; + var wasRemoved = false; + for (var i = 0; i < managedTextures.length; i++) { + var texture = managedTextures[i]; + // only supports non generated textures at the moment! + if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { + tm.destroyTexture(texture, true); + managedTextures[i] = null; + wasRemoved = true; + } + } + if (wasRemoved) { + var j = 0; + for (var i = 0; i < managedTextures.length; i++) { + if (managedTextures[i] !== null) { + managedTextures[j++] = managedTextures[i]; + } + } + managedTextures.length = j; + } + }; + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + TextureGCSystem.prototype.unload = function (displayObject) { + var tm = this.renderer.texture; + var texture = displayObject._texture; + // only destroy non generated textures + if (texture && !texture.framebuffer) { + tm.destroyTexture(texture); + } + for (var i = displayObject.children.length - 1; i >= 0; i--) { + this.unload(displayObject.children[i]); + } + }; + TextureGCSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureGCSystem; +}()); + +/** + * Returns a lookup table that maps each type-format pair to a compatible internal format. + * @memberof PIXI + * @function mapTypeAndFormatToInternalFormat + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @returns Lookup table. + */ +function mapTypeAndFormatToInternalFormat(gl) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; + var table; + if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext) { + table = (_a = {}, + _a[TYPES.UNSIGNED_BYTE] = (_b = {}, + _b[FORMATS.RGBA] = gl.RGBA8, + _b[FORMATS.RGB] = gl.RGB8, + _b[FORMATS.RG] = gl.RG8, + _b[FORMATS.RED] = gl.R8, + _b[FORMATS.RGBA_INTEGER] = gl.RGBA8UI, + _b[FORMATS.RGB_INTEGER] = gl.RGB8UI, + _b[FORMATS.RG_INTEGER] = gl.RG8UI, + _b[FORMATS.RED_INTEGER] = gl.R8UI, + _b[FORMATS.ALPHA] = gl.ALPHA, + _b[FORMATS.LUMINANCE] = gl.LUMINANCE, + _b[FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _b), + _a[TYPES.BYTE] = (_c = {}, + _c[FORMATS.RGBA] = gl.RGBA8_SNORM, + _c[FORMATS.RGB] = gl.RGB8_SNORM, + _c[FORMATS.RG] = gl.RG8_SNORM, + _c[FORMATS.RED] = gl.R8_SNORM, + _c[FORMATS.RGBA_INTEGER] = gl.RGBA8I, + _c[FORMATS.RGB_INTEGER] = gl.RGB8I, + _c[FORMATS.RG_INTEGER] = gl.RG8I, + _c[FORMATS.RED_INTEGER] = gl.R8I, + _c), + _a[TYPES.UNSIGNED_SHORT] = (_d = {}, + _d[FORMATS.RGBA_INTEGER] = gl.RGBA16UI, + _d[FORMATS.RGB_INTEGER] = gl.RGB16UI, + _d[FORMATS.RG_INTEGER] = gl.RG16UI, + _d[FORMATS.RED_INTEGER] = gl.R16UI, + _d[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT16, + _d), + _a[TYPES.SHORT] = (_e = {}, + _e[FORMATS.RGBA_INTEGER] = gl.RGBA16I, + _e[FORMATS.RGB_INTEGER] = gl.RGB16I, + _e[FORMATS.RG_INTEGER] = gl.RG16I, + _e[FORMATS.RED_INTEGER] = gl.R16I, + _e), + _a[TYPES.UNSIGNED_INT] = (_f = {}, + _f[FORMATS.RGBA_INTEGER] = gl.RGBA32UI, + _f[FORMATS.RGB_INTEGER] = gl.RGB32UI, + _f[FORMATS.RG_INTEGER] = gl.RG32UI, + _f[FORMATS.RED_INTEGER] = gl.R32UI, + _f[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT24, + _f), + _a[TYPES.INT] = (_g = {}, + _g[FORMATS.RGBA_INTEGER] = gl.RGBA32I, + _g[FORMATS.RGB_INTEGER] = gl.RGB32I, + _g[FORMATS.RG_INTEGER] = gl.RG32I, + _g[FORMATS.RED_INTEGER] = gl.R32I, + _g), + _a[TYPES.FLOAT] = (_h = {}, + _h[FORMATS.RGBA] = gl.RGBA32F, + _h[FORMATS.RGB] = gl.RGB32F, + _h[FORMATS.RG] = gl.RG32F, + _h[FORMATS.RED] = gl.R32F, + _h[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT32F, + _h), + _a[TYPES.HALF_FLOAT] = (_j = {}, + _j[FORMATS.RGBA] = gl.RGBA16F, + _j[FORMATS.RGB] = gl.RGB16F, + _j[FORMATS.RG] = gl.RG16F, + _j[FORMATS.RED] = gl.R16F, + _j), + _a[TYPES.UNSIGNED_SHORT_5_6_5] = (_k = {}, + _k[FORMATS.RGB] = gl.RGB565, + _k), + _a[TYPES.UNSIGNED_SHORT_4_4_4_4] = (_l = {}, + _l[FORMATS.RGBA] = gl.RGBA4, + _l), + _a[TYPES.UNSIGNED_SHORT_5_5_5_1] = (_m = {}, + _m[FORMATS.RGBA] = gl.RGB5_A1, + _m), + _a[TYPES.UNSIGNED_INT_2_10_10_10_REV] = (_o = {}, + _o[FORMATS.RGBA] = gl.RGB10_A2, + _o[FORMATS.RGBA_INTEGER] = gl.RGB10_A2UI, + _o), + _a[TYPES.UNSIGNED_INT_10F_11F_11F_REV] = (_p = {}, + _p[FORMATS.RGB] = gl.R11F_G11F_B10F, + _p), + _a[TYPES.UNSIGNED_INT_5_9_9_9_REV] = (_q = {}, + _q[FORMATS.RGB] = gl.RGB9_E5, + _q), + _a[TYPES.UNSIGNED_INT_24_8] = (_r = {}, + _r[FORMATS.DEPTH_STENCIL] = gl.DEPTH24_STENCIL8, + _r), + _a[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV] = (_s = {}, + _s[FORMATS.DEPTH_STENCIL] = gl.DEPTH32F_STENCIL8, + _s), + _a); + } + else { + table = (_t = {}, + _t[TYPES.UNSIGNED_BYTE] = (_u = {}, + _u[FORMATS.RGBA] = gl.RGBA, + _u[FORMATS.RGB] = gl.RGB, + _u[FORMATS.ALPHA] = gl.ALPHA, + _u[FORMATS.LUMINANCE] = gl.LUMINANCE, + _u[FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA, + _u), + _t[TYPES.UNSIGNED_SHORT_5_6_5] = (_v = {}, + _v[FORMATS.RGB] = gl.RGB, + _v), + _t[TYPES.UNSIGNED_SHORT_4_4_4_4] = (_w = {}, + _w[FORMATS.RGBA] = gl.RGBA, + _w), + _t[TYPES.UNSIGNED_SHORT_5_5_5_1] = (_x = {}, + _x[FORMATS.RGBA] = gl.RGBA, + _x), + _t); + } + return table; +} + +/** + * Internal texture for WebGL context. + * @memberof PIXI + */ +var GLTexture = /** @class */ (function () { + function GLTexture(texture) { + this.texture = texture; + this.width = -1; + this.height = -1; + this.dirtyId = -1; + this.dirtyStyleId = -1; + this.mipmap = false; + this.wrapMode = 33071; + this.type = TYPES.UNSIGNED_BYTE; + this.internalFormat = FORMATS.RGBA; + this.samplerType = 0; + } + return GLTexture; +}()); + +/** + * System plugin to the renderer to manage textures. + * @memberof PIXI + */ +var TextureSystem = /** @class */ (function () { + /** + * @param renderer - The renderer this system works for. + */ + function TextureSystem(renderer) { + this.renderer = renderer; + // TODO set to max textures... + this.boundTextures = []; + this.currentLocation = -1; + this.managedTextures = []; + this._unknownBoundTextures = false; + this.unknownTexture = new BaseTexture(); + this.hasIntegerTextures = false; + } + /** Sets up the renderer context and necessary buffers. */ + TextureSystem.prototype.contextChange = function () { + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.webGLVersion = this.renderer.context.webGLVersion; + this.internalFormats = mapTypeAndFormatToInternalFormat(gl); + var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + this.boundTextures.length = maxTextures; + for (var i = 0; i < maxTextures; i++) { + this.boundTextures[i] = null; + } + // TODO move this.. to a nice make empty textures class.. + this.emptyTextures = {}; + var emptyTexture2D = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); + this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; + this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); + for (var i = 0; i < 6; i++) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + for (var i = 0; i < this.boundTextures.length; i++) { + this.bind(null, i); + } + }; + /** + * Bind a texture to a specific location + * + * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` + * @param texture - Texture to bind + * @param [location=0] - Location to bind at + */ + TextureSystem.prototype.bind = function (texture, location) { + if (location === void 0) { location = 0; } + var gl = this.gl; + texture = texture === null || texture === void 0 ? void 0 : texture.castToBaseTexture(); + // cannot bind partial texture + // TODO: report a warning + if (texture && texture.valid && !texture.parentTextureArray) { + texture.touched = this.renderer.textureGC.count; + var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); + if (this.boundTextures[location] !== texture) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(texture.target, glTexture.texture); + } + if (glTexture.dirtyId !== texture.dirtyId) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + this.updateTexture(texture); + } + else if (glTexture.dirtyStyleId !== texture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + this.boundTextures[location] = texture; + } + else { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); + this.boundTextures[location] = null; + } + }; + /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */ + TextureSystem.prototype.reset = function () { + this._unknownBoundTextures = true; + this.hasIntegerTextures = false; + this.currentLocation = -1; + for (var i = 0; i < this.boundTextures.length; i++) { + this.boundTextures[i] = this.unknownTexture; + } + }; + /** + * Unbind a texture. + * @param texture - Texture to bind + */ + TextureSystem.prototype.unbind = function (texture) { + var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; + if (this._unknownBoundTextures) { + this._unknownBoundTextures = false; + // someone changed webGL state, + // we have to be sure that our texture does not appear in multi-texture renderer samplers + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === this.unknownTexture) { + this.bind(null, i); + } + } + } + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === texture) { + if (this.currentLocation !== i) { + gl.activeTexture(gl.TEXTURE0 + i); + this.currentLocation = i; + } + gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); + boundTextures[i] = null; + } + } + }; + /** + * Ensures that current boundTextures all have FLOAT sampler type, + * see {@link PIXI.SAMPLER_TYPES} for explanation. + * @param maxTextures - number of locations to check + */ + TextureSystem.prototype.ensureSamplerType = function (maxTextures) { + var _a = this, boundTextures = _a.boundTextures, hasIntegerTextures = _a.hasIntegerTextures, CONTEXT_UID = _a.CONTEXT_UID; + if (!hasIntegerTextures) { + return; + } + for (var i = maxTextures - 1; i >= 0; --i) { + var tex = boundTextures[i]; + if (tex) { + var glTexture = tex._glTextures[CONTEXT_UID]; + if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT) { + this.renderer.texture.unbind(tex); + } + } + } + }; + /** + * Initialize a texture + * @private + * @param texture - Texture to initialize + */ + TextureSystem.prototype.initTexture = function (texture) { + var glTexture = new GLTexture(this.gl.createTexture()); + // guarantee an update.. + glTexture.dirtyId = -1; + texture._glTextures[this.CONTEXT_UID] = glTexture; + this.managedTextures.push(texture); + texture.on('dispose', this.destroyTexture, this); + return glTexture; + }; + TextureSystem.prototype.initTextureType = function (texture, glTexture) { + var _a, _b; + glTexture.internalFormat = (_b = (_a = this.internalFormats[texture.type]) === null || _a === void 0 ? void 0 : _a[texture.format]) !== null && _b !== void 0 ? _b : texture.format; + if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT) { + // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES + // we have to convert it to WebGL HALF_FLOAT + glTexture.type = this.gl.HALF_FLOAT; + } + else { + glTexture.type = texture.type; + } + }; + /** + * Update a texture + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + TextureSystem.prototype.updateTexture = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + var renderer = this.renderer; + this.initTextureType(texture, glTexture); + if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { + // texture is uploaded, dont do anything! + if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT) { + this.hasIntegerTextures = true; + } + } + else { + // default, renderTexture-like logic + var width = texture.realWidth; + var height = texture.realHeight; + var gl = renderer.gl; + if (glTexture.width !== width + || glTexture.height !== height + || glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); + } + } + // lets only update what changes.. + if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + glTexture.dirtyId = texture.dirtyId; + }; + /** + * Deletes the texture from WebGL + * @private + * @param texture - the texture to destroy + * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { + var gl = this.gl; + texture = texture.castToBaseTexture(); + if (texture._glTextures[this.CONTEXT_UID]) { + this.unbind(texture); + gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); + texture.off('dispose', this.destroyTexture, this); + delete texture._glTextures[this.CONTEXT_UID]; + if (!skipRemove) { + var i = this.managedTextures.indexOf(texture); + if (i !== -1) { + removeItems(this.managedTextures, i, 1); + } + } + } + }; + /** + * Update texture style such as mipmap flag + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + */ + TextureSystem.prototype.updateTextureStyle = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { + glTexture.mipmap = false; + } + else { + glTexture.mipmap = texture.mipmap >= 1; + } + if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { + glTexture.wrapMode = WRAP_MODES.CLAMP; + } + else { + glTexture.wrapMode = texture.wrapMode; + } + if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) ; + else { + this.setStyle(texture, glTexture); + } + glTexture.dirtyStyleId = texture.dirtyStyleId; + }; + /** + * Set style for texture + * @private + * @param texture - Texture to update + * @param glTexture + */ + TextureSystem.prototype.setStyle = function (texture, glTexture) { + var gl = this.gl; + if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL) { + gl.generateMipmap(texture.target); + } + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); + if (glTexture.mipmap) { + /* eslint-disable max-len */ + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + /* eslint-disable max-len */ + var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; + if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR) { + var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); + gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); + } + } + else { + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + } + gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + }; + TextureSystem.prototype.destroy = function () { + this.renderer = null; + }; + return TextureSystem; +}()); + +var _systems = { + __proto__: null, + FilterSystem: FilterSystem, + BatchSystem: BatchSystem, + ContextSystem: ContextSystem, + FramebufferSystem: FramebufferSystem, + GeometrySystem: GeometrySystem, + MaskSystem: MaskSystem, + ScissorSystem: ScissorSystem, + StencilSystem: StencilSystem, + ProjectionSystem: ProjectionSystem, + RenderTextureSystem: RenderTextureSystem, + ShaderSystem: ShaderSystem, + StateSystem: StateSystem, + TextureGCSystem: TextureGCSystem, + TextureSystem: TextureSystem +}; + +var tempMatrix = new Matrix(); +/** + * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. + * @abstract + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ +var AbstractRenderer = /** @class */ (function (_super) { + __extends(AbstractRenderer, _super); + /** + * @param type - The renderer type. + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function AbstractRenderer(type, options) { + if (type === void 0) { type = RENDERER_TYPE.UNKNOWN; } + var _this = _super.call(this) || this; + // Add the default render options + options = Object.assign({}, settings.RENDER_OPTIONS, options); + /** + * The supplied constructor options. + * @member {object} + * @readonly + */ + _this.options = options; + /** + * The type of the renderer. + * @member {number} + * @default PIXI.RENDERER_TYPE.UNKNOWN + * @see PIXI.RENDERER_TYPE + */ + _this.type = type; + /** + * Measurements of the screen. (0, 0, screenWidth, screenHeight). + * + * Its safe to use as filterArea or hitArea for the whole stage. + * @member {PIXI.Rectangle} + */ + _this.screen = new Rectangle(0, 0, options.width, options.height); + /** + * The canvas element that everything is drawn to. + * @member {HTMLCanvasElement} + */ + _this.view = options.view || settings.ADAPTER.createCanvas(); + /** + * The resolution / device pixel ratio of the renderer. + * @member {number} + * @default PIXI.settings.RESOLUTION + */ + _this.resolution = options.resolution || settings.RESOLUTION; + /** + * Pass-thru setting for the canvas' context `alpha` property. This is typically + * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`. + * @member {boolean} + */ + _this.useContextAlpha = options.useContextAlpha; + /** + * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. + * @member {boolean} + */ + _this.autoDensity = !!options.autoDensity; + /** + * The value of the preserveDrawingBuffer flag affects whether or not the contents of + * the stencil buffer is retained after rendering. + * @member {boolean} + */ + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; + /** + * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. + * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every + * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect + * to clear the canvas every frame. Disable this by setting this to false. For example, if + * your game has a canvas filling background image you often don't need this set. + * @member {boolean} + * @default + */ + _this.clearBeforeRender = options.clearBeforeRender; + /** + * The background color as a number. + * @member {number} + * @protected + */ + _this._backgroundColor = 0x000000; + /** + * The background color as an [R, G, B, A] array. + * @member {number[]} + * @protected + */ + _this._backgroundColorRgba = [0, 0, 0, 1]; + /** + * The background color as a string. + * @member {string} + * @protected + */ + _this._backgroundColorString = '#000000'; + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter + _this.backgroundAlpha = options.backgroundAlpha; + // @deprecated + if (options.transparent !== undefined) { + deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.'); + _this.useContextAlpha = options.transparent; + _this.backgroundAlpha = options.transparent ? 0 : 1; + } + /** + * The last root object that the renderer tried to render. + * @member {PIXI.DisplayObject} + * @protected + */ + _this._lastObjectRendered = null; + /** + * Collection of plugins. + * @readonly + * @member {object} + */ + _this.plugins = {}; + return _this; + } + /** + * Initialize the plugins. + * @protected + * @param {object} staticMap - The dictionary of statically saved plugins. + */ + AbstractRenderer.prototype.initPlugins = function (staticMap) { + for (var o in staticMap) { + this.plugins[o] = new (staticMap[o])(this); + } + }; + Object.defineProperty(AbstractRenderer.prototype, "width", { + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * @member {number} + * @readonly + * @default 800 + */ + get: function () { + return this.view.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "height", { + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * @member {number} + * @readonly + * @default 600 + */ + get: function () { + return this.view.height; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the screen and canvas as close as possible to the specified width and height. + * Canvas dimensions are multiplied by resolution and rounded to the nearest integers. + * The new canvas dimensions divided by the resolution become the new screen dimensions. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + AbstractRenderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + this.view.width = Math.round(desiredScreenWidth * this.resolution); + this.view.height = Math.round(desiredScreenHeight * this.resolution); + var screenWidth = this.view.width / this.resolution; + var screenHeight = this.view.height / this.resolution; + this.screen.width = screenWidth; + this.screen.height = screenHeight; + if (this.autoDensity) { + this.view.style.width = screenWidth + "px"; + this.view.style.height = screenHeight + "px"; + } + /** + * Fired after view has been resized. + * @event PIXI.Renderer#resize + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + this.emit('resize', screenWidth, screenHeight); + }; + /** + * @ignore + */ + AbstractRenderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + // @deprecated parameters spread, use options instead + if (typeof options === 'number') { + deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.'); + options = { scaleMode: options, resolution: resolution, region: region }; + } + var manualRegion = options.region, textureOptions = __rest(options, ["region"]); + region = manualRegion || displayObject.getLocalBounds(null, true); + // minimum texture size is 1x1, 0x0 will throw an error + if (region.width === 0) + { region.width = 1; } + if (region.height === 0) + { region.height = 1; } + var renderTexture = RenderTexture.create(__assign({ width: region.width, height: region.height }, textureOptions)); + tempMatrix.tx = -region.x; + tempMatrix.ty = -region.y; + this.render(displayObject, { + renderTexture: renderTexture, + clear: false, + transform: tempMatrix, + skipUpdateTransform: !!displayObject.parent + }); + return renderTexture; + }; + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * @param [removeView=false] - Removes the Canvas element from the DOM. + */ + AbstractRenderer.prototype.destroy = function (removeView) { + for (var o in this.plugins) { + this.plugins[o].destroy(); + this.plugins[o] = null; + } + if (removeView && this.view.parentNode) { + this.view.parentNode.removeChild(this.view); + } + var thisAny = this; + // null-ing all objects, that's a tradition! + thisAny.plugins = null; + thisAny.type = RENDERER_TYPE.UNKNOWN; + thisAny.view = null; + thisAny.screen = null; + thisAny._tempDisplayObjectParent = null; + thisAny.options = null; + this._backgroundColorRgba = null; + this._backgroundColorString = null; + this._lastObjectRendered = null; + }; + Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { + /** + * The background color to fill if not transparent + * @member {number} + */ + get: function () { + return this._backgroundColor; + }, + set: function (value) { + this._backgroundColor = value; + this._backgroundColorString = hex2string(value); + hex2rgb(value, this._backgroundColorRgba); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "backgroundAlpha", { + /** + * The background color alpha. Setting this to 0 will make the canvas transparent. + * @member {number} + */ + get: function () { + return this._backgroundColorRgba[3]; + }, + set: function (value) { + this._backgroundColorRgba[3] = value; + }, + enumerable: false, + configurable: true + }); + return AbstractRenderer; +}(EventEmitter)); + +var GLBuffer = /** @class */ (function () { + function GLBuffer(buffer) { + this.buffer = buffer || null; + this.updateID = -1; + this.byteLength = -1; + this.refCount = 0; + } + return GLBuffer; +}()); + +/** + * System plugin to the renderer to manage buffers. + * + * WebGL uses Buffers as a way to store objects to the GPU. + * This system makes working with them a lot easier. + * + * Buffers are used in three main places in WebGL + * - geometry information + * - Uniform information (via uniform buffer objects - a WebGL 2 only feature) + * - Transform feedback information. (WebGL 2 only feature) + * + * This system will handle the binding of buffers to the GPU as well as uploading + * them. With this system, you never need to work directly with GPU buffers, but instead work with + * the PIXI.Buffer class. + * @class + * @memberof PIXI + */ +var BufferSystem = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function BufferSystem(renderer) { + this.renderer = renderer; + this.managedBuffers = {}; + this.boundBufferBases = {}; + } + /** + * @ignore + */ + BufferSystem.prototype.destroy = function () { + this.renderer = null; + }; + /** Sets up the renderer context and necessary buffers. */ + BufferSystem.prototype.contextChange = function () { + this.disposeAll(true); + this.gl = this.renderer.gl; + // TODO fill out... + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + }; + /** + * This binds specified buffer. On first run, it will create the webGL buffers for the context too + * @param buffer - the buffer to bind to the renderer + */ + BufferSystem.prototype.bind = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBuffer(buffer.type, glBuffer.buffer); + }; + /** + * Binds an uniform buffer to at the given index. + * + * A cache is used so a buffer will not be bound again if already bound. + * @param buffer - the buffer to bind + * @param index - the base index to bind it to. + */ + BufferSystem.prototype.bindBufferBase = function (buffer, index) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (this.boundBufferBases[index] !== buffer) { + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + this.boundBufferBases[index] = buffer; + gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer); + } + }; + /** + * Binds a buffer whilst also binding its range. + * This will make the buffer start from the offset supplied rather than 0 when it is read. + * @param buffer - the buffer to bind + * @param index - the base index to bind at, defaults to 0 + * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc + */ + BufferSystem.prototype.bindBufferRange = function (buffer, index, offset) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + offset = offset || 0; + var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer); + gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256); + }; + /** + * Will ensure the data in the buffer is uploaded to the GPU. + * @param {PIXI.Buffer} buffer - the buffer to update + */ + BufferSystem.prototype.update = function (buffer) { + var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (buffer._updateID === glBuffer.updateID) { + return; + } + glBuffer.updateID = buffer._updateID; + gl.bindBuffer(buffer.type, glBuffer.buffer); + if (glBuffer.byteLength >= buffer.data.byteLength) { + // offset is always zero for now! + gl.bufferSubData(buffer.type, 0, buffer.data); + } + else { + var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; + glBuffer.byteLength = buffer.data.byteLength; + gl.bufferData(buffer.type, buffer.data, drawType); + } + }; + /** + * Disposes buffer + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + BufferSystem.prototype.dispose = function (buffer, contextLost) { + if (!this.managedBuffers[buffer.id]) { + return; + } + delete this.managedBuffers[buffer.id]; + var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; + var gl = this.gl; + buffer.disposeRunner.remove(this); + if (!glBuffer) { + return; + } + if (!contextLost) { + gl.deleteBuffer(glBuffer.buffer); + } + delete buffer._glBuffers[this.CONTEXT_UID]; + }; + /** + * dispose all WebGL resources of all managed buffers + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + BufferSystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedBuffers); + for (var i = 0; i < all.length; i++) { + this.dispose(this.managedBuffers[all[i]], contextLost); + } + }; + /** + * creates and attaches a GLBuffer object tied to the current context. + * @param buffer + * @protected + */ + BufferSystem.prototype.createGLBuffer = function (buffer) { + var _a = this, CONTEXT_UID = _a.CONTEXT_UID, gl = _a.gl; + buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); + this.managedBuffers[buffer.id] = buffer; + buffer.disposeRunner.add(this); + return buffer._glBuffers[CONTEXT_UID]; + }; + return BufferSystem; +}()); + +/** + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! + * + * Renderer is composed of systems that manage specific tasks. The following systems are added by default + * whenever you create a renderer: + * + * | System | Description | + * | ------------------------------------ | ----------------------------------------------------------------------------- | + * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. | + * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. | + * | {@link PIXI.EventSystem} | This manages UI events. | + * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. | + * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. | + * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. | + * | {@link PIXI.MaskSystem} | This manages masking operations. | + * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. | + * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. | + * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. | + * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. | + * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. | + * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. | + * + * The breadth of the API surface provided by the renderer is contained within these systems. + * @memberof PIXI + */ +var Renderer = /** @class */ (function (_super) { + __extends(Renderer, _super); + /** + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + function Renderer(options) { + var _this = _super.call(this, RENDERER_TYPE.WEBGL, options) || this; + // the options will have been modified here in the super constructor with pixi's default settings.. + options = _this.options; + _this.gl = null; + _this.CONTEXT_UID = 0; + _this.runners = { + destroy: new Runner('destroy'), + contextChange: new Runner('contextChange'), + reset: new Runner('reset'), + update: new Runner('update'), + postrender: new Runner('postrender'), + prerender: new Runner('prerender'), + resize: new Runner('resize'), + }; + _this.runners.contextChange.add(_this); + _this.globalUniforms = new UniformGroup({ + projectionMatrix: new Matrix(), + }, true); + _this.addSystem(MaskSystem, 'mask') + .addSystem(ContextSystem, 'context') + .addSystem(StateSystem, 'state') + .addSystem(ShaderSystem, 'shader') + .addSystem(TextureSystem, 'texture') + .addSystem(BufferSystem, 'buffer') + .addSystem(GeometrySystem, 'geometry') + .addSystem(FramebufferSystem, 'framebuffer') + .addSystem(ScissorSystem, 'scissor') + .addSystem(StencilSystem, 'stencil') + .addSystem(ProjectionSystem, 'projection') + .addSystem(TextureGCSystem, 'textureGC') + .addSystem(FilterSystem, 'filter') + .addSystem(RenderTextureSystem, 'renderTexture') + .addSystem(BatchSystem, 'batch'); + _this.initPlugins(Renderer.__plugins); + _this.multisample = undefined; + /* + * The options passed in to create a new WebGL context. + */ + if (options.context) { + _this.context.initFromContext(options.context); + } + else { + _this.context.initFromOptions({ + alpha: !!_this.useContextAlpha, + antialias: options.antialias, + premultipliedAlpha: _this.useContextAlpha && _this.useContextAlpha !== 'notMultiplied', + stencil: true, + preserveDrawingBuffer: options.preserveDrawingBuffer, + powerPreference: _this.options.powerPreference, + }); + } + _this.renderingToScreen = true; + sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); + _this.resize(_this.options.width, _this.options.height); + return _this; + } + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @param options + * @private + */ + Renderer.create = function (options) { + if (isWebGLSupported()) { + return new Renderer(options); + } + throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); + }; + Renderer.prototype.contextChange = function () { + var gl = this.gl; + var samples; + if (this.context.webGLVersion === 1) { + var framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + else { + var framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); + samples = gl.getParameter(gl.SAMPLES); + gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer); + } + if (samples >= MSAA_QUALITY.HIGH) { + this.multisample = MSAA_QUALITY.HIGH; + } + else if (samples >= MSAA_QUALITY.MEDIUM) { + this.multisample = MSAA_QUALITY.MEDIUM; + } + else if (samples >= MSAA_QUALITY.LOW) { + this.multisample = MSAA_QUALITY.LOW; + } + else { + this.multisample = MSAA_QUALITY.NONE; + } + }; + /** + * Add a new system to the renderer. + * @param ClassRef - Class reference + * @param name - Property name for system, if not specified + * will use a static `name` property on the class itself. This + * name will be assigned as s property on the Renderer so make + * sure it doesn't collide with properties on Renderer. + * @returns Return instance of renderer + */ + Renderer.prototype.addSystem = function (ClassRef, name) { + var system = new ClassRef(this); + if (this[name]) { + throw new Error("Whoops! The name \"" + name + "\" is already in use"); + } + this[name] = system; + for (var i in this.runners) { + this.runners[i].add(system); + } + /** + * Fired after rendering finishes. + * @event PIXI.Renderer#postrender + */ + /** + * Fired before rendering starts. + * @event PIXI.Renderer#prerender + */ + /** + * Fired when the WebGL context is set. + * @event PIXI.Renderer#context + * @param {WebGLRenderingContext} gl - WebGL context. + */ + return this; + }; + /** + * @ignore + */ + Renderer.prototype.render = function (displayObject, options) { + var renderTexture; + var clear; + var transform; + var skipUpdateTransform; + if (options) { + if (options instanceof RenderTexture) { + deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.'); + /* eslint-disable prefer-rest-params */ + renderTexture = options; + clear = arguments[2]; + transform = arguments[3]; + skipUpdateTransform = arguments[4]; + /* eslint-enable prefer-rest-params */ + } + else { + renderTexture = options.renderTexture; + clear = options.clear; + transform = options.transform; + skipUpdateTransform = options.skipUpdateTransform; + } + } + // can be handy to know! + this.renderingToScreen = !renderTexture; + this.runners.prerender.emit(); + this.emit('prerender'); + // apply a transform at a GPU level + this.projection.transform = transform; + // no point rendering if our context has been blown up! + if (this.context.isLost) { + return; + } + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.enableTempParent(); + displayObject.updateTransform(); + displayObject.disableTempParent(cacheParent); + // displayObject.hitArea = //TODO add a temp hit area + } + this.renderTexture.bind(renderTexture); + this.batch.currentRenderer.start(); + if (clear !== undefined ? clear : this.clearBeforeRender) { + this.renderTexture.clear(); + } + displayObject.render(this); + // apply transform.. + this.batch.currentRenderer.flush(); + if (renderTexture) { + renderTexture.baseTexture.update(); + } + this.runners.postrender.emit(); + // reset transform after render + this.projection.transform = null; + this.emit('postrender'); + }; + /** + * @override + * @ignore + */ + Renderer.prototype.generateTexture = function (displayObject, options, resolution, region) { + if (options === void 0) { options = {}; } + var renderTexture = _super.prototype.generateTexture.call(this, displayObject, options, resolution, region); + this.framebuffer.blit(); + return renderTexture; + }; + /** + * Resizes the WebGL view to the specified width and height. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + Renderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) { + _super.prototype.resize.call(this, desiredScreenWidth, desiredScreenHeight); + this.runners.resize.emit(this.screen.height, this.screen.width); + }; + /** + * Resets the WebGL state so you can render things however you fancy! + * @returns Returns itself. + */ + Renderer.prototype.reset = function () { + this.runners.reset.emit(); + return this; + }; + /** Clear the frame buffer. */ + Renderer.prototype.clear = function () { + this.renderTexture.bind(); + this.renderTexture.clear(); + }; + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * @param [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + Renderer.prototype.destroy = function (removeView) { + this.runners.destroy.emit(); + for (var r in this.runners) { + this.runners[r].destroy(); + } + // call base destroy + _super.prototype.destroy.call(this, removeView); + // TODO nullify all the managers.. + this.gl = null; + }; + Object.defineProperty(Renderer.prototype, "extract", { + /** + * Please use `plugins.extract` instead. + * @member {PIXI.Extract} extract + * @deprecated since 6.0.0 + * @readonly + */ + get: function () { + deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.'); + return this.plugins.extract; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param pluginName - The name of the plugin. + * @param ctor - The constructor function or class for the plugin. + */ + Renderer.registerPlugin = function (pluginName, ctor) { + deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.'); + extensions$1.add({ + name: pluginName, + type: ExtensionType.RendererPlugin, + ref: ctor, + }); + }; + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @readonly + * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.Extract} extract Extract image data from renderer. + * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects. + * @property {PIXI.Prepare} prepare Pre-render display objects. + * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects. + * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects. + */ + Renderer.__plugins = {}; + return Renderer; +}(AbstractRenderer)); +// Handle registration of extensions +extensions$1.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins); + +/** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by + * the browser then this function will return a canvas renderer. + * @memberof PIXI + * @function autoDetectRenderer + * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {boolean} [options.forceCanvas=false] - + * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when + * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + * @returns {PIXI.Renderer|PIXI.CanvasRenderer} + * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}. + */ +function autoDetectRenderer(options) { + return Renderer.create(options); +} + +var $defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; + +var $defaultFilterVertex = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + +/** + * Default vertex shader + * @memberof PIXI + * @member {string} defaultVertex + */ +/** + * Default filter vertex shader + * @memberof PIXI + * @member {string} defaultFilterVertex + */ +// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types +// of defaultVertex, defaultFilterVertex. +var defaultVertex$1 = $defaultVertex; +var defaultFilterVertex = $defaultFilterVertex; + +/** + * Use the ISystem interface instead. + * @deprecated since 6.1.0 + * @memberof PIXI + */ +var System = /** @class */ (function () { + /** + * @param renderer - Reference to Renderer + */ + function System(renderer) { + deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.'); + this.renderer = renderer; + } + /** Destroy and don't use after this. */ + System.prototype.destroy = function () { + this.renderer = null; + }; + return System; +}()); + +/** + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. + * @memberof PIXI + */ +var BatchDrawCall = /** @class */ (function () { + function BatchDrawCall() { + this.texArray = null; + this.blend = 0; + this.type = DRAW_MODES.TRIANGLES; + this.start = 0; + this.size = 0; + this.data = null; + } + return BatchDrawCall; +}()); + +/** + * Used by the batcher to build texture batches. + * Holds list of textures and their respective locations. + * @memberof PIXI + */ +var BatchTextureArray = /** @class */ (function () { + function BatchTextureArray() { + this.elements = []; + this.ids = []; + this.count = 0; + } + BatchTextureArray.prototype.clear = function () { + for (var i = 0; i < this.count; i++) { + this.elements[i] = null; + } + this.count = 0; + }; + return BatchTextureArray; +}()); + +/** + * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand. + * @memberof PIXI + */ +var ViewableBuffer = /** @class */ (function () { + function ViewableBuffer(sizeOrBuffer) { + if (typeof sizeOrBuffer === 'number') { + this.rawBinaryData = new ArrayBuffer(sizeOrBuffer); + } + else if (sizeOrBuffer instanceof Uint8Array) { + this.rawBinaryData = sizeOrBuffer.buffer; + } + else { + this.rawBinaryData = sizeOrBuffer; + } + this.uint32View = new Uint32Array(this.rawBinaryData); + this.float32View = new Float32Array(this.rawBinaryData); + } + Object.defineProperty(ViewableBuffer.prototype, "int8View", { + /** View on the raw binary data as a `Int8Array`. */ + get: function () { + if (!this._int8View) { + this._int8View = new Int8Array(this.rawBinaryData); + } + return this._int8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint8View", { + /** View on the raw binary data as a `Uint8Array`. */ + get: function () { + if (!this._uint8View) { + this._uint8View = new Uint8Array(this.rawBinaryData); + } + return this._uint8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int16View", { + /** View on the raw binary data as a `Int16Array`. */ + get: function () { + if (!this._int16View) { + this._int16View = new Int16Array(this.rawBinaryData); + } + return this._int16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint16View", { + /** View on the raw binary data as a `Uint16Array`. */ + get: function () { + if (!this._uint16View) { + this._uint16View = new Uint16Array(this.rawBinaryData); + } + return this._uint16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int32View", { + /** View on the raw binary data as a `Int32Array`. */ + get: function () { + if (!this._int32View) { + this._int32View = new Int32Array(this.rawBinaryData); + } + return this._int32View; + }, + enumerable: false, + configurable: true + }); + /** + * Returns the view of the given type. + * @param type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @returns - typed array of given type + */ + ViewableBuffer.prototype.view = function (type) { + return this[type + "View"]; + }; + /** Destroys all buffer references. Do not use after calling this. */ + ViewableBuffer.prototype.destroy = function () { + this.rawBinaryData = null; + this._int8View = null; + this._uint8View = null; + this._int16View = null; + this._uint16View = null; + this._int32View = null; + this.uint32View = null; + this.float32View = null; + }; + ViewableBuffer.sizeOf = function (type) { + switch (type) { + case 'int8': + case 'uint8': + return 1; + case 'int16': + case 'uint16': + return 2; + case 'int32': + case 'uint32': + case 'float32': + return 4; + default: + throw new Error(type + " isn't a valid view type"); + } + }; + return ViewableBuffer; +}()); + +/** + * Renderer dedicated to drawing and batching sprites. + * + * This is the default batch renderer. It buffers objects + * with texture-based geometries and renders them in + * batches. It uploads multiple textures to the GPU to + * reduce to the number of draw calls. + * @memberof PIXI + */ +var AbstractBatchRenderer = /** @class */ (function (_super) { + __extends(AbstractBatchRenderer, _super); + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + function AbstractBatchRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = null; + _this.geometryClass = null; + _this.vertexSize = null; + _this.state = State.for2d(); + _this.size = settings.SPRITE_BATCH_SIZE * 4; + _this._vertexCount = 0; + _this._indexCount = 0; + _this._bufferedElements = []; + _this._bufferedTextures = []; + _this._bufferSize = 0; + _this._shader = null; + _this._packedGeometries = []; + _this._packedGeometryPoolSize = 2; + _this._flushId = 0; + _this._aBuffers = {}; + _this._iBuffers = {}; + _this.MAX_TEXTURES = 1; + _this.renderer.on('prerender', _this.onPrerender, _this); + renderer.runners.contextChange.add(_this); + _this._dcIndex = 0; + _this._aIndex = 0; + _this._iIndex = 0; + _this._attributeBuffer = null; + _this._indexBuffer = null; + _this._tempBoundTextures = []; + return _this; + } + /** + * Handles the `contextChange` signal. + * + * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool. + */ + AbstractBatchRenderer.prototype.contextChange = function () { + var gl = this.renderer.gl; + if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) { + this.MAX_TEXTURES = 1; + } + else { + // step 1: first check max textures the GPU can handle. + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); + // step 2: check the maximum number of if statements the shader can have too.. + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); + } + this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); + // we use the second shader as the first one depending on your browser + // may omit aTextureId as it is not used by the shader so is optimized out. + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + /* eslint-disable max-len */ + this._packedGeometries[i] = new (this.geometryClass)(); + } + this.initFlushBuffers(); + }; + /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */ + AbstractBatchRenderer.prototype.initFlushBuffers = function () { + var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; + // max draw calls + var MAX_SPRITES = this.size / 4; + // max texture arrays + var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; + while (_drawCallPool.length < MAX_SPRITES) { + _drawCallPool.push(new BatchDrawCall()); + } + while (_textureArrayPool.length < MAX_TA) { + _textureArrayPool.push(new BatchTextureArray()); + } + for (var i = 0; i < this.MAX_TEXTURES; i++) { + this._tempBoundTextures[i] = null; + } + }; + /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */ + AbstractBatchRenderer.prototype.onPrerender = function () { + this._flushId = 0; + }; + /** + * Buffers the "batchable" object. It need not be rendered immediately. + * @param {PIXI.DisplayObject} element - the element to render when + * using this renderer + */ + AbstractBatchRenderer.prototype.render = function (element) { + if (!element._texture.valid) { + return; + } + if (this._vertexCount + (element.vertexData.length / 2) > this.size) { + this.flush(); + } + this._vertexCount += element.vertexData.length / 2; + this._indexCount += element.indices.length; + this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; + this._bufferedElements[this._bufferSize++] = element; + }; + AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { + var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; + var textureArrays = AbstractBatchRenderer._textureArrayPool; + var batch = this.renderer.batch; + var boundTextures = this._tempBoundTextures; + var touch = this.renderer.textureGC.count; + var TICK = ++BaseTexture._globalBatch; + var countTexArrays = 0; + var texArray = textureArrays[0]; + var start = 0; + batch.copyBoundTextures(boundTextures, MAX_TEXTURES); + for (var i = 0; i < this._bufferSize; ++i) { + var tex = textures[i]; + textures[i] = null; + if (tex._batchEnabled === TICK) { + continue; + } + if (texArray.count >= MAX_TEXTURES) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, i); + start = i; + texArray = textureArrays[++countTexArrays]; + ++TICK; + } + tex._batchEnabled = TICK; + tex.touched = touch; + texArray.elements[texArray.count++] = tex; + } + if (texArray.count > 0) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, this._bufferSize); + ++countTexArrays; + ++TICK; + } + // Clean-up + for (var i = 0; i < boundTextures.length; i++) { + boundTextures[i] = null; + } + BaseTexture._globalBatch = TICK; + }; + /** + * Populating drawcalls for rendering + * @param texArray + * @param start + * @param finish + */ + AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { + var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var dcIndex = this._dcIndex; + var aIndex = this._aIndex; + var iIndex = this._iIndex; + var drawCall = drawCalls[dcIndex]; + drawCall.start = this._iIndex; + drawCall.texArray = texArray; + for (var i = start; i < finish; ++i) { + var sprite = elements[i]; + var tex = sprite._texture.baseTexture; + var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; + elements[i] = null; + if (start < i && drawCall.blend !== spriteBlendMode) { + drawCall.size = iIndex - drawCall.start; + start = i; + drawCall = drawCalls[++dcIndex]; + drawCall.texArray = texArray; + drawCall.start = iIndex; + } + this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); + aIndex += sprite.vertexData.length / 2 * vertexSize; + iIndex += sprite.indices.length; + drawCall.blend = spriteBlendMode; + } + if (start < finish) { + drawCall.size = iIndex - drawCall.start; + ++dcIndex; + } + this._dcIndex = dcIndex; + this._aIndex = aIndex; + this._iIndex = iIndex; + }; + /** + * Bind textures for current rendering + * @param texArray + */ + AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { + var textureSystem = this.renderer.texture; + for (var j = 0; j < texArray.count; j++) { + textureSystem.bind(texArray.elements[j], texArray.ids[j]); + texArray.elements[j] = null; + } + texArray.count = 0; + }; + AbstractBatchRenderer.prototype.updateGeometry = function () { + var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; + if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't + like uploads to the same buffer in a single frame. */ + if (this._packedGeometryPoolSize <= this._flushId) { + this._packedGeometryPoolSize++; + packedGeometries[this._flushId] = new (this.geometryClass)(); + } + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.bind(packedGeometries[this._flushId]); + this.renderer.geometry.updateBuffers(); + this._flushId++; + } + else { + // lets use the faster option, always use buffer number 0 + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.updateBuffers(); + } + }; + AbstractBatchRenderer.prototype.drawBatches = function () { + var dcCount = this._dcIndex; + var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var curTexArray = null; + // Upload textures and do the draw calls + for (var i = 0; i < dcCount; i++) { + var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; + if (curTexArray !== texArray) { + curTexArray = texArray; + this.bindAndClearTexArray(texArray); + } + this.state.blendMode = blend; + stateSystem.set(this.state); + gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); + } + }; + /** Renders the content _now_ and empties the current batch. */ + AbstractBatchRenderer.prototype.flush = function () { + if (this._vertexCount === 0) { + return; + } + this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); + this._indexBuffer = this.getIndexBuffer(this._indexCount); + this._aIndex = 0; + this._iIndex = 0; + this._dcIndex = 0; + this.buildTexturesAndDrawCalls(); + this.updateGeometry(); + this.drawBatches(); + // reset elements buffer for the next flush + this._bufferSize = 0; + this._vertexCount = 0; + this._indexCount = 0; + }; + /** Starts a new sprite batch. */ + AbstractBatchRenderer.prototype.start = function () { + this.renderer.state.set(this.state); + this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES); + this.renderer.shader.bind(this._shader); + if (settings.CAN_UPLOAD_SAME_BUFFER) { + // bind buffer #0, we don't need others + this.renderer.geometry.bind(this._packedGeometries[this._flushId]); + } + }; + /** Stops and flushes the current batch. */ + AbstractBatchRenderer.prototype.stop = function () { + this.flush(); + }; + /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */ + AbstractBatchRenderer.prototype.destroy = function () { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + if (this._packedGeometries[i]) { + this._packedGeometries[i].destroy(); + } + } + this.renderer.off('prerender', this.onPrerender, this); + this._aBuffers = null; + this._iBuffers = null; + this._packedGeometries = null; + this._attributeBuffer = null; + this._indexBuffer = null; + if (this._shader) { + this._shader.destroy(); + this._shader = null; + } + _super.prototype.destroy.call(this); + }; + /** + * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats. + * @param size - minimum capacity required + * @returns - buffer than can hold atleast `size` floats + */ + AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { + // 8 vertices is enough for 2 quads + var roundedP2 = nextPow2(Math.ceil(size / 8)); + var roundedSizeIndex = log2(roundedP2); + var roundedSize = roundedP2 * 8; + if (this._aBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._aBuffers[roundedSize]; + if (!buffer) { + this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); + } + return buffer; + }; + /** + * Fetches an index buffer from `this._iBuffers` that can + * have at least `size` capacity. + * @param size - minimum required capacity + * @returns - buffer that can fit `size` indices. + */ + AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { + // 12 indices is enough for 2 quads + var roundedP2 = nextPow2(Math.ceil(size / 12)); + var roundedSizeIndex = log2(roundedP2); + var roundedSize = roundedP2 * 12; + if (this._iBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._iBuffers[roundedSizeIndex]; + if (!buffer) { + this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); + } + return buffer; + }; + /** + * Takes the four batching parameters of `element`, interleaves + * and pushes them into the batching attribute/index buffers given. + * + * It uses these properties: `vertexData` `uvs`, `textureId` and + * `indicies`. It also uses the "tint" of the base-texture, if + * present. + * @param {PIXI.DisplayObject} element - element being rendered + * @param attributeBuffer - attribute buffer. + * @param indexBuffer - index buffer + * @param aIndex - number of floats already in the attribute buffer + * @param iIndex - number of indices already in `indexBuffer` + */ + AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { + var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; + var packedVertices = aIndex / this.vertexSize; + var uvs = element.uvs; + var indicies = element.indices; + var vertexData = element.vertexData; + var textureId = element._texture.baseTexture._batchLocation; + var alpha = Math.min(element.worldAlpha, 1.0); + var argb = (alpha < 1.0 + && element._texture.baseTexture.alphaMode) + ? premultiplyTint(element._tintRGB, alpha) + : element._tintRGB + (alpha * 255 << 24); + // lets not worry about tint! for now.. + for (var i = 0; i < vertexData.length; i += 2) { + float32View[aIndex++] = vertexData[i]; + float32View[aIndex++] = vertexData[i + 1]; + float32View[aIndex++] = uvs[i]; + float32View[aIndex++] = uvs[i + 1]; + uint32View[aIndex++] = argb; + float32View[aIndex++] = textureId; + } + for (var i = 0; i < indicies.length; i++) { + indexBuffer[iIndex++] = packedVertices + indicies[i]; + } + }; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchDrawCall[]} + */ + AbstractBatchRenderer._drawCallPool = []; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchTextureArray[]} + */ + AbstractBatchRenderer._textureArrayPool = []; + return AbstractBatchRenderer; +}(ObjectRenderer)); + +/** + * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer + * @memberof PIXI + */ +var BatchShaderGenerator = /** @class */ (function () { + /** + * @param vertexSrc - Vertex shader + * @param fragTemplate - Fragment shader template + */ + function BatchShaderGenerator(vertexSrc, fragTemplate) { + this.vertexSrc = vertexSrc; + this.fragTemplate = fragTemplate; + this.programCache = {}; + this.defaultGroupCache = {}; + if (fragTemplate.indexOf('%count%') < 0) { + throw new Error('Fragment template must contain "%count%".'); + } + if (fragTemplate.indexOf('%forloop%') < 0) { + throw new Error('Fragment template must contain "%forloop%".'); + } + } + BatchShaderGenerator.prototype.generateShader = function (maxTextures) { + if (!this.programCache[maxTextures]) { + var sampleValues = new Int32Array(maxTextures); + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); + var fragmentSrc = this.fragTemplate; + fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new Matrix(), + default: this.defaultGroupCache[maxTextures], + }; + return new Shader(this.programCache[maxTextures], uniforms); + }; + BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxTextures - 1) { + src += "if(vTextureId < " + i + ".5)"; + } + src += '\n{'; + src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + }; + return BatchShaderGenerator; +}()); + +/** + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * @memberof PIXI + */ +var BatchGeometry = /** @class */ (function (_super) { + __extends(BatchGeometry, _super); + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + function BatchGeometry(_static) { + if (_static === void 0) { _static = false; } + var _this = _super.call(this) || this; + _this._buffer = new Buffer(null, _static, false); + _this._indexBuffer = new Buffer(null, _static, true); + _this.addAttribute('aVertexPosition', _this._buffer, 2, false, TYPES.FLOAT) + .addAttribute('aTextureCoord', _this._buffer, 2, false, TYPES.FLOAT) + .addAttribute('aColor', _this._buffer, 4, true, TYPES.UNSIGNED_BYTE) + .addAttribute('aTextureId', _this._buffer, 1, true, TYPES.FLOAT) + .addIndex(_this._indexBuffer); + return _this; + } + return BatchGeometry; +}(Geometry)); + +var defaultVertex = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; + +var defaultFragment = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; + +/** @memberof PIXI */ +var BatchPluginFactory = /** @class */ (function () { + function BatchPluginFactory() { + } + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.extensions.add({ + * name: 'invert', + * ref: InvertBatchRenderer, + * type: PIXI.ExtensionType.RendererPlugin, + * }); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @returns {*} New batch renderer plugin + */ + BatchPluginFactory.create = function (options) { + var _a = Object.assign({ + vertex: defaultVertex, + fragment: defaultFragment, + geometryClass: BatchGeometry, + vertexSize: 6, + }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; + return /** @class */ (function (_super) { + __extends(BatchPlugin, _super); + function BatchPlugin(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); + _this.geometryClass = geometryClass; + _this.vertexSize = vertexSize; + return _this; + } + return BatchPlugin; + }(AbstractBatchRenderer)); + }; + Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { + /** + * The default vertex shader source + * @readonly + */ + get: function () { + return defaultVertex; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { + /** + * The default fragment shader source + * @readonly + */ + get: function () { + return defaultFragment; + }, + enumerable: false, + configurable: true + }); + return BatchPluginFactory; +}()); +// Setup the default BatchRenderer plugin, this is what +// we'll actually export at the root level +var BatchRenderer = BatchPluginFactory.create(); +Object.assign(BatchRenderer, { + extension: { + name: 'batch', + type: ExtensionType.RendererPlugin, + }, +}); + +/** + * @memberof PIXI + * @namespace resources + * @see PIXI + * @deprecated since 6.0.0 + */ +var resources = {}; +var _loop_1 = function (name) { + Object.defineProperty(resources, name, { + get: function () { + deprecation('6.0.0', "PIXI.systems." + name + " has moved to PIXI." + name); + return _resources[name]; + }, + }); +}; +for (var name in _resources) { + _loop_1(name); +} +/** + * @memberof PIXI + * @namespace systems + * @see PIXI + * @deprecated since 6.0.0 + */ +var systems = {}; +var _loop_2 = function (name) { + Object.defineProperty(systems, name, { + get: function () { + deprecation('6.0.0', "PIXI.resources." + name + " has moved to PIXI." + name); + return _systems[name]; + }, + }); +}; +for (var name in _systems) { + _loop_2(name); +} + +/** + * @namespace PIXI + */ +/** + * String of the current PIXI version. + * @memberof PIXI + */ +var VERSION = '6.5.10'; + +export { AbstractBatchRenderer, AbstractMultiResource, AbstractRenderer, ArrayResource, Attribute, BaseImageResource, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchPluginFactory, BatchRenderer, BatchShaderGenerator, BatchSystem, BatchTextureArray, Buffer, BufferResource, CanvasResource, ContextSystem, CubeResource, Filter, FilterState, FilterSystem, Framebuffer, FramebufferSystem, GLFramebuffer, GLProgram, GLTexture, Geometry, GeometrySystem, IGLUniformData, INSTALLED, ImageBitmapResource, ImageResource, MaskData, MaskSystem, ObjectRenderer, Program, ProjectionSystem, Quad, QuadUv, RenderTexture, RenderTexturePool, RenderTextureSystem, Renderer, Resource, SVGResource, ScissorSystem, Shader, ShaderSystem, SpriteMaskFilter, State, StateSystem, StencilSystem, System, Texture, TextureGCSystem, TextureMatrix, TextureSystem, TextureUvs, UniformGroup, VERSION, VideoResource, ViewableBuffer, autoDetectRenderer, autoDetectResource, checkMaxIfStatementsInShader, createUBOElements, defaultFilterVertex, defaultVertex$1 as defaultVertex, generateProgram, generateUniformBufferSync, getTestContext, getUBOData, resources, systems, uniformParsers }; +//# sourceMappingURL=core.mjs.map diff --git a/live2d/node_modules/@pixi/core/dist/esm/core.mjs.map b/live2d/node_modules/@pixi/core/dist/esm/core.mjs.map new file mode 100644 index 0000000..7ba4495 --- /dev/null +++ b/live2d/node_modules/@pixi/core/dist/esm/core.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"core.mjs","sources":["../../src/settings.ts","../../src/textures/resources/autoDetectResource.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/textures/resources/Resource.ts","../../src/textures/resources/BufferResource.ts","../../src/textures/BaseTexture.ts","../../src/textures/resources/AbstractMultiResource.ts","../../src/textures/resources/ArrayResource.ts","../../src/textures/resources/BaseImageResource.ts","../../src/textures/resources/CanvasResource.ts","../../src/textures/resources/CubeResource.ts","../../src/textures/resources/ImageResource.ts","../../src/textures/resources/SVGResource.ts","../../src/textures/resources/VideoResource.ts","../../src/textures/resources/ImageBitmapResource.ts","../../src/textures/resources/index.ts","../../src/textures/resources/DepthResource.ts","../../src/framebuffer/Framebuffer.ts","../../src/renderTexture/BaseRenderTexture.ts","../../src/textures/TextureUvs.ts","../../src/textures/Texture.ts","../../src/renderTexture/RenderTexture.ts","../../src/renderTexture/RenderTexturePool.ts","../../src/geometry/Attribute.ts","../../src/geometry/Buffer.ts","../../src/geometry/utils/interleaveTypedArrays.ts","../../src/geometry/Geometry.ts","../../src/utils/Quad.ts","../../src/utils/QuadUv.ts","../../src/shader/UniformGroup.ts","../../src/filters/FilterState.ts","../../src/filters/FilterSystem.ts","../../src/batch/ObjectRenderer.ts","../../src/batch/BatchSystem.ts","../../src/context/ContextSystem.ts","../../src/framebuffer/GLFramebuffer.ts","../../src/framebuffer/FramebufferSystem.ts","../../src/geometry/GeometrySystem.ts","../../src/mask/MaskData.ts","../../src/shader/utils/compileShader.ts","../../src/shader/utils/logProgramError.ts","../../src/shader/utils/defaultValue.ts","../../src/shader/utils/getTestContext.ts","../../src/shader/utils/getMaxFragmentPrecision.ts","../../src/shader/utils/setPrecision.ts","../../src/shader/utils/mapSize.ts","../../src/shader/utils/mapType.ts","../../src/shader/utils/uniformParsers.ts","../../src/shader/utils/generateUniformsSync.ts","../../src/shader/utils/checkMaxIfStatementsInShader.ts","../../src/shader/utils/unsafeEvalSupported.ts","../../src/shader/Program.ts","../../src/shader/Shader.ts","../../src/state/State.ts","../../src/filters/Filter.ts","../../src/textures/TextureMatrix.ts","../../src/filters/spriteMask/SpriteMaskFilter.ts","../../src/mask/MaskSystem.ts","../../src/mask/AbstractMaskSystem.ts","../../src/mask/ScissorSystem.ts","../../src/mask/StencilSystem.ts","../../src/projection/ProjectionSystem.ts","../../src/renderTexture/RenderTextureSystem.ts","../../src/shader/utils/generateUniformBufferSync.ts","../../src/shader/GLProgram.ts","../../src/shader/utils/getAttributeData.ts","../../src/shader/utils/getUniformData.ts","../../src/shader/utils/generateProgram.ts","../../src/shader/ShaderSystem.ts","../../src/state/utils/mapWebGLBlendModesToPixi.ts","../../src/state/StateSystem.ts","../../src/textures/TextureGCSystem.ts","../../src/textures/utils/mapTypeAndFormatToInternalFormat.ts","../../src/textures/GLTexture.ts","../../src/textures/TextureSystem.ts","../../src/AbstractRenderer.ts","../../src/geometry/GLBuffer.ts","../../src/geometry/BufferSystem.ts","../../src/Renderer.ts","../../src/autoDetectRenderer.ts","../../src/fragments/index.ts","../../src/ISystem.ts","../../src/batch/BatchDrawCall.ts","../../src/batch/BatchTextureArray.ts","../../src/geometry/ViewableBuffer.ts","../../src/batch/AbstractBatchRenderer.ts","../../src/batch/BatchShaderGenerator.ts","../../src/batch/BatchGeometry.ts","../../src/batch/BatchPluginFactory.ts","../../src/deprecations.ts","../../src/index.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\nimport { ENV } from '@pixi/constants';\nimport { isMobile } from '@pixi/utils';\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\nexport { settings };\n","import type { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n| ICubeResourceOptions\n| IImageResourceOptions\n| ISVGResourceOptions\n| IVideoResourceOptions\n| IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nexport const INSTALLED: Array> = [];\n\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @returns {PIXI.Resource} The created resource.\n */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n * @memberof PIXI\n */\nexport abstract class Resource\n{\n /** The url of the resource */\n public src: string;\n\n /**\n * If resource has been destroyed.\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\n }\n\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n * @protected\n * @returns Handle the validate event\n */\n load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - true is success\n */\n abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\n\n /**\n * Set the style, optional to override\n * @param _renderer - yeah, renderer!\n * @param _baseTexture - the texture\n * @param _glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\n\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n destroy(): void\n {\n if (!this.destroyed)\n {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n }\n\n /**\n * Abstract, used to auto-detect resource type.\n * @param {*} _source - The source object\n * @param {string} _extension - The extension of source, if set\n */\n static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */\n data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array;\n\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if \n */\n static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;\n\nexport interface IBaseTextureOptions\n{\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\n\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param options - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n\n this.resolution = resolution || settings.RESOLUTION;\n this.width = Math.round((width || 0) * this.resolution) / this.resolution;\n this.height = Math.round((height || 0) * this.resolution) / this.resolution;\n this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n this._wrapMode = wrapMode || settings.WRAP_MODE;\n this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n this.format = format || FORMATS.RGBA;\n this.type = type || TYPES.UNSIGNED_BYTE;\n this.target = target || TARGETS.TEXTURE_2D;\n this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\n this._glTextures = {};\n this.dirtyId = 0;\n this.dirtyStyleId = 0;\n this.cacheId = null;\n this.valid = width > 0 && height > 0;\n this.textureCacheIds = [];\n this.destroyed = false;\n this.resource = null;\n\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\n /**\n * Fired when a not-immediately-available source finishes loading.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when a not-immediately-available source fails to load.\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n\n /**\n * Fired when BaseTexture is updated.\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n\n /**\n * Fired when BaseTexture is destroyed.\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n * @readonly\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n * @readonly\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\n /**\n * Mipmap mode of the texture, affects downscaled images\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * The scale mode to apply when scaling this texture\n * @default PIXI.settings.SCALE_MODE\n */\n get scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * Changes style options of BaseTexture\n * @param scaleMode - Pixi scalemode\n * @param mipmap - enable mipmaps\n * @returns - this\n */\n setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\n\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n * @param desiredWidth - Desired visual width\n * @param desiredHeight - Desired visual height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\n\n /**\n * Sets real size of baseTexture, preserves current resolution.\n * @param realWidth - Full rendered width\n * @param realHeight - Full rendered height\n * @param resolution - Optionally set resolution\n * @returns - this\n */\n setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n * @param resolution - res\n * @returns - this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n\n this._refreshPOT();\n\n return this;\n }\n\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n * @param resource - that is managing this BaseTexture\n * @returns - this\n */\n setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\n\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\n\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\n\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n * @static\n * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n static from(source: ImageSource | string | string[],\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\n\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * Default properties are different from the constructor's defaults.\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign({}, defaultBufferOptions, options || { width, height, type }));\n }\n\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`BaseTexture added to the cache with an id [${id}] that already had an entry`);\n }\n\n BaseTextureCache[id] = baseTexture;\n }\n }\n\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /** Global number of the texture batch, used by multi-texture renderers. */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport type { ISize } from '@pixi/math';\nimport type { IAutoDetectOptions } from './autoDetectResource';\nimport { autoDetectResource } from './autoDetectResource';\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n * @memberof PIXI\n */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\n this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n this.itemDirtyIds.push(-2);\n }\n\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\n\n /**\n * Used from ArrayResource and CubeResource constructors.\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\n\n /**\n * Set a resource by ID\n * @param resource\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /**\n * Set the parent base texture.\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Unset the parent base texture.\n * @param baseTexture\n */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n * @returns - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport type { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n constructor(source: number | Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\n\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @returns - Instance for chaining\n */\n addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /**\n * Add binding\n * @param baseTexture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\n\n /**\n * Upload the resources to the GPU.\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\n\n /**\n * Set cross origin based detecting the url and the crossorigin\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n }\n\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n if (source instanceof HTMLImageElement)\n {\n if (!source.complete || source.naturalWidth === 0)\n {\n return false;\n }\n }\n else if (source instanceof HTMLVideoElement)\n {\n if (source.readyState <= 1)\n {\n return false;\n }\n }\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\n\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement\n {\n const { OffscreenCanvas } = globalThis;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return globalThis.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/** Constructor options for CubeResource */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n * @protected\n */\n linkBaseTexture: boolean;\n\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n * @param renderer\n * @param _baseTexture\n * @param glTexture\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId || glTexture.dirtyId < _baseTexture.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an array of 6 elements\n */\n static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean | string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n constructor(source: HTMLImageElement | string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!this._width && !!this._height)\n {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\n this.preserveBitmap = false;\n this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!globalThis.createImageBitmap;\n this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n this.bitmap = null;\n\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\n\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n * @returns - Cached promise to fill that bitmap\n */\n process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !globalThis.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = globalThis.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === null || this.alphaMode === ALPHA_MODES.UNPACK\n ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\n\n /**\n * Upload the image resource to GPU.\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is string or HTMLImageElement\n */\n static test(source: unknown): source is string | HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean | string;\n}\n/**\n * Resource type for SVG elements and graphics.\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean | string;\n\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(settings.ADAPTER.createCanvas());\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\n width = this._overrideWidth || this._overrideHeight / svgHeight * svgWidth;\n height = this._overrideHeight || this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\n }\n\n /**\n * Get size from an svg string using a regular expression.\n * @param svgString - a serialized svg element\n * @returns - image extension\n */\n static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} - If the source is a SVG source or data file\n */\n static test(source: unknown, extension?: string): boolean\n {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && source.startsWith('data:image/svg+xml'))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n }\n\n /**\n * Regular expression for SVG XML document.\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean | string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n constructor(\n source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions\n )\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.slice(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n * @param _deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n * @returns {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /**\n * Handle video error events.\n * @param event\n */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n * @returns - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (!source.paused && !source.ended && this._isSourceReady());\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n * @returns - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState > 2;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @returns {boolean} `true` if video source\n */\n static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (globalThis.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\n\n /**\n * Used to auto-detect the type of resource.\n * @param {*} source - The source object\n * @returns {boolean} `true` if source is an ImageBitmap\n */\n static test(source: unknown): source is ImageBitmap\n {\n return !!globalThis.createImageBitmap && typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\n{\n /**\n * Upload the texture to the GPU.\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n * @memberof PIXI\n */\nexport class Framebuffer\n{\n /** Width of framebuffer in pixels. */\n public width: number;\n\n /** Height of framebuffer in pixels. */\n public height: number;\n\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n * @default PIXI.MSAA_QUALITY.NONE\n */\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param width - Width of the frame buffer\n * @param height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n this.width = Math.round(width || 100);\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n this.multisample = MSAA_QUALITY.NONE;\n }\n\n /**\n * Reference to the colorTexture.\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\n\n /**\n * Add texture to the colorTexture array.\n * @param index - Index of the array to add the texture to\n * @param texture - Texture to add to the array\n */\n addColorTexture(index = 0, texture?: BaseTexture): this\n {\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer.\n * @param texture - Texture to add.\n */\n addDepthTexture(texture?: BaseTexture): this\n {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable depth on the frame buffer. */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /** Enable stencil on the frame buffer. */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Resize the frame buffer\n * @param width - Width of the frame buffer to resize to\n * @param height - Height of the frame buffer to resize to\n */\n resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys and removes the depth texture added to this framebuffer. */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n\n /** The data structure for the stencil masks. */\n maskStack: Array;\n\n /** The data structure for the filters. */\n filterStack: Array;\n\n /**\n * @param options\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n constructor(options: IBaseTextureOptions = {})\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\n\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n this.maskStack = [];\n this.filterStack = [{}];\n }\n\n /**\n * Resizes the BaseRenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\n\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n * @fires PIXI.BaseTexture#dispose\n */\n dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /** Destroys this texture. */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n * @protected\n * @memberof PIXI\n */\nexport class TextureUvs\n{\n /** X-component of top-left corner `(x0,y0)`. */\n public x0: number;\n\n /** Y-component of top-left corner `(x0,y0)`. */\n public y0: number;\n\n /** X-component of top-right corner `(x1,y1)`. */\n public x1: number;\n\n /** Y-component of top-right corner `(x1,y1)`. */\n public y1: number;\n\n /** X-component of bottom-right corner `(x2,y2)`. */\n public x2: number;\n\n /** Y-component of bottom-right corner `(x2,y2)`. */\n public y2: number;\n\n /** X-component of bottom-left corner `(x3,y3)`. */\n public x3: number;\n\n /** Y-component of bottom-right corner `(x3,y3)`. */\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n this.x0 = 0;\n this.y0 = 0;\n this.x1 = 1;\n this.y1 = 0;\n this.x2 = 1;\n this.y2 = 1;\n this.x3 = 0;\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\n\n /**\n * Sets the texture Uvs based on the given frame information.\n * @protected\n * @param frame - The frame of the texture\n * @param baseFrame - The base frame of the texture\n * @param rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else\n {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:TextureUvs `\n + `x0=${this.x0} y0=${this.y0} `\n + `x1=${this.x1} y1=${this.y1} x2=${this.x2} `\n + `y2=${this.y2} x3=${this.x3} y3=${this.y3}`\n + `]`;\n }\n // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport type { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string | BaseTexture | ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\n/**\n * Used to remove listeners from WHITE and EMPTY Textures\n * @ignore\n */\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\n\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nexport class Texture extends EventEmitter\n{\n /** The base texture that this texture uses. */\n public baseTexture: BaseTexture;\n\n /** This is the area of original texture, before it was put in atlas. */\n public orig: Rectangle;\n\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n */\n public trim: Rectangle;\n\n /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */\n public valid: boolean;\n\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n */\n public noFrame: boolean;\n\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @default {0,0}\n */\n public defaultAnchor: Point;\n\n /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n * @protected\n */\n _updateID: number;\n\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n */\n _frame: Rectangle;\n\n /**\n * The WebGL UV data cache. Can be used as quad UV.\n * @protected\n */\n _uvs: TextureUvs;\n\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n */\n textureCacheIds: Array;\n\n /**\n * @param baseTexture - The base texture source to create the texture from\n * @param frame - The rectangle frame of the texture to show\n * @param orig - The area of original texture\n * @param trim - Trimmed rectangle of original texture\n * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param anchor - Default anchor point used for sprite placement / rotation\n */\n constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\n this.noFrame = false;\n\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n this.baseTexture = baseTexture;\n this._frame = frame;\n this.trim = trim;\n this.valid = false;\n this._uvs = DEFAULT_UVS;\n this.uvMatrix = null;\n this.orig = orig || frame;// new Rectangle(0, 0, 1, 1);\n\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n this._rotate = 2;\n }\n else if (this._rotate % 2 !== 0)\n {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n\n this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n\n this._updateID = 0;\n\n this.textureCacheIds = [];\n\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\n\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n */\n update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n * @protected\n * @param baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n * @param [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url])\n {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\n\n /**\n * Creates a new texture object that acts the same as this one.\n * @returns - The new texture\n */\n clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\n\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\n\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source or array of sources to create texture from\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.Texture} The newly created texture\n */\n static from(source: TextureSource | TextureSource[],\n options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\n\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param url - The remote URL or array of URLs to load.\n * @param options - Optional options to include\n * @returns - A Promise that resolves to a Texture.\n */\n static fromURL(\n url: string | string[], options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\n\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param width - Width of the resource\n * @param height - Height of the resource\n * @param options - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns - The resulting new BaseTexture\n */\n static fromBuffer(buffer: Float32Array | Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\n\n /**\n * Create a texture from a source and add to the cache.\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param imageUrl - File name of texture, for cache and resolving resolution.\n * @param name - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @param options\n * @returns - Output texture\n */\n static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\n\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\n }\n\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n * @param texture - The Texture to add to the cache.\n * @param id - The id that the Texture will be stored against.\n */\n static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\n // eslint-disable-next-line no-console\n console.warn(`Texture added to the cache with an id [${id}] that already had an entry`);\n }\n\n TextureCache[id] = texture;\n }\n }\n\n /**\n * Remove a Texture from the global TextureCache.\n * @param texture - id of a Texture to be removed, or a Texture instance itself\n * @returns - The Texture that was removed\n */\n static removeFromCache(texture: string | Texture): Texture | null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n */\n get frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n */\n get rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /** The width of the Texture in pixels. */\n get width(): number\n {\n return this.orig.width;\n }\n\n /** The height of the Texture in pixels. */\n get height(): number\n {\n return this.orig.height;\n }\n\n /** Utility function for BaseTexture|Texture cast. */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n private static _EMPTY: Texture;\n private static _WHITE: Texture;\n\n /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */\n public static get EMPTY(): Texture\n {\n if (!Texture._EMPTY)\n {\n Texture._EMPTY = new Texture(new BaseTexture());\n removeAllHandlers(Texture._EMPTY);\n removeAllHandlers(Texture._EMPTY.baseTexture);\n }\n\n return Texture._EMPTY;\n }\n\n /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */\n public static get WHITE(): Texture\n {\n if (!Texture._WHITE)\n {\n const canvas = settings.ADAPTER.createCanvas(16, 16);\n const context = canvas.getContext('2d');\n\n canvas.width = 16;\n canvas.height = 16;\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n Texture._WHITE = new Texture(BaseTexture.from(canvas));\n removeAllHandlers(Texture._WHITE);\n removeAllHandlers(Texture._WHITE.baseTexture);\n }\n\n return Texture._WHITE;\n }\n}\n\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n * @memberof PIXI\n */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n * @readonly\n */\n public filterFrame: Rectangle | null;\n\n /**\n * The key for pooled texture of FilterSystem.\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string | number | null;\n\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\n\n /**\n * Resizes the RenderTexture.\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\n\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n * @param resolution - The new resolution to apply to RenderTexture\n */\n setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the render texture\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @returns The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n * @memberof PIXI\n */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string | number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns The new render texture.\n */\n getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil((minWidth * resolution) - 1e-6);\n minHeight = Math.ceil((minHeight * resolution) - 1e-6);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\n\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\n\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n * @param size - Initial size of screen.\n */\n setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n * @memberof PIXI\n */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\n\n /**\n * Helper function that creates an Attribute based on the information provided\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n * @type {PIXI.IArrayBuffer}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n * @private\n * @type {Object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\n /**\n * @param {PIXI.IArrayBuffer} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\n\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer.\n */\n update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\n\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @returns - A new Buffer based on the data provided.\n */\n static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport type { TYPES } from '@pixi/constants';\nimport { BUFFER_TYPE } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n * @memberof PIXI\n */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @returns - Returns self, useful for chaining.\n */\n addAttribute(id: string, buffer: Buffer | Float32Array | Uint32Array | Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n * @param id - The name of the attribute required\n * @returns - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n * @param id - The name of the buffer required.\n * @returns - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\n\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @returns - Returns self, useful for chaining.\n */\n addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n * @returns - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\n\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n * @returns - Returns self, useful for chaining.\n */\n interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\n\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n * @param geometries - array of geometries to merge\n * @returns - Shiny new geometry!\n */\n static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Helper class to create a quad with uvs like in v4\n * @memberof PIXI\n */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n\n /** An array of vertices. */\n vertices: Float32Array;\n\n /** The Uvs of the quad. */\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\n this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1,\n ]);\n\n this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\n\n /**\n * Maps two Rectangle to the quad.\n * @param targetTextureFrame - The first rectangle\n * @param destinationFrame - The second rectangle\n * @returns - Returns itself.\n */\n map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * Legacy upload method, just marks buffers dirty.\n * @returns - Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n * @memberof PIXI\n */\nexport class UniformGroup>\n{\n /**\n * Uniform values\n * @member {object}\n */\n public readonly uniforms: LAYOUT;\n\n /**\n * Its a group and not a single uniforms.\n * @default true\n */\n public readonly group: boolean;\n\n /**\n * unique id\n * @protected\n */\n public id: number;\n syncUniforms: Dict;\n\n /**\n * Dirty version\n * @protected\n */\n dirtyId: number;\n\n /** Flag for if uniforms wont be changed after creation. */\n static: boolean;\n\n /** Flags whether this group is treated like a uniform buffer object. */\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer.\n * @param isStatic - Uniforms wont be changed after creation.\n * @param isUbo - If true, will treat this uniform group as a uniform buffer object.\n */\n constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n this.dirtyId = 0;\n this.id = UID++;\n this.static = !!isStatic;\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else\n {\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n }\n\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\n\n /**\n * A short hand function for creating a static UBO UniformGroup.\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import type { Matrix } from '@pixi/math';\nimport { Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n * @memberof PIXI\n */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n * @property {PIXI.Rectangle} outputFrame -\n * @property {Float32Array} inputSize -\n * @property {Float32Array} inputPixel -\n * @property {Float32Array} inputClamp -\n * @property {number} resolution -\n * @property {Float32Array} filterArea -\n * @property {Float32Array} filterClamp -\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n if (autoFit)\n {\n state.sourceFrame.fit(sourceFrameProjected);\n\n if (state.sourceFrame.width <= 0 || state.sourceFrame.height <= 0)\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n }\n else if (!state.sourceFrame.intersects(sourceFrameProjected))\n {\n state.sourceFrame.width = 0;\n state.sourceFrame.height = 0;\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n }\n\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\n\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\n\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n }\n\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n }\n\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @returns The mapped matrix.\n */\n calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\n\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @returns - The new render texture.\n */\n protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\n\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (frame.width <= 0 || frame.height <= 0 || bindingSourceFrame.width <= 0 || bindingSourceFrame.height <= 0)\n {\n return;\n }\n\n if (transform)\n {\n const { a, b, c, d } = transform;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4))\n {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /** Stub method that should be used to empty the current batch by rendering objects now. */\n flush(): void\n {\n // flush!\n }\n\n /** Generic destruction method that frees all resources. This should be called by subclasses. */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n start(): void\n {\n // set the shader..\n }\n\n /** Stops the renderer. It should free up any state and become dormant. */\n stop(): void\n {\n this.flush();\n }\n\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n * @param {PIXI.DisplayObject} _object - The object to render.\n */\n render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\n\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /** Reset the system to an empty renderer */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\n }\n }\n\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict\n{\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n }\n\n /**\n * Initializes the context.\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n }\n\n /**\n * Initialize from context options\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\n\n /**\n * Helper class to create a WebGL Context\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @returns {WebGLRenderingContext} the WebGL context\n */\n createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options) || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n loseContext: gl.getExtension('WEBGL_lose_context'),\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), // eslint-disable-line camelcase\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n if (this.webGLVersion === 1)\n {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2)\n {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n // Prevent default to be able to restore the context\n event.preventDefault();\n\n // Restore the context after this event has exited\n setTimeout(() =>\n {\n if (this.gl.isContextLost() && this.extensions.loseContext)\n {\n this.extensions.loseContext.restoreContext();\n }\n }, 0);\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (attributes && !attributes.stencil)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n }\n}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context.\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n /** The WebGL framebuffer. */\n public framebuffer: WebGLFramebuffer;\n\n /** Stencil+depth , usually costs 32bits per pixel. */\n public stencil: WebGLRenderbuffer;\n\n /** Detected AA samples number. */\n public multisample: MSAA_QUALITY;\n\n /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */\n public msaaBuffer: WebGLRenderbuffer;\n\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n */\n public blitFramebuffer: Framebuffer;\n\n /** Latest known version of framebuffer. */\n dirtyId: number;\n\n /** Latest known version of framebuffer format. */\n dirtyFormat: number;\n\n /** Latest known version of framebuffer size. */\n dirtySize: number;\n\n /** Store the current mipmap of the textures the framebuffer will write too. */\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\n this.framebuffer = framebuffer;\n this.stencil = null;\n this.dirtyId = -1;\n this.dirtyFormat = -1;\n this.dirtySize = -1;\n this.multisample = MSAA_QUALITY.NONE;\n this.msaaBuffer = null;\n this.blitFramebuffer = null;\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n /** A list of managed framebuffers. */\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /** Framebuffer value that shows that we don't know what is bound. */\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedFramebuffers = [];\n this.unknownFramebuffer = new Framebuffer(10, 10);\n\n this.msaaSamples = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n }\n\n /**\n * Bind a framebuffer.\n * @param framebuffer\n * @param frame - frame, default is framebuffer size\n * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0\n */\n bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n }\n\n /**\n * Set the WebGLRenderingContext's viewport.\n * @param x - X position of viewport\n * @param y - Y position of viewport\n * @param width - Width of viewport\n * @param height - Height of viewport\n */\n setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n * @readonly\n */\n get size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\n\n /**\n * Clear the color of the context\n * @param r - Red value from 0 to 1\n * @param g - Green value from 0 to 1\n * @param b - Blue value from 0 to 1\n * @param a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n * @protected\n * @param framebuffer\n * @returns - created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n * @param framebuffer\n * @protected\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n * @param framebuffer\n * @param mipLevel\n * @protected\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled.\n * @param framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\n\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n * @param samples - number of samples\n * @returns - recommended number of samples\n */\n protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\n\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n * @param framebuffer - by default it blits \"into itself\", from renderBuffer to texture.\n * @param sourcePixels - source rectangle in pixels\n * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(\n sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom,\n destPixels.left, destPixels.top, destPixels.right, destPixels.bottom,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\n\n /**\n * Disposes framebuffer.\n * @param framebuffer - framebuffer that has to be disposed of\n * @param contextLost - If context was lost, we suppress all delete function calls\n */\n disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\n }\n\n /**\n * Disposes all framebuffers, but not textures bound to them.\n * @param [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\n }\n\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n * @private\n */\n forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\n\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\n }\n\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n }\n\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\n }\n\n /**\n * Check compatibility between a geometry and a program\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\n }\n }\n\n /**\n * Takes a geometry and program and generates a unique signature for them.\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @returns - Unique signature of the geometry and program\n */\n protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\n console.warn(`PIXI Geometry attribute '${j}' size cannot be determined (likely the bound shader does not have the attribute)`); // eslint-disable-line\n }\n\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\n\n /**\n * Disposes geometry.\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\n\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem)\n {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\n\n /**\n * Dispose all WebGL resources of all managed geometries.\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n }\n\n /**\n * Draws the currently bound geometry.\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else\n {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else\n {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport type { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { COLOR_MASK_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /** Color mask. */\n public colorMask: COLOR_MASK_BITS;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n * @private\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n * @private\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * pre-computed color mask\n * @private\n */\n _colorMask: number;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.colorMask = 0xf;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._colorMask = 0xf;\n this._target = null;\n }\n\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /**\n * Copies counters from maskData above, called from pushMask().\n * @param maskAbove\n */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n }\n}\n","/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @returns {WebGLShader} the shader\n */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\n}\n","/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n\n/**\n *\n * logs out any program errors\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(\n type: string,\n size: number\n): number | Float32Array | Int32Array | Uint32Array | boolean | boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\n/**\n * returns a little WebGL context to use for program inspection.\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = settings.ADAPTER.createCanvas();\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = (canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext));\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n * @returns {string} modified shader source\n */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH)\n {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {string} type\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\n}\n","/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n if(uv[\"${name}\"] !== ud[\"${name}\"].value)\n {\n ud[\"${name}\"].value = uv[\"${name}\"]\n gl.uniform1f(ud[\"${name}\"].location, uv[\"${name}\"])\n }\n `,\n },\n // handling samplers\n {\n test: (data: any, uniform: any): boolean =>\n // eslint-disable-next-line max-len,no-eq-null,eqeqeq\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray && (uniform == null || uniform.castToBaseTexture !== undefined),\n code: (name: string): string => `t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"${name}\"], t);\n\n if(ud[\"${name}\"].value !== t)\n {\n ud[\"${name}\"].value = t;\n gl.uniform1i(ud[\"${name}\"].location, t);\\n; // eslint-disable-line max-len\n }`,\n },\n // uploading pixi matrix object to mat3\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && !data.isArray && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\n var ${name}_matrix = uv.${name}.toArray(true);\n\n data[offset] = ${name}_matrix[0];\n data[offset+1] = ${name}_matrix[1];\n data[offset+2] = ${name}_matrix[2];\n \n data[offset + 4] = ${name}_matrix[3];\n data[offset + 5] = ${name}_matrix[4];\n data[offset + 6] = ${name}_matrix[5];\n \n data[offset + 8] = ${name}_matrix[6];\n data[offset + 9] = ${name}_matrix[7];\n data[offset + 10] = ${name}_matrix[8];\n `\n ,\n\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray && uniform.x !== undefined,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"${name}\"].location, v.x, v.y);\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"${name}\"].location, v[0], v[1]);\n }\n `,\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"${name}\"].location, v.x, v.y, v.width, v.height)\n }`,\n codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n `\n },\n // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1 && !data.isArray,\n code: (name: string): string =>\n `\n cv = ud[\"${name}\"].value;\n v = uv[\"${name}\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"${name}\"].location, v[0], v[1], v[2], v[3])\n }`,\n },\n];\n\n","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\n\n vec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }`,\n\n vec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }`,\n\n vec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }`,\n\n int: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n ivec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n ivec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n ivec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n uint: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }`,\n uvec2: `\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }`,\n uvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }`,\n uvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }`,\n\n bool: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }`,\n bvec2: `\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }`,\n bvec3: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }`,\n bvec4: `\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }`,\n\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n samplerCube: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n sampler2DArray: `\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }`,\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = data.size === 1 && !data.isArray ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\n }\n\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n * @private\n * @returns {boolean} `true` if `new Function` is supported.\n */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\n/**\n * A helper class for shaders.\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\n disposeRunner: Runner;\n\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n\n this.disposeRunner = new Runner('disposeShader');\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n\n this.disposeRunner.emit(this);\n this.disposeRunner.destroy();\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\n\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n * @memberof PIXI\n */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n * @default 0\n */\n get polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/core:State `\n + `blendMode=${this.blendMode} `\n + `clockwiseFrontFace=${this.clockwiseFrontFace} `\n + `culling=${this.culling} `\n + `depthMask=${this.depthMask} `\n + `polygonOffset=${this.polygonOffset}`\n + `]`;\n }\n // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { settings } from '@pixi/settings';\nimport { Program } from '../shader/Program';\nimport { Shader } from '../shader/Shader';\nimport { State } from '../state/State';\nimport defaultFragment from './defaultFilter.frag';\nimport defaultVertex from './defaultFilter.vert';\n\nimport type { MSAA_QUALITY, BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterState } from './FilterState';\nimport type { FilterSystem } from './FilterSystem';\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n * @memberof PIXI\n */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\n this.padding = 0;\n this.resolution = settings.FILTER_RESOLUTION;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this.autoFit = true;\n this.state = new State();\n }\n\n /**\n * Applies the filter\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [_currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @memberof PIXI\n */\nexport class TextureMatrix\n{\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @readonly\n */\n public mapCoord: Matrix;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n * @default 0\n */\n public clampOffset: number;\n\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n * @default 0.5\n */\n public clampMargin: number;\n\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n */\n readonly uClampFrame: Float32Array;\n\n /** Normalized clamp offset. Calculated based on clampOffset. */\n readonly uClampOffset: Float32Array;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _textureID: number;\n\n /**\n * Tracks Texture frame changes.\n * @protected\n */\n _updateID: number;\n _texture: Texture;\n\n /**\n * If texture size is the same as baseTexture.\n * @default false\n * @readonly\n */\n isSimple: boolean;\n\n /**\n * @param texture - observed texture\n * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n */\n constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\n this.mapCoord = new Matrix();\n this.uClampFrame = new Float32Array(4);\n this.uClampOffset = new Float32Array(2);\n this._textureID = -1;\n this._updateID = 0;\n\n this.clampOffset = 0;\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n this.isSimple = false;\n }\n\n /** Texture property. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\n\n /**\n * Multiplies uvs array to transform\n * @param uvs - mesh uvs\n * @param [out=uvs] - output\n * @returns - output\n */\n multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n\n return out;\n }\n\n /**\n * Updates matrices if texture was changed.\n * @param [forceUpdate=false] - if true, matrices will be updated any case\n * @returns - Whether or not it was updated\n */\n update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport type { Point } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\n}\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n * @memberof PIXI\n */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\n\n /**\n * Applies the filter\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n * @memberof PIXI\n */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\n\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data.\n */\n push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n maskData._colorMask = maskAbove ? maskAbove._colorMask : 0xf;\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.pushColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n }\n\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from\n */\n pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n case MASK_TYPES.COLOR:\n this.popColorMask(maskData);\n break;\n default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /**\n * Sets type of MaskData based on its maskObject.\n * @param maskData\n */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (!maskObject)\n {\n maskData.type = MASK_TYPES.COLOR;\n }\n else if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\n }\n\n /**\n * Applies the Mask and adds it to the current filter stack.\n * @param maskData - Sprite to be used as the mask.\n */\n pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\n }\n\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n * @param maskData - Sprite to be used as the mask.\n */\n popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n /**\n * Pushes the color mask.\n * @param maskData - The mask data\n */\n pushColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = maskData._colorMask = currColorMask & maskData.colorMask;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n /**\n * Pops the color mask.\n * @param maskData - The mask data\n */\n popColorMask(maskData: MaskData): void\n {\n const currColorMask = maskData._colorMask;\n const nextColorMask = this.maskStack.length > 0\n ? this.maskStack[this.maskStack.length - 1]._colorMask : 0xf;\n\n if (nextColorMask !== currColorMask)\n {\n this.renderer.gl.colorMask(\n (nextColorMask & 0x1) !== 0,\n (nextColorMask & 0x2) !== 0,\n (nextColorMask & 0x4) !== 0,\n (nextColorMask & 0x8) !== 0\n );\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\n\nconst tempMatrix = new Matrix();\nconst rectPool: Rectangle[] = [];\n\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n * @memberof PIXI\n */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n const rect = maskObject.getBounds(true, rectPool.pop() ?? new Rectangle());\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n }\n\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData - mask data\n * @returns whether Whether the object can be scissor mask\n */\n public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\n\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n * @param maskData - The mask data.\n */\n pop(maskData?: MaskData): void\n {\n const { gl } = this.renderer;\n\n if (maskData)\n {\n rectPool.push(maskData._scissorRectLocal);\n }\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\nimport { settings } from '@pixi/settings';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n\n maskData._stencilCounter++;\n\n const colorMask = maskData._colorMask;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 1) !== 0,\n (colorMask & 2) !== 0,\n (colorMask & 4) !== 0,\n (colorMask & 8) !== 0\n );\n }\n\n this._useCurrent();\n }\n\n /**\n * Pops stencil mask. MaskData is already removed from stack\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\n const maskData = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n const colorMask = maskData ? maskData._colorMask : 0xf;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = 0;\n gl.colorMask(false, false, false, false);\n }\n\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n if (colorMask !== 0)\n {\n maskData._colorMask = colorMask;\n gl.colorMask(\n (colorMask & 0x1) !== 0,\n (colorMask & 0x2) !== 0,\n (colorMask & 0x4) !== 0,\n (colorMask & 0x8) !== 0\n );\n }\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n }\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n * @memberof PIXI\n */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader)\n {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n }\n\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n * @param _destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n * @param _matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport type { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n * @memberof PIXI\n */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n\n /**\n * Bind the current render texture.\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\n\n /**\n * Erases the render texture and fills the drawing area with a colour.\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport type { IUniformData } from '../Program';\nimport type { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\n float: `\n data[offset] = v;\n `,\n vec2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n `,\n vec3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n `,\n vec4: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n `,\n mat2: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n `,\n mat3: `\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n `,\n mat4: `\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n `\n};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement\n{\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\n\n/**\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n * @ignore\n * @param uniformData\n */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const funcFragments = [`\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n `];\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n\n t = 0;\n\n for(var i=0; i < ${uboElement.data.size * rowSize}; i++)\n {\n for(var j = 0; j < ${elementSize}; j++)\n {\n data[offset++] = v[t++];\n }\n offset += ${remainder};\n }\n\n `);\n }\n else\n {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n * @memberof PIXI\n */\nexport class GLProgram\n{\n /** The shader program. */\n public program: WebGLProgram;\n\n /**\n * Holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands.\n */\n public uniformData: Dict;\n\n /**\n * UniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n */\n public uniformGroups: Dict;\n\n /** A hash that stores where UBOs are bound to on the program. */\n public uniformBufferBindings: Dict;\n\n /** A hash for lazily-generated uniform uploading functions. */\n public uniformSync: Dict;\n\n /**\n * A place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program.\n * @param program - webgl program\n * @param uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n this.program = program;\n this.uniformData = uniformData;\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n\n /** Destroys this program. */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import type { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\n\n/**\n * returns the attribute data from the program\n * @private\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n * @returns {object} the attribute data for this program\n */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import type { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\n\n/**\n * returns the uniform data from the program\n * @private\n * @param program - the webgl program\n * @param gl - the WebGL context\n * @returns {object} the uniform data for this program\n */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import type { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc))\n {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import type { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\n\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n * @private\n */\n systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\n\n /**\n * Changes the current shader to the one given in parameter.\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.disposeRunner.add(this);\n\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\n\n /**\n * Uploads the uniforms values to the currently bound shader.\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\n\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n * @param group\n * @param glProgram\n * @param syncData\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\n\n /**\n * Syncs uniform buffers\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\n\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\n\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n * @param group - The uniform group to get signature of\n * @param group.uniforms\n * @param uniformData - Uniform information generated by the shader\n * @param preFix\n * @returns Unique signature of the uniform group\n */\n private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\n\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n * @returns The glProgram for the currently bound Shader for this context\n */\n getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\n\n /**\n * Generates a glProgram version of the Shader provided.\n * @param shader - The shader that the glProgram will be based on.\n * @returns A shiny new glProgram!\n */\n generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /**\n * Disposes shader.\n * If disposing one equals with current shader, set current as null.\n * @param shader - Shader object\n */\n disposeShader(shader: Shader): void\n {\n if (this.shader === shader)\n {\n this.shader = null;\n }\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Maps gl blend combinations to WebGL.\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @returns {number[][]} Mapped modes.\n */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n\n return array;\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {Function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {Function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\n\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\n\n /**\n * Sets whether to enable or disable polygon offset fill.\n * @param value - Turn on or off webgl polygon offset testing.\n */\n setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\n\n /**\n * Sets whether to enable or disable cull face.\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n }\n\n /**\n * Sets the polygon offset.\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\n\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\n }\n\n /**\n * A private little wrapper function that we call to check the blend mode.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\n\n /**\n * A private little wrapper function that we call to check the polygon offset.\n * @param system - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture\n{\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\n}\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n * @memberof PIXI\n */\nexport class TextureGCSystem implements ISystem\n{\n /**\n * Count\n * @readonly\n */\n public count: number;\n\n /**\n * Check count\n * @readonly\n */\n public checkCount: number;\n\n /**\n * Maximum idle time, in seconds\n * @see PIXI.settings.GC_MAX_IDLE\n */\n public maxIdle: number;\n\n /**\n * Maximum number of item to check\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n public checkCountMax: number;\n\n /**\n * Current garbage collection mode\n * @see PIXI.settings.GC_MODE\n */\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.count = 0;\n this.checkCount = 0;\n this.maxIdle = settings.GC_MAX_IDLE;\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n this.mode = settings.GC_MODE;\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\n }\n\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\n }\n\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @returns Lookup table.\n */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n{ [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in globalThis && gl instanceof globalThis.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context.\n * @memberof PIXI\n */\nexport class GLTexture\n{\n /** The WebGL texture. */\n public texture: WebGLTexture;\n\n /** Width of texture that was used in texImage2D. */\n public width: number;\n\n /** Height of texture that was used in texImage2D. */\n public height: number;\n\n /** Whether mip levels has to be generated. */\n public mipmap: boolean;\n\n /** WrapMode copied from baseTexture. */\n public wrapMode: number;\n\n /** Type copied from baseTexture. */\n public type: number;\n\n /** Type copied from baseTexture. */\n public internalFormat: number;\n\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n /** Texture contents dirty flag. */\n dirtyId: number;\n\n /** Texture style dirty flag. */\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n this.texture = texture;\n this.width = -1;\n this.height = -1;\n this.dirtyId = -1;\n this.dirtyStyleId = -1;\n this.mipmap = false;\n this.wrapMode = 33071;\n this.type = TYPES.UNSIGNED_BYTE;\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n * @memberof PIXI\n */\nexport class TextureSystem implements ISystem\n{\n /**\n * Bound textures.\n * @readonly\n */\n public boundTextures: BaseTexture[];\n\n /**\n * List of managed textures.\n * @readonly\n */\n public managedTextures: Array;\n\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n\n /**\n * BaseTexture value that shows that we don't know what is bound.\n * @readonly\n */\n protected unknownTexture: BaseTexture;\n\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @private\n */\n protected _unknownBoundTextures: boolean;\n\n /**\n * Current location.\n * @readonly\n */\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this system works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n this.boundTextures = [];\n this.currentLocation = -1;\n this.managedTextures = [];\n\n this._unknownBoundTextures = false;\n this.unknownTexture = new BaseTexture();\n\n this.hasIntegerTextures = false;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\n }\n\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n * @param texture - Texture to bind\n * @param [location=0] - Location to bind at\n */\n bind(texture: Texture | BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n else if (glTexture.dirtyStyleId !== texture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n }\n\n /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */\n reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture.\n * @param texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n }\n\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n * @param maxTextures - number of locations to check\n */\n ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n * @private\n * @param texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else\n {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\n\n /**\n * Deletes the texture from WebGL\n * @private\n * @param texture - the texture to destroy\n * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n }\n\n /**\n * Update texture style such as mipmap flag\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\n\n /**\n * Set style for texture\n * @private\n * @param texture - Texture to update\n * @param glTexture\n */\n setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\n/**\n * Renderer options supplied to constructor.\n * @memberof PIXI\n * @see PIXI.settings.RENDER_OPTIONS\n */\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n /** The canvas to use as the view. If omitted, a new canvas will be created. */\n view?: HTMLCanvasElement;\n /**\n * The width of the renderer's view.\n * @default 800\n */\n width?: number;\n /**\n * The height of the renderer's view.\n * @default 600\n */\n height?: number;\n /**\n * The resolution / device pixel ratio of the renderer.\n * @default PIXI.settings.RESOLUTION\n */\n resolution?: number;\n /**\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @default false\n */\n autoDensity?: boolean;\n\n /**\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @default 0x000000\n */\n backgroundColor?: number;\n /**\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @default 1\n */\n backgroundAlpha?: number;\n /**\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`.\n *\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @default true\n */\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated since 6.0.0\n */\n transparent?: boolean;\n /**\n * Whether to clear the canvas before new render passes.\n * @default true\n */\n clearBeforeRender?: boolean;\n\n /** **WebGL Only.** User-provided WebGL rendering context object. */\n context?: IRenderingContext;\n /**\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @default false\n */\n antialias?: boolean;\n /**\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n */\n powerPreference?: WebGLPowerPreference;\n /**\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @default false\n */\n preserveDrawingBuffer?: boolean;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions\n{\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions\n{\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\n /**\n * @param type - The renderer type.\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n * @member {object}\n * @readonly\n */\n this.options = options;\n\n /**\n * The type of the renderer.\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n this.type = type;\n\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n * @member {PIXI.Rectangle}\n */\n this.screen = new Rectangle(0, 0, options.width, options.height);\n\n /**\n * The canvas element that everything is drawn to.\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || settings.ADAPTER.createCanvas();\n\n /**\n * The resolution / device pixel ratio of the renderer.\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n this.resolution = options.resolution || settings.RESOLUTION;\n\n /**\n * Pass-thru setting for the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n * @member {boolean}\n */\n this.useContextAlpha = options.useContextAlpha;\n\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n * @member {boolean}\n */\n this.autoDensity = !!options.autoDensity;\n\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n * @member {boolean}\n */\n this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n * @member {boolean}\n * @default\n */\n this.clearBeforeRender = options.clearBeforeRender;\n\n /**\n * The background color as a number.\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\n /**\n * The background color as an [R, G, B, A] array.\n * @member {number[]}\n * @protected\n */\n this._backgroundColorRgba = [0, 0, 0, 1];\n\n /**\n * The background color as a string.\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n\n /**\n * The last root object that the renderer tried to render.\n * @member {PIXI.DisplayObject}\n * @protected\n */\n this._lastObjectRendered = null;\n\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n * @member {number}\n * @readonly\n * @default 800\n */\n get width(): number\n {\n return this.view.width;\n }\n\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n * @member {number}\n * @readonly\n * @default 600\n */\n get height(): number\n {\n return this.view.height;\n }\n\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\n\n /**\n * Fired after view has been resized.\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n }\n\n /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @returns A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @returns A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n /**\n * Adds a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system\n * @returns Return instance of renderer\n */\n abstract addSystem(ClassRef: ISystemConstructor, name: string): this;\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n }\n\n /**\n * The background color to fill if not transparent\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n * @class\n * @memberof PIXI\n */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\n\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n * @param buffer - the buffer to bind to the renderer\n */\n bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\n\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n }\n\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\n\n /**\n * Will ensure the data in the buffer is uploaded to the GPU.\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n }\n\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\n\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @param buffer\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport type { Rectangle } from '@pixi/math';\nimport { Matrix } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\nimport { extensions, ExtensionType } from '@pixi/extensions';\n\nexport interface IRendererPluginConstructor\n{\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin\n{\n destroy(): void;\n}\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n * @memberof PIXI\n */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\n\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n * @param options\n * @private\n */\n static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\n\n /**\n * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\n this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\n this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\n this.context.initFromOptions({\n alpha: !!this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: this.useContextAlpha && this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: this.options.powerPreference,\n });\n }\n\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\n }\n\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param name - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @returns Return instance of renderer\n */\n addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n * @param displayObject - The object to be rendered.\n * @param {object} [options] - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\n\n /**\n * Resizes the WebGL view to the specified width and height.\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n * @returns Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\n\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins = {};\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Renderer.registerPlugin() has been deprecated, please use extensions.add() instead.');\n // #endif\n extensions.add({\n name: pluginName,\n type: ExtensionType.RendererPlugin,\n ref: ctor,\n });\n }\n}\n\n// Handle registration of extensions\nextensions.handleByMap(ExtensionType.RendererPlugin, Renderer.__plugins);\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\n/**\n * Renderer options supplied to `autoDetectRenderer`.\n * @memberof PIXI\n */\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer.\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters.\n * @param {boolean} [options.antialias=false] -\n * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance.\n * @param {boolean} [options.autoDensity=false] -\n * Whether the CSS dimensions of the renderer's view should be resized automatically.\n * @param {number} [options.backgroundAlpha=1] -\n * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque).\n * @param {number} [options.backgroundColor=0x000000] -\n * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`).\n * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes.\n * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object.\n * @param {boolean} [options.forceCanvas=false] -\n * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when\n * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored.\n * @param {number} [options.height=600] - The height of the renderer's view.\n * @param {string} [options.powerPreference] -\n * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context,\n * can be `'default'`, `'high-performance'` or `'low-power'`.\n * Setting to `'high-performance'` will prioritize rendering performance over power consumption,\n * while setting to `'low-power'` will prioritize power saving over rendering performance.\n * @param {boolean} [options.premultipliedAlpha=true] -\n * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha.\n * @param {boolean} [options.preserveDrawingBuffer=false] -\n * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve\n * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] -\n * The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.transparent] -\n * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \\\n * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`.\n * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] -\n * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * If you want to set transparency, please use `backgroundAlpha`. \\\n * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be\n * set to `true` and `premultipliedAlpha` will be to `false`.\n * @param {HTMLCanvasElement} [options.view=null] -\n * The canvas to use as the view. If omitted, a new canvas will be created.\n * @param {number} [options.width=800] - The width of the renderer's view.\n * @returns {PIXI.Renderer|PIXI.CanvasRenderer}\n * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}.\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import $defaultVertex from './default.vert';\nimport $defaultFilterVertex from './defaultFilter.vert';\n\n/**\n * Default vertex shader\n * @memberof PIXI\n * @member {string} defaultVertex\n */\n\n/**\n * Default filter vertex shader\n * @memberof PIXI\n * @member {string} defaultFilterVertex\n */\n\n// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types\n// of defaultVertex, defaultFilterVertex.\nconst defaultVertex: string = $defaultVertex;\nconst defaultFilterVertex: string = $defaultFilterVertex;\n\nexport { defaultVertex, defaultFilterVertex };\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /** Generic destroy methods to be overridden by the subclass */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n * @memberof PIXI\n */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n * @memberof PIXI\n */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n\n /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */\n public rawBinaryData: ArrayBuffer;\n\n /** View on the raw binary data as a `Uint32Array`. */\n public uint32View: Uint32Array;\n\n /** View on the raw binary data as a `Float32Array`. */\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array)\n {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\n\n this.uint32View = new Uint32Array(this.rawBinaryData);\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /** View on the raw binary data as a `Int8Array`. */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /** View on the raw binary data as a `Uint8Array`. */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /** View on the raw binary data as a `Int16Array`. */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /** View on the raw binary data as a `Uint16Array`. */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /** View on the raw binary data as a `Int32Array`. */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\n\n /**\n * Returns the view of the given type.\n * @param type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @returns - typed array of given type\n */\n view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /** Destroys all buffer references. Do not use after calling this. */\n destroy(): void\n {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n }\n\n static sizeOf(type: string): number\n {\n switch (type)\n {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(`${type} isn't a valid view type`);\n }\n }\n}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n * @memberof PIXI\n */\nexport interface IBatchableElement\n{\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\n}\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n * @memberof PIXI\n */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = null;\n this.geometryClass = null;\n this.vertexSize = null;\n this.state = State.for2d();\n this.size = settings.SPRITE_BATCH_SIZE * 4;\n this._vertexCount = 0;\n this._indexCount = 0;\n this._bufferedElements = [];\n this._bufferedTextures = [];\n this._bufferSize = 0;\n this._shader = null;\n this._packedGeometries = [];\n this._packedGeometryPoolSize = 2;\n this._flushId = 0;\n this._aBuffers = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */\n onPrerender(): void\n {\n this._flushId = 0;\n }\n\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\n\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n }\n\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /**\n * Populating drawcalls for rendering\n * @param texArray\n * @param start\n * @param finish\n */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /**\n * Bind textures for current rendering\n * @param texArray\n */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId)\n {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\n\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\n\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n * @param size - minimum capacity required\n * @returns - buffer than can hold atleast `size` floats\n */\n getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\n\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n * @param size - minimum required capacity\n * @returns - buffer that can fit `size` indices.\n */\n getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\n\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n }\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchDrawCall[]}\n */\n static _drawCallPool: Array = [];\n\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n * @member {PIXI.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\n this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(this._indexBuffer);\n }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class BatchPluginFactory\n{\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.extensions.add({\n * name: 'invert',\n * ref: InvertBatchRenderer,\n * type: PIXI.ExtensionType.RendererPlugin,\n * });\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @returns {*} New batch renderer plugin\n */\n static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n\nObject.assign(BatchRenderer, {\n extension: {\n name: 'batch',\n type: ExtensionType.RendererPlugin,\n } as ExtensionMetadata,\n});\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import './settings';\n\n/**\n * @namespace PIXI\n */\n\n/**\n * String of the current PIXI version.\n * @memberof PIXI\n */\nexport const VERSION = '$_VERSION';\n\nexport * from '@pixi/extensions';\nexport * from './textures/resources';\nexport * from './systems';\nexport * from './IRenderingContext';\nexport * from './IRenderableObject';\nexport * from './autoDetectRenderer';\nexport * from './fragments';\nexport * from './ISystem';\nexport * from './Renderer';\nexport * from './AbstractRenderer';\nexport * from './framebuffer/Framebuffer';\nexport * from './framebuffer/GLFramebuffer';\nexport * from './textures/Texture';\nexport * from './textures/BaseTexture';\nexport * from './textures/GLTexture';\nexport * from './textures/TextureMatrix';\nexport * from './renderTexture/RenderTexture';\nexport * from './renderTexture/RenderTexturePool';\nexport * from './renderTexture/BaseRenderTexture';\nexport * from './textures/TextureUvs';\nexport * from './state/State';\nexport * from './batch/ObjectRenderer';\nexport * from './batch/AbstractBatchRenderer';\nexport * from './batch/BatchPluginFactory';\nexport * from './batch/BatchShaderGenerator';\nexport * from './batch/BatchGeometry';\nexport * from './batch/BatchDrawCall';\nexport * from './batch/BatchTextureArray';\nexport * from './utils/Quad';\nexport * from './utils/QuadUv';\nexport * from './shader/utils/checkMaxIfStatementsInShader';\nexport * from './shader/utils/uniformParsers';\nexport * from './shader/utils/generateUniformBufferSync';\nexport * from './shader/utils/getTestContext';\nexport * from './shader/utils/generateProgram';\nexport * from './shader/Shader';\nexport * from './shader/Program';\nexport * from './shader/GLProgram';\nexport * from './shader/UniformGroup';\nexport * from './mask/MaskData';\nexport * from './filters/spriteMask/SpriteMaskFilter';\nexport * from './filters/Filter';\nexport * from './filters/FilterState';\nexport * from './filters/IFilterTarget';\nexport * from './geometry/Attribute';\nexport * from './geometry/Buffer';\nexport * from './geometry/Geometry';\nexport * from './geometry/ViewableBuffer';\nexport * from './deprecations';\n"],"names":["arguments","UID","map","byteSizeMap","tempMatrix","defaultVertex","defaultFragment","BLEND","OFFSET","CULLING","DEPTH_TEST","WINDING","DEPTH_MASK","extensions"],"mappings":";;;;;;;;;;;;;;;;AAIA;;;;;;;;;;;;;;AAcG;AACH,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;AAE5D;;;;;;;;;;;;;;AAcG;AACH,QAAQ,CAAC,oBAAoB,GAAG,KAAK;;ACHrC;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AACU,IAAA,SAAS,GAAqC,GAAG;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AACa,SAAA,kBAAkB,CAAyB,M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AH,YAAA;YAGI,WAAW,CAAC,OAAO,EAAE,eAAA,GAAgB,IAAI,GAAsB,qBAAA,GAAA,IAAM,CAAC,CAAC;AAGvE,YAAA,OAAQ,UAAkB,CAAC,IAAI,CAAC,CAAC;SACpC;AACJ,KAAA,CAAC,CAAC;;AAZX,KAAK,IAAM,IAAI,IAAI,UAAU,EAAA;YAAlB,IAAI,CAAA,CAAA;AAad,CAAA;AAED;;;;;AAKG;AACG,IAAA,OAAO,GAAG,GAAG;wBAER,IAAI,EAAA;AAEX,IAAA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAC/B;AACI,QAAA,GAAG,EAAH,YAAA;YAGI,WAAW,CAAC,OAAO,EAAE,iBAAA,GAAkB,IAAI,GAAsB,qBAAA,GAAA,IAAM,CAAC,CAAC;AAGzE,YAAA,OAAQ,QAAgB,CAAC,IAAI,CAAC,CAAC;SAClC;AACJ,KAAA,CAAC,CAAC;;AAZX,KAAK,IAAM,IAAI,IAAI,QAAQ,EAAA;YAAhB,IAAI,CAAA,CAAA;AAad;;AC9CD;;AAEG;AAEH;;;AAGG;AACU,IAAA,OAAO,GAAG;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/core/global.d.ts b/live2d/node_modules/@pixi/core/global.d.ts new file mode 100644 index 0000000..cbbebad --- /dev/null +++ b/live2d/node_modules/@pixi/core/global.d.ts @@ -0,0 +1,26 @@ +declare namespace GlobalMixins +{ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface BaseTexture + { + + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Texture + { + + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface BaseRenderTexture + { + + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface IRendererOptions + { + + } +} diff --git a/live2d/node_modules/@pixi/core/index.d.ts b/live2d/node_modules/@pixi/core/index.d.ts new file mode 100644 index 0000000..ed5873b --- /dev/null +++ b/live2d/node_modules/@pixi/core/index.d.ts @@ -0,0 +1,5465 @@ +/// + +import { ALPHA_MODES } from '@pixi/constants'; +import type { ArrayFixed } from '@pixi/utils'; +import type { BaseTexture as BaseTexture_2 } from '@pixi/core'; +import { BLEND_MODES } from '@pixi/constants'; +import { BUFFER_BITS } from '@pixi/constants'; +import { BUFFER_TYPE } from '@pixi/constants'; +import { CLEAR_MODES } from '@pixi/constants'; +import type { COLOR_MASK_BITS } from '@pixi/constants'; +import type { Dict } from '@pixi/utils'; +import { DRAW_MODES } from '@pixi/constants'; +import { EventEmitter } from '@pixi/utils'; +import { FORMATS } from '@pixi/constants'; +import { GC_MODES } from '@pixi/constants'; +import type { IPointData } from '@pixi/math'; +import type { ISize } from '@pixi/math'; +import type { ISpriteMaskFilter as ISpriteMaskFilter_2 } from '@pixi/core'; +import { MASK_TYPES } from '@pixi/constants'; +import { Matrix } from '@pixi/math'; +import type { MIPMAP_MODES } from '@pixi/constants'; +import { MSAA_QUALITY } from '@pixi/constants'; +import { Point } from '@pixi/math'; +import { Rectangle } from '@pixi/math'; +import { RENDERER_TYPE } from '@pixi/constants'; +import { Runner } from '@pixi/runner'; +import { SCALE_MODES } from '@pixi/constants'; +import { TARGETS } from '@pixi/constants'; +import { TYPES } from '@pixi/constants'; +import type { WRAP_MODES } from '@pixi/constants'; + +/** + * Renderer dedicated to drawing and batching sprites. + * + * This is the default batch renderer. It buffers objects + * with texture-based geometries and renders them in + * batches. It uploads multiple textures to the GPU to + * reduce to the number of draw calls. + * @memberof PIXI + */ +export declare class AbstractBatchRenderer extends ObjectRenderer { + /** The WebGL state in which this renderer will work. */ + readonly state: State; + /** + * The number of bufferable objects before a flush + * occurs automatically. + * @default settings.SPRITE_BATCH_SIZE * 4 + */ + size: number; + /** + * Maximum number of textures that can be uploaded to + * the GPU under the current context. It is initialized + * properly in `this.contextChange`. + * @see PIXI.AbstractBatchRenderer#contextChange + * @readonly + */ + MAX_TEXTURES: number; + /** + * This is used to generate a shader that can + * color each vertex based on a `aTextureId` + * attribute that points to an texture in `uSampler`. + * + * This enables the objects with different textures + * to be drawn in the same draw call. + * + * You can customize your shader by creating your + * custom shader generator. + */ + protected shaderGenerator: BatchShaderGenerator; + /** + * The class that represents the geometry of objects + * that are going to be batched with this. + * @member {object} + * @default PIXI.BatchGeometry + */ + protected geometryClass: typeof BatchGeometry; + /** + * Size of data being buffered per vertex in the + * attribute buffers (in floats). By default, the + * batch-renderer plugin uses 6: + * + * | aVertexPosition | 2 | + * |-----------------|---| + * | aTextureCoords | 2 | + * | aColor | 1 | + * | aTextureId | 1 | + * @readonly + */ + protected vertexSize: number; + /** Total count of all vertices used by the currently buffered objects. */ + protected _vertexCount: number; + /** Total count of all indices used by the currently buffered objects. */ + protected _indexCount: number; + /** + * Buffer of objects that are yet to be rendered. + * @member {PIXI.DisplayObject[]} + */ + protected _bufferedElements: Array; + /** + * Data for texture batch builder, helps to save a bit of CPU on a pass. + * @member {PIXI.BaseTexture[]} + */ + protected _bufferedTextures: Array; + /** Number of elements that are buffered and are waiting to be flushed. */ + protected _bufferSize: number; + /** + * This shader is generated by `this.shaderGenerator`. + * + * It is generated specifically to handle the required + * number of textures being batched together. + */ + protected _shader: Shader; + /** + * A flush may occur multiple times in a single + * frame. On iOS devices or when + * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the + * batch renderer does not upload data to the same + * `WebGLBuffer` for performance reasons. + * + * This is the index into `packedGeometries` that points to + * geometry holding the most recent buffers. + */ + protected _flushId: number; + /** + * Pool of `ViewableBuffer` objects that are sorted in + * order of increasing size. The flush method uses + * the buffer with the least size above the amount + * it requires. These are used for passing attributes. + * + * The first buffer has a size of 8; each subsequent + * buffer has double capacity of its previous. + * @member {PIXI.ViewableBuffer[]} + * @see PIXI.AbstractBatchRenderer#getAttributeBuffer + */ + protected _aBuffers: Array; + /** + * Pool of `Uint16Array` objects that are sorted in + * order of increasing size. The flush method uses + * the buffer with the least size above the amount + * it requires. These are used for passing indices. + * + * The first buffer has a size of 12; each subsequent + * buffer has double capacity of its previous. + * @member {Uint16Array[]} + * @see PIXI.AbstractBatchRenderer#getIndexBuffer + */ + protected _iBuffers: Array; + protected _dcIndex: number; + protected _aIndex: number; + protected _iIndex: number; + protected _attributeBuffer: ViewableBuffer; + protected _indexBuffer: Uint16Array; + protected _tempBoundTextures: BaseTexture[]; + /** + * Pool of `this.geometryClass` geometry objects + * that store buffers. They are used to pass data + * to the shader on each draw call. + * + * These are never re-allocated again, unless a + * context change occurs; however, the pool may + * be expanded if required. + * @member {PIXI.Geometry[]} + * @see PIXI.AbstractBatchRenderer.contextChange + */ + private _packedGeometries; + /** + * Size of `this._packedGeometries`. It can be expanded + * if more than `this._packedGeometryPoolSize` flushes + * occur in a single frame. + */ + private _packedGeometryPoolSize; + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + constructor(renderer: Renderer); + /** + * Handles the `contextChange` signal. + * + * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool. + */ + contextChange(): void; + /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */ + initFlushBuffers(): void; + /** Handles the `prerender` signal. It ensures that flushes start from the first geometry object again. */ + onPrerender(): void; + /** + * Buffers the "batchable" object. It need not be rendered immediately. + * @param {PIXI.DisplayObject} element - the element to render when + * using this renderer + */ + render(element: IBatchableElement): void; + buildTexturesAndDrawCalls(): void; + /** + * Populating drawcalls for rendering + * @param texArray + * @param start + * @param finish + */ + buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void; + /** + * Bind textures for current rendering + * @param texArray + */ + bindAndClearTexArray(texArray: BatchTextureArray): void; + updateGeometry(): void; + drawBatches(): void; + /** Renders the content _now_ and empties the current batch. */ + flush(): void; + /** Starts a new sprite batch. */ + start(): void; + /** Stops and flushes the current batch. */ + stop(): void; + /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */ + destroy(): void; + /** + * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats. + * @param size - minimum capacity required + * @returns - buffer than can hold atleast `size` floats + */ + getAttributeBuffer(size: number): ViewableBuffer; + /** + * Fetches an index buffer from `this._iBuffers` that can + * have at least `size` capacity. + * @param size - minimum required capacity + * @returns - buffer that can fit `size` indices. + */ + getIndexBuffer(size: number): Uint16Array; + /** + * Takes the four batching parameters of `element`, interleaves + * and pushes them into the batching attribute/index buffers given. + * + * It uses these properties: `vertexData` `uvs`, `textureId` and + * `indicies`. It also uses the "tint" of the base-texture, if + * present. + * @param {PIXI.DisplayObject} element - element being rendered + * @param attributeBuffer - attribute buffer. + * @param indexBuffer - index buffer + * @param aIndex - number of floats already in the attribute buffer + * @param iIndex - number of indices already in `indexBuffer` + */ + packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array, aIndex: number, iIndex: number): void; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchDrawCall[]} + */ + static _drawCallPool: Array; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * @member {PIXI.BatchTextureArray[]} + */ + static _textureArrayPool: Array; +} + +/** + * System plugin to the renderer to manage specific types of masking operations. + * @memberof PIXI + */ +declare class AbstractMaskSystem implements ISystem { + /** + * The mask stack + * @member {PIXI.MaskData[]} + */ + protected maskStack: Array; + /** + * Constant for gl.enable + * @private + */ + protected glConst: number; + protected renderer: Renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** Gets count of masks of certain type. */ + getStackLength(): number; + /** + * Changes the mask stack that is used by this System. + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + setMaskStack(maskStack: Array): void; + /** + * Setup renderer to use the current mask data. + * @private + */ + protected _useCurrent(): void; + /** Destroys the mask stack. */ + destroy(): void; +} + +/** + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource + * @memberof PIXI + */ +export declare abstract class AbstractMultiResource extends Resource { + /** Number of elements in array. */ + readonly length: number; + /** + * Collection of partial baseTextures that correspond to resources. + * @readonly + */ + items: Array; + /** + * Dirty IDs for each part. + * @readonly + */ + itemDirtyIds: Array; + /** + * Promise when loading. + * @default null + */ + private _load; + /** Bound baseTexture, there can only be one. */ + baseTexture: BaseTexture; + /** + * @param length + * @param options - Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + constructor(length: number, options?: ISize); + /** + * Used from ArrayResource and CubeResource constructors. + * @param resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param options - Detect options for resources + */ + protected initFromArray(resources: Array, options?: IAutoDetectOptions): void; + /** Destroy this BaseImageResource. */ + dispose(): void; + /** + * Set a baseTexture by ID + * @param baseTexture + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this; + /** + * Set a resource by ID + * @param resource + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + addResourceAt(resource: Resource, index: number): this; + /** + * Set the parent base texture. + * @param baseTexture + */ + bind(baseTexture: BaseTexture): void; + /** + * Unset the parent base texture. + * @param baseTexture + */ + unbind(baseTexture: BaseTexture): void; + /** + * Load all the resources simultaneously + * @returns - When load is resolved + */ + load(): Promise; +} + +/** + * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. + * @abstract + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ +export declare abstract class AbstractRenderer extends EventEmitter { + resolution: number; + clearBeforeRender?: boolean; + readonly options: IRendererOptions; + readonly type: RENDERER_TYPE; + readonly screen: Rectangle; + readonly view: HTMLCanvasElement; + readonly plugins: IRendererPlugins; + readonly useContextAlpha: boolean | 'notMultiplied'; + readonly autoDensity: boolean; + readonly preserveDrawingBuffer: boolean; + protected _backgroundColor: number; + protected _backgroundColorString: string; + _backgroundColorRgba: number[]; + _lastObjectRendered: IRenderableObject; + /** + * @param type - The renderer type. + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + constructor(type?: RENDERER_TYPE, options?: IRendererOptions); + /** + * Initialize the plugins. + * @protected + * @param {object} staticMap - The dictionary of statically saved plugins. + */ + initPlugins(staticMap: IRendererPlugins): void; + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * @member {number} + * @readonly + * @default 800 + */ + get width(): number; + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * @member {number} + * @readonly + * @default 600 + */ + get height(): number; + /** + * Resizes the screen and canvas as close as possible to the specified width and height. + * Canvas dimensions are multiplied by resolution and rounded to the nearest integers. + * The new canvas dimensions divided by the resolution become the new screen dimensions. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + resize(desiredScreenWidth: number, desiredScreenHeight: number): void; + /** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. + * @method PIXI.AbstractRenderer#generateTexture + * @param displayObject - The displayObject the object will be generated from. + * @param {object} options - Generate texture options. + * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture. + * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated. + * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered, + * if no region is specified, defaults to the local bounds of the displayObject. + * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer. + * @returns A texture of the graphics object. + */ + generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture; + /** + * Please use the options argument instead. + * @method PIXI.AbstractRenderer#generateTexture + * @deprecated Since 6.1.0 + * @param displayObject - The displayObject the object will be generated from. + * @param scaleMode - The scale mode of the texture. + * @param resolution - The resolution / device pixel ratio of the texture being generated. + * @param region - The region of the displayObject, that shall be rendered, + * if no region is specified, defaults to the local bounds of the displayObject. + * @returns A texture of the graphics object. + */ + generateTexture(displayObject: IRenderableObject, scaleMode?: SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture; + /** + * Adds a new system to the renderer. + * @param ClassRef - Class reference + * @param name - Property name for system + * @returns Return instance of renderer + */ + abstract addSystem(ClassRef: ISystemConstructor, name: string): this; + abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void; + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * @param [removeView=false] - Removes the Canvas element from the DOM. + */ + destroy(removeView?: boolean): void; + /** + * The background color to fill if not transparent + * @member {number} + */ + get backgroundColor(): number; + set backgroundColor(value: number); + /** + * The background color alpha. Setting this to 0 will make the canvas transparent. + * @member {number} + */ + get backgroundAlpha(): number; + set backgroundAlpha(value: number); +} + +/** + * A resource that contains a number of sources. + * @memberof PIXI + */ +export declare class ArrayResource extends AbstractMultiResource { + /** + * @param source - Number of items in array or the collection + * of image URLs to use. Can also be resources, image elements, canvas, etc. + * @param options - Options to apply to {@link PIXI.autoDetectResource} + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + constructor(source: number | Array, options?: ISize); + /** + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more + * @param baseTexture + * @param index - Zero-based index of resource to set + * @returns - Instance for chaining + */ + addBaseTextureAt(baseTexture: BaseTexture, index: number): this; + /** + * Add binding + * @param baseTexture + */ + bind(baseTexture: BaseTexture): void; + /** + * Upload the resources to the GPU. + * @param renderer + * @param texture + * @param glTexture + * @returns - whether texture was uploaded + */ + upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean; +} + +/** + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. + * @memberof PIXI + */ +export declare class Attribute { + buffer: number; + size: number; + normalized: boolean; + type: TYPES; + stride: number; + start: number; + instance: boolean; + /** + * @param buffer - the id of the buffer that this attribute will look for + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param normalized - should the data be normalized. + * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param [instance=false] - Whether the geometry is instanced. + */ + constructor(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number, start?: number, instance?: boolean); + /** Destroys the Attribute. */ + destroy(): void; + /** + * Helper function that creates an Attribute based on the information provided + * @param buffer - the id of the buffer that this attribute will look for + * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param [normalized=false] - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @returns - A new {@link PIXI.Attribute} based on the information provided + */ + static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute; +} + +/** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by + * the browser then this function will return a canvas renderer. + * @memberof PIXI + * @function autoDetectRenderer + * @param {PIXI.IRendererOptionsAuto} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {boolean} [options.forceCanvas=false] - + * Force using {@link PIXI.CanvasRenderer}, even if WebGL is available. This option only is available when + * using **pixi.js-legacy** or **@pixi/canvas-renderer** packages, otherwise it is ignored. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + * @returns {PIXI.Renderer|PIXI.CanvasRenderer} + * Returns {@link PIXI.Renderer} if WebGL is available, otherwise {@link PIXI.CanvasRenderer}. + */ +export declare function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer; + +/** + * Create a resource element from a single source element. This + * auto-detects which type of resource to create. All resources that + * are auto-detectable must have a static `test` method and a constructor + * with the arguments `(source, options?)`. Currently, the supported + * resources for auto-detection include: + * - {@link PIXI.ImageResource} + * - {@link PIXI.CanvasResource} + * - {@link PIXI.VideoResource} + * - {@link PIXI.SVGResource} + * - {@link PIXI.BufferResource} + * @static + * @memberof PIXI + * @function autoDetectResource + * @param {string|*} source - Resource source, this can be the URL to the resource, + * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri + * or any other resource that can be auto-detected. If not resource is + * detected, it's assumed to be an ImageResource. + * @param {object} [options] - Pass-through options to use for Resource + * @param {number} [options.width] - Width of BufferResource or SVG rasterization + * @param {number} [options.height] - Height of BufferResource or SVG rasterization + * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading + * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object + * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin + * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately + * @param {number} [options.updateFPS=0] - Video option to update how many times a second the + * texture should be updated from the video. Leave at 0 to update at every render + * @returns {PIXI.Resource} The created resource. + */ +export declare function autoDetectResource(source: unknown, options?: RO): R; + +/** + * Base for all the image/canvas resources. + * @memberof PIXI + */ +export declare class BaseImageResource extends Resource { + /** + * The source element. + * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} + * @readonly + */ + source: ImageSource; + /** + * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. + * Certain types of media (e.g. video) using `texImage2D` is more performant. + * @default false + * @private + */ + noSubImage: boolean; + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + constructor(source: ImageSource); + /** + * Set cross origin based detecting the url and the crossorigin + * @param element - Element to apply crossOrigin + * @param url - URL to check + * @param crossorigin - Cross origin value to use + */ + static crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: boolean | string): void; + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional) + * @returns - true is success + */ + upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + update(): void; + /** Destroy this {@link BaseImageResource} */ + dispose(): void; +} + +export declare interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture { +} + +/** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +export declare class BaseRenderTexture extends BaseTexture { + clearColor: number[]; + framebuffer: Framebuffer; + /** The data structure for the stencil masks. */ + maskStack: Array; + /** The data structure for the filters. */ + filterStack: Array; + /** + * @param options + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} + * for possible values. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio + * of the texture being generated. + * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer. + */ + constructor(options?: IBaseTextureOptions); + /** + * Resizes the BaseRenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + */ + resize(desiredWidth: number, desiredHeight: number): void; + /** + * Frees the texture and framebuffer from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + dispose(): void; + /** Destroys this texture. */ + destroy(): void; +} + +export declare interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter { +} + +/** + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + * @typeParam RO - The options for constructing resource. + */ +export declare class BaseTexture extends EventEmitter { + /** + * The width of the base texture set when the image has loaded + * @readonly + */ + width: number; + /** + * The height of the base texture set when the image has loaded + * @readonly + */ + height: number; + /** + * The resolution / device pixel ratio of the texture + * @readonly + * @default PIXI.settings.RESOLUTION + */ + resolution: number; + /** + * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}. + * @member {PIXI.ALPHA_MODES} + * @default PIXI.ALPHA_MODES.UNPACK + */ + alphaMode?: ALPHA_MODES; + /** + * Anisotropic filtering level of texture + * @member {number} + * @default PIXI.settings.ANISOTROPIC_LEVEL + */ + anisotropicLevel?: number; + /** + * The pixel format of the texture + * @default PIXI.FORMATS.RGBA + */ + format?: FORMATS; + /** + * The type of resource data + * @default PIXI.TYPES.UNSIGNED_BYTE + */ + type?: TYPES; + /** + * The target type + * @default PIXI.TARGETS.TEXTURE_2D + */ + target?: TARGETS; + /** + * Global unique identifier for this BaseTexture + * @protected + */ + readonly uid: number; + /** + * Used by automatic texture Garbage Collection, stores last GC tick when it was bound + * @protected + */ + touched: number; + /** + * Whether or not the texture is a power of two, try to use power of two textures as much + * as you can + * @readonly + * @default false + */ + isPowerOfTwo: boolean; + /** + * The map of render context textures where this is bound + * @private + */ + _glTextures: { + [key: number]: GLTexture; + }; + /** + * Used by TextureSystem to only update texture to the GPU when needed. + * Please call `update()` to increment it. + * @readonly + */ + dirtyId: number; + /** + * Used by TextureSystem to only update texture style when needed. + * @protected + */ + dirtyStyleId: number; + /** + * Currently default cache ID. + * @member {string} + */ + cacheId: string; + /** + * Generally speaking means when resource is loaded. + * @readonly + * @member {boolean} + */ + valid: boolean; + /** + * The collection of alternative cache ids, since some BaseTextures + * can have more than one ID, short name and longer full URL + * @member {Array} + * @readonly + */ + textureCacheIds: Array; + /** + * Flag if BaseTexture has been destroyed. + * @member {boolean} + * @readonly + */ + destroyed: boolean; + /** + * The resource used by this BaseTexture, there can only + * be one resource per BaseTexture, but textures can share + * resources. + * @member {PIXI.Resource} + * @readonly + */ + resource: R; + /** + * Number of the texture batch, used by multi-texture renderers + * @member {number} + */ + _batchEnabled: number; + /** + * Location inside texture batch, used by multi-texture renderers + * @member {number} + */ + _batchLocation: number; + /** + * Whether its a part of another texture, handled by ArrayResource or CubeResource + * @member {PIXI.BaseTexture} + */ + parentTextureArray: BaseTexture; + private _mipmap?; + private _scaleMode?; + private _wrapMode?; + /** + * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] - + * The current resource to use, for things that aren't Resource objects, will be converted + * into a Resource. + * @param options - Collection of options + * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture + * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture + * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type + * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha + * @param {number} [options.width=0] - Width of the texture + * @param {number} [options.height=0] - Height of the texture + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture + * @param {object} [options.resourceOptions] - Optional resource options, + * see {@link PIXI.autoDetectResource autoDetectResource} + */ + constructor(resource?: R | ImageSource | string | any, options?: IBaseTextureOptions); + /** + * Pixel width of the source of this texture + * @readonly + */ + get realWidth(): number; + /** + * Pixel height of the source of this texture + * @readonly + */ + get realHeight(): number; + /** + * Mipmap mode of the texture, affects downscaled images + * @default PIXI.settings.MIPMAP_TEXTURES + */ + get mipmap(): MIPMAP_MODES; + set mipmap(value: MIPMAP_MODES); + /** + * The scale mode to apply when scaling this texture + * @default PIXI.settings.SCALE_MODE + */ + get scaleMode(): SCALE_MODES; + set scaleMode(value: SCALE_MODES); + /** + * How the texture wraps + * @default PIXI.settings.WRAP_MODE + */ + get wrapMode(): WRAP_MODES; + set wrapMode(value: WRAP_MODES); + /** + * Changes style options of BaseTexture + * @param scaleMode - Pixi scalemode + * @param mipmap - enable mipmaps + * @returns - this + */ + setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this; + /** + * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. + * @param desiredWidth - Desired visual width + * @param desiredHeight - Desired visual height + * @param resolution - Optionally set resolution + * @returns - this + */ + setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this; + /** + * Sets real size of baseTexture, preserves current resolution. + * @param realWidth - Full rendered width + * @param realHeight - Full rendered height + * @param resolution - Optionally set resolution + * @returns - this + */ + setRealSize(realWidth: number, realHeight: number, resolution?: number): this; + /** + * Refresh check for isPowerOfTwo texture based on size + * @private + */ + protected _refreshPOT(): void; + /** + * Changes resolution + * @param resolution - res + * @returns - this + */ + setResolution(resolution: number): this; + /** + * Sets the resource if it wasn't set. Throws error if resource already present + * @param resource - that is managing this BaseTexture + * @returns - this + */ + setResource(resource: R): this; + /** Invalidates the object. Texture becomes valid if width and height are greater than zero. */ + update(): void; + /** + * Handle errors with resources. + * @private + * @param event - Error event emitted. + */ + onError(event: ErrorEvent): void; + /** + * Destroys this base texture. + * The method stops if resource doesn't want this texture to be destroyed. + * Removes texture from all caches. + */ + destroy(): void; + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * @fires PIXI.BaseTexture#dispose + */ + dispose(): void; + /** Utility function for BaseTexture|Texture cast. */ + castToBaseTexture(): BaseTexture; + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * @static + * @param {string|string[]|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The + * source to create base texture from. + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.BaseTexture} The new base texture. + */ + static from(source: ImageSource | string | string[], options?: IBaseTextureOptions, strict?: boolean): BaseTexture; + /** + * Create a new BaseTexture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * Default properties are different from the constructor's defaults. + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.NPM] - Image alpha, not premultiplied by default + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.SCALE_MODES.NEAREST] - Scale mode, pixelating by default + * @returns - The resulting new BaseTexture + */ + static fromBuffer(buffer: Float32Array | Uint8Array, width: number, height: number, options?: IBaseTextureOptions): BaseTexture; + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + static addToCache(baseTexture: BaseTexture, id: string): void; + /** + * Remove a BaseTexture from the global BaseTextureCache. + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @returns {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + static removeFromCache(baseTexture: string | BaseTexture): BaseTexture | null; + /** Global number of the texture batch, used by multi-texture renderers. */ + static _globalBatch: number; +} + +/** + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. + * @memberof PIXI + */ +export declare class BatchDrawCall { + texArray: BatchTextureArray; + type: DRAW_MODES; + blend: BLEND_MODES; + start: number; + size: number; + /** Data for uniforms or custom webgl state. */ + data: any; + constructor(); +} + +/** + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * @memberof PIXI + */ +export declare class BatchGeometry extends Geometry { + /** + * Buffer used for position, color, texture IDs + * @protected + */ + _buffer: Buffer_2; + /** + * Index buffer data + * @protected + */ + _indexBuffer: Buffer_2; + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + constructor(_static?: boolean); +} + +/** @memberof PIXI */ +export declare class BatchPluginFactory { + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.extensions.add({ + * name: 'invert', + * ref: InvertBatchRenderer, + * type: PIXI.ExtensionType.RendererPlugin, + * }); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @returns {*} New batch renderer plugin + */ + static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer; + /** + * The default vertex shader source + * @readonly + */ + static get defaultVertexSrc(): string; + /** + * The default fragment shader source + * @readonly + */ + static get defaultFragmentTemplate(): string; +} + +export declare const BatchRenderer: typeof AbstractBatchRenderer; + +/** + * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer + * @memberof PIXI + */ +export declare class BatchShaderGenerator { + /** Reference to the vertex shader source. */ + vertexSrc: string; + /** Reference to the fragment shader template. Must contain "%count%" and "%forloop%". */ + fragTemplate: string; + programCache: { + [key: number]: Program; + }; + defaultGroupCache: { + [key: number]: UniformGroup; + }; + /** + * @param vertexSrc - Vertex shader + * @param fragTemplate - Fragment shader template + */ + constructor(vertexSrc: string, fragTemplate: string); + generateShader(maxTextures: number): Shader; + generateSampleSrc(maxTextures: number): string; +} + +/** + * System plugin to the renderer to manage batching. + * @memberof PIXI + */ +export declare class BatchSystem implements ISystem { + /** An empty renderer. */ + readonly emptyRenderer: ObjectRenderer; + /** The currently active ObjectRenderer. */ + currentRenderer: ObjectRenderer; + private renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** + * Changes the current renderer to the one given in parameter + * @param objectRenderer - The object renderer to use. + */ + setObjectRenderer(objectRenderer: ObjectRenderer): void; + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + */ + flush(): void; + /** Reset the system to an empty renderer */ + reset(): void; + /** + * Handy function for batch renderers: copies bound textures in first maxTextures locations to array + * sets actual _batchLocation for them + * @param arr - arr copy destination + * @param maxTextures - number of copied elements + */ + copyBoundTextures(arr: BaseTexture[], maxTextures: number): void; + /** + * Assigns batch locations to textures in array based on boundTextures state. + * All textures in texArray should have `_batchEnabled = _batchId`, + * and their count should be less than `maxTextures`. + * @param texArray - textures to bound + * @param boundTextures - current state of bound textures + * @param batchId - marker for _batchEnabled param of textures in texArray + * @param maxTextures - number of texture locations to manipulate + */ + boundArray(texArray: BatchTextureArray, boundTextures: Array, batchId: number, maxTextures: number): void; + /** + * @ignore + */ + destroy(): void; +} + +/** + * Used by the batcher to build texture batches. + * Holds list of textures and their respective locations. + * @memberof PIXI + */ +export declare class BatchTextureArray { + /** Inside textures array. */ + elements: BaseTexture_2[]; + /** Respective locations for textures. */ + ids: number[]; + /** Number of filled elements. */ + count: number; + constructor(); + clear(): void; +} + +/** + * A wrapper for data so that it can be used and uploaded by WebGL + * @memberof PIXI + */ +declare class Buffer_2 { + /** + * The data in the buffer, as a typed array + * @type {PIXI.IArrayBuffer} + */ + data: ITypedArray; + /** + * The type of buffer this is, one of: + * + ELEMENT_ARRAY_BUFFER - used as an index buffer + * + ARRAY_BUFFER - used as an attribute buffer + * + UNIFORM_BUFFER - used as a uniform buffer (if available) + */ + type: BUFFER_TYPE; + static: boolean; + id: number; + disposeRunner: Runner; + /** + * A map of renderer IDs to webgl buffer + * @private + * @type {Object} + */ + _glBuffers: { + [key: number]: GLBuffer; + }; + _updateID: number; + /** + * @param {PIXI.IArrayBuffer} data - the data to store in the buffer. + * @param _static - `true` for static buffer + * @param index - `true` for index buffer + */ + constructor(data?: IArrayBuffer, _static?: boolean, index?: boolean); + /** + * Flags this buffer as requiring an upload to the GPU. + * @param {PIXI.IArrayBuffer|number[]} [data] - the data to update in the buffer. + */ + update(data?: IArrayBuffer | Array): void; + /** Disposes WebGL resources that are connected to this geometry. */ + dispose(): void; + /** Destroys the buffer. */ + destroy(): void; + /** + * Flags whether this is an index buffer. + * + * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make + * the buffer of type `ARRAY_BUFFER`. + * + * For backwards compatibility. + */ + set index(value: boolean); + get index(): boolean; + /** + * Helper function that creates a buffer based on an array or TypedArray + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @returns - A new Buffer based on the data provided. + */ + static from(data: IArrayBuffer | number[]): Buffer_2; +} +export { Buffer_2 as Buffer } + +/** + * @interface SharedArrayBuffer + */ +/** + * Buffer resource with data of typed array. + * @memberof PIXI + */ +export declare class BufferResource extends Resource { + /** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */ + data: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array; + /** + * @param source - Source buffer + * @param options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + constructor(source: Float32Array | Uint8Array | Uint16Array | Int32Array | Uint32Array, options: ISize); + /** + * Upload the texture to the GPU. + * @param renderer - Upload to the renderer + * @param baseTexture - Reference to parent texture + * @param glTexture - glTexture + * @returns - true is success + */ + upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean; + /** Destroy and don't use after this. */ + dispose(): void; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if + */ + static test(source: unknown): source is Float32Array | Uint8Array | Uint32Array; +} + +/** + * System plugin to the renderer to manage buffers. + * + * WebGL uses Buffers as a way to store objects to the GPU. + * This system makes working with them a lot easier. + * + * Buffers are used in three main places in WebGL + * - geometry information + * - Uniform information (via uniform buffer objects - a WebGL 2 only feature) + * - Transform feedback information. (WebGL 2 only feature) + * + * This system will handle the binding of buffers to the GPU as well as uploading + * them. With this system, you never need to work directly with GPU buffers, but instead work with + * the PIXI.Buffer class. + * @class + * @memberof PIXI + */ +declare class BufferSystem implements ISystem { + CONTEXT_UID: number; + gl: IRenderingContext; + /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */ + readonly managedBuffers: { + [key: number]: Buffer_2; + }; + /** Cache keeping track of the base bound buffer bases */ + readonly boundBufferBases: { + [key: number]: Buffer_2; + }; + private renderer; + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** + * @ignore + */ + destroy(): void; + /** Sets up the renderer context and necessary buffers. */ + protected contextChange(): void; + /** + * This binds specified buffer. On first run, it will create the webGL buffers for the context too + * @param buffer - the buffer to bind to the renderer + */ + bind(buffer: Buffer_2): void; + /** + * Binds an uniform buffer to at the given index. + * + * A cache is used so a buffer will not be bound again if already bound. + * @param buffer - the buffer to bind + * @param index - the base index to bind it to. + */ + bindBufferBase(buffer: Buffer_2, index: number): void; + /** + * Binds a buffer whilst also binding its range. + * This will make the buffer start from the offset supplied rather than 0 when it is read. + * @param buffer - the buffer to bind + * @param index - the base index to bind at, defaults to 0 + * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc + */ + bindBufferRange(buffer: Buffer_2, index?: number, offset?: number): void; + /** + * Will ensure the data in the buffer is uploaded to the GPU. + * @param {PIXI.Buffer} buffer - the buffer to update + */ + update(buffer: Buffer_2): void; + /** + * Disposes buffer + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + dispose(buffer: Buffer_2, contextLost?: boolean): void; + /** + * dispose all WebGL resources of all managed buffers + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + disposeAll(contextLost?: boolean): void; + /** + * creates and attaches a GLBuffer object tied to the current context. + * @param buffer + * @protected + */ + protected createGLBuffer(buffer: Buffer_2): GLBuffer; +} + +/** + * @interface OffscreenCanvas + */ +/** + * Resource type for HTMLCanvasElement. + * @memberof PIXI + */ +export declare class CanvasResource extends BaseImageResource { + /** + * @param source - Canvas element to use + */ + constructor(source: HTMLCanvasElement); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + static test(source: unknown): source is OffscreenCanvas | HTMLCanvasElement; +} + +export declare function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number; + +/** + * System plugin to the renderer to manage the context. + * @memberof PIXI + */ +export declare class ContextSystem implements ISystem { + /** + * Either 1 or 2 to reflect the WebGL version being used. + * @readonly + */ + webGLVersion: number; + /** + * Features supported by current context. + * @type {object} + * @readonly + * @property {boolean} uint32Indices - Support for 32-bit indices buffer. + */ + readonly supports: ISupportDict; + protected CONTEXT_UID: number; + protected gl: IRenderingContext; + /** + * Extensions available. + * @type {object} + * @readonly + * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {OES_texture_float} floatTexture - WebGL v1 extension + * @property {WEBGL_lose_context} loseContext - WebGL v1 extension + * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension + * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension + */ + extensions: WebGLExtensions; + private renderer; + /** @param renderer - The renderer this System works for. */ + constructor(renderer: Renderer); + /** + * `true` if the context is lost + * @readonly + */ + get isLost(): boolean; + /** + * Handles the context change event. + * @param {WebGLRenderingContext} gl - New WebGL context. + */ + protected contextChange(gl: IRenderingContext): void; + /** + * Initializes the context. + * @protected + * @param {WebGLRenderingContext} gl - WebGL context + */ + initFromContext(gl: IRenderingContext): void; + /** + * Initialize from context options + * @protected + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext + * @param {object} options - context attributes + */ + initFromOptions(options: WebGLContextAttributes): void; + /** + * Helper class to create a WebGL Context + * @param canvas - the canvas element that we will get the context from + * @param options - An options object that gets passed in to the canvas element containing the + * context attributes + * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext + * @returns {WebGLRenderingContext} the WebGL context + */ + createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext; + /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */ + protected getExtensions(): void; + /** + * Handles a lost webgl context + * @param {WebGLContextEvent} event - The context lost event. + */ + protected handleContextLost(event: WebGLContextEvent): void; + /** Handles a restored webgl context. */ + protected handleContextRestored(): void; + destroy(): void; + /** Handle the post-render runner event. */ + protected postrender(): void; + /** + * Validate context. + * @param {WebGLRenderingContext} gl - Render context. + */ + protected validateContext(gl: IRenderingContext): void; +} + +/** + * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js + * rewrote it, but this was a great starting point to get a solid understanding of whats going on :) + * @ignore + * @param uniformData + */ +export declare function createUBOElements(uniformData: IUniformData[]): { + uboElements: UBOElement[]; + size: number; +}; + +/** + * Resource for a CubeTexture which contains six resources. + * @memberof PIXI + */ +export declare class CubeResource extends AbstractMultiResource { + items: ArrayFixed; + /** + * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself. + * @protected + */ + linkBaseTexture: boolean; + /** + * @param {Array} [source] - Collection of URLs or resources + * to use as the sides of the cube. + * @param options - ImageResource options + * @param {number} [options.width] - Width of resource + * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use + */ + constructor(source?: ArrayFixed, options?: ICubeResourceOptions); + /** + * Add binding. + * @param baseTexture - parent base texture + */ + bind(baseTexture: BaseTexture): void; + addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this; + /** + * Upload the resource + * @param renderer + * @param _baseTexture + * @param glTexture + * @returns {boolean} true is success + */ + upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean; + /** Number of texture sides to store for CubeResources. */ + static SIDES: number; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an array of 6 elements + */ + static test(source: unknown): source is ArrayFixed; +} + +export declare const defaultFilterVertex: string; + +/** + * Default filter vertex shader + * @memberof PIXI + * @member {string} defaultFilterVertex + */ +export declare const defaultVertex: string; + +/** + * A filter is a special shader that applies post-processing effects to an input texture and writes into an output + * render-target. + * + * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the + * {@link PIXI.filters.BlurFilter BlurFilter}. + * + * ### Usage + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. + * + * ``` + * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); + * const container = new PIXI.Container(); + * container.filters = [filter]; + * ``` + * + * ### Previous Version Differences + * + * In PixiJS **v3**, a filter was always applied to _whole screen_. + * + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers had to create a set of uniforms to deal with coordinates. + * + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. + * + * Also be aware that we have changed default vertex shader, please consult + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * ### Frames + * + * The following table summarizes the coordinate spaces used in the filtering pipeline: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Coordinate SpaceDescription
Texture Coordinates + * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along + * both axes. + *
World Space + * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space). + *
Physical Pixels + * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture + * coordinates by the dimensions of the texture. + *
+ * + * ### Built-in Uniforms + * + * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, + * and `projectionMatrix` uniform maps it to the gl viewport. + * + * **uSampler** + * + * The most important uniform is the input texture that container was rendered into. + * _Important note: as with all Framebuffers in PixiJS, both input and output are + * premultiplied by alpha._ + * + * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. + * Use it to sample the input. + * + * ``` + * const fragment = ` + * varying vec2 vTextureCoord; + * uniform sampler2D uSampler; + * void main(void) + * { + * gl_FragColor = texture2D(uSampler, vTextureCoord); + * } + * `; + * + * const myFilter = new PIXI.Filter(null, fragment); + * ``` + * + * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. + * + * **outputFrame** + * + * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. + * It's the same as `renderer.screen` for a fullscreen filter. + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, + * `(0, 0, outputFrame.width, outputFrame.height)`, + * + * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. + * To calculate vertex position in screen space using normalized (0-1) space: + * + * ``` + * vec4 filterVertexPosition( void ) + * { + * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + * } + * ``` + * + * **inputSize** + * + * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary framebuffer that holds input. + * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. + * + * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. + * + * To calculate input normalized coordinate, you have to map it to filter normalized space. + * Multiply by `outputFrame.zw` to get input coordinate. + * Divide by `inputSize.xy` to get input normalized coordinate. + * + * ``` + * vec2 filterTextureCoord( void ) + * { + * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy + * } + * ``` + * **resolution** + * + * The `resolution` is the ratio of screen (CSS) pixels to real pixels. + * + * **inputPixel** + * + * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` + * `inputPixel.zw` is inverted `inputPixel.xy`. + * + * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. + * + * **inputClamp** + * + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. + * For displacements, coordinates has to be clamped. + * + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer + * `inputClamp.zw` is bottom-right pixel center. + * + * ``` + * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw)) + * ``` + * OR + * ``` + * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) + * ``` + * + * ### Additional Information + * + * Complete documentation on Filter usage is located in the + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. + * @memberof PIXI + */ +export declare class Filter extends Shader { + /** + * The padding of the filter. Some filters require extra space to breath such as a blur. + * Increasing this will add extra width and height to the bounds of the object that the + * filter is applied to. + */ + padding: number; + /** The samples of the filter. */ + multisample: MSAA_QUALITY; + /** If enabled is true the filter is applied, if false it will not. */ + enabled: boolean; + /** + * If enabled, PixiJS will fit the filter area into boundaries for better performance. + * Switch it off if it does not work for specific shader. + * @default true + */ + autoFit: boolean; + /** + * Legacy filters use position and uvs from attributes (set by filter system) + * @readonly + */ + legacy: boolean; + /** The WebGL state the filter requires to render. */ + state: State; + protected _resolution: number; + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict); + /** + * Applies the filter + * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it. + * @param {object} [_currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES, _currentState?: FilterState): void; + /** + * Sets the blend mode of the filter. + * @default PIXI.BLEND_MODES.NORMAL + */ + get blendMode(): BLEND_MODES; + set blendMode(value: BLEND_MODES); + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + */ + get resolution(): number; + set resolution(value: number); + /** + * The default vertex shader source + * @constant + */ + static get defaultVertexSrc(): string; + /** + * The default fragment shader source + * @constant + */ + static get defaultFragmentSrc(): string; + /** Used for caching shader IDs. */ + static SOURCE_KEY_MAP: Dict; +} + +/** + * System plugin to the renderer to manage filter states. + * @ignore + */ +export declare class FilterState { + renderTexture: RenderTexture; + /** + * Target of the filters + * We store for case when custom filter wants to know the element it was applied on + * @member {PIXI.DisplayObject} + */ + target: IFilterTarget; + /** + * Compatibility with PixiJS v4 filters + * @default false + */ + legacy: boolean; + /** + * Resolution of filters + * @default 1 + */ + resolution: number; + /** + * Number of samples + * @default MSAA_QUALITY.NONE + */ + multisample: MSAA_QUALITY; + /** Source frame. */ + sourceFrame: Rectangle; + /** Destination frame. */ + destinationFrame: Rectangle; + /** Original render-target source frame. */ + bindingSourceFrame: Rectangle; + /** Original render-target destination frame. */ + bindingDestinationFrame: Rectangle; + /** Collection of filters. */ + filters: Array; + /** Projection system transform saved by link. */ + transform: Matrix; + constructor(); + /** Clears the state */ + clear(): void; +} + +/** + * System plugin to the renderer to manage filters. + * + * ## Pipeline + * + * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its + * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target. + * + * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into + * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called + * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame` + * in the final render-target. + * + * ## Usage + * + * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process: + * + * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target. + * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents + * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is + * illegal during an existing render cycle, and it may reset the filter system. + * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them + * serially and output to the bounds of the filter-target. + * @memberof PIXI + */ +export declare class FilterSystem implements ISystem { + /** + * List of filters for the FilterSystem + * @member {object[]} + */ + readonly defaultFilterStack: Array; + /** A pool for storing filter states, save us creating new ones each tick. */ + statePool: Array; + /** Stores a bunch of POT textures used for filtering. */ + texturePool: RenderTexturePool; + /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */ + forceClear: boolean; + /** + * Old padding behavior is to use the max amount instead of sum padding. + * Use this flag if you need the old behavior. + * @default false + */ + useMaxPadding: boolean; + /** A very simple geometry used when drawing a filter effect to the screen. */ + protected quad: Quad; + /** Quad UVs */ + protected quadUv: QuadUv; + /** + * Active state + * @member {object} + */ + protected activeState: FilterState; + /** + * This uniform group is attached to filter uniforms when used. + * @property {PIXI.Rectangle} outputFrame - + * @property {Float32Array} inputSize - + * @property {Float32Array} inputPixel - + * @property {Float32Array} inputClamp - + * @property {number} resolution - + * @property {Float32Array} filterArea - + * @property {Float32Array} filterClamp - + */ + protected globalUniforms: UniformGroup; + /** Temporary rect for math. */ + private tempRect; + renderer: Renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** + * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an + * input render-texture for the rest of the filtering pipeline. + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param filters - The filters to apply. + */ + push(target: IFilterTarget, filters: Array): void; + /** Pops off the filter and applies it. */ + pop(): void; + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + bindAndClear(filterTexture: RenderTexture, clearMode?: CLEAR_MODES): void; + /** + * Draws a filter using the default rendering process. + * + * This should be called only by {@link Filter#apply}. + * @param filter - The filter to draw. + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it + */ + applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void; + /** + * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. + * + * Use `outputMatrix * vTextureCoord` in the shader. + * @param outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @returns The mapped matrix. + */ + calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix; + /** Destroys this Filter System. */ + destroy(): void; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture in real pixels. + * @param minHeight - The minimum height of the render texture in real pixels. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns - The new render texture. + */ + protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture; + /** + * Gets extra render texture to use inside current filter + * To be compliant with older filters, you can use params in any order + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * @param multisample - number of samples of the renderTexture + */ + getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture; + /** + * Frees a render texture back into the pool. + * @param renderTexture - The renderTarget to free + */ + returnFilterTexture(renderTexture: RenderTexture): void; + /** Empties the texture pool. */ + emptyPool(): void; + /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */ + resize(): void; + /** + * @param matrix - first param + * @param rect - second param + */ + private transformAABB; + private roundFrame; +} + +/** + * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses + * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer. + * + * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES. + * @memberof PIXI + */ +export declare class Framebuffer { + /** Width of framebuffer in pixels. */ + width: number; + /** Height of framebuffer in pixels. */ + height: number; + /** + * Desired number of samples for antialiasing. 0 means AA should not be used. + * + * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. + * Antialiasing is the same as for main buffer with renderer `antialias:true` options. + * Seriously affects GPU memory consumption and GPU performance. + * + *```js + * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH; + * //... + * renderer.render(myContainer, {renderTexture}); + * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture + * ``` + * @default PIXI.MSAA_QUALITY.NONE + */ + multisample: MSAA_QUALITY; + stencil: boolean; + depth: boolean; + dirtyId: number; + dirtyFormat: number; + dirtySize: number; + depthTexture: BaseTexture; + colorTextures: Array; + glFramebuffers: { + [key: string]: GLFramebuffer; + }; + disposeRunner: Runner; + /** + * @param width - Width of the frame buffer + * @param height - Height of the frame buffer + */ + constructor(width: number, height: number); + /** + * Reference to the colorTexture. + * @readonly + */ + get colorTexture(): BaseTexture; + /** + * Add texture to the colorTexture array. + * @param index - Index of the array to add the texture to + * @param texture - Texture to add to the array + */ + addColorTexture(index?: number, texture?: BaseTexture): this; + /** + * Add a depth texture to the frame buffer. + * @param texture - Texture to add. + */ + addDepthTexture(texture?: BaseTexture): this; + /** Enable depth on the frame buffer. */ + enableDepth(): this; + /** Enable stencil on the frame buffer. */ + enableStencil(): this; + /** + * Resize the frame buffer + * @param width - Width of the frame buffer to resize to + * @param height - Height of the frame buffer to resize to + */ + resize(width: number, height: number): void; + /** Disposes WebGL resources that are connected to this geometry. */ + dispose(): void; + /** Destroys and removes the depth texture added to this framebuffer. */ + destroyDepthTexture(): void; +} + +/** + * System plugin to the renderer to manage framebuffers. + * @memberof PIXI + */ +export declare class FramebufferSystem implements ISystem { + /** A list of managed framebuffers. */ + readonly managedFramebuffers: Array; + current: Framebuffer; + viewport: Rectangle; + hasMRT: boolean; + writeDepthTexture: boolean; + protected CONTEXT_UID: number; + protected gl: IRenderingContext; + /** Framebuffer value that shows that we don't know what is bound. */ + protected unknownFramebuffer: Framebuffer; + protected msaaSamples: Array; + renderer: Renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** Sets up the renderer context and necessary buffers. */ + protected contextChange(): void; + /** + * Bind a framebuffer. + * @param framebuffer + * @param frame - frame, default is framebuffer size + * @param mipLevel - optional mip level to set on the framebuffer - defaults to 0 + */ + bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel?: number): void; + /** + * Set the WebGLRenderingContext's viewport. + * @param x - X position of viewport + * @param y - Y position of viewport + * @param width - Width of viewport + * @param height - Height of viewport + */ + setViewport(x: number, y: number, width: number, height: number): void; + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * @readonly + */ + get size(): { + x: number; + y: number; + width: number; + height: number; + }; + /** + * Clear the color of the context + * @param r - Red value from 0 to 1 + * @param g - Green value from 0 to 1 + * @param b - Blue value from 0 to 1 + * @param a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + clear(r: number, g: number, b: number, a: number, mask?: BUFFER_BITS): void; + /** + * Initialize framebuffer for this context + * @protected + * @param framebuffer + * @returns - created GLFramebuffer + */ + initFramebuffer(framebuffer: Framebuffer): GLFramebuffer; + /** + * Resize the framebuffer + * @param framebuffer + * @protected + */ + resizeFramebuffer(framebuffer: Framebuffer): void; + /** + * Update the framebuffer + * @param framebuffer + * @param mipLevel + * @protected + */ + updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void; + /** + * Returns true if the frame buffer can be multisampled. + * @param framebuffer + */ + protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean; + /** + * Detects number of samples that is not more than a param but as close to it as possible + * @param samples - number of samples + * @returns - recommended number of samples + */ + protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * @param framebuffer - by default it blits "into itself", from renderBuffer to texture. + * @param sourcePixels - source rectangle in pixels + * @param destPixels - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void; + /** + * Disposes framebuffer. + * @param framebuffer - framebuffer that has to be disposed of + * @param contextLost - If context was lost, we suppress all delete function calls + */ + disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void; + /** + * Disposes all framebuffers, but not textures bound to them. + * @param [contextLost=false] - If context was lost, we suppress all delete function calls + */ + disposeAll(contextLost?: boolean): void; + /** + * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. + * Used by MaskSystem, when its time to use stencil mask for Graphics element. + * + * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. + * @private + */ + forceStencil(): void; + /** Resets framebuffer stored state, binds screen framebuffer. Should be called before renderTexture reset(). */ + reset(): void; + destroy(): void; +} + +/** + * generates a WebGL Program object from a high level Pixi Program. + * @param gl - a rendering context on which to generate the program + * @param program - the high level Pixi Program. + */ +export declare function generateProgram(gl: IRenderingContext, program: Program): GLProgram; + +export declare function generateUniformBufferSync(group: UniformGroup, uniformData: Dict): { + size: number; + syncFunc: UniformsSyncCallback; +}; + +/** + * The Geometry represents a model. It consists of two components: + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. + * + * Geometry can be defined without passing in a style or data if required (thats how I prefer!) + * + * ```js + * let geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) + * geometry.addIndex([0,1,2,1,3,2]) + * ``` + * @memberof PIXI + */ +export declare class Geometry { + buffers: Array; + indexBuffer: Buffer_2; + attributes: { + [key: string]: Attribute; + }; + id: number; + /** Whether the geometry is instanced. */ + instanced: boolean; + /** + * Number of instances in this geometry, pass it to `GeometrySystem.draw()`. + * @default 1 + */ + instanceCount: number; + /** + * A map of renderer IDs to webgl VAOs + * @type {object} + */ + glVertexArrayObjects: { + [key: number]: { + [key: string]: WebGLVertexArrayObject; + }; + }; + disposeRunner: Runner; + /** Count of existing (not destroyed) meshes that reference this geometry. */ + refCount: number; + /** + * @param buffers - An array of buffers. optional. + * @param attributes - Of the geometry, optional structure of the attributes layout + */ + constructor(buffers?: Array, attributes?: { + [key: string]: Attribute; + }); + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * @param id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param normalized - should the data be normalized. + * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data) + * @param [start=0] - How far into the array to start reading values (used for interleaving data) + * @param instance - Instancing flag + * @returns - Returns self, useful for chaining. + */ + addAttribute(id: string, buffer: Buffer_2 | Float32Array | Uint32Array | Array, size?: number, normalized?: boolean, type?: TYPES, stride?: number, start?: number, instance?: boolean): this; + /** + * Returns the requested attribute. + * @param id - The name of the attribute required + * @returns - The attribute requested. + */ + getAttribute(id: string): Attribute; + /** + * Returns the requested buffer. + * @param id - The name of the buffer required. + * @returns - The buffer requested. + */ + getBuffer(id: string): Buffer_2; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @returns - Returns self, useful for chaining. + */ + addIndex(buffer?: Buffer_2 | IArrayBuffer | number[]): Geometry; + /** + * Returns the index buffer + * @returns - The index buffer. + */ + getIndex(): Buffer_2; + /** + * This function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * @returns - Returns self, useful for chaining. + */ + interleave(): Geometry; + /** Get the size of the geometries, in vertices. */ + getSize(): number; + /** Disposes WebGL resources that are connected to this geometry. */ + dispose(): void; + /** Destroys the geometry. */ + destroy(): void; + /** + * Returns a clone of the geometry. + * @returns - A new clone of this geometry. + */ + clone(): Geometry; + /** + * Merges an array of geometries into a new single one. + * + * Geometry attribute styles must match for this operation to work. + * @param geometries - array of geometries to merge + * @returns - Shiny new geometry! + */ + static merge(geometries: Array): Geometry; +} + +/** + * System plugin to the renderer to manage geometry. + * @memberof PIXI + */ +export declare class GeometrySystem implements ISystem { + /** + * `true` if we has `*_vertex_array_object` extension. + * @readonly + */ + hasVao: boolean; + /** + * `true` if has `ANGLE_instanced_arrays` extension. + * @readonly + */ + hasInstance: boolean; + /** + * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`. + * @readonly + */ + canUseUInt32ElementIndex: boolean; + protected CONTEXT_UID: number; + protected gl: IRenderingContext; + protected _activeGeometry: Geometry; + protected _activeVao: WebGLVertexArrayObject; + protected _boundBuffer: GLBuffer; + /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */ + readonly managedGeometries: { + [key: number]: Geometry; + }; + /** Renderer that owns this {@link GeometrySystem}. */ + private renderer; + /** @param renderer - The renderer this System works for. */ + constructor(renderer: Renderer); + /** Sets up the renderer context and necessary buffers. */ + protected contextChange(): void; + /** + * Binds geometry so that is can be drawn. Creating a Vao if required + * @param geometry - Instance of geometry to bind. + * @param shader - Instance of shader to use vao for. + */ + bind(geometry?: Geometry, shader?: Shader): void; + /** Reset and unbind any active VAO and geometry. */ + reset(): void; + /** Update buffers of the currently bound geometry. */ + updateBuffers(): void; + /** + * Check compatibility between a geometry and a program + * @param geometry - Geometry instance. + * @param program - Program instance. + */ + protected checkCompatibility(geometry: Geometry, program: Program): void; + /** + * Takes a geometry and program and generates a unique signature for them. + * @param geometry - To get signature from. + * @param program - To test geometry against. + * @returns - Unique signature of the geometry and program + */ + protected getSignature(geometry: Geometry, program: Program): string; + /** + * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. + * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the + * attribute locations. + * @param geometry - Instance of geometry to to generate Vao for. + * @param shader - Instance of the shader. + * @param incRefCount - Increment refCount of all geometry buffers. + */ + protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount?: boolean): WebGLVertexArrayObject; + /** + * Disposes geometry. + * @param geometry - Geometry with buffers. Only VAO will be disposed + * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + disposeGeometry(geometry: Geometry, contextLost?: boolean): void; + /** + * Dispose all WebGL resources of all managed geometries. + * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + disposeAll(contextLost?: boolean): void; + /** + * Activate vertex array object. + * @param geometry - Geometry instance. + * @param program - Shader program instance. + */ + protected activateVao(geometry: Geometry, program: Program): void; + /** + * Draws the currently bound geometry. + * @param type - The type primitive to render. + * @param size - The number of elements to be rendered. If not specified, all vertices after the + * starting vertex will be drawn. + * @param start - The starting vertex in the geometry to start drawing from. If not specified, + * drawing will start from the first vertex. + * @param instanceCount - The number of instances of the set of elements to execute. If not specified, + * all instances will be drawn. + */ + draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this; + /** Unbind/reset everything. */ + protected unbind(): void; + destroy(): void; +} + +/** + * returns a little WebGL context to use for program inspection. + * @static + * @private + * @returns {WebGLRenderingContext} a gl context to test with + */ +export declare function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext; + +export declare function getUBOData(uniforms: Dict, uniformData: Dict): any[]; + +declare class GLBuffer { + buffer: WebGLBuffer; + updateID: number; + byteLength: number; + refCount: number; + constructor(buffer?: WebGLBuffer); +} + +/** + * Internal framebuffer for WebGL context. + * @memberof PIXI + */ +export declare class GLFramebuffer { + /** The WebGL framebuffer. */ + framebuffer: WebGLFramebuffer; + /** Stencil+depth , usually costs 32bits per pixel. */ + stencil: WebGLRenderbuffer; + /** Detected AA samples number. */ + multisample: MSAA_QUALITY; + /** In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info. */ + msaaBuffer: WebGLRenderbuffer; + /** + * In case we use MSAA, this is actual framebuffer that has colorTextures[0] + * The contents of that framebuffer are read when we use that renderTexture in sprites + */ + blitFramebuffer: Framebuffer; + /** Latest known version of framebuffer. */ + dirtyId: number; + /** Latest known version of framebuffer format. */ + dirtyFormat: number; + /** Latest known version of framebuffer size. */ + dirtySize: number; + /** Store the current mipmap of the textures the framebuffer will write too. */ + mipLevel: number; + constructor(framebuffer: WebGLTexture); +} + +/** + * Helper class to create a WebGL Program + * @memberof PIXI + */ +export declare class GLProgram { + /** The shader program. */ + program: WebGLProgram; + /** + * Holds the uniform data which contains uniform locations + * and current uniform values used for caching and preventing unneeded GPU commands. + */ + uniformData: Dict; + /** + * UniformGroups holds the various upload functions for the shader. Each uniform group + * and program have a unique upload function generated. + */ + uniformGroups: Dict; + /** A hash that stores where UBOs are bound to on the program. */ + uniformBufferBindings: Dict; + /** A hash for lazily-generated uniform uploading functions. */ + uniformSync: Dict; + /** + * A place where dirty ticks are stored for groups + * If a tick here does not match with the Higher level Programs tick, it means + * we should re upload the data. + */ + uniformDirtyGroups: Dict; + /** + * Makes a new Pixi program. + * @param program - webgl program + * @param uniformData - uniforms + */ + constructor(program: WebGLProgram, uniformData: { + [key: string]: IGLUniformData; + }); + /** Destroys this program. */ + destroy(): void; +} + +/** + * Internal texture for WebGL context. + * @memberof PIXI + */ +export declare class GLTexture { + /** The WebGL texture. */ + texture: WebGLTexture; + /** Width of texture that was used in texImage2D. */ + width: number; + /** Height of texture that was used in texImage2D. */ + height: number; + /** Whether mip levels has to be generated. */ + mipmap: boolean; + /** WrapMode copied from baseTexture. */ + wrapMode: number; + /** Type copied from baseTexture. */ + type: number; + /** Type copied from baseTexture. */ + internalFormat: number; + /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */ + samplerType: number; + /** Texture contents dirty flag. */ + dirtyId: number; + /** Texture style dirty flag. */ + dirtyStyleId: number; + constructor(texture: WebGLTexture); +} + +/** + * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer + * + * Same as ArrayBuffer in typescript lib, defined here just for documentation + */ +export declare interface IArrayBuffer extends ArrayBuffer { +} + +export declare interface IAttributeData { + type: string; + size: number; + location: number; + name: string; +} + +export declare type IAutoDetectOptions = ISize | ICubeResourceOptions | IImageResourceOptions | ISVGResourceOptions | IVideoResourceOptions | IResourcePluginOptions; + +export declare interface IBaseTextureOptions { + alphaMode?: ALPHA_MODES; + mipmap?: MIPMAP_MODES; + anisotropicLevel?: number; + scaleMode?: SCALE_MODES; + width?: number; + height?: number; + wrapMode?: WRAP_MODES; + format?: FORMATS; + type?: TYPES; + target?: TARGETS; + resolution?: number; + multisample?: MSAA_QUALITY; + resourceOptions?: RO; + pixiIdPrefix?: string; +} + +/** + * Interface for elements like Sprite, Mesh etc. for batching. + * @memberof PIXI + */ +export declare interface IBatchableElement { + _texture: Texture; + vertexData: Float32Array; + indices: Uint16Array | Uint32Array | Array; + uvs: Float32Array; + worldAlpha: number; + _tintRGB: number; + blendMode: BLEND_MODES; +} + +export declare interface IBatchFactoryOptions { + vertex?: string; + fragment?: string; + geometryClass?: typeof BatchGeometry; + vertexSize?: number; +} + +/** Constructor options for CubeResource */ +export declare interface ICubeResourceOptions extends ISize { + /** Whether to auto-load resources */ + autoLoad?: boolean; + /** In case BaseTextures are supplied, whether to copy them or use. */ + linkBaseTexture?: boolean; +} + +export declare interface IFilterTarget { + filterArea: Rectangle; + getBounds(skipUpdate?: boolean): Rectangle; +} + +export declare interface IGenerateTextureOptions { + scaleMode?: SCALE_MODES; + resolution?: number; + region?: Rectangle; + multisample?: MSAA_QUALITY; +} + +/** + * @private + */ +export declare class IGLUniformData { + location: WebGLUniformLocation; + value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[]; +} + +export declare interface IImageResourceOptions { + /** Start loading process */ + autoLoad?: boolean; + /** Whether its required to create a bitmap before upload. */ + createBitmap?: boolean; + /** Load image using cross origin. */ + crossorigin?: boolean | string; + /** Premultiply image alpha in bitmap. */ + alphaMode?: ALPHA_MODES; +} + +/** + * Resource type for ImageBitmap. + * @memberof PIXI + */ +export declare class ImageBitmapResource extends BaseImageResource { + /** + * @param source - Image element to use + */ + constructor(source: ImageBitmap); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is an ImageBitmap + */ + static test(source: unknown): source is ImageBitmap; +} + +/** + * Resource type for HTMLImageElement. + * @memberof PIXI + */ +export declare class ImageResource extends BaseImageResource { + /** URL of the image source */ + url: string; + /** + * If the image should be disposed after upload + * @default false + */ + preserveBitmap: boolean; + /** + * If capable, convert the image using createImageBitmap API. + * @default PIXI.settings.CREATE_IMAGE_BITMAP + */ + createBitmap: boolean; + /** + * Controls texture alphaMode field + * Copies from options + * Default is `null`, copies option from baseTexture + * @readonly + */ + alphaMode: ALPHA_MODES; + /** + * The ImageBitmap element created for a {@code HTMLImageElement}. + * @default null + */ + bitmap: ImageBitmap; + /** + * Promise when loading. + * @default null + */ + private _load; + /** When process is completed */ + private _process; + /** + * @param source - image source or URL + * @param options + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + constructor(source: HTMLImageElement | string, options?: IImageResourceOptions); + /** + * Returns a promise when image will be loaded and processed. + * @param createBitmap - whether process image into bitmap + */ + load(createBitmap?: boolean): Promise; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * @returns - Cached promise to fill that bitmap + */ + process(): Promise; + /** + * Upload the image resource to GPU. + * @param renderer - Renderer to upload to + * @param baseTexture - BaseTexture for this resource + * @param glTexture - GLTexture to use + * @returns {boolean} true is success + */ + upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean; + /** Destroys this resource. */ + dispose(): void; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @returns {boolean} `true` if source is string or HTMLImageElement + */ + static test(source: unknown): source is string | HTMLImageElement; +} + +export declare type ImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap; + +export declare interface IMaskTarget extends IFilterTarget { + renderable: boolean; + isSprite?: boolean; + worldTransform: Matrix; + isFastRect?(): boolean; + getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle; + render(renderer: Renderer): void; +} + +/** + * Collection of installed resource types, class must extend {@link PIXI.Resource}. + * @example + * class CustomResource extends PIXI.Resource { + * // MUST have source, options constructor signature + * // for auto-detected resources to be created. + * constructor(source, options) { + * super(); + * } + * upload(renderer, baseTexture, glTexture) { + * // upload with GL + * return true; + * } + * // used to auto-detect resource + * static test(source, extension) { + * return extension === 'xyz'|| source instanceof SomeClass; + * } + * } + * // Install the new resource type + * PIXI.INSTALLED.push(CustomResource); + * @memberof PIXI + * @type {Array} + * @static + * @readonly + */ +export declare const INSTALLED: Array>; + +/** + * Interface for Container to interface with Renderer. + * @memberof PIXI + */ +export declare interface IRenderableContainer extends IRenderableObject { + /** Get Local bounds for container */ + getLocalBounds(rect?: Rectangle, skipChildrenUpdate?: boolean): Rectangle; +} + +/** + * Interface for DisplayObject to interface with Renderer. + * The minimum APIs needed to implement a renderable object. + * @memberof PIXI + */ +export declare interface IRenderableObject { + /** Object must have a parent container */ + parent: IRenderableContainer; + /** Before method for transform updates */ + enableTempParent(): IRenderableContainer; + /** Update the transforms */ + updateTransform(): void; + /** After method for transform updates */ + disableTempParent(parent: IRenderableContainer): void; + /** Render object directly */ + render(renderer: Renderer): void; +} + +/** + * Renderer options supplied to constructor. + * @memberof PIXI + * @see PIXI.settings.RENDER_OPTIONS + */ +export declare interface IRendererOptions extends GlobalMixins.IRendererOptions { + /** The canvas to use as the view. If omitted, a new canvas will be created. */ + view?: HTMLCanvasElement; + /** + * The width of the renderer's view. + * @default 800 + */ + width?: number; + /** + * The height of the renderer's view. + * @default 600 + */ + height?: number; + /** + * The resolution / device pixel ratio of the renderer. + * @default PIXI.settings.RESOLUTION + */ + resolution?: number; + /** + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @default false + */ + autoDensity?: boolean; + /** + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @default 0x000000 + */ + backgroundColor?: number; + /** + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @default 1 + */ + backgroundAlpha?: number; + /** + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. + * + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @default true + */ + useContextAlpha?: boolean | 'notMultiplied'; + /** + * Use `backgroundAlpha` instead. + * @deprecated since 6.0.0 + */ + transparent?: boolean; + /** + * Whether to clear the canvas before new render passes. + * @default true + */ + clearBeforeRender?: boolean; + /** **WebGL Only.** User-provided WebGL rendering context object. */ + context?: IRenderingContext; + /** + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @default false + */ + antialias?: boolean; + /** + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + */ + powerPreference?: WebGLPowerPreference; + /** + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @default false + */ + preserveDrawingBuffer?: boolean; +} + +/** + * Renderer options supplied to `autoDetectRenderer`. + * @memberof PIXI + */ +export declare interface IRendererOptionsAuto extends IRendererOptions { + forceCanvas?: boolean; +} + +export declare interface IRendererPlugin { + destroy(): void; +} + +export declare interface IRendererPluginConstructor { + new (renderer: Renderer, options?: any): IRendererPlugin; +} + +export declare interface IRendererPlugins { + [key: string]: any; +} + +export declare interface IRendererRenderOptions { + renderTexture?: RenderTexture; + clear?: boolean; + transform?: Matrix; + skipUpdateTransform?: boolean; +} + +/** Mixed WebGL1/WebGL2 Rendering Context. Either its WebGL2, either its WebGL1 with PixiJS polyfills on it */ +export declare interface IRenderingContext extends WebGL2RenderingContext { +} + +/** + * Shape of supported resource plugins + * @memberof PIXI + */ +export declare interface IResourcePlugin { + test(source: unknown, extension: string): boolean; + new (source: any, options?: RO): R; +} + +export declare type IResourcePluginOptions = { + [key: string]: any; +}; + +export declare interface ISpriteMaskFilter extends Filter { + maskSprite: IMaskTarget; +} + +export declare interface ISpriteMaskTarget extends IMaskTarget { + _texture: Texture; + worldAlpha: number; + anchor: Point; +} + +export declare interface ISupportDict { + uint32Indices: boolean; +} + +export declare interface ISVGResourceOptions { + source?: string; + scale?: number; + width?: number; + height?: number; + autoLoad?: boolean; + crossorigin?: boolean | string; +} + +/** + * Interface for systems used by the {@link PIXI.Renderer}. + * @memberof PIXI + */ +export declare interface ISystem { + /** Generic destroy methods to be overridden by the subclass */ + destroy(): void; +} + +/** + * Types for system and pipe classes. + * @ignore + */ +export declare interface ISystemConstructor { + new (renderer: R): ISystem; +} + +/** + * PixiJS classes use this type instead of ArrayBuffer and typed arrays + * to support expressions like `geometry.buffers[0].data[0] = position.x`. + * + * Gives access to indexing and `length` field + * * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :) + */ +export declare interface ITypedArray extends IArrayBuffer { + readonly length: number; + [index: number]: number; + readonly BYTES_PER_ELEMENT: number; +} + +export declare interface IUniformData { + index: number; + type: string; + size: number; + isArray: boolean; + value: any; + name: string; +} + +export declare interface IUniformParser { + test(data: unknown, uniform: any): boolean; + code(name: string, uniform: any): string; + codeUbo?(name: string, uniform: any): string; +} + +export declare interface IUnloadableTexture { + _texture: Texture | RenderTexture; + children: IUnloadableTexture[]; +} + +export declare interface IVideoResourceOptions { + autoLoad?: boolean; + autoPlay?: boolean; + updateFPS?: number; + crossorigin?: boolean | string; +} + +export declare interface IVideoResourceOptionsElement { + src: string; + mime: string; +} + +/** + * Component for masked elements. + * + * Holds mask mode and temporary data about current mask. + * @memberof PIXI + */ +export declare class MaskData { + /** Mask type */ + type: MASK_TYPES; + /** + * Whether we know the mask type beforehand + * @default true + */ + autoDetect: boolean; + /** + * Which element we use to mask + * @member {PIXI.DisplayObject} + */ + maskObject: IMaskTarget; + /** Whether it belongs to MaskSystem pool */ + pooled: boolean; + /** Indicator of the type (always true for {@link MaskData} objects) */ + isMaskData: boolean; + /** + * Resolution of the sprite mask filter. + * If set to `null` or `0`, the resolution of the current render target is used. + * @default null + */ + resolution: number; + /** + * Number of samples of the sprite mask filter. + * If set to `null`, the sample count of the current render target is used. + * @default PIXI.settings.FILTER_MULTISAMPLE + */ + multisample: MSAA_QUALITY; + /** If enabled is true the mask is applied, if false it will not. */ + enabled: boolean; + /** Color mask. */ + colorMask: COLOR_MASK_BITS; + /** + * The sprite mask filter wrapped in an array. + * @private + */ + _filters: ISpriteMaskFilter_2[]; + /** + * Stencil counter above the mask in stack + * @private + */ + _stencilCounter: number; + /** + * Scissor counter above the mask in stack + * @private + */ + _scissorCounter: number; + /** + * Scissor operation above the mask in stack. + * Null if _scissorCounter is zero, rectangle instance if positive. + * @private + */ + _scissorRect: Rectangle; + /** + * pre-computed scissor rect + * does become _scissorRect when mask is actually pushed + * @private + */ + _scissorRectLocal: Rectangle; + /** + * pre-computed color mask + * @private + */ + _colorMask: number; + /** + * Targeted element. Temporary variable set by MaskSystem + * @member {PIXI.DisplayObject} + * @private + */ + _target: IMaskTarget; + /** + * Create MaskData + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask + */ + constructor(maskObject?: IMaskTarget); + /** + * The sprite mask filter. + * If set to `null`, the default sprite mask filter is used. + * @default null + */ + get filter(): ISpriteMaskFilter_2; + set filter(value: ISpriteMaskFilter_2); + /** Resets the mask data after popMask(). */ + reset(): void; + /** + * Copies counters from maskData above, called from pushMask(). + * @param maskAbove + */ + copyCountersOrReset(maskAbove?: MaskData): void; +} + +/** + * System plugin to the renderer to manage masks. + * + * There are three built-in types of masking: + * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is + * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular. + * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil + * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does + * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks. + * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's + * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this + * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins. + * + * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics` + * object with just a rectangle drawn. + * + * ## Mask Stacks + * + * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask + * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e. + * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target. + * @memberof PIXI + */ +export declare class MaskSystem implements ISystem { + /** + * Flag to enable scissor masking. + * @default true + */ + enableScissor: boolean; + /** Pool of used sprite mask filters. */ + protected readonly alphaMaskPool: Array; + /** + * Current index of alpha mask pool. + * @default 0 + * @readonly + */ + protected alphaMaskIndex: number; + /** Pool of mask data. */ + private readonly maskDataPool; + private maskStack; + private renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** + * Changes the mask stack that is used by this System. + * @param maskStack - The mask stack + */ + setMaskStack(maskStack: Array): void; + /** + * Enables the mask and appends it to the current mask stack. + * + * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked. + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskDataOrTarget - The masking data. + */ + push(target: IMaskTarget, maskDataOrTarget: MaskData | IMaskTarget): void; + /** + * Removes the last mask from the mask stack and doesn't return it. + * + * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed. + * @param {PIXI.IMaskTarget} target - Display Object to pop the mask from + */ + pop(target: IMaskTarget): void; + /** + * Sets type of MaskData based on its maskObject. + * @param maskData + */ + detect(maskData: MaskData): void; + /** + * Applies the Mask and adds it to the current filter stack. + * @param maskData - Sprite to be used as the mask. + */ + pushSpriteMask(maskData: MaskData): void; + /** + * Removes the last filter from the filter stack and doesn't return it. + * @param maskData - Sprite to be used as the mask. + */ + popSpriteMask(maskData: MaskData): void; + /** + * Pushes the color mask. + * @param maskData - The mask data + */ + pushColorMask(maskData: MaskData): void; + /** + * Pops the color mask. + * @param maskData - The mask data + */ + popColorMask(maskData: MaskData): void; + destroy(): void; +} + +/** + * Base for a common object renderer that can be used as a + * system renderer plugin. + * @memberof PIXI + */ +export declare class ObjectRenderer implements ISystem { + /** The renderer this manager works for. */ + protected renderer: Renderer; + /** + * @param renderer - The renderer this manager works for. + */ + constructor(renderer: Renderer); + /** Stub method that should be used to empty the current batch by rendering objects now. */ + flush(): void; + /** Generic destruction method that frees all resources. This should be called by subclasses. */ + destroy(): void; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + start(): void; + /** Stops the renderer. It should free up any state and become dormant. */ + stop(): void; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * @param {PIXI.DisplayObject} _object - The object to render. + */ + render(_object: any): void; +} + +/** + * Helper class to create a shader program. + * @memberof PIXI + */ +export declare class Program { + id: number; + /** Source code for the vertex shader. */ + vertexSrc: string; + /** Source code for the fragment shader. */ + fragmentSrc: string; + nameCache: any; + glPrograms: { + [key: number]: GLProgram; + }; + syncUniforms: any; + /** Assigned when a program is first bound to the shader system. */ + attributeData: { + [key: string]: IAttributeData; + }; + /** Assigned when a program is first bound to the shader system. */ + uniformData: { + [key: string]: IUniformData; + }; + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + */ + constructor(vertexSrc?: string, fragmentSrc?: string, name?: string); + /** + * The default vertex shader source. + * @constant + */ + static get defaultVertexSrc(): string; + /** + * The default fragment shader source. + * @constant + */ + static get defaultFragmentSrc(): string; + /** + * A short hand function to create a program based of a vertex and fragment shader. + * + * This method will also check to see if there is a cached program. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param name - Name for shader + * @returns A shiny new PixiJS shader program! + */ + static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program; +} + +/** + * System plugin to the renderer to manage the projection matrix. + * + * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to + * normalized device coordinates. + * @memberof PIXI + */ +export declare class ProjectionSystem implements ISystem { + /** + * The destination frame used to calculate the current projection matrix. + * + * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering + * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the + * bottom-left. This "flipping" phenomenon is because of WebGL convention for (shader) texture coordinates, where + * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left) + * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the + * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures + * at runtime. + * + * The destination frame's dimensions (width,height) should be equal to the source frame. This is because, + * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y) + * coordinates are (0,0) unless you know what you're doing. + * @readonly + */ + destinationFrame: Rectangle; + /** + * The source frame used to calculate the current projection matrix. + * + * The source frame is the rectangle in world space containing the contents to be rendered. + * @readonly + */ + sourceFrame: Rectangle; + /** + * Default destination frame + * + * This is not used internally. It is not advised to use this feature specifically unless you know what + * you're doing. The `update` method will default to this frame if you do not pass the destination frame. + * @readonly + */ + defaultFrame: Rectangle; + /** + * Projection matrix + * + * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated + * from the sourceFrame → destinationFrame mapping provided. + * + * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a + * uniform. + * @readonly + */ + projectionMatrix: Matrix; + /** + * A transform to be appended to the projection matrix. + * + * This can be used to transform points in world-space one last time before they are outputted by the shader. You can + * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything. + * @member {PIXI.Matrix} + */ + transform: Matrix; + private renderer; + /** @param renderer - The renderer this System works for. */ + constructor(renderer: Renderer); + /** + * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided. + * + * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because + * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates. + * + * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected + * that you dirty the current bindings when calling this manually. + * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas, + * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left. + * @param sourceFrame - The rectangle in world space that contains the contents being rendered. + * @param resolution - The resolution of the render-target, which is the ratio of + * world-space (or CSS) pixels to physical pixels. + * @param root - Whether the render-target is the screen. This is required because rendering to textures + * is y-flipped (i.e. upside down relative to the screen). + */ + update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void; + /** + * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`. + * @param _destinationFrame - The destination frame in the render-target. + * @param sourceFrame - The source frame in world space. + * @param _resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels. + * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection + * is y-flipped. + */ + calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void; + /** + * Sets the transform of the active render target to the given matrix. + * @param _matrix - The transformation matrix + */ + setTransform(_matrix: Matrix): void; + destroy(): void; +} + +/** + * Helper class to create a quad + * @memberof PIXI + */ +export declare class Quad extends Geometry { + constructor(); +} + +/** + * Helper class to create a quad with uvs like in v4 + * @memberof PIXI + */ +export declare class QuadUv extends Geometry { + vertexBuffer: Buffer_2; + uvBuffer: Buffer_2; + /** An array of vertices. */ + vertices: Float32Array; + /** The Uvs of the quad. */ + uvs: Float32Array; + constructor(); + /** + * Maps two Rectangle to the quad. + * @param targetTextureFrame - The first rectangle + * @param destinationFrame - The second rectangle + * @returns - Returns itself. + */ + map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this; + /** + * Legacy upload method, just marks buffers dirty. + * @returns - Returns itself. + */ + invalidate(): this; +} + +/** + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! + * + * Renderer is composed of systems that manage specific tasks. The following systems are added by default + * whenever you create a renderer: + * + * | System | Description | + * | ------------------------------------ | ----------------------------------------------------------------------------- | + * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. | + * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. | + * | {@link PIXI.EventSystem} | This manages UI events. | + * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. | + * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. | + * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. | + * | {@link PIXI.MaskSystem} | This manages masking operations. | + * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. | + * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. | + * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. | + * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. | + * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} | + * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. | + * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. | + * + * The breadth of the API surface provided by the renderer is contained within these systems. + * @memberof PIXI + */ +export declare class Renderer extends AbstractRenderer { + /** + * WebGL context, set by {@link PIXI.ContextSystem this.context}. + * @readonly + * @member {WebGLRenderingContext} + */ + gl: IRenderingContext; + /** Global uniforms */ + globalUniforms: UniformGroup; + /** Unique UID assigned to the renderer's WebGL context. */ + CONTEXT_UID: number; + /** + * Flag if we are rendering to the screen vs renderTexture + * @readonly + * @default true + */ + renderingToScreen: boolean; + /** + * The number of msaa samples of the canvas. + * @readonly + */ + multisample: MSAA_QUALITY; + /** + * Mask system instance + * @readonly + */ + mask: MaskSystem; + /** + * Context system instance + * @readonly + */ + context: ContextSystem; + /** + * State system instance + * @readonly + */ + state: StateSystem; + /** + * Shader system instance + * @readonly + */ + shader: ShaderSystem; + /** + * Texture system instance + * @readonly + */ + texture: TextureSystem; + /** + * Buffer system instance + * @readonly + */ + buffer: BufferSystem; + /** + * Geometry system instance + * @readonly + */ + geometry: GeometrySystem; + /** + * Framebuffer system instance + * @readonly + */ + framebuffer: FramebufferSystem; + /** + * Scissor system instance + * @readonly + */ + scissor: ScissorSystem; + /** + * Stencil system instance + * @readonly + */ + stencil: StencilSystem; + /** + * Projection system instance + * @readonly + */ + projection: ProjectionSystem; + /** + * Texture garbage collector system instance + * @readonly + */ + textureGC: TextureGCSystem; + /** + * Filter system instance + * @readonly + */ + filter: FilterSystem; + /** + * RenderTexture system instance + * @readonly + */ + renderTexture: RenderTextureSystem; + /** + * Batch system instance + * @readonly + */ + batch: BatchSystem; + /** + * Internal signal instances of **runner**, these + * are assigned to each system created. + * @see PIXI.Runner + * @name runners + * @private + * @type {object} + * @readonly + * @property {PIXI.Runner} destroy - Destroy runner + * @property {PIXI.Runner} contextChange - Context change runner + * @property {PIXI.Runner} reset - Reset runner + * @property {PIXI.Runner} update - Update runner + * @property {PIXI.Runner} postrender - Post-render runner + * @property {PIXI.Runner} prerender - Pre-render runner + * @property {PIXI.Runner} resize - Resize runner + */ + runners: { + [key: string]: Runner; + }; + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @param options + * @private + */ + static create(options?: IRendererOptions): AbstractRenderer; + /** + * @param {PIXI.IRendererOptions} [options] - The optional renderer parameters. + * @param {boolean} [options.antialias=false] - + * **WebGL Only.** Whether to enable anti-aliasing. This may affect performance. + * @param {boolean} [options.autoDensity=false] - + * Whether the CSS dimensions of the renderer's view should be resized automatically. + * @param {number} [options.backgroundAlpha=1] - + * Transparency of the background color, value from `0` (fully transparent) to `1` (fully opaque). + * @param {number} [options.backgroundColor=0x000000] - + * The background color used to clear the canvas. It accepts hex numbers (e.g. `0xff0000`). + * @param {boolean} [options.clearBeforeRender=true] - Whether to clear the canvas before new render passes. + * @param {PIXI.IRenderingContext} [options.context] - **WebGL Only.** User-provided WebGL rendering context object. + * @param {number} [options.height=600] - The height of the renderer's view. + * @param {string} [options.powerPreference] - + * **WebGL Only.** A hint indicating what configuration of GPU is suitable for the WebGL context, + * can be `'default'`, `'high-performance'` or `'low-power'`. + * Setting to `'high-performance'` will prioritize rendering performance over power consumption, + * while setting to `'low-power'` will prioritize power saving over rendering performance. + * @param {boolean} [options.premultipliedAlpha=true] - + * **WebGL Only.** Whether the compositor will assume the drawing buffer contains colors with premultiplied alpha. + * @param {boolean} [options.preserveDrawingBuffer=false] - + * **WebGL Only.** Whether to enable drawing buffer preservation. If enabled, the drawing buffer will preserve + * its value until cleared or overwritten. Enable this if you need to call `toDataUrl` on the WebGL context. + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - + * The resolution / device pixel ratio of the renderer. + * @param {boolean} [options.transparent] - + * **Deprecated since 6.0.0, Use `backgroundAlpha` instead.** \ + * `true` sets `backgroundAlpha` to `0`, `false` sets `backgroundAlpha` to `1`. + * @param {boolean|'notMultiplied'} [options.useContextAlpha=true] - + * Pass-through value for canvas' context attribute `alpha`. This option is for cases where the + * canvas needs to be opaque, possibly for performance reasons on some older devices. + * If you want to set transparency, please use `backgroundAlpha`. \ + * **WebGL Only:** When set to `'notMultiplied'`, the canvas' context attribute `alpha` will be + * set to `true` and `premultipliedAlpha` will be to `false`. + * @param {HTMLCanvasElement} [options.view=null] - + * The canvas to use as the view. If omitted, a new canvas will be created. + * @param {number} [options.width=800] - The width of the renderer's view. + */ + constructor(options?: IRendererOptions); + protected contextChange(): void; + /** + * Add a new system to the renderer. + * @param ClassRef - Class reference + * @param name - Property name for system, if not specified + * will use a static `name` property on the class itself. This + * name will be assigned as s property on the Renderer so make + * sure it doesn't collide with properties on Renderer. + * @returns Return instance of renderer + */ + addSystem(ClassRef: ISystemConstructor, name: string): this; + /** + * Renders the object to its WebGL view. + * @param displayObject - The object to be rendered. + * @param {object} [options] - Object to use for render options. + * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to. + * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render. + * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering. + * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass? + */ + render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void; + /** + * Please use the `option` render arguments instead. + * @deprecated Since 6.0.0 + * @param displayObject + * @param renderTexture + * @param clear + * @param transform + * @param skipUpdateTransform + */ + render(displayObject: IRenderableObject, renderTexture?: RenderTexture, clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void; + /** + * @override + * @ignore + */ + generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions | SCALE_MODES, resolution?: number, region?: Rectangle): RenderTexture; + /** + * Resizes the WebGL view to the specified width and height. + * @param desiredScreenWidth - The desired width of the screen. + * @param desiredScreenHeight - The desired height of the screen. + */ + resize(desiredScreenWidth: number, desiredScreenHeight: number): void; + /** + * Resets the WebGL state so you can render things however you fancy! + * @returns Returns itself. + */ + reset(): this; + /** Clear the frame buffer. */ + clear(): void; + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * @param [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + destroy(removeView?: boolean): void; + /** + * Please use `plugins.extract` instead. + * @member {PIXI.Extract} extract + * @deprecated since 6.0.0 + * @readonly + */ + get extract(): any; + /** + * Collection of installed plugins. These are included by default in PIXI, but can be excluded + * by creating a custom build. Consult the README for more information about creating custom + * builds and excluding plugins. + * @readonly + * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements. + * @property {PIXI.Extract} extract Extract image data from renderer. + * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events. + * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects. + * @property {PIXI.Prepare} prepare Pre-render display objects. + * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects. + * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects. + */ + static __plugins: IRendererPlugins; + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param pluginName - The name of the plugin. + * @param ctor - The constructor function or class for the plugin. + */ + static registerPlugin(pluginName: string, ctor: IRendererPluginConstructor): void; +} + +/** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * __Hint-2__: The actual memory allocation will happen on first render. + * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, {renderTexture}); + * ``` + * Note that you should not create a new renderer, but reuse the same one as the rest of the application. + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 }); + * + * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture + * ``` + * @memberof PIXI + */ +export declare class RenderTexture extends Texture { + baseTexture: BaseRenderTexture; + /** + * Stores `sourceFrame` when this texture is inside current filter stack. + * + * You can read it inside filters. + * @readonly + */ + filterFrame: Rectangle | null; + /** + * The key for pooled texture of FilterSystem. + * @see PIXI.RenderTexturePool + */ + filterPoolKey: string | number | null; + /** + * @param baseRenderTexture - The base texture object that this texture uses. + * @param frame - The rectangle frame of the texture to show. + */ + constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle); + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @readonly + */ + get framebuffer(): Framebuffer; + /** + * Shortcut to `this.framebuffer.multisample`. + * @default PIXI.MSAA_QUALITY.NONE + */ + get multisample(): MSAA_QUALITY; + set multisample(value: MSAA_QUALITY); + /** + * Resizes the RenderTexture. + * @param desiredWidth - The desired width to resize to. + * @param desiredHeight - The desired height to resize to. + * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well? + */ + resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture?: boolean): void; + /** + * Changes the resolution of baseTexture, but does not change framebuffer size. + * @param resolution - The new resolution to apply to RenderTexture + */ + setResolution(resolution: number): void; + /** + * Use the object-based construction instead. + * @deprecated since 6.0.0 + * @param {number} [width] + * @param {number} [height] + * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE] + * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] + */ + static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture; + /** + * A short hand way of creating a render texture. + * @param options - Options + * @param {number} [options.width=100] - The width of the render texture + * @param {number} [options.height=100] - The height of the render texture + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} + * for possible values + * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the texture + * being generated + * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer + * @returns The new render texture + */ + static create(options?: IBaseTextureOptions): RenderTexture; +} + +/** + * Texture pool, used by FilterSystem and plugins. + * + * Stores collection of temporary pow2 or screen-sized renderTextures + * + * If you use custom RenderTexturePool for your filters, you can use methods + * `getFilterTexture` and `returnFilterTexture` same as in + * @memberof PIXI + */ +export declare class RenderTexturePool { + textureOptions: IBaseTextureOptions; + /** + * Allow renderTextures of the same size as screen, not just pow2 + * + * Automatically sets to true after `setScreenSize` + * @default false + */ + enableFullScreen: boolean; + texturePool: { + [x in string | number]: RenderTexture[]; + }; + private _pixelsWidth; + private _pixelsHeight; + /** + * @param textureOptions - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + */ + constructor(textureOptions?: IBaseTextureOptions); + /** + * Creates texture with params that were specified in pool constructor. + * @param realWidth - Width of texture in pixels. + * @param realHeight - Height of texture in pixels. + * @param multisample - Number of samples of the framebuffer. + */ + createTexture(realWidth: number, realHeight: number, multisample?: MSAA_QUALITY): RenderTexture; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * @param minWidth - The minimum width of the render texture. + * @param minHeight - The minimum height of the render texture. + * @param resolution - The resolution of the render texture. + * @param multisample - Number of samples of the render texture. + * @returns The new render texture. + */ + getOptimalTexture(minWidth: number, minHeight: number, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * @param input - renderTexture from which size and resolution will be copied + * @param resolution - override resolution of the renderTexture + * It overrides, it does not multiply + * @param multisample - number of samples of the renderTexture + */ + getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture; + /** + * Place a render texture back into the pool. + * @param renderTexture - The renderTexture to free + */ + returnTexture(renderTexture: RenderTexture): void; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface. + * @param renderTexture - The renderTexture to free + */ + returnFilterTexture(renderTexture: RenderTexture): void; + /** + * Clears the pool. + * @param destroyTextures - Destroy all stored textures. + */ + clear(destroyTextures?: boolean): void; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * @param size - Initial size of screen. + */ + setScreenSize(size: ISize): void; + /** + * Key that is used to store fullscreen renderTextures in a pool + * @constant + */ + static SCREEN_KEY: number; +} + +/** + * System plugin to the renderer to manage render textures. + * + * Should be added after FramebufferSystem + * + * ### Frames + * + * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different + * coordinate spaces used: + * + * | Frame | Description | Coordinate System | + * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- | + * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left | + * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. | + * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. | + * @memberof PIXI + */ +export declare class RenderTextureSystem implements ISystem { + /** The clear background color as RGBA. */ + clearColor: number[]; + /** + * List of masks for the {@link PIXI.StencilSystem}. + * @readonly + */ + defaultMaskStack: Array; + /** + * Render texture currently bound. {@code null} if rendering to the canvas. + * @readonly + */ + current: RenderTexture | null; + /** + * The source frame for the render-target's projection mapping. + * + * See {@link PIXI.ProjectionSystem#sourceFrame} for more details + */ + readonly sourceFrame: Rectangle; + /** + * The destination frame for the render-target's projection mapping. + * + * See {@link PIXI.Projection#destinationFrame} for more details. + */ + readonly destinationFrame: Rectangle; + /** + * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame + * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on + * the bottom-left). + */ + readonly viewportFrame: Rectangle; + private renderer; + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + /** + * Bind the current render texture. + * @param renderTexture - RenderTexture to bind, by default its `null` - the screen. + * @param sourceFrame - Part of world that is mapped to the renderTexture. + * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame. + */ + bind(renderTexture?: RenderTexture, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void; + /** + * Erases the render texture and fills the drawing area with a colour. + * @param clearColor - The color as rgba, default to use the renderer backgroundColor + * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + clear(clearColor?: number[], mask?: BUFFER_BITS): void; + resize(): void; + /** Resets render-texture state. */ + reset(): void; + destroy(): void; +} + +/** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * @memberof PIXI + */ +export declare abstract class Resource { + /** The url of the resource */ + src: string; + /** + * If resource has been destroyed. + * @readonly + * @default false + */ + destroyed: boolean; + /** + * `true` if resource is created by BaseTexture + * useful for doing cleanup with BaseTexture destroy + * and not cleaning up resources that were created + * externally. + */ + internal: boolean; + /** Internal width of the resource. */ + protected _width: number; + /** Internal height of the resource. */ + protected _height: number; + /** + * Mini-runner for handling resize events + * accepts 2 parameters: width, height + * @member {Runner} + * @private + */ + protected onResize: Runner; + /** + * Mini-runner for handling update events + * @member {Runner} + * @private + */ + protected onUpdate: Runner; + /** + * Handle internal errors, such as loading errors + * accepts 1 param: error + * @member {Runner} + * @private + */ + protected onError: Runner; + /** + * @param width - Width of the resource + * @param height - Height of the resource + */ + constructor(width?: number, height?: number); + /** + * Bind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + bind(baseTexture: BaseTexture): void; + /** + * Unbind to a parent BaseTexture + * @param baseTexture - Parent texture + */ + unbind(baseTexture: BaseTexture): void; + /** + * Trigger a resize event + * @param width - X dimension + * @param height - Y dimension + */ + resize(width: number, height: number): void; + /** + * Has been validated + * @readonly + */ + get valid(): boolean; + /** Has been updated trigger event. */ + update(): void; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @returns Handle the validate event + */ + load(): Promise; + /** + * The width of the resource. + * @readonly + */ + get width(): number; + /** + * The height of the resource. + * @readonly + */ + get height(): number; + /** + * Uploads the texture or returns false if it cant for some reason. Override this. + * @param renderer - yeah, renderer! + * @param baseTexture - the texture + * @param glTexture - texture instance for this webgl context + * @returns - true is success + */ + abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean; + /** + * Set the style, optional to override + * @param _renderer - yeah, renderer! + * @param _baseTexture - the texture + * @param _glTexture - texture instance for this webgl context + * @returns - `true` is success + */ + style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean; + /** Clean up anything, this happens when destroying is ready. */ + dispose(): void; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + destroy(): void; + /** + * Abstract, used to auto-detect resource type. + * @param {*} _source - The source object + * @param {string} _extension - The extension of source, if set + */ + static test(_source: unknown, _extension?: string): boolean; +} + +/** + * @memberof PIXI + * @namespace resources + * @see PIXI + * @deprecated since 6.0.0 + */ +export declare const resources: {}; + +/** + * System plugin to the renderer to manage scissor masking. + * + * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer + * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically + * by this system. + * @memberof PIXI + */ +export declare class ScissorSystem extends AbstractMaskSystem { + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + getStackLength(): number; + /** + * evaluates _boundsTransformed, _scissorRect for MaskData + * @param maskData + */ + calcScissorRect(maskData: MaskData): void; + private static isMatrixRotated; + /** + * Test, whether the object can be scissor mask with current renderer projection. + * Calls "calcScissorRect()" if its true. + * @param maskData - mask data + * @returns whether Whether the object can be scissor mask + */ + testScissor(maskData: MaskData): boolean; + private roundFrameToPixels; + /** + * Applies the Mask and adds it to the current stencil stack. + * @author alvin + * @param maskData - The mask data. + */ + push(maskData: MaskData): void; + /** + * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the + * last mask in the stack. + * + * This can also be called when you directly modify the scissor box and want to restore PixiJS state. + * @param maskData - The mask data. + */ + pop(maskData?: MaskData): void; + /** + * Setup renderer to use the current scissor data. + * @private + */ + _useCurrent(): void; +} + +/** + * A helper class for shaders. + * @memberof PIXI + */ +export declare class Shader { + /** Program that the shader uses. */ + program: Program; + uniformGroup: UniformGroup; + /** + * Used internally to bind uniform buffer objects. + * @ignore + */ + uniformBindCount: number; + disposeRunner: Runner; + /** + * @param program - The program the shader will use. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + constructor(program: Program, uniforms?: Dict); + checkUniformExists(name: string, group: UniformGroup): boolean; + destroy(): void; + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms`. + * @readonly + */ + get uniforms(): Dict; + /** + * A short hand function to create a shader based of a vertex and fragment shader. + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + * @returns A shiny new PixiJS shader! + */ + static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader; +} + +/** + * System plugin to the renderer to manage shaders. + * @memberof PIXI + */ +export declare class ShaderSystem implements ISystem { + /** + * The current WebGL rendering context. + * @member {WebGLRenderingContext} + */ + protected gl: IRenderingContext; + shader: Shader; + program: Program; + id: number; + destroyed: boolean; + /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */ + private cache; + private _uboCache; + private renderer; + /** @param renderer - The renderer this System works for. */ + constructor(renderer: Renderer); + /** + * Overrideable function by `@pixi/unsafe-eval` to silence + * throwing an error if platform doesn't support unsafe-evals. + * @private + */ + systemCheck(): void; + protected contextChange(gl: IRenderingContext): void; + /** + * Changes the current shader to the one given in parameter. + * @param shader - the new shader + * @param dontSync - false if the shader should automatically sync its uniforms. + * @returns the glProgram that belongs to the shader. + */ + bind(shader: Shader, dontSync?: boolean): GLProgram; + /** + * Uploads the uniforms values to the currently bound shader. + * @param uniforms - the uniforms values that be applied to the current shader + */ + setUniforms(uniforms: Dict): void; + /** + * Syncs uniforms on the group + * @param group - the uniform group to sync + * @param syncData - this is data that is passed to the sync function and any nested sync functions + */ + syncUniformGroup(group: UniformGroup, syncData?: any): void; + /** + * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead. + * @param group + * @param glProgram + * @param syncData + */ + syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void; + createSyncGroups(group: UniformGroup): UniformsSyncCallback_2; + /** + * Syncs uniform buffers + * @param group - the uniform buffer group to sync + * @param name - the name of the uniform buffer + */ + syncUniformBufferGroup(group: UniformGroup, name?: string): void; + /** + * Will create a function that uploads a uniform buffer using the STD140 standard. + * The upload function will then be cached for future calls + * If a group is manually managed, then a simple upload function is generated + * @param group - the uniform buffer group to sync + * @param glProgram - the gl program to attach the uniform bindings to + * @param name - the name of the uniform buffer (must exist on the shader) + */ + protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback_2; + /** + * Takes a uniform group and data and generates a unique signature for them. + * @param group - The uniform group to get signature of + * @param group.uniforms + * @param uniformData - Uniform information generated by the shader + * @param preFix + * @returns Unique signature of the uniform group + */ + private getSignature; + /** + * Returns the underlying GLShade rof the currently bound shader. + * + * This can be handy for when you to have a little more control over the setting of your uniforms. + * @returns The glProgram for the currently bound Shader for this context + */ + getGlProgram(): GLProgram; + /** + * Generates a glProgram version of the Shader provided. + * @param shader - The shader that the glProgram will be based on. + * @returns A shiny new glProgram! + */ + generateProgram(shader: Shader): GLProgram; + /** Resets ShaderSystem state, does not affect WebGL state. */ + reset(): void; + /** + * Disposes shader. + * If disposing one equals with current shader, set current as null. + * @param shader - Shader object + */ + disposeShader(shader: Shader): void; + /** Destroys this System and removes all its textures. */ + destroy(): void; +} + +/** + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. + * @memberof PIXI + */ +export declare class SpriteMaskFilter extends Filter { + /** @private */ + _maskSprite: IMaskTarget; + /** Mask matrix */ + maskMatrix: Matrix; + /** + * @param {PIXI.Sprite} sprite - The target sprite. + */ + constructor(sprite: IMaskTarget); + /** + * @param vertexSrc - The source of the vertex shader. + * @param fragmentSrc - The source of the fragment shader. + * @param uniforms - Custom uniforms to use to augment the built-in ones. + */ + constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict); + /** + * Sprite mask + * @type {PIXI.DisplayObject} + */ + get maskSprite(): IMaskTarget; + set maskSprite(value: IMaskTarget); + /** + * Applies the filter + * @param filterManager - The renderer to retrieve the filter from + * @param input - The input render target. + * @param output - The target to output to. + * @param clearMode - Should the output be cleared before rendering to it. + */ + apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void; +} + +/** + * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}. + * + * Each mesh rendered may require WebGL to be in a different state. + * For example you may want different blend mode or to enable polygon offsets + * @memberof PIXI + */ +export declare class State { + data: number; + _blendMode: BLEND_MODES; + _polygonOffset: number; + constructor(); + /** + * Activates blending of the computed fragment color values. + * @default true + */ + get blend(): boolean; + set blend(value: boolean); + /** + * Activates adding an offset to depth values of polygon's fragments + * @default false + */ + get offsets(): boolean; + set offsets(value: boolean); + /** + * Activates culling of polygons. + * @default false + */ + get culling(): boolean; + set culling(value: boolean); + /** + * Activates depth comparisons and updates to the depth buffer. + * @default false + */ + get depthTest(): boolean; + set depthTest(value: boolean); + /** + * Enables or disables writing to the depth buffer. + * @default true + */ + get depthMask(): boolean; + set depthMask(value: boolean); + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @default false + */ + get clockwiseFrontFace(): boolean; + set clockwiseFrontFace(value: boolean); + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * @default PIXI.BLEND_MODES.NORMAL + */ + get blendMode(): BLEND_MODES; + set blendMode(value: BLEND_MODES); + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * @default 0 + */ + get polygonOffset(): number; + set polygonOffset(value: number); + toString(): string; + static for2d(): State; +} + +/** + * System plugin to the renderer to manage WebGL state machines. + * @memberof PIXI + */ +export declare class StateSystem implements ISystem { + /** + * State ID + * @readonly + */ + stateId: number; + /** + * Polygon offset + * @readonly + */ + polygonOffset: number; + /** + * Blend mode + * @default PIXI.BLEND_MODES.NONE + * @readonly + */ + blendMode: BLEND_MODES; + /** Whether current blend equation is different */ + protected _blendEq: boolean; + /** + * GL context + * @member {WebGLRenderingContext} + * @readonly + */ + protected gl: IRenderingContext; + protected blendModes: number[][]; + /** + * Collection of calls + * @member {Function[]} + */ + protected readonly map: Array<(value: boolean) => void>; + /** + * Collection of check calls + * @member {Function[]} + */ + protected readonly checks: Array<(system: this, state: State) => void>; + /** + * Default WebGL State + * @readonly + */ + protected defaultState: State; + constructor(); + contextChange(gl: IRenderingContext): void; + /** + * Sets the current state + * @param {*} state - The state to set. + */ + set(state: State): void; + /** + * Sets the state, when previous state is unknown. + * @param {*} state - The state to set + */ + forceState(state: State): void; + /** + * Sets whether to enable or disable blending. + * @param value - Turn on or off WebGl blending. + */ + setBlend(value: boolean): void; + /** + * Sets whether to enable or disable polygon offset fill. + * @param value - Turn on or off webgl polygon offset testing. + */ + setOffset(value: boolean): void; + /** + * Sets whether to enable or disable depth test. + * @param value - Turn on or off webgl depth testing. + */ + setDepthTest(value: boolean): void; + /** + * Sets whether to enable or disable depth mask. + * @param value - Turn on or off webgl depth mask. + */ + setDepthMask(value: boolean): void; + /** + * Sets whether to enable or disable cull face. + * @param {boolean} value - Turn on or off webgl cull face. + */ + setCullFace(value: boolean): void; + /** + * Sets the gl front face. + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + setFrontFace(value: boolean): void; + /** + * Sets the blend mode. + * @param {number} value - The blend mode to set to. + */ + setBlendMode(value: number): void; + /** + * Sets the polygon offset. + * @param {number} value - the polygon offset + * @param {number} scale - the polygon offset scale + */ + setPolygonOffset(value: number, scale: number): void; + /** Resets all the logic and disables the VAOs. */ + reset(): void; + /** + * Checks to see which updates should be checked based on which settings have been activated. + * + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. + * The idea is that we only check what we have too. + * @param func - the checking function to add or remove + * @param value - should the check function be added or removed. + */ + updateCheck(func: (system: this, state: State) => void, value: boolean): void; + /** + * A private little wrapper function that we call to check the blend mode. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + private static checkBlendMode; + /** + * A private little wrapper function that we call to check the polygon offset. + * @param system - the System to perform the state check on + * @param state - the state that the blendMode will pulled from + */ + private static checkPolygonOffset; + /** + * @ignore + */ + destroy(): void; +} + +/** + * System plugin to the renderer to manage stencils (used for masks). + * @memberof PIXI + */ +export declare class StencilSystem extends AbstractMaskSystem { + /** + * @param renderer - The renderer this System works for. + */ + constructor(renderer: Renderer); + getStackLength(): number; + /** + * Applies the Mask and adds it to the current stencil stack. + * @param maskData - The mask data + */ + push(maskData: MaskData): void; + /** + * Pops stencil mask. MaskData is already removed from stack + * @param {PIXI.DisplayObject} maskObject - object of popped mask data + */ + pop(maskObject: IMaskTarget): void; + /** + * Setup renderer to use the current stencil data. + * @private + */ + _useCurrent(): void; +} + +/** + * Resource type for SVG elements and graphics. + * @memberof PIXI + */ +export declare class SVGResource extends BaseImageResource { + /** Base64 encoded SVG element or URL for SVG file. */ + readonly svg: string; + /** The source scale to apply when rasterizing on load. */ + readonly scale: number; + /** A width override for rasterization on load. */ + readonly _overrideWidth: number; + /** A height override for rasterization on load. */ + readonly _overrideHeight: number; + /** Call when completely loaded. */ + private _resolve; + /** Promise when loading */ + private _load; + /** Cross origin value to use */ + private _crossorigin?; + /** + * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file. + * @param {object} [options] - Options to use + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. + */ + constructor(sourceBase64: string, options?: ISVGResourceOptions); + load(): Promise; + /** Loads an SVG image from `imageUrl` or `data URL`. */ + private _loadSvg; + /** + * Get size from an svg string using a regular expression. + * @param svgString - a serialized svg element + * @returns - image extension + */ + static getSize(svgString?: string): ISize; + /** Destroys this texture. */ + dispose(): void; + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} - If the source is a SVG source or data file + */ + static test(source: unknown, extension?: string): boolean; + /** + * Regular expression for SVG XML document. + * @example <?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg + * @readonly + */ + static SVG_XML: RegExp; + /** + * Regular expression for SVG size. + * @example <svg width="100" height="100"></svg> + * @readonly + */ + static SVG_SIZE: RegExp; +} + +/** + * Use the ISystem interface instead. + * @deprecated since 6.1.0 + * @memberof PIXI + */ +export declare class System implements ISystem { + /** Reference to the main renderer */ + renderer: Renderer; + /** + * @param renderer - Reference to Renderer + */ + constructor(renderer: Renderer); + /** Destroy and don't use after this. */ + destroy(): void; +} + +/** + * @memberof PIXI + * @namespace systems + * @see PIXI + * @deprecated since 6.0.0 + */ +export declare const systems: {}; + +export declare interface Texture extends GlobalMixins.Texture, EventEmitter { +} + +/** + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.from('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: + * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.from('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * @memberof PIXI + * @typeParam R - The BaseTexture's Resource type. + */ +export declare class Texture extends EventEmitter { + /** The base texture that this texture uses. */ + baseTexture: BaseTexture; + /** This is the area of original texture, before it was put in atlas. */ + orig: Rectangle; + /** + * This is the trimmed area of original texture, before it was put in atlas + * Please call `updateUvs()` after you change coordinates of `trim` manually. + */ + trim: Rectangle; + /** This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. */ + valid: boolean; + /** + * Does this Texture have any frame data assigned to it? + * + * This mode is enabled automatically if no frame was passed inside constructor. + * + * In this mode texture is subscribed to baseTexture events, and fires `update` on any change. + * + * Beware, after loading or resize of baseTexture event can fired two times! + * If you want more control, subscribe on baseTexture itself. + * + * ```js + * texture.on('update', () => {}); + * ``` + * + * Any assignment of `frame` switches off `noFrame` mode. + */ + noFrame: boolean; + /** + * Anchor point that is used as default if sprite is created with this texture. + * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. + * @default {0,0} + */ + defaultAnchor: Point; + /** Default TextureMatrix instance for this texture. By default, that object is not created because its heavy. */ + uvMatrix: TextureMatrix; + protected _rotate: number; + /** + * Update ID is observed by sprites and TextureMatrix instances. + * Call updateUvs() to increment it. + * @protected + */ + _updateID: number; + /** + * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, + * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) + */ + _frame: Rectangle; + /** + * The WebGL UV data cache. Can be used as quad UV. + * @protected + */ + _uvs: TextureUvs; + /** + * The ids under which this Texture has been added to the texture cache. This is + * automatically set as long as Texture.addToCache is used, but may not be set if a + * Texture is added directly to the TextureCache array. + */ + textureCacheIds: Array; + /** + * @param baseTexture - The base texture source to create the texture from + * @param frame - The rectangle frame of the texture to show + * @param orig - The area of original texture + * @param trim - Trimmed rectangle of original texture + * @param rotate - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param anchor - Default anchor point used for sprite placement / rotation + */ + constructor(baseTexture: BaseTexture, frame?: Rectangle, orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData); + /** + * Updates this texture on the gpu. + * + * Calls the TextureResource update. + * + * If you adjusted `frame` manually, please call `updateUvs()` instead. + */ + update(): void; + /** + * Called when the base texture is updated + * @protected + * @param baseTexture - The base texture. + */ + onBaseTextureUpdated(baseTexture: BaseTexture): void; + /** + * Destroys this texture + * @param [destroyBase=false] - Whether to destroy the base texture as well + */ + destroy(destroyBase?: boolean): void; + /** + * Creates a new texture object that acts the same as this one. + * @returns - The new texture + */ + clone(): Texture; + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + * Call it after changing the frame + */ + updateUvs(): void; + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source - + * Source or array of sources to create texture from + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.Texture} The newly created texture + */ + static from(source: TextureSource | TextureSource[], options?: IBaseTextureOptions, strict?: boolean): Texture; + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param url - The remote URL or array of URLs to load. + * @param options - Optional options to include + * @returns - A Promise that resolves to a Texture. + */ + static fromURL(url: string | string[], options?: IBaseTextureOptions): Promise>; + /** + * Create a new Texture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param width - Width of the resource + * @param height - Height of the resource + * @param options - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns - The resulting new BaseTexture + */ + static fromBuffer(buffer: Float32Array | Uint8Array, width: number, height: number, options?: IBaseTextureOptions): Texture; + /** + * Create a texture from a source and add to the cache. + * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source. + * @param imageUrl - File name of texture, for cache and resolving resolution. + * @param name - Human readable name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @param options + * @returns - Output texture + */ + static fromLoader(source: HTMLImageElement | HTMLCanvasElement | string, imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>; + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * @param texture - The Texture to add to the cache. + * @param id - The id that the Texture will be stored against. + */ + static addToCache(texture: Texture, id: string): void; + /** + * Remove a Texture from the global TextureCache. + * @param texture - id of a Texture to be removed, or a Texture instance itself + * @returns - The Texture that was removed + */ + static removeFromCache(texture: string | Texture): Texture | null; + /** + * Returns resolution of baseTexture + * @readonly + */ + get resolution(): number; + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + */ + get frame(): Rectangle; + set frame(frame: Rectangle); + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + */ + get rotate(): number; + set rotate(rotate: number); + /** The width of the Texture in pixels. */ + get width(): number; + /** The height of the Texture in pixels. */ + get height(): number; + /** Utility function for BaseTexture|Texture cast. */ + castToBaseTexture(): BaseTexture; + private static _EMPTY; + private static _WHITE; + /** An empty texture, used often to not have to create multiple empty textures. Can not be destroyed. */ + static get EMPTY(): Texture; + /** A white texture of 16x16 size, used for graphics and other things Can not be destroyed. */ + static get WHITE(): Texture; +} + +/** + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. + * @memberof PIXI + */ +export declare class TextureGCSystem implements ISystem { + /** + * Count + * @readonly + */ + count: number; + /** + * Check count + * @readonly + */ + checkCount: number; + /** + * Maximum idle time, in seconds + * @see PIXI.settings.GC_MAX_IDLE + */ + maxIdle: number; + /** + * Maximum number of item to check + * @see PIXI.settings.GC_MAX_CHECK_COUNT + */ + checkCountMax: number; + /** + * Current garbage collection mode + * @see PIXI.settings.GC_MODE + */ + mode: GC_MODES; + private renderer; + /** @param renderer - The renderer this System works for. */ + constructor(renderer: Renderer); + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + protected postrender(): void; + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + run(): void; + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + unload(displayObject: IUnloadableTexture): void; + destroy(): void; +} + +/** + * Class controls uv mapping from Texture normal space to BaseTexture normal space. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. + * + * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * Takes track of Texture changes through `_lastTextureID` private field. + * Use `update()` method call to track it from outside. + * @see PIXI.Texture + * @see PIXI.Mesh + * @see PIXI.TilingSprite + * @memberof PIXI + */ +export declare class TextureMatrix { + /** + * Matrix operation that converts texture region coords to texture coords + * @readonly + */ + mapCoord: Matrix; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders + * @default 0 + */ + clampOffset: number; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * @default 0.5 + */ + clampMargin: number; + /** + * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. + * Calculated based on clampOffset. + */ + readonly uClampFrame: Float32Array; + /** Normalized clamp offset. Calculated based on clampOffset. */ + readonly uClampOffset: Float32Array; + /** + * Tracks Texture frame changes. + * @protected + */ + _textureID: number; + /** + * Tracks Texture frame changes. + * @protected + */ + _updateID: number; + _texture: Texture; + /** + * If texture size is the same as baseTexture. + * @default false + * @readonly + */ + isSimple: boolean; + /** + * @param texture - observed texture + * @param clampMargin - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + */ + constructor(texture: Texture, clampMargin?: number); + /** Texture property. */ + get texture(): Texture; + set texture(value: Texture); + /** + * Multiplies uvs array to transform + * @param uvs - mesh uvs + * @param [out=uvs] - output + * @returns - output + */ + multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array; + /** + * Updates matrices if texture was changed. + * @param [forceUpdate=false] - if true, matrices will be updated any case + * @returns - Whether or not it was updated + */ + update(forceUpdate?: boolean): boolean; +} + +export declare type TextureSource = string | BaseTexture | ImageSource; + +/** + * System plugin to the renderer to manage textures. + * @memberof PIXI + */ +export declare class TextureSystem implements ISystem { + /** + * Bound textures. + * @readonly + */ + boundTextures: BaseTexture[]; + /** + * List of managed textures. + * @readonly + */ + managedTextures: Array; + /** Whether glTexture with int/uint sampler type was uploaded. */ + protected hasIntegerTextures: boolean; + protected CONTEXT_UID: number; + protected gl: IRenderingContext; + protected internalFormats: { + [type: number]: { + [format: number]: number; + }; + }; + protected webGLVersion: number; + /** + * BaseTexture value that shows that we don't know what is bound. + * @readonly + */ + protected unknownTexture: BaseTexture; + /** + * Did someone temper with textures state? We'll overwrite them when we need to unbind something. + * @private + */ + protected _unknownBoundTextures: boolean; + /** + * Current location. + * @readonly + */ + currentLocation: number; + emptyTextures: { + [key: number]: GLTexture; + }; + private renderer; + /** + * @param renderer - The renderer this system works for. + */ + constructor(renderer: Renderer); + /** Sets up the renderer context and necessary buffers. */ + contextChange(): void; + /** + * Bind a texture to a specific location + * + * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` + * @param texture - Texture to bind + * @param [location=0] - Location to bind at + */ + bind(texture: Texture | BaseTexture, location?: number): void; + /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */ + reset(): void; + /** + * Unbind a texture. + * @param texture - Texture to bind + */ + unbind(texture?: BaseTexture): void; + /** + * Ensures that current boundTextures all have FLOAT sampler type, + * see {@link PIXI.SAMPLER_TYPES} for explanation. + * @param maxTextures - number of locations to check + */ + ensureSamplerType(maxTextures: number): void; + /** + * Initialize a texture + * @private + * @param texture - Texture to initialize + */ + initTexture(texture: BaseTexture): GLTexture; + initTextureType(texture: BaseTexture, glTexture: GLTexture): void; + /** + * Update a texture + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + updateTexture(texture: BaseTexture): void; + /** + * Deletes the texture from WebGL + * @private + * @param texture - the texture to destroy + * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void; + /** + * Update texture style such as mipmap flag + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + */ + updateTextureStyle(texture: BaseTexture): void; + /** + * Set style for texture + * @private + * @param texture - Texture to update + * @param glTexture + */ + setStyle(texture: BaseTexture, glTexture: GLTexture): void; + destroy(): void; +} + +/** + * Stores a texture's frame in UV coordinates, in + * which everything lies in the rectangle `[(0,0), (1,0), + * (1,1), (0,1)]`. + * + * | Corner | Coordinates | + * |--------------|-------------| + * | Top-Left | `(x0,y0)` | + * | Top-Right | `(x1,y1)` | + * | Bottom-Right | `(x2,y2)` | + * | Bottom-Left | `(x3,y3)` | + * @protected + * @memberof PIXI + */ +export declare class TextureUvs { + /** X-component of top-left corner `(x0,y0)`. */ + x0: number; + /** Y-component of top-left corner `(x0,y0)`. */ + y0: number; + /** X-component of top-right corner `(x1,y1)`. */ + x1: number; + /** Y-component of top-right corner `(x1,y1)`. */ + y1: number; + /** X-component of bottom-right corner `(x2,y2)`. */ + x2: number; + /** Y-component of bottom-right corner `(x2,y2)`. */ + y2: number; + /** X-component of bottom-left corner `(x3,y3)`. */ + x3: number; + /** Y-component of bottom-right corner `(x3,y3)`. */ + y3: number; + uvsFloat32: Float32Array; + constructor(); + /** + * Sets the texture Uvs based on the given frame information. + * @protected + * @param frame - The frame of the texture + * @param baseFrame - The base frame of the texture + * @param rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + set(frame: Rectangle, baseFrame: ISize, rotate: number): void; + toString(): string; +} + +declare interface UBOElement { + data: IUniformData; + offset: number; + dataLen: number; + dirty: number; +} + +/** + * Uniform group holds uniform map and some ID's for work + * + * `UniformGroup` has two modes: + * + * 1: Normal mode + * Normal mode will upload the uniforms with individual function calls as required + * + * 2: Uniform buffer mode + * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or + * or a generic object that PixiJS will automatically map to a buffer for you. + * For maximum benefits, make Ubo UniformGroups static, and only update them each frame. + * + * Rules of UBOs: + * - UBOs only work with WebGL2, so make sure you have a fallback! + * - Only floats are supported (including vec[2,3,4], mat[2,3,4]) + * - Samplers cannot be used in ubo's (a GPU limitation) + * - You must ensure that the object you pass in exactly matches in the shader ubo structure. + * Otherwise, weirdness will ensue! + * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader. + * + * ``` + * // ubo in shader: + * uniform myCoolData { // declaring a ubo.. + * mat4 uCoolMatrix; + * float uFloatyMcFloatFace + * + * + * // a new uniform buffer object.. + * const myCoolData = new UniformBufferGroup({ + * uCoolMatrix: new Matrix(), + * uFloatyMcFloatFace: 23, + * }} + * + * // build a shader... + * const shader = Shader.from(srcVert, srcFrag, { + * myCoolData // name matches the ubo name in the shader. will be processed accordingly. + * }) + * + * ``` + * @memberof PIXI + */ +export declare class UniformGroup> { + /** + * Uniform values + * @member {object} + */ + readonly uniforms: LAYOUT; + /** + * Its a group and not a single uniforms. + * @default true + */ + readonly group: boolean; + /** + * unique id + * @protected + */ + id: number; + syncUniforms: Dict; + /** + * Dirty version + * @protected + */ + dirtyId: number; + /** Flag for if uniforms wont be changed after creation. */ + static: boolean; + /** Flags whether this group is treated like a uniform buffer object. */ + ubo: boolean; + buffer?: Buffer_2; + autoManage: boolean; + /** + * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer. + * @param isStatic - Uniforms wont be changed after creation. + * @param isUbo - If true, will treat this uniform group as a uniform buffer object. + */ + constructor(uniforms: LAYOUT | Buffer_2, isStatic?: boolean, isUbo?: boolean); + update(): void; + add(name: string, uniforms: Dict, _static?: boolean): void; + static from(uniforms: Dict | Buffer_2, _static?: boolean, _ubo?: boolean): UniformGroup; + /** + * A short hand function for creating a static UBO UniformGroup. + * @param uniforms - the ubo item + * @param _static - should this be updated each time it is used? defaults to true here! + */ + static uboFrom(uniforms: Dict | Buffer_2, _static?: boolean): UniformGroup; +} + +export declare const uniformParsers: IUniformParser[]; + +export declare type UniformsSyncCallback = (...args: any[]) => void; + +declare type UniformsSyncCallback_2 = (...args: any[]) => void; + +/** + * String of the current PIXI version. + * @memberof PIXI + */ +export declare const VERSION = "$_VERSION"; + +/** + * Resource type for {@code HTMLVideoElement}. + * @memberof PIXI + */ +export declare class VideoResource extends BaseImageResource { + /** Override the source to be the video element. */ + source: HTMLVideoElement; + /** + * `true` to use PIXI.Ticker.shared to auto update the base texture. + * @default true + */ + protected _autoUpdate: boolean; + /** + * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture. + * @default false + */ + protected _isConnectedToTicker: boolean; + protected _updateFPS: number; + protected _msToNextUpdate: number; + /** + * When set to true will automatically play videos used by this texture once + * they are loaded. If false, it will not modify the playing state. + * @default true + */ + protected autoPlay: boolean; + /** + * Promise when loading. + * @default null + */ + private _load; + /** Callback when completed with load. */ + private _resolve; + /** + * @param {HTMLVideoElement|object|string|Array} source - Video element to use. + * @param {object} [options] - Options to use + * @param {boolean} [options.autoLoad=true] - Start loading the video immediately + * @param {boolean} [options.autoPlay=true] - Start playing video immediately + * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. + * Leave at 0 to update at every render. + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + */ + constructor(source?: HTMLVideoElement | Array | string, options?: IVideoResourceOptions); + /** + * Trigger updating of the texture. + * @param _deltaTime - time delta since last tick + */ + update(_deltaTime?: number): void; + /** + * Start preloading the video resource. + * @returns {Promise} Handle the validate event + */ + load(): Promise; + /** + * Handle video error events. + * @param event + */ + private _onError; + /** + * Returns true if the underlying source is playing. + * @returns - True if playing. + */ + private _isSourcePlaying; + /** + * Returns true if the underlying source is ready for playing. + * @returns - True if ready. + */ + private _isSourceReady; + /** Runs the update loop when the video is ready to play. */ + private _onPlayStart; + /** Fired when a pause event is triggered, stops the update loop. */ + private _onPlayStop; + /** Fired when the video is loaded and ready to play. */ + private _onCanPlay; + /** Destroys this texture. */ + dispose(): void; + /** Should the base texture automatically update itself, set to true by default. */ + get autoUpdate(): boolean; + set autoUpdate(value: boolean); + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + */ + get updateFPS(): number; + set updateFPS(value: number); + /** + * Used to auto-detect the type of resource. + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @returns {boolean} `true` if video source + */ + static test(source: unknown, extension?: string): source is HTMLVideoElement; + /** + * List of common video file extensions supported by VideoResource. + * @readonly + */ + static TYPES: Array; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @readonly + */ + static MIME_TYPES: Dict; +} + +/** + * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand. + * @memberof PIXI + */ +export declare class ViewableBuffer { + size: number; + /** Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`. */ + rawBinaryData: ArrayBuffer; + /** View on the raw binary data as a `Uint32Array`. */ + uint32View: Uint32Array; + /** View on the raw binary data as a `Float32Array`. */ + float32View: Float32Array; + private _int8View; + private _uint8View; + private _int16View; + private _uint16View; + private _int32View; + /** + * @param length - The size of the buffer in bytes. + */ + constructor(length: number); + /** + * @param arrayBuffer - The source array buffer. + */ + constructor(arrayBuffer: ArrayBuffer); + /** View on the raw binary data as a `Int8Array`. */ + get int8View(): Int8Array; + /** View on the raw binary data as a `Uint8Array`. */ + get uint8View(): Uint8Array; + /** View on the raw binary data as a `Int16Array`. */ + get int16View(): Int16Array; + /** View on the raw binary data as a `Uint16Array`. */ + get uint16View(): Uint16Array; + /** View on the raw binary data as a `Int32Array`. */ + get int32View(): Int32Array; + /** + * Returns the view of the given type. + * @param type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @returns - typed array of given type + */ + view(type: string): ITypedArray; + /** Destroys all buffer references. Do not use after calling this. */ + destroy(): void; + static sizeOf(type: string): number; +} + +declare interface WEBGL_compressed_texture_atc { + COMPRESSED_RGB_ATC_WEBGL: number; + COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: number; + COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: number; +} + +declare interface WEBGL_compressed_texture_etc1_2 { + COMPRESSED_RGB_ETC1_WEBGL: number; +} + +declare interface WEBGL_compressed_texture_etc_2 { + COMPRESSED_R11_EAC: number; + COMPRESSED_SIGNED_R11_EAC: number; + COMPRESSED_RG11_EAC: number; + COMPRESSED_SIGNED_RG11_EAC: number; + COMPRESSED_RGB8_ETC2: number; + COMPRESSED_RGBA8_ETC2_EAC: number; + COMPRESSED_SRGB8_ETC2: number; + COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: number; + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: number; + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: number; +} + +declare interface WEBGL_compressed_texture_pvrtc_2 { + COMPRESSED_RGB_PVRTC_4BPPV1_IMG: number; + COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: number; + COMPRESSED_RGB_PVRTC_2BPPV1_IMG: number; + COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: number; +} + +declare interface WebGLExtensions { + drawBuffers?: WEBGL_draw_buffers; + depthTexture?: OES_texture_float; + loseContext?: WEBGL_lose_context; + vertexArrayObject?: OES_vertex_array_object; + anisotropicFiltering?: EXT_texture_filter_anisotropic; + uint32ElementIndex?: OES_element_index_uint; + floatTexture?: OES_texture_float; + floatTextureLinear?: OES_texture_float_linear; + textureHalfFloat?: OES_texture_half_float; + textureHalfFloatLinear?: OES_texture_half_float_linear; + colorBufferFloat?: WEBGL_color_buffer_float; + s3tc?: WEBGL_compressed_texture_s3tc; + s3tc_sRGB?: WEBGL_compressed_texture_s3tc_srgb; + etc?: WEBGL_compressed_texture_etc_2; + etc1?: WEBGL_compressed_texture_etc1_2; + pvrtc?: WEBGL_compressed_texture_pvrtc_2; + atc?: WEBGL_compressed_texture_atc; + astc?: WEBGL_compressed_texture_astc; +} + + +export * from "@pixi/extensions"; + +export { } diff --git a/live2d/node_modules/@pixi/core/package.json b/live2d/node_modules/@pixi/core/package.json new file mode 100644 index 0000000..6d85b41 --- /dev/null +++ b/live2d/node_modules/@pixi/core/package.json @@ -0,0 +1,57 @@ +{ + "name": "@pixi/core", + "version": "6.5.10", + "main": "dist/cjs/core.js", + "module": "dist/esm/core.mjs", + "bundle": "dist/browser/core.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/core.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/core.js" + } + } + }, + "description": "Core PixiJS", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/pixijs" + }, + "dependencies": { + "@types/offscreencanvas": "^2019.6.4" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/extensions": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/runner": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/ticker": "6.5.10", + "@pixi/utils": "6.5.10" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/display/LICENSE b/live2d/node_modules/@pixi/display/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/display/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/README.md b/live2d/node_modules/@pixi/display/README.md new file mode 100644 index 0000000..4c60468 --- /dev/null +++ b/live2d/node_modules/@pixi/display/README.md @@ -0,0 +1,13 @@ +# @pixi/display + +## Installation + +```bash +npm install @pixi/display +``` + +## Usage + +```js +import * as application from '@pixi/display'; +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/browser/display.js b/live2d/node_modules/@pixi/display/dist/browser/display.js new file mode 100644 index 0000000..7ed012a --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/browser/display.js @@ -0,0 +1,1985 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_display = (function (exports, settings, math, utils, constants) { + 'use strict'; + + /** + * Sets the default value for the container property 'sortableChildren'. + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * @static + * @constant + * @name SORTABLE_CHILDREN + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + settings.settings.SORTABLE_CHILDREN = false; + + /** + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. + * @memberof PIXI + */ + var Bounds = /** @class */ (function () { + function Bounds() { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + this.rect = null; + this.updateID = -1; + } + /** + * Checks if bounds are empty. + * @returns - True if empty. + */ + Bounds.prototype.isEmpty = function () { + return this.minX > this.maxX || this.minY > this.maxY; + }; + /** Clears the bounds and resets. */ + Bounds.prototype.clear = function () { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * @param rect - Temporary object will be used if AABB is not empty + * @returns - A rectangle of the bounds + */ + Bounds.prototype.getRectangle = function (rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return math.Rectangle.EMPTY; + } + rect = rect || new math.Rectangle(0, 0, 1, 1); + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + return rect; + }; + /** + * This function should be inlined when its possible. + * @param point - The point to add. + */ + Bounds.prototype.addPoint = function (point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + /** + * Adds a point, after transformed. This should be inlined when its possible. + * @param matrix + * @param point + */ + Bounds.prototype.addPointMatrix = function (matrix, point) { + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty; + var x = (a * point.x) + (c * point.y) + tx; + var y = (b * point.x) + (d * point.y) + ty; + this.minX = Math.min(this.minX, x); + this.maxX = Math.max(this.maxX, x); + this.minY = Math.min(this.minY, y); + this.maxY = Math.max(this.maxY, y); + }; + /** + * Adds a quad, not transformed + * @param vertices - The verts to add. + */ + Bounds.prototype.addQuad = function (vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = vertices[0]; + var y = vertices[1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds sprite frame, transformed. + * @param transform - transform to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { + this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); + }; + /** + * Adds sprite frame, multiplied by matrix + * @param matrix - matrix to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = (a * x0) + (c * y0) + tx; + var y = (b * x0) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y0) + tx; + y = (b * x1) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x0) + (c * y1) + tx; + y = (b * x0) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y1) + tx; + y = (b * x1) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds screen vertices from array + * @param vertexData - calculated vertices + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var x = vertexData[i]; + var y = vertexData[i + 1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Add an array of mesh vertices + * @param transform - mesh transform + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { + this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); + }; + /** + * Add an array of mesh vertices. + * @param matrix - mesh matrix + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + * @param padX - x padding + * @param padY - y padding + */ + Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { + if (padX === void 0) { padX = 0; } + if (padY === void 0) { padY = padX; } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + minX = Math.min(minX, x - padX); + maxX = Math.max(maxX, x + padX); + minY = Math.min(minY, y - padY); + maxY = Math.max(maxY, y + padY); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds other {@link Bounds}. + * @param bounds - The Bounds to be added + */ + Bounds.prototype.addBounds = function (bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + /** + * Adds other Bounds, masked with Bounds. + * @param bounds - The Bounds to be added. + * @param mask - TODO + */ + Bounds.prototype.addBoundsMask = function (bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * @param bounds - other bounds + * @param matrix - multiplicator + */ + Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { + this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); + }; + /** + * Adds other Bounds, masked with Rectangle. + * @param bounds - TODO + * @param area - TODO + */ + Bounds.prototype.addBoundsArea = function (bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + */ + Bounds.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + if (!this.isEmpty()) { + this.minX -= paddingX; + this.maxX += paddingX; + this.minY -= paddingY; + this.maxY += paddingY; + } + }; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + * @param padX - padding X + * @param padY - padding Y + */ + Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { + x0 -= padX; + y0 -= padY; + x1 += padX; + y1 += padY; + this.minX = this.minX < x0 ? this.minX : x0; + this.maxX = this.maxX > x1 ? this.maxX : x1; + this.minY = this.minY < y0 ? this.minY : y0; + this.maxY = this.maxY > y1 ? this.maxY : y1; + }; + return Bounds; + }()); + + /*! ***************************************************************************** + 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 __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + 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 __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + 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 __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __createBinding(o, m, k, k2) { + if (k2 === undefined) { k2 = k; } + o[k2] = m[k]; + } + + function __exportStar(m, exports) { + for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + 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."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __spreadArrays() { + var arguments$1 = arguments; + + for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[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 __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + + function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + } + + function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + } + + /** + * The base class for all objects that are rendered on the screen. + * + * This is an abstract class and can not be used on its own; rather it should be extended. + * + * ## Display objects implemented in PixiJS + * + * | Display Object | Description | + * | ------------------------------- | --------------------------------------------------------------------- | + * | {@link PIXI.Container} | Adds support for `children` to DisplayObject | + * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API | + * | {@link PIXI.Sprite} | Draws textures (i.e. images) | + * | {@link PIXI.Text} | Draws text using the Canvas API internally | + * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures | + * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion | + * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images | + * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data | + * | {@link PIXI.NineSlicePlane} | Mesh-related | + * | {@link PIXI.SimpleMesh} | v4-compatible mesh | + * | {@link PIXI.SimplePlane} | Mesh-related | + * | {@link PIXI.SimpleRope} | Mesh-related | + * + * ## Transforms + * + * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its + * local coordinate space to its parent's local coordinate space. The following properties are derived + * from the transform: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot} + * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot + * is equal to position, regardless of the other three transformations. In other words, It is the center of + * rotation, scaling, and skewing. + *
[position]{@link PIXI.DisplayObject#position} + * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local + * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object + * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space. + *
[scale]{@link PIXI.DisplayObject#scale} + * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the + * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center + * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}. + *
[rotation]{@link PIXI.DisplayObject#rotation} + * Rotation. This will rotate the display object's projection by this angle (in radians). + *
[skew]{@link PIXI.DisplayObject#skew} + *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

+ *

+ * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be + * thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is + * ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be + * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will + * be rotated by an angle between ⍺ and β. + *

+ *

+ * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying + * a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ. + *

+ *

+ * Another quite interesting observation is that "skew.x", "skew.y", rotation are communtative operations. Indeed, + * because rotation is essentially a careful combination of the two. + *

+ *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width + * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing + * the "requested" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there + * is no concept of user-defined width. + *
height + * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing + * the "requested" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there + * is no concept of user-defined height. + *
+ * + * ## Bounds + * + * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit + * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the + * `worldTransform` to calculate in world space). + * + * There are a few additional types of bounding boxes: + * + * | Bounds | Description | + * | --------------------- | ---------------------------------------------------------------------------------------- | + * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. | + * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. | + * | Render Bounds | The bounds, but including extra rendering effects like filter padding. | + * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. | + * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. | + * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)| + * | Content Bounds | The natural bounds when excluding all children of a `Container`. | + * + * ### calculateBounds + * + * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children. + * + * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and + * `getLocalBounds` to work. This method must write the bounds into `this._bounds`. + * + * Generally, the following technique works for most simple cases: take the list of points + * forming the "hull" of the object (i.e. outline of the object's shape), and then add them + * using {@link PIXI.Bounds#addPointMatrix}. + * + * ```js + * calculateBounds(): void + * { + * const points = [...]; + * + * for (let i = 0, j = points.length; i < j; i++) + * { + * this._bounds.addPointMatrix(this.worldTransform, points[i]); + * } + * } + * ``` + * + * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them + * in one array together. + * + * ## Alpha + * + * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display + * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not + * applied on any ancestor further up the chain). + * + * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}. + * + * ## Renderable vs Visible + * + * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the + * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display + * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not + * be calculated. + * + * It is recommended that applications use the `renderable` property for culling. See + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details. + * + * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This + * one is also better in terms of performance. + * @memberof PIXI + */ + var DisplayObject = /** @class */ (function (_super) { + __extends(DisplayObject, _super); + function DisplayObject() { + var _this = _super.call(this) || this; + _this.tempDisplayObjectParent = null; + // TODO: need to create Transform from factory + _this.transform = new math.Transform(); + _this.alpha = 1; + _this.visible = true; + _this.renderable = true; + _this.cullable = false; + _this.cullArea = null; + _this.parent = null; + _this.worldAlpha = 1; + _this._lastSortedIndex = 0; + _this._zIndex = 0; + _this.filterArea = null; + _this.filters = null; + _this._enabledFilters = null; + _this._bounds = new Bounds(); + _this._localBounds = null; + _this._boundsID = 0; + _this._boundsRect = null; + _this._localBoundsRect = null; + _this._mask = null; + _this._maskRefCount = 0; + _this._destroyed = false; + _this.isSprite = false; + _this.isMask = false; + return _this; + } + /** + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * @param source - The source of properties and methods to mix in. + */ + DisplayObject.mixin = function (source) { + // in ES8/ES2017, this would be really easy: + // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); + // get all the enumerable property keys + var keys = Object.keys(source); + // loop through properties + for (var i = 0; i < keys.length; ++i) { + var propertyName = keys[i]; + // Set the property using the property descriptor - this works for accessors and normal value properties + Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); + } + }; + Object.defineProperty(DisplayObject.prototype, "destroyed", { + /** + * Fired when this DisplayObject is added to a Container. + * @instance + * @event added + * @param {PIXI.Container} container - The container added to. + */ + /** + * Fired when this DisplayObject is removed from a Container. + * @instance + * @event removed + * @param {PIXI.Container} container - The container removed from. + */ + /** + * Fired when this DisplayObject is destroyed. This event is emitted once + * destroy is finished. + * @instance + * @event destroyed + */ + /** Readonly flag for destroyed display objects. */ + get: function () { + return this._destroyed; + }, + enumerable: false, + configurable: true + }); + /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */ + DisplayObject.prototype._recursivePostUpdateTransform = function () { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } + else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); + } + }; + /** Updates the object transform for rendering. TODO - Optimization pass! */ + DisplayObject.prototype.updateTransform = function () { + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // multiply the alphas.. + this.worldAlpha = this.alpha * this.parent.worldAlpha; + }; + /** + * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}. + * + * This method is expensive on containers with a large subtree (like the stage). This is because the bounds + * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to + * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update + * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using + * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise, + * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as + * its height increases. + * + * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated. + * The world bounds of all display objects in a container's **subtree** will also be recalculated. + * + * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds + * calculation if needed. + * + * ```js + * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect); + * ``` + * + * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This + * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more + * details. + * + * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms + * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain + * cases. + * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The minimum axis-aligned rectangle in world space that fits around this object. + */ + DisplayObject.prototype.getBounds = function (skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } + else { + this._recursivePostUpdateTransform(); + this.updateTransform(); + } + } + if (this._bounds.updateID !== this._boundsID) { + this.calculateBounds(); + this._bounds.updateID = this._boundsID; + } + if (!rect) { + if (!this._boundsRect) { + this._boundsRect = new math.Rectangle(); + } + rect = this._boundsRect; + } + return this._bounds.getRectangle(rect); + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The rectangular bounding area. + */ + DisplayObject.prototype.getLocalBounds = function (rect) { + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new math.Rectangle(); + } + rect = this._localBoundsRect; + } + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + var transformRef = this.transform; + var parentRef = this.parent; + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + var worldBounds = this._bounds; + var worldBoundsID = this._boundsID; + this._bounds = this._localBounds; + var bounds = this.getBounds(false, rect); + this.parent = parentRef; + this.transform = transformRef; + this._bounds = worldBounds; + this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects + return bounds; + }; + /** + * Calculates the global position of the display object. + * @param position - The world origin to calculate from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform. + * @returns - A point object representing the position of this object. + */ + DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { + if (skipUpdate === void 0) { skipUpdate = false; } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // don't need to update the lot + return this.worldTransform.apply(position, point); + }; + /** + * Calculates the local position of the display object relative to another point. + * @param position - The world origin to calculate from. + * @param from - The DisplayObject to calculate the global position from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform + * @returns - A point object representing the position of this object + */ + DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { + if (from) { + position = from.toGlobal(position, point, skipUpdate); + } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // simply apply the matrix.. + return this.worldTransform.applyInverse(position, point); + }; + /** + * Set the parent Container of this DisplayObject. + * @param container - The Container to add this DisplayObject to. + * @returns - The Container that this DisplayObject was added to. + */ + DisplayObject.prototype.setParent = function (container) { + if (!container || !container.addChild) { + throw new Error('setParent: Argument must be a Container'); + } + container.addChild(this); + return container; + }; + /** + * Convenience function to set the position, scale, skew and pivot at once. + * @param x - The X position + * @param y - The Y position + * @param scaleX - The X scale value + * @param scaleY - The Y scale value + * @param rotation - The rotation + * @param skewX - The X skew value + * @param skewY - The Y skew value + * @param pivotX - The X pivot value + * @param pivotY - The Y pivot value + * @returns - The DisplayObject instance + */ + DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (scaleX === void 0) { scaleX = 1; } + if (scaleY === void 0) { scaleY = 1; } + if (rotation === void 0) { rotation = 0; } + if (skewX === void 0) { skewX = 0; } + if (skewY === void 0) { skewY = 0; } + if (pivotX === void 0) { pivotX = 0; } + if (pivotY === void 0) { pivotY = 0; } + this.position.x = x; + this.position.y = y; + this.scale.x = !scaleX ? 1 : scaleX; + this.scale.y = !scaleY ? 1 : scaleY; + this.rotation = rotation; + this.skew.x = skewX; + this.skew.y = skewY; + this.pivot.x = pivotX; + this.pivot.y = pivotY; + return this; + }; + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy()`. + * @param _options + */ + DisplayObject.prototype.destroy = function (_options) { + if (this.parent) { + this.parent.removeChild(this); + } + this._destroyed = true; + this.transform = null; + this.parent = null; + this._bounds = null; + this.mask = null; + this.cullArea = null; + this.filters = null; + this.filterArea = null; + this.hitArea = null; + this.interactive = false; + this.interactiveChildren = false; + this.emit('destroyed'); + this.removeAllListeners(); + }; + Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { + /** + * @protected + * @member {PIXI.Container} + */ + get: function () { + if (this.tempDisplayObjectParent === null) { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + this.tempDisplayObjectParent = new TemporaryDisplayObject(); + } + return this.tempDisplayObjectParent; + }, + enumerable: false, + configurable: true + }); + /** + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root + * + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` + * @returns - current parent + */ + DisplayObject.prototype.enableTempParent = function () { + var myParent = this.parent; + this.parent = this._tempDisplayObjectParent; + return myParent; + }; + /** + * Pair method for `enableTempParent` + * @param cacheParent - Actual parent of element + */ + DisplayObject.prototype.disableTempParent = function (cacheParent) { + this.parent = cacheParent; + }; + Object.defineProperty(DisplayObject.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + */ + get: function () { + return this.position.x; + }, + set: function (value) { + this.transform.position.x = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "y", { + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + */ + get: function () { + return this.position.y; + }, + set: function (value) { + this.transform.position.y = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldTransform", { + /** + * Current transform of the object based on world (parent) factors. + * @readonly + */ + get: function () { + return this.transform.worldTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "localTransform", { + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * @readonly + */ + get: function () { + return this.transform.localTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "position", { + /** + * The coordinate of the object relative to the local coordinates of the parent. + * @since 4.0.0 + */ + get: function () { + return this.transform.position; + }, + set: function (value) { + this.transform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "scale", { + /** + * The scale factors of this object along the local coordinate axes. + * + * The default scale is (1, 1). + * @since 4.0.0 + */ + get: function () { + return this.transform.scale; + }, + set: function (value) { + this.transform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "pivot", { + /** + * The center of rotation, scaling, and skewing for this display object in its local space. The `position` + * is the projection of `pivot` in the parent's local space. + * + * By default, the pivot is the origin (0, 0). + * @since 4.0.0 + */ + get: function () { + return this.transform.pivot; + }, + set: function (value) { + this.transform.pivot.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "skew", { + /** + * The skew factor for the object in radians. + * @since 4.0.0 + */ + get: function () { + return this.transform.skew; + }, + set: function (value) { + this.transform.skew.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "rotation", { + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation; + }, + set: function (value) { + this.transform.rotation = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "angle", { + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation * math.RAD_TO_DEG; + }, + set: function (value) { + this.transform.rotation = value * math.DEG_TO_RAD; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "zIndex", { + /** + * The zIndex of the displayObject. + * + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other display objects within the same container. + * @see PIXI.Container#sortableChildren + */ + get: function () { + return this._zIndex; + }, + set: function (value) { + this._zIndex = value; + if (this.parent) { + this.parent.sortDirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldVisible", { + /** + * Indicates if the object is globally visible. + * @readonly + */ + get: function () { + var item = this; + do { + if (!item.visible) { + return false; + } + item = item.parent; + } while (item); + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "mask", { + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. + * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong. + * To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + */ + get: function () { + return this._mask; + }, + set: function (value) { + if (this._mask === value) { + return; + } + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + maskObject._maskRefCount--; + if (maskObject._maskRefCount === 0) { + maskObject.renderable = true; + maskObject.isMask = false; + } + } + } + this._mask = value; + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + if (maskObject._maskRefCount === 0) { + maskObject.renderable = false; + maskObject.isMask = true; + } + maskObject._maskRefCount++; + } + } + }, + enumerable: false, + configurable: true + }); + return DisplayObject; + }(utils.EventEmitter)); + /** + * @private + */ + var TemporaryDisplayObject = /** @class */ (function (_super) { + __extends(TemporaryDisplayObject, _super); + function TemporaryDisplayObject() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.sortDirty = null; + return _this; + } + return TemporaryDisplayObject; + }(DisplayObject)); + /** + * DisplayObject default updateTransform, does not update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.DisplayObject# + * @method displayObjectUpdateTransform + */ + DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; + + function sortChildren(a, b) { + if (a.zIndex === b.zIndex) { + return a._lastSortedIndex - b._lastSortedIndex; + } + return a.zIndex - b.zIndex; + } + /** + * Container is a general-purpose display object that holds children. It also adds built-in support for advanced + * rendering features like masking and filtering. + * + * It is the base class of all display objects that act as a container for other objects, including Graphics + * and Sprite. + * + * ```js + * import { BlurFilter } from '@pixi/filter-blur'; + * import { Container } from '@pixi/display'; + * import { Graphics } from '@pixi/graphics'; + * import { Sprite } from '@pixi/sprite'; + * + * let container = new Container(); + * let sprite = Sprite.from("https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png"); + * + * sprite.width = 512; + * sprite.height = 512; + * + * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container + * // is rendered. + * container.addChild(sprite); + * + * // Blurs whatever is rendered by the container + * container.filters = [new BlurFilter()]; + * + * // Only the contents within a circle at the center should be rendered onto the screen. + * container.mask = new Graphics() + * .beginFill(0xffffff) + * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2) + * .endFill(); + * ``` + * @memberof PIXI + */ + var Container = /** @class */ (function (_super) { + __extends(Container, _super); + function Container() { + var _this = _super.call(this) || this; + _this.children = []; + _this.sortableChildren = settings.settings.SORTABLE_CHILDREN; + _this.sortDirty = false; + return _this; + /** + * Fired when a DisplayObject is added to this Container. + * @event PIXI.Container#childAdded + * @param {PIXI.DisplayObject} child - The child added to the Container. + * @param {PIXI.Container} container - The container that added the child. + * @param {number} index - The children's index of the added child. + */ + /** + * Fired when a DisplayObject is removed from this Container. + * @event PIXI.DisplayObject#childRemoved + * @param {PIXI.DisplayObject} child - The child removed from the Container. + * @param {PIXI.Container} container - The container that removed the child. + * @param {number} index - The former children's index of the removed child + */ + } + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified. + * @param _length + */ + Container.prototype.onChildrenChange = function (_length) { + /* empty */ + }; + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container + * @returns {PIXI.DisplayObject} - The first child that was added. + */ + Container.prototype.addChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the array and add all children + for (var i = 0; i < children.length; i++) { + // eslint-disable-next-line prefer-rest-params + this.addChild(children[i]); + } + } + else { + var child = children[0]; + // if the child has a parent then lets remove it as PixiJS objects can only exist in one place + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.push(child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(this.children.length - 1); + this.emit('childAdded', child, this, this.children.length - 1); + child.emit('added', this); + } + return children[0]; + }; + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @returns {PIXI.DisplayObject} The child that was added. + */ + Container.prototype.addChildAt = function (child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); + } + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.splice(index, 0, child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('added', this); + this.emit('childAdded', child, this, index); + return child; + }; + /** + * Swaps the position of 2 Display Objects within this container. + * @param child - First display object to swap + * @param child2 - Second display object to swap + */ + Container.prototype.swapChildren = function (child, child2) { + if (child === child2) { + return; + } + var index1 = this.getChildIndex(child); + var index2 = this.getChildIndex(child2); + this.children[index1] = child2; + this.children[index2] = child; + this.onChildrenChange(index1 < index2 ? index1 : index2); + }; + /** + * Returns the index position of a child DisplayObject instance + * @param child - The DisplayObject instance to identify + * @returns - The index position of the child display object to identify + */ + Container.prototype.getChildIndex = function (child) { + var index = this.children.indexOf(child); + if (index === -1) { + throw new Error('The supplied DisplayObject must be a child of the caller'); + } + return index; + }; + /** + * Changes the position of an existing child in the display object container + * @param child - The child DisplayObject instance for which you want to change the index number + * @param index - The resulting index number for the child display object + */ + Container.prototype.setChildIndex = function (child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); + } + var currentIndex = this.getChildIndex(child); + utils.removeItems(this.children, currentIndex, 1); // remove from old position + this.children.splice(index, 0, child); // add at new position + this.onChildrenChange(index); + }; + /** + * Returns the child at the specified index + * @param index - The index to get the child at + * @returns - The child at the given index, if any. + */ + Container.prototype.getChildAt = function (index) { + if (index < 0 || index >= this.children.length) { + throw new Error("getChildAt: Index (" + index + ") does not exist."); + } + return this.children[index]; + }; + /** + * Removes one or more children from the container. + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove + * @returns {PIXI.DisplayObject} The first child that was removed. + */ + Container.prototype.removeChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the arguments property and remove all children + for (var i = 0; i < children.length; i++) { + this.removeChild(children[i]); + } + } + else { + var child = children[0]; + var index = this.children.indexOf(child); + if (index === -1) + { return null; } + child.parent = null; + // ensure child transform will be recalculated + child.transform._parentID = -1; + utils.removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + } + return children[0]; + }; + /** + * Removes a child from the specified index position. + * @param index - The index to get the child from + * @returns The child that was removed. + */ + Container.prototype.removeChildAt = function (index) { + var child = this.getChildAt(index); + // ensure child transform will be recalculated.. + child.parent = null; + child.transform._parentID = -1; + utils.removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + return child; + }; + /** + * Removes all children from this container that are within the begin and end indexes. + * @param beginIndex - The beginning position. + * @param endIndex - The ending position. Default value is size of the container. + * @returns - List of removed children + */ + Container.prototype.removeChildren = function (beginIndex, endIndex) { + if (beginIndex === void 0) { beginIndex = 0; } + if (endIndex === void 0) { endIndex = this.children.length; } + var begin = beginIndex; + var end = endIndex; + var range = end - begin; + var removed; + if (range > 0 && range <= end) { + removed = this.children.splice(begin, range); + for (var i = 0; i < removed.length; ++i) { + removed[i].parent = null; + if (removed[i].transform) { + removed[i].transform._parentID = -1; + } + } + this._boundsID++; + this.onChildrenChange(beginIndex); + for (var i = 0; i < removed.length; ++i) { + removed[i].emit('removed', this); + this.emit('childRemoved', removed[i], this, i); + } + return removed; + } + else if (range === 0 && this.children.length === 0) { + return []; + } + throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); + }; + /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */ + Container.prototype.sortChildren = function () { + var sortRequired = false; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + child._lastSortedIndex = i; + if (!sortRequired && child.zIndex !== 0) { + sortRequired = true; + } + } + if (sortRequired && this.children.length > 1) { + this.children.sort(sortChildren); + } + this.sortDirty = false; + }; + /** Updates the transform on all children of this container for rendering. */ + Container.prototype.updateTransform = function () { + if (this.sortableChildren && this.sortDirty) { + this.sortChildren(); + } + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // TODO: check render flags, how to process stuff here + this.worldAlpha = this.alpha * this.parent.worldAlpha; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + }; + /** + * Recalculates the bounds of the container. + * + * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds + * is limited to its mask's bounds or filterArea, if any is applied. + */ + Container.prototype.calculateBounds = function () { + this._bounds.clear(); + this._calculateBounds(); + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (!child.visible || !child.renderable) { + continue; + } + child.calculateBounds(); + // TODO: filter+mask, need to mask both somehow + if (child._mask) { + var maskObject = (child._mask.isMaskData + ? child._mask.maskObject : child._mask); + if (maskObject) { + maskObject.calculateBounds(); + this._bounds.addBoundsMask(child._bounds, maskObject._bounds); + } + else { + this._bounds.addBounds(child._bounds); + } + } + else if (child.filterArea) { + this._bounds.addBoundsArea(child._bounds, child.filterArea); + } + else { + this._bounds.addBounds(child._bounds); + } + } + this._bounds.updateID = this._boundsID; + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render() + * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @returns - The rectangular bounding area. + */ + Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { + if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } + var result = _super.prototype.getLocalBounds.call(this, rect); + if (!skipChildrenUpdate) { + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + } + return result; + }; + /** + * Recalculates the content bounds of this object. This should be overriden to + * calculate the bounds of this specific object (not including children). + * @protected + */ + Container.prototype._calculateBounds = function () { + // FILL IN// + }; + /** + * Renders this object and its children with culling. + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype._renderWithCulling = function (renderer) { + var sourceFrame = renderer.renderTexture.sourceFrame; + // If the source frame is empty, stop rendering. + if (!(sourceFrame.width > 0 && sourceFrame.height > 0)) { + return; + } + // Render the content of the container only if its bounds intersect with the source frame. + // All filters are on the stack at this point, and the filter source frame is bound: + // therefore, even if the bounds to non intersect the filter frame, the filter + // is still applied and any filter padding that is in the frame is rendered correctly. + var bounds; + var transform; + // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea + // rectangle must completely contain the container and its children including filter padding. + if (this.cullArea) { + bounds = this.cullArea; + transform = this.worldTransform; + } + // If the container doesn't override _render, we can skip the bounds calculation and intersection test. + else if (this._render !== Container.prototype._render) { + bounds = this.getBounds(true); + } + // Render the container if the source frame intersects the bounds. + if (bounds && sourceFrame.intersects(bounds, transform)) { + this._render(renderer); + } + // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering. + else if (this.cullArea) { + return; + } + // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect + // the source frame, because the children might have filters with nonzero padding, which may intersect + // with the source frame while the bounds do not: filter padding is not included in the bounds. + // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered + // if they are out of frame; otherwise, render the children normally. + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + var childCullable = child.cullable; + child.cullable = childCullable || !this.cullArea; + child.render(renderer); + child.cullable = childCullable; + } + }; + /** + * Renders the object using the WebGL renderer. + * + * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the + * container itself. This `render` method will invoke it, and also invoke the `render` methods of all + * children afterward. + * + * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and + * the bounds of this object are out of frame, this implementation will entirely skip rendering. + * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally, + * setting alpha to zero is not recommended for purely skipping rendering. + * + * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is + * advised to employ **culling** to automatically skip rendering objects outside of the current screen. + * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}. + * Other culling methods might be better suited for a large number static objects; see + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}. + * + * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or + * filtering is applied on a container. This does, however, break batching and can affect performance when + * masking and filtering is applied extensively throughout the scene graph. + * @param renderer - The renderer + */ + Container.prototype.render = function (renderer) { + // if the object is not visible or the alpha is 0 then no need to render this element + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + // do a quick check to see if this element has a mask or a filter. + if (this._mask || (this.filters && this.filters.length)) { + this.renderAdvanced(renderer); + } + else if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + }; + /** + * Render the object using the WebGL renderer and advanced features. + * @param renderer - The renderer + */ + Container.prototype.renderAdvanced = function (renderer) { + var filters = this.filters; + var mask = this._mask; + // push filter first as we need to ensure the stencil buffer is correct for any masking + if (filters) { + if (!this._enabledFilters) { + this._enabledFilters = []; + } + this._enabledFilters.length = 0; + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { + this._enabledFilters.push(filters[i]); + } + } + } + var flush = (filters && this._enabledFilters && this._enabledFilters.length) + || (mask && (!mask.isMaskData + || (mask.enabled && (mask.autoDetect || mask.type !== constants.MASK_TYPES.NONE)))); + if (flush) { + renderer.batch.flush(); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.push(this, this._enabledFilters); + } + if (mask) { + renderer.mask.push(this, this._mask); + } + if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + if (flush) { + renderer.batch.flush(); + } + if (mask) { + renderer.mask.pop(this); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.pop(); + } + }; + /** + * To be overridden by the subclasses. + * @param _renderer - The renderer + */ + Container.prototype._render = function (_renderer) { + // this is where content itself gets rendered... + }; + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Container.prototype.destroy = function (options) { + _super.prototype.destroy.call(this); + this.sortDirty = false; + var destroyChildren = typeof options === 'boolean' ? options : options && options.children; + var oldChildren = this.removeChildren(0, this.children.length); + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { + oldChildren[i].destroy(options); + } + } + }; + Object.defineProperty(Container.prototype, "width", { + /** The width of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.x * this.getLocalBounds().width; + }, + set: function (value) { + var width = this.getLocalBounds().width; + if (width !== 0) { + this.scale.x = value / width; + } + else { + this.scale.x = 1; + } + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Container.prototype, "height", { + /** The height of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.y * this.getLocalBounds().height; + }, + set: function (value) { + var height = this.getLocalBounds().height; + if (height !== 0) { + this.scale.y = value / height; + } + else { + this.scale.y = 1; + } + this._height = value; + }, + enumerable: false, + configurable: true + }); + return Container; + }(DisplayObject)); + /** + * Container default updateTransform, does update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.Container# + * @method containerUpdateTransform + */ + Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; + + exports.Bounds = Bounds; + exports.Container = Container; + exports.DisplayObject = DisplayObject; + exports.TemporaryDisplayObject = TemporaryDisplayObject; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI, PIXI.utils, PIXI); +Object.assign(this.PIXI, _pixi_display); +//# sourceMappingURL=display.js.map diff --git a/live2d/node_modules/@pixi/display/dist/browser/display.js.map b/live2d/node_modules/@pixi/display/dist/browser/display.js.map new file mode 100644 index 0000000..843d0b4 --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/browser/display.js.map @@ -0,0 +1 @@ +{"version":3,"file":"display.js","sources":["../../src/settings.ts","../../src/Bounds.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/DisplayObject.ts","../../src/Container.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n * @memberof PIXI\n */\nexport class Bounds\n{\n /** @default Infinity */\n public minX: number;\n\n /** @default Infinity */\n public minY: number;\n\n /** @default -Infinity */\n public maxX: number;\n\n /** @default -Infinity */\n public maxY: number;\n\n public rect: Rectangle;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n */\n public updateID: number;\n\n constructor()\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n\n this.rect = null;\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n * @returns - True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["settings","Rectangle","arguments","Transform","RAD_TO_DEG","DEG_TO_RAD","EventEmitter","removeItems","MASK_TYPES"],"mappings":";;;;;;;;;;;IAEA;;;;;;;;;;;;;;;;;IAiBG;AACHA,qBAAQ,CAAC,iBAAiB,GAAG,KAAK;;IChBlC;;;;;;IAMG;AACH,QAAA,MAAA,kBAAA,YAAA;IAsBI,IAAA,SAAA,MAAA,GAAA;IAEI,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACrB,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACrB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;IACtB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;IAEtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACjB,QAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;SACtB;IAED;;;IAGG;IACH,IAAA,MAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;IAEI,QAAA,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SACzD,CAAA;;IAGD,IAAA,MAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;IAEI,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACrB,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;IACrB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;IACtB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;SACzB,CAAA;IAED;;;;;IAKG;QACH,MAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,IAAgB,EAAA;IAEzB,QAAA,IAAI,IAAI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AC;IAChC,aAAA;IAED,iBAAA;IACI,gBAAA,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IACpB,aAAA;IAED,YAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;aACvB;;;IAhBA,KAAA,CAAA,CAAA;IAmBD,IAAA,MAAA,CAAA,cAAA,CAAI,SAAM,CAAA,SAAA,EAAA,QAAA,EAAA;;IAAV,QAAA,GAAA,EAAA,YAAA;IAEI,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC;aACtD;IAED,QAAA,GAAA,EAAA,UAAW,KAAa,EAAA;gBAEpB,IAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC;gBAE5C,IAAI,MAAM,KAAK,CAAC,EAChB;oBACI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;IACjC,aAAA;IAED,iBAAA;IACI,gBAAA,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;IACpB,aAAA;IAED,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;aACxB;;;IAhBA,KAAA,CAAA,CAAA;QAiBL,OAAC,SAAA,CAAA;IAAD,CApvBA,CAAwE,aAAa,CAovBpF,EAAA;IAED;;;;;IAKG;IACH,SAAS,CAAC,SAAS,CAAC,wBAAwB,GAAG,SAAS,CAAC,SAAS,CAAC,eAAe;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/browser/display.min.js b/live2d/node_modules/@pixi/display/dist/browser/display.min.js new file mode 100644 index 0000000..7bf0294 --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/browser/display.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_display=function(t,e,i,n,r){"use strict";e.settings.SORTABLE_CHILDREN=!1;var s=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?i.Rectangle.EMPTY:((t=t||new i.Rectangle(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var i=t.a,n=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,h=i*e.x+r*e.y+o,l=n*e.x+s*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,n=this.maxX,r=this.maxY,s=t[0],o=t[1];e=sn?s:n,r=o>r?o:r,e=(s=t[2])n?s:n,r=o>r?o:r,e=(s=t[4])n?s:n,r=o>r?o:r,e=(s=t[6])n?s:n,r=o>r?o:r,this.minX=e,this.minY=i,this.maxX=n,this.maxY=r},t.prototype.addFrame=function(t,e,i,n,r){this.addFrameMatrix(t.worldTransform,e,i,n,r)},t.prototype.addFrameMatrix=function(t,e,i,n,r){var s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,d=t.ty,u=this.minX,p=this.minY,m=this.maxX,c=this.maxY,f=s*e+a*i+l,y=o*e+h*i+d;u=fm?f:m,c=y>c?y:c,u=(f=s*n+a*i+l)m?f:m,c=y>c?y:c,u=(f=s*e+a*r+l)m?f:m,c=y>c?y:c,u=(f=s*n+a*r+l)m?f:m,c=y>c?y:c,this.minX=u,this.minY=p,this.maxX=m,this.maxY=c},t.prototype.addVertexData=function(t,e,i){for(var n=this.minX,r=this.minY,s=this.maxX,o=this.maxY,a=e;as?h:s,o=l>o?l:o}this.minX=n,this.minY=r,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,e,i,n){this.addVerticesMatrix(t.worldTransform,e,i,n)},t.prototype.addVerticesMatrix=function(t,e,i,n,r,s){void 0===r&&(r=0),void 0===s&&(s=r);for(var o=t.a,a=t.b,h=t.c,l=t.d,d=t.tx,u=t.ty,p=this.minX,m=this.minY,c=this.maxX,f=this.maxY,y=i;yn?t.maxX:n,this.maxY=t.maxY>r?t.maxY:r},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,n=t.minY>e.minY?t.minY:e.minY,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,n=t.minY>e.y?t.minY:e.y,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,n,r,s){t-=r,e-=s,i+=r,n+=s,this.minX=this.minXi?this.maxX:i,this.minY=this.minYn?this.maxY:n},t}(),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},o(t,e)};function a(t,e){function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var h=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new i.Transform,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new s,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return a(e,t),e.mixin=function(t){for(var i=Object.keys(t),n=0;n1)for(var n=0;nthis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},i.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);this.children[i]=e,this.children[n]=t,this.onChildrenChange(i=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);n.removeItems(this.children,i,1),this.children.splice(e,0,t),this.onChildrenChange(e)},i.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},i.prototype.removeChild=function(){for(var t=arguments,e=[],i=0;i1)for(var r=0;r0&&r<=e){i=this.children.splice(n,r);for(var s=0;s1&&this.children.sort(d),this.sortDirty=!1},i.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t0&&e.height>0){var n,r;if(this.cullArea?(n=this.cullArea,r=this.worldTransform):this._render!==i.prototype._render&&(n=this.getBounds(!0)),n&&e.intersects(n,r))this._render(t);else if(this.cullArea)return;for(var s=0,o=this.children.length;s this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["settings","SORTABLE_CHILDREN","Bounds","this","minX","Infinity","minY","maxX","maxY","rect","updateID","prototype","isEmpty","clear","getRectangle","Rectangle","EMPTY","x","y","width","height","addPoint","point","Math","min","max","addPointMatrix","matrix","a","b","c","d","tx","ty","addQuad","vertices","addFrame","transform","x0","y0","x1","y1","addFrameMatrix","worldTransform","addVertexData","vertexData","beginOffset","endOffset","i","addVertices","addVerticesMatrix","padX","padY","rawX","rawY","addBounds","bounds","addBoundsMask","mask","_minX","_minY","_maxX","_maxY","addBoundsMatrix","addBoundsArea","area","pad","paddingX","paddingY","addFramePad","extendStatics","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","create","DisplayObject","_super","_this","tempDisplayObjectParent","Transform","alpha","visible","renderable","cullable","cullArea","parent","worldAlpha","_lastSortedIndex","_zIndex","filterArea","filters","_enabledFilters","_bounds","_localBounds","_boundsID","_boundsRect","_localBoundsRect","_mask","_maskRefCount","_destroyed","isSprite","isMask","mixin","source","keys","length","propertyName","defineProperty","getOwnPropertyDescriptor","get","_recursivePostUpdateTransform","updateTransform","_tempDisplayObjectParent","getBounds","skipUpdate","calculateBounds","getLocalBounds","transformRef","parentRef","worldBounds","worldBoundsID","toGlobal","position","displayObjectUpdateTransform","apply","toLocal","from","applyInverse","setParent","container","addChild","Error","setTransform","scaleX","scaleY","rotation","skewX","skewY","pivotX","pivotY","scale","skew","pivot","destroy","_options","removeChild","hitArea","interactive","interactiveChildren","emit","removeAllListeners","TemporaryDisplayObject","enableTempParent","myParent","disableTempParent","cacheParent","set","value","localTransform","copyFrom","RAD_TO_DEG","DEG_TO_RAD","sortDirty","item","maskObject","isMaskData","EventEmitter","arguments","sortChildren","zIndex","Container","children","sortableChildren","onChildrenChange","_length","_i","child","_parentID","push","addChildAt","index","splice","swapChildren","child2","index1","getChildIndex","index2","indexOf","setChildIndex","currentIndex","removeItems","getChildAt","removeChildAt","removeChildren","beginIndex","endIndex","removed","begin","range","RangeError","sortRequired","j","sort","_calculateBounds","skipChildrenUpdate","result","call","_renderWithCulling","renderer","sourceFrame","renderTexture","_render","intersects","childCullable","render","renderAdvanced","enabled","flush","autoDetect","type","MASK_TYPES","NONE","batch","filter","pop","_renderer","options","destroyChildren","oldChildren","_width","_height","containerUpdateTransform"],"mappings":";;;;;;;2EAoBQA,EAAAA,SAACC,mBAAoB,ECT7B,IAAAC,EAAA,WAsBI,SAAAA,IAEIC,KAAKC,KAAOC,EAAAA,EACZF,KAAKG,KAAOD,EAAAA,EACZF,KAAKI,MAAQF,EAAAA,EACbF,KAAKK,MAAQH,EAAAA,EAEbF,KAAKM,KAAO,KACZN,KAAKO,UAAY,EAwYzB,OAjYIR,EAAAS,UAAAC,QAAA,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,KAAK+I,MAAMjI,EAAId,KAAKuH,iBAAiBvG,OAGhD+I,IAAA,SAAUC,GAEN,IAAMhJ,EAAQhB,KAAKuH,iBAAiBvG,MAIhChB,KAAK+I,MAAMjI,EAFD,IAAVE,EAEegJ,EAAQhJ,EAIR,EAGnBhB,KAAKwO,OAASxE,mCAIlB5F,OAAA0C,eAAI+D,EAAMrK,UAAA,SAAA,CAAVwG,IAAA,WAEI,OAAOhH,KAAK+I,MAAMhI,EAAIf,KAAKuH,iBAAiBtG,QAGhD8I,IAAA,SAAWC,GAEP,IAAM/I,EAASjB,KAAKuH,iBAAiBtG,OAIjCjB,KAAK+I,MAAMhI,EAFA,IAAXE,EAEe+I,EAAQ/I,EAIR,EAGnBjB,KAAKyO,QAAUzE,mCAEtBa,EApvBD,CAAwE/F,UA4vBxE+F,EAAUrK,UAAUkO,yBAA2B7D,EAAUrK,UAAU0G"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/cjs/display.js b/live2d/node_modules/@pixi/display/dist/cjs/display.js new file mode 100644 index 0000000..738b034 --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/cjs/display.js @@ -0,0 +1,1787 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var settings = require('@pixi/settings'); +var math = require('@pixi/math'); +var utils = require('@pixi/utils'); +var constants = require('@pixi/constants'); + +/** + * Sets the default value for the container property 'sortableChildren'. + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * @static + * @constant + * @name SORTABLE_CHILDREN + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.settings.SORTABLE_CHILDREN = false; + +/** + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. + * @memberof PIXI + */ +var Bounds = /** @class */ (function () { + function Bounds() { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + this.rect = null; + this.updateID = -1; + } + /** + * Checks if bounds are empty. + * @returns - True if empty. + */ + Bounds.prototype.isEmpty = function () { + return this.minX > this.maxX || this.minY > this.maxY; + }; + /** Clears the bounds and resets. */ + Bounds.prototype.clear = function () { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * @param rect - Temporary object will be used if AABB is not empty + * @returns - A rectangle of the bounds + */ + Bounds.prototype.getRectangle = function (rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return math.Rectangle.EMPTY; + } + rect = rect || new math.Rectangle(0, 0, 1, 1); + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + return rect; + }; + /** + * This function should be inlined when its possible. + * @param point - The point to add. + */ + Bounds.prototype.addPoint = function (point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + /** + * Adds a point, after transformed. This should be inlined when its possible. + * @param matrix + * @param point + */ + Bounds.prototype.addPointMatrix = function (matrix, point) { + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty; + var x = (a * point.x) + (c * point.y) + tx; + var y = (b * point.x) + (d * point.y) + ty; + this.minX = Math.min(this.minX, x); + this.maxX = Math.max(this.maxX, x); + this.minY = Math.min(this.minY, y); + this.maxY = Math.max(this.maxY, y); + }; + /** + * Adds a quad, not transformed + * @param vertices - The verts to add. + */ + Bounds.prototype.addQuad = function (vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = vertices[0]; + var y = vertices[1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds sprite frame, transformed. + * @param transform - transform to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { + this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); + }; + /** + * Adds sprite frame, multiplied by matrix + * @param matrix - matrix to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = (a * x0) + (c * y0) + tx; + var y = (b * x0) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y0) + tx; + y = (b * x1) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x0) + (c * y1) + tx; + y = (b * x0) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y1) + tx; + y = (b * x1) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds screen vertices from array + * @param vertexData - calculated vertices + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var x = vertexData[i]; + var y = vertexData[i + 1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Add an array of mesh vertices + * @param transform - mesh transform + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { + this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); + }; + /** + * Add an array of mesh vertices. + * @param matrix - mesh matrix + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + * @param padX - x padding + * @param padY - y padding + */ + Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { + if (padX === void 0) { padX = 0; } + if (padY === void 0) { padY = padX; } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + minX = Math.min(minX, x - padX); + maxX = Math.max(maxX, x + padX); + minY = Math.min(minY, y - padY); + maxY = Math.max(maxY, y + padY); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds other {@link Bounds}. + * @param bounds - The Bounds to be added + */ + Bounds.prototype.addBounds = function (bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + /** + * Adds other Bounds, masked with Bounds. + * @param bounds - The Bounds to be added. + * @param mask - TODO + */ + Bounds.prototype.addBoundsMask = function (bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * @param bounds - other bounds + * @param matrix - multiplicator + */ + Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { + this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); + }; + /** + * Adds other Bounds, masked with Rectangle. + * @param bounds - TODO + * @param area - TODO + */ + Bounds.prototype.addBoundsArea = function (bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + */ + Bounds.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + if (!this.isEmpty()) { + this.minX -= paddingX; + this.maxX += paddingX; + this.minY -= paddingY; + this.maxY += paddingY; + } + }; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + * @param padX - padding X + * @param padY - padding Y + */ + Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { + x0 -= padX; + y0 -= padY; + x1 += padX; + y1 += padY; + this.minX = this.minX < x0 ? this.minX : x0; + this.maxX = this.maxX > x1 ? this.maxX : x1; + this.minY = this.minY < y0 ? this.minY : y0; + this.maxY = this.maxY > y1 ? this.maxY : y1; + }; + return Bounds; +}()); + +/*! ***************************************************************************** +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 __()); +} + +/** + * The base class for all objects that are rendered on the screen. + * + * This is an abstract class and can not be used on its own; rather it should be extended. + * + * ## Display objects implemented in PixiJS + * + * | Display Object | Description | + * | ------------------------------- | --------------------------------------------------------------------- | + * | {@link PIXI.Container} | Adds support for `children` to DisplayObject | + * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API | + * | {@link PIXI.Sprite} | Draws textures (i.e. images) | + * | {@link PIXI.Text} | Draws text using the Canvas API internally | + * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures | + * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion | + * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images | + * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data | + * | {@link PIXI.NineSlicePlane} | Mesh-related | + * | {@link PIXI.SimpleMesh} | v4-compatible mesh | + * | {@link PIXI.SimplePlane} | Mesh-related | + * | {@link PIXI.SimpleRope} | Mesh-related | + * + * ## Transforms + * + * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its + * local coordinate space to its parent's local coordinate space. The following properties are derived + * from the transform: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot} + * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot + * is equal to position, regardless of the other three transformations. In other words, It is the center of + * rotation, scaling, and skewing. + *
[position]{@link PIXI.DisplayObject#position} + * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local + * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object + * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space. + *
[scale]{@link PIXI.DisplayObject#scale} + * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the + * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center + * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}. + *
[rotation]{@link PIXI.DisplayObject#rotation} + * Rotation. This will rotate the display object's projection by this angle (in radians). + *
[skew]{@link PIXI.DisplayObject#skew} + *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

+ *

+ * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be + * thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is + * ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be + * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will + * be rotated by an angle between ⍺ and β. + *

+ *

+ * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying + * a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ. + *

+ *

+ * Another quite interesting observation is that "skew.x", "skew.y", rotation are communtative operations. Indeed, + * because rotation is essentially a careful combination of the two. + *

+ *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width + * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing + * the "requested" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there + * is no concept of user-defined width. + *
height + * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing + * the "requested" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there + * is no concept of user-defined height. + *
+ * + * ## Bounds + * + * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit + * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the + * `worldTransform` to calculate in world space). + * + * There are a few additional types of bounding boxes: + * + * | Bounds | Description | + * | --------------------- | ---------------------------------------------------------------------------------------- | + * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. | + * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. | + * | Render Bounds | The bounds, but including extra rendering effects like filter padding. | + * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. | + * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. | + * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)| + * | Content Bounds | The natural bounds when excluding all children of a `Container`. | + * + * ### calculateBounds + * + * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children. + * + * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and + * `getLocalBounds` to work. This method must write the bounds into `this._bounds`. + * + * Generally, the following technique works for most simple cases: take the list of points + * forming the "hull" of the object (i.e. outline of the object's shape), and then add them + * using {@link PIXI.Bounds#addPointMatrix}. + * + * ```js + * calculateBounds(): void + * { + * const points = [...]; + * + * for (let i = 0, j = points.length; i < j; i++) + * { + * this._bounds.addPointMatrix(this.worldTransform, points[i]); + * } + * } + * ``` + * + * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them + * in one array together. + * + * ## Alpha + * + * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display + * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not + * applied on any ancestor further up the chain). + * + * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}. + * + * ## Renderable vs Visible + * + * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the + * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display + * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not + * be calculated. + * + * It is recommended that applications use the `renderable` property for culling. See + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details. + * + * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This + * one is also better in terms of performance. + * @memberof PIXI + */ +var DisplayObject = /** @class */ (function (_super) { + __extends(DisplayObject, _super); + function DisplayObject() { + var _this = _super.call(this) || this; + _this.tempDisplayObjectParent = null; + // TODO: need to create Transform from factory + _this.transform = new math.Transform(); + _this.alpha = 1; + _this.visible = true; + _this.renderable = true; + _this.cullable = false; + _this.cullArea = null; + _this.parent = null; + _this.worldAlpha = 1; + _this._lastSortedIndex = 0; + _this._zIndex = 0; + _this.filterArea = null; + _this.filters = null; + _this._enabledFilters = null; + _this._bounds = new Bounds(); + _this._localBounds = null; + _this._boundsID = 0; + _this._boundsRect = null; + _this._localBoundsRect = null; + _this._mask = null; + _this._maskRefCount = 0; + _this._destroyed = false; + _this.isSprite = false; + _this.isMask = false; + return _this; + } + /** + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * @param source - The source of properties and methods to mix in. + */ + DisplayObject.mixin = function (source) { + // in ES8/ES2017, this would be really easy: + // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); + // get all the enumerable property keys + var keys = Object.keys(source); + // loop through properties + for (var i = 0; i < keys.length; ++i) { + var propertyName = keys[i]; + // Set the property using the property descriptor - this works for accessors and normal value properties + Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); + } + }; + Object.defineProperty(DisplayObject.prototype, "destroyed", { + /** + * Fired when this DisplayObject is added to a Container. + * @instance + * @event added + * @param {PIXI.Container} container - The container added to. + */ + /** + * Fired when this DisplayObject is removed from a Container. + * @instance + * @event removed + * @param {PIXI.Container} container - The container removed from. + */ + /** + * Fired when this DisplayObject is destroyed. This event is emitted once + * destroy is finished. + * @instance + * @event destroyed + */ + /** Readonly flag for destroyed display objects. */ + get: function () { + return this._destroyed; + }, + enumerable: false, + configurable: true + }); + /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */ + DisplayObject.prototype._recursivePostUpdateTransform = function () { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } + else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); + } + }; + /** Updates the object transform for rendering. TODO - Optimization pass! */ + DisplayObject.prototype.updateTransform = function () { + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // multiply the alphas.. + this.worldAlpha = this.alpha * this.parent.worldAlpha; + }; + /** + * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}. + * + * This method is expensive on containers with a large subtree (like the stage). This is because the bounds + * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to + * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update + * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using + * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise, + * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as + * its height increases. + * + * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated. + * The world bounds of all display objects in a container's **subtree** will also be recalculated. + * + * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds + * calculation if needed. + * + * ```js + * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect); + * ``` + * + * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This + * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more + * details. + * + * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms + * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain + * cases. + * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The minimum axis-aligned rectangle in world space that fits around this object. + */ + DisplayObject.prototype.getBounds = function (skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } + else { + this._recursivePostUpdateTransform(); + this.updateTransform(); + } + } + if (this._bounds.updateID !== this._boundsID) { + this.calculateBounds(); + this._bounds.updateID = this._boundsID; + } + if (!rect) { + if (!this._boundsRect) { + this._boundsRect = new math.Rectangle(); + } + rect = this._boundsRect; + } + return this._bounds.getRectangle(rect); + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The rectangular bounding area. + */ + DisplayObject.prototype.getLocalBounds = function (rect) { + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new math.Rectangle(); + } + rect = this._localBoundsRect; + } + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + var transformRef = this.transform; + var parentRef = this.parent; + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + var worldBounds = this._bounds; + var worldBoundsID = this._boundsID; + this._bounds = this._localBounds; + var bounds = this.getBounds(false, rect); + this.parent = parentRef; + this.transform = transformRef; + this._bounds = worldBounds; + this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects + return bounds; + }; + /** + * Calculates the global position of the display object. + * @param position - The world origin to calculate from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform. + * @returns - A point object representing the position of this object. + */ + DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { + if (skipUpdate === void 0) { skipUpdate = false; } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // don't need to update the lot + return this.worldTransform.apply(position, point); + }; + /** + * Calculates the local position of the display object relative to another point. + * @param position - The world origin to calculate from. + * @param from - The DisplayObject to calculate the global position from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform + * @returns - A point object representing the position of this object + */ + DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { + if (from) { + position = from.toGlobal(position, point, skipUpdate); + } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // simply apply the matrix.. + return this.worldTransform.applyInverse(position, point); + }; + /** + * Set the parent Container of this DisplayObject. + * @param container - The Container to add this DisplayObject to. + * @returns - The Container that this DisplayObject was added to. + */ + DisplayObject.prototype.setParent = function (container) { + if (!container || !container.addChild) { + throw new Error('setParent: Argument must be a Container'); + } + container.addChild(this); + return container; + }; + /** + * Convenience function to set the position, scale, skew and pivot at once. + * @param x - The X position + * @param y - The Y position + * @param scaleX - The X scale value + * @param scaleY - The Y scale value + * @param rotation - The rotation + * @param skewX - The X skew value + * @param skewY - The Y skew value + * @param pivotX - The X pivot value + * @param pivotY - The Y pivot value + * @returns - The DisplayObject instance + */ + DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (scaleX === void 0) { scaleX = 1; } + if (scaleY === void 0) { scaleY = 1; } + if (rotation === void 0) { rotation = 0; } + if (skewX === void 0) { skewX = 0; } + if (skewY === void 0) { skewY = 0; } + if (pivotX === void 0) { pivotX = 0; } + if (pivotY === void 0) { pivotY = 0; } + this.position.x = x; + this.position.y = y; + this.scale.x = !scaleX ? 1 : scaleX; + this.scale.y = !scaleY ? 1 : scaleY; + this.rotation = rotation; + this.skew.x = skewX; + this.skew.y = skewY; + this.pivot.x = pivotX; + this.pivot.y = pivotY; + return this; + }; + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy()`. + * @param _options + */ + DisplayObject.prototype.destroy = function (_options) { + if (this.parent) { + this.parent.removeChild(this); + } + this._destroyed = true; + this.transform = null; + this.parent = null; + this._bounds = null; + this.mask = null; + this.cullArea = null; + this.filters = null; + this.filterArea = null; + this.hitArea = null; + this.interactive = false; + this.interactiveChildren = false; + this.emit('destroyed'); + this.removeAllListeners(); + }; + Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { + /** + * @protected + * @member {PIXI.Container} + */ + get: function () { + if (this.tempDisplayObjectParent === null) { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + this.tempDisplayObjectParent = new TemporaryDisplayObject(); + } + return this.tempDisplayObjectParent; + }, + enumerable: false, + configurable: true + }); + /** + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root + * + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` + * @returns - current parent + */ + DisplayObject.prototype.enableTempParent = function () { + var myParent = this.parent; + this.parent = this._tempDisplayObjectParent; + return myParent; + }; + /** + * Pair method for `enableTempParent` + * @param cacheParent - Actual parent of element + */ + DisplayObject.prototype.disableTempParent = function (cacheParent) { + this.parent = cacheParent; + }; + Object.defineProperty(DisplayObject.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + */ + get: function () { + return this.position.x; + }, + set: function (value) { + this.transform.position.x = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "y", { + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + */ + get: function () { + return this.position.y; + }, + set: function (value) { + this.transform.position.y = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldTransform", { + /** + * Current transform of the object based on world (parent) factors. + * @readonly + */ + get: function () { + return this.transform.worldTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "localTransform", { + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * @readonly + */ + get: function () { + return this.transform.localTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "position", { + /** + * The coordinate of the object relative to the local coordinates of the parent. + * @since 4.0.0 + */ + get: function () { + return this.transform.position; + }, + set: function (value) { + this.transform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "scale", { + /** + * The scale factors of this object along the local coordinate axes. + * + * The default scale is (1, 1). + * @since 4.0.0 + */ + get: function () { + return this.transform.scale; + }, + set: function (value) { + this.transform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "pivot", { + /** + * The center of rotation, scaling, and skewing for this display object in its local space. The `position` + * is the projection of `pivot` in the parent's local space. + * + * By default, the pivot is the origin (0, 0). + * @since 4.0.0 + */ + get: function () { + return this.transform.pivot; + }, + set: function (value) { + this.transform.pivot.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "skew", { + /** + * The skew factor for the object in radians. + * @since 4.0.0 + */ + get: function () { + return this.transform.skew; + }, + set: function (value) { + this.transform.skew.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "rotation", { + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation; + }, + set: function (value) { + this.transform.rotation = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "angle", { + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation * math.RAD_TO_DEG; + }, + set: function (value) { + this.transform.rotation = value * math.DEG_TO_RAD; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "zIndex", { + /** + * The zIndex of the displayObject. + * + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other display objects within the same container. + * @see PIXI.Container#sortableChildren + */ + get: function () { + return this._zIndex; + }, + set: function (value) { + this._zIndex = value; + if (this.parent) { + this.parent.sortDirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldVisible", { + /** + * Indicates if the object is globally visible. + * @readonly + */ + get: function () { + var item = this; + do { + if (!item.visible) { + return false; + } + item = item.parent; + } while (item); + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "mask", { + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. + * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong. + * To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + */ + get: function () { + return this._mask; + }, + set: function (value) { + if (this._mask === value) { + return; + } + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + maskObject._maskRefCount--; + if (maskObject._maskRefCount === 0) { + maskObject.renderable = true; + maskObject.isMask = false; + } + } + } + this._mask = value; + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + if (maskObject._maskRefCount === 0) { + maskObject.renderable = false; + maskObject.isMask = true; + } + maskObject._maskRefCount++; + } + } + }, + enumerable: false, + configurable: true + }); + return DisplayObject; +}(utils.EventEmitter)); +/** + * @private + */ +var TemporaryDisplayObject = /** @class */ (function (_super) { + __extends(TemporaryDisplayObject, _super); + function TemporaryDisplayObject() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.sortDirty = null; + return _this; + } + return TemporaryDisplayObject; +}(DisplayObject)); +/** + * DisplayObject default updateTransform, does not update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.DisplayObject# + * @method displayObjectUpdateTransform + */ +DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; + +function sortChildren(a, b) { + if (a.zIndex === b.zIndex) { + return a._lastSortedIndex - b._lastSortedIndex; + } + return a.zIndex - b.zIndex; +} +/** + * Container is a general-purpose display object that holds children. It also adds built-in support for advanced + * rendering features like masking and filtering. + * + * It is the base class of all display objects that act as a container for other objects, including Graphics + * and Sprite. + * + * ```js + * import { BlurFilter } from '@pixi/filter-blur'; + * import { Container } from '@pixi/display'; + * import { Graphics } from '@pixi/graphics'; + * import { Sprite } from '@pixi/sprite'; + * + * let container = new Container(); + * let sprite = Sprite.from("https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png"); + * + * sprite.width = 512; + * sprite.height = 512; + * + * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container + * // is rendered. + * container.addChild(sprite); + * + * // Blurs whatever is rendered by the container + * container.filters = [new BlurFilter()]; + * + * // Only the contents within a circle at the center should be rendered onto the screen. + * container.mask = new Graphics() + * .beginFill(0xffffff) + * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2) + * .endFill(); + * ``` + * @memberof PIXI + */ +var Container = /** @class */ (function (_super) { + __extends(Container, _super); + function Container() { + var _this = _super.call(this) || this; + _this.children = []; + _this.sortableChildren = settings.settings.SORTABLE_CHILDREN; + _this.sortDirty = false; + return _this; + /** + * Fired when a DisplayObject is added to this Container. + * @event PIXI.Container#childAdded + * @param {PIXI.DisplayObject} child - The child added to the Container. + * @param {PIXI.Container} container - The container that added the child. + * @param {number} index - The children's index of the added child. + */ + /** + * Fired when a DisplayObject is removed from this Container. + * @event PIXI.DisplayObject#childRemoved + * @param {PIXI.DisplayObject} child - The child removed from the Container. + * @param {PIXI.Container} container - The container that removed the child. + * @param {number} index - The former children's index of the removed child + */ + } + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified. + * @param _length + */ + Container.prototype.onChildrenChange = function (_length) { + /* empty */ + }; + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container + * @returns {PIXI.DisplayObject} - The first child that was added. + */ + Container.prototype.addChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the array and add all children + for (var i = 0; i < children.length; i++) { + // eslint-disable-next-line prefer-rest-params + this.addChild(children[i]); + } + } + else { + var child = children[0]; + // if the child has a parent then lets remove it as PixiJS objects can only exist in one place + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.push(child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(this.children.length - 1); + this.emit('childAdded', child, this, this.children.length - 1); + child.emit('added', this); + } + return children[0]; + }; + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @returns {PIXI.DisplayObject} The child that was added. + */ + Container.prototype.addChildAt = function (child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); + } + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.splice(index, 0, child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('added', this); + this.emit('childAdded', child, this, index); + return child; + }; + /** + * Swaps the position of 2 Display Objects within this container. + * @param child - First display object to swap + * @param child2 - Second display object to swap + */ + Container.prototype.swapChildren = function (child, child2) { + if (child === child2) { + return; + } + var index1 = this.getChildIndex(child); + var index2 = this.getChildIndex(child2); + this.children[index1] = child2; + this.children[index2] = child; + this.onChildrenChange(index1 < index2 ? index1 : index2); + }; + /** + * Returns the index position of a child DisplayObject instance + * @param child - The DisplayObject instance to identify + * @returns - The index position of the child display object to identify + */ + Container.prototype.getChildIndex = function (child) { + var index = this.children.indexOf(child); + if (index === -1) { + throw new Error('The supplied DisplayObject must be a child of the caller'); + } + return index; + }; + /** + * Changes the position of an existing child in the display object container + * @param child - The child DisplayObject instance for which you want to change the index number + * @param index - The resulting index number for the child display object + */ + Container.prototype.setChildIndex = function (child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); + } + var currentIndex = this.getChildIndex(child); + utils.removeItems(this.children, currentIndex, 1); // remove from old position + this.children.splice(index, 0, child); // add at new position + this.onChildrenChange(index); + }; + /** + * Returns the child at the specified index + * @param index - The index to get the child at + * @returns - The child at the given index, if any. + */ + Container.prototype.getChildAt = function (index) { + if (index < 0 || index >= this.children.length) { + throw new Error("getChildAt: Index (" + index + ") does not exist."); + } + return this.children[index]; + }; + /** + * Removes one or more children from the container. + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove + * @returns {PIXI.DisplayObject} The first child that was removed. + */ + Container.prototype.removeChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the arguments property and remove all children + for (var i = 0; i < children.length; i++) { + this.removeChild(children[i]); + } + } + else { + var child = children[0]; + var index = this.children.indexOf(child); + if (index === -1) + { return null; } + child.parent = null; + // ensure child transform will be recalculated + child.transform._parentID = -1; + utils.removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + } + return children[0]; + }; + /** + * Removes a child from the specified index position. + * @param index - The index to get the child from + * @returns The child that was removed. + */ + Container.prototype.removeChildAt = function (index) { + var child = this.getChildAt(index); + // ensure child transform will be recalculated.. + child.parent = null; + child.transform._parentID = -1; + utils.removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + return child; + }; + /** + * Removes all children from this container that are within the begin and end indexes. + * @param beginIndex - The beginning position. + * @param endIndex - The ending position. Default value is size of the container. + * @returns - List of removed children + */ + Container.prototype.removeChildren = function (beginIndex, endIndex) { + if (beginIndex === void 0) { beginIndex = 0; } + if (endIndex === void 0) { endIndex = this.children.length; } + var begin = beginIndex; + var end = endIndex; + var range = end - begin; + var removed; + if (range > 0 && range <= end) { + removed = this.children.splice(begin, range); + for (var i = 0; i < removed.length; ++i) { + removed[i].parent = null; + if (removed[i].transform) { + removed[i].transform._parentID = -1; + } + } + this._boundsID++; + this.onChildrenChange(beginIndex); + for (var i = 0; i < removed.length; ++i) { + removed[i].emit('removed', this); + this.emit('childRemoved', removed[i], this, i); + } + return removed; + } + else if (range === 0 && this.children.length === 0) { + return []; + } + throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); + }; + /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */ + Container.prototype.sortChildren = function () { + var sortRequired = false; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + child._lastSortedIndex = i; + if (!sortRequired && child.zIndex !== 0) { + sortRequired = true; + } + } + if (sortRequired && this.children.length > 1) { + this.children.sort(sortChildren); + } + this.sortDirty = false; + }; + /** Updates the transform on all children of this container for rendering. */ + Container.prototype.updateTransform = function () { + if (this.sortableChildren && this.sortDirty) { + this.sortChildren(); + } + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // TODO: check render flags, how to process stuff here + this.worldAlpha = this.alpha * this.parent.worldAlpha; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + }; + /** + * Recalculates the bounds of the container. + * + * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds + * is limited to its mask's bounds or filterArea, if any is applied. + */ + Container.prototype.calculateBounds = function () { + this._bounds.clear(); + this._calculateBounds(); + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (!child.visible || !child.renderable) { + continue; + } + child.calculateBounds(); + // TODO: filter+mask, need to mask both somehow + if (child._mask) { + var maskObject = (child._mask.isMaskData + ? child._mask.maskObject : child._mask); + if (maskObject) { + maskObject.calculateBounds(); + this._bounds.addBoundsMask(child._bounds, maskObject._bounds); + } + else { + this._bounds.addBounds(child._bounds); + } + } + else if (child.filterArea) { + this._bounds.addBoundsArea(child._bounds, child.filterArea); + } + else { + this._bounds.addBounds(child._bounds); + } + } + this._bounds.updateID = this._boundsID; + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render() + * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @returns - The rectangular bounding area. + */ + Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { + if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } + var result = _super.prototype.getLocalBounds.call(this, rect); + if (!skipChildrenUpdate) { + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + } + return result; + }; + /** + * Recalculates the content bounds of this object. This should be overriden to + * calculate the bounds of this specific object (not including children). + * @protected + */ + Container.prototype._calculateBounds = function () { + // FILL IN// + }; + /** + * Renders this object and its children with culling. + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype._renderWithCulling = function (renderer) { + var sourceFrame = renderer.renderTexture.sourceFrame; + // If the source frame is empty, stop rendering. + if (!(sourceFrame.width > 0 && sourceFrame.height > 0)) { + return; + } + // Render the content of the container only if its bounds intersect with the source frame. + // All filters are on the stack at this point, and the filter source frame is bound: + // therefore, even if the bounds to non intersect the filter frame, the filter + // is still applied and any filter padding that is in the frame is rendered correctly. + var bounds; + var transform; + // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea + // rectangle must completely contain the container and its children including filter padding. + if (this.cullArea) { + bounds = this.cullArea; + transform = this.worldTransform; + } + // If the container doesn't override _render, we can skip the bounds calculation and intersection test. + else if (this._render !== Container.prototype._render) { + bounds = this.getBounds(true); + } + // Render the container if the source frame intersects the bounds. + if (bounds && sourceFrame.intersects(bounds, transform)) { + this._render(renderer); + } + // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering. + else if (this.cullArea) { + return; + } + // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect + // the source frame, because the children might have filters with nonzero padding, which may intersect + // with the source frame while the bounds do not: filter padding is not included in the bounds. + // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered + // if they are out of frame; otherwise, render the children normally. + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + var childCullable = child.cullable; + child.cullable = childCullable || !this.cullArea; + child.render(renderer); + child.cullable = childCullable; + } + }; + /** + * Renders the object using the WebGL renderer. + * + * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the + * container itself. This `render` method will invoke it, and also invoke the `render` methods of all + * children afterward. + * + * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and + * the bounds of this object are out of frame, this implementation will entirely skip rendering. + * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally, + * setting alpha to zero is not recommended for purely skipping rendering. + * + * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is + * advised to employ **culling** to automatically skip rendering objects outside of the current screen. + * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}. + * Other culling methods might be better suited for a large number static objects; see + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}. + * + * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or + * filtering is applied on a container. This does, however, break batching and can affect performance when + * masking and filtering is applied extensively throughout the scene graph. + * @param renderer - The renderer + */ + Container.prototype.render = function (renderer) { + // if the object is not visible or the alpha is 0 then no need to render this element + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + // do a quick check to see if this element has a mask or a filter. + if (this._mask || (this.filters && this.filters.length)) { + this.renderAdvanced(renderer); + } + else if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + }; + /** + * Render the object using the WebGL renderer and advanced features. + * @param renderer - The renderer + */ + Container.prototype.renderAdvanced = function (renderer) { + var filters = this.filters; + var mask = this._mask; + // push filter first as we need to ensure the stencil buffer is correct for any masking + if (filters) { + if (!this._enabledFilters) { + this._enabledFilters = []; + } + this._enabledFilters.length = 0; + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { + this._enabledFilters.push(filters[i]); + } + } + } + var flush = (filters && this._enabledFilters && this._enabledFilters.length) + || (mask && (!mask.isMaskData + || (mask.enabled && (mask.autoDetect || mask.type !== constants.MASK_TYPES.NONE)))); + if (flush) { + renderer.batch.flush(); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.push(this, this._enabledFilters); + } + if (mask) { + renderer.mask.push(this, this._mask); + } + if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + if (flush) { + renderer.batch.flush(); + } + if (mask) { + renderer.mask.pop(this); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.pop(); + } + }; + /** + * To be overridden by the subclasses. + * @param _renderer - The renderer + */ + Container.prototype._render = function (_renderer) { + // this is where content itself gets rendered... + }; + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Container.prototype.destroy = function (options) { + _super.prototype.destroy.call(this); + this.sortDirty = false; + var destroyChildren = typeof options === 'boolean' ? options : options && options.children; + var oldChildren = this.removeChildren(0, this.children.length); + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { + oldChildren[i].destroy(options); + } + } + }; + Object.defineProperty(Container.prototype, "width", { + /** The width of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.x * this.getLocalBounds().width; + }, + set: function (value) { + var width = this.getLocalBounds().width; + if (width !== 0) { + this.scale.x = value / width; + } + else { + this.scale.x = 1; + } + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Container.prototype, "height", { + /** The height of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.y * this.getLocalBounds().height; + }, + set: function (value) { + var height = this.getLocalBounds().height; + if (height !== 0) { + this.scale.y = value / height; + } + else { + this.scale.y = 1; + } + this._height = value; + }, + enumerable: false, + configurable: true + }); + return Container; +}(DisplayObject)); +/** + * Container default updateTransform, does update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.Container# + * @method containerUpdateTransform + */ +Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; + +exports.Bounds = Bounds; +exports.Container = Container; +exports.DisplayObject = DisplayObject; +exports.TemporaryDisplayObject = TemporaryDisplayObject; +//# sourceMappingURL=display.js.map diff --git a/live2d/node_modules/@pixi/display/dist/cjs/display.js.map b/live2d/node_modules/@pixi/display/dist/cjs/display.js.map new file mode 100644 index 0000000..f06ccf0 --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/cjs/display.js.map @@ -0,0 +1 @@ +{"version":3,"file":"display.js","sources":["../../src/settings.ts","../../src/Bounds.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/DisplayObject.ts","../../src/Container.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n * @memberof PIXI\n */\nexport class Bounds\n{\n /** @default Infinity */\n public minX: number;\n\n /** @default Infinity */\n public minY: number;\n\n /** @default -Infinity */\n public maxX: number;\n\n /** @default -Infinity */\n public maxY: number;\n\n public rect: Rectangle;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n */\n public updateID: number;\n\n constructor()\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n\n this.rect = null;\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n * @returns - True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["settings","Rectangle","Transform","RAD_TO_DEG","DEG_TO_RAD","EventEmitter","arguments","removeItems","MASK_TYPES"],"mappings":";;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACHA,iBAAQ,CAAC,iBAAiB,GAAG,KAAK;;AChBlC;;;;;;AAMG;AACH,IAAA,MAAA,kBAAA,YAAA;AAsBI,IAAA,SAAA,MAAA,GAAA;AAEI,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AACrB,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AACrB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;AAEtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;KACtB;AAED;;;AAGG;AACH,IAAA,MAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AAEI,QAAA,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;KACzD,CAAA;;AAGD,IAAA,MAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;AAEI,QAAA,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AACrB,QAAA,IAA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K,GAAG,KAAK,CAAC;AAChC,aAAA;AAED,iBAAA;AACI,gBAAA,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACpB,aAAA;AAED,YAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACvB;;;AAhBA,KAAA,CAAA,CAAA;AAmBD,IAAA,MAAA,CAAA,cAAA,CAAI,SAAM,CAAA,SAAA,EAAA,QAAA,EAAA;;AAAV,QAAA,GAAA,EAAA,YAAA;AAEI,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC;SACtD;AAED,QAAA,GAAA,EAAA,UAAW,KAAa,EAAA;YAEpB,IAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC;YAE5C,IAAI,MAAM,KAAK,CAAC,EAChB;gBACI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;AACjC,aAAA;AAED,iBAAA;AACI,gBAAA,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACpB,aAAA;AAED,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACxB;;;AAhBA,KAAA,CAAA,CAAA;IAiBL,OAAC,SAAA,CAAA;AAAD,CApvBA,CAAwE,aAAa,CAovBpF,EAAA;AAED;;;;;AAKG;AACH,SAAS,CAAC,SAAS,CAAC,wBAAwB,GAAG,SAAS,CAAC,SAAS,CAAC,eAAe;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/cjs/display.min.js b/live2d/node_modules/@pixi/display/dist/cjs/display.min.js new file mode 100644 index 0000000..24f4362 --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/cjs/display.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/settings"),e=require("@pixi/math"),i=require("@pixi/utils"),n=require("@pixi/constants");t.settings.SORTABLE_CHILDREN=!1;var r=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?e.Rectangle.EMPTY:((t=t||new e.Rectangle(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var i=t.a,n=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,h=i*e.x+r*e.y+o,l=n*e.x+s*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},t.prototype.addQuad=function(t){var e=this.minX,i=this.minY,n=this.maxX,r=this.maxY,s=t[0],o=t[1];e=sn?s:n,r=o>r?o:r,e=(s=t[2])n?s:n,r=o>r?o:r,e=(s=t[4])n?s:n,r=o>r?o:r,e=(s=t[6])n?s:n,r=o>r?o:r,this.minX=e,this.minY=i,this.maxX=n,this.maxY=r},t.prototype.addFrame=function(t,e,i,n,r){this.addFrameMatrix(t.worldTransform,e,i,n,r)},t.prototype.addFrameMatrix=function(t,e,i,n,r){var s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,d=t.ty,u=this.minX,p=this.minY,m=this.maxX,c=this.maxY,f=s*e+a*i+l,y=o*e+h*i+d;u=fm?f:m,c=y>c?y:c,u=(f=s*n+a*i+l)m?f:m,c=y>c?y:c,u=(f=s*e+a*r+l)m?f:m,c=y>c?y:c,u=(f=s*n+a*r+l)m?f:m,c=y>c?y:c,this.minX=u,this.minY=p,this.maxX=m,this.maxY=c},t.prototype.addVertexData=function(t,e,i){for(var n=this.minX,r=this.minY,s=this.maxX,o=this.maxY,a=e;as?h:s,o=l>o?l:o}this.minX=n,this.minY=r,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,e,i,n){this.addVerticesMatrix(t.worldTransform,e,i,n)},t.prototype.addVerticesMatrix=function(t,e,i,n,r,s){void 0===r&&(r=0),void 0===s&&(s=r);for(var o=t.a,a=t.b,h=t.c,l=t.d,d=t.tx,u=t.ty,p=this.minX,m=this.minY,c=this.maxX,f=this.maxY,y=i;yn?t.maxX:n,this.maxY=t.maxY>r?t.maxY:r},t.prototype.addBoundsMask=function(t,e){var i=t.minX>e.minX?t.minX:e.minX,n=t.minY>e.minY?t.minY:e.minY,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var i=t.minX>e.x?t.minX:e.x,n=t.minY>e.y?t.minY:e.y,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,i,n,r,s){t-=r,e-=s,i+=r,n+=s,this.minX=this.minXi?this.maxX:i,this.minY=this.minYn?this.maxY:n},t}(),s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},s(t,e)};function o(t,e){function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var a=function(t){function i(){var i=t.call(this)||this;return i.tempDisplayObjectParent=null,i.transform=new e.Transform,i.alpha=1,i.visible=!0,i.renderable=!0,i.cullable=!1,i.cullArea=null,i.parent=null,i.worldAlpha=1,i._lastSortedIndex=0,i._zIndex=0,i.filterArea=null,i.filters=null,i._enabledFilters=null,i._bounds=new r,i._localBounds=null,i._boundsID=0,i._boundsRect=null,i._localBoundsRect=null,i._mask=null,i._maskRefCount=0,i._destroyed=!1,i.isSprite=!1,i.isMask=!1,i}return o(i,t),i.mixin=function(t){for(var e=Object.keys(t),n=0;n1)for(var n=0;nthis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},r.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);this.children[i]=e,this.children[n]=t,this.onChildrenChange(i=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var n=this.getChildIndex(t);i.removeItems(this.children,n,1),this.children.splice(e,0,t),this.onChildrenChange(e)},r.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},r.prototype.removeChild=function(){for(var t=arguments,e=[],n=0;n1)for(var r=0;r0&&r<=e){i=this.children.splice(n,r);for(var s=0;s1&&this.children.sort(l),this.sortDirty=!1},r.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t0&&e.height>0){var i,n;if(this.cullArea?(i=this.cullArea,n=this.worldTransform):this._render!==r.prototype._render&&(i=this.getBounds(!0)),i&&e.intersects(i,n))this._render(t);else if(this.cullArea)return;for(var s=0,o=this.children.length;s this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["settings","SORTABLE_CHILDREN","Bounds","this","minX","Infinity","minY","maxX","maxY","rect","updateID","prototype","isEmpty","clear","getRectangle","Rectangle","EMPTY","x","y","width","height","addPoint","point","Math","min","max","addPointMatrix","matrix","a","b","c","d","tx","ty","addQuad","vertices","addFrame","transform","x0","y0","x1","y1","addFrameMatrix","worldTransform","addVertexData","vertexData","beginOffset","endOffset","i","addVertices","addVerticesMatrix","padX","padY","rawX","rawY","addBounds","bounds","addBoundsMask","mask","_minX","_minY","_maxX","_maxY","addBoundsMatrix","addBoundsArea","area","pad","paddingX","paddingY","addFramePad","extendStatics","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","create","DisplayObject","_super","_this","tempDisplayObjectParent","Transform","alpha","visible","renderable","cullable","cullArea","parent","worldAlpha","_lastSortedIndex","_zIndex","filterArea","filters","_enabledFilters","_bounds","_localBounds","_boundsID","_boundsRect","_localBoundsRect","_mask","_maskRefCount","_destroyed","isSprite","isMask","mixin","source","keys","length","propertyName","defineProperty","getOwnPropertyDescriptor","get","_recursivePostUpdateTransform","updateTransform","_tempDisplayObjectParent","getBounds","skipUpdate","calculateBounds","getLocalBounds","transformRef","parentRef","worldBounds","worldBoundsID","toGlobal","position","displayObjectUpdateTransform","apply","toLocal","from","applyInverse","setParent","container","addChild","Error","setTransform","scaleX","scaleY","rotation","skewX","skewY","pivotX","pivotY","scale","skew","pivot","destroy","_options","removeChild","hitArea","interactive","interactiveChildren","emit","removeAllListeners","TemporaryDisplayObject","enableTempParent","myParent","disableTempParent","cacheParent","set","value","localTransform","copyFrom","RAD_TO_DEG","DEG_TO_RAD","sortDirty","item","maskObject","isMaskData","EventEmitter","arguments","sortChildren","zIndex","Container","children","sortableChildren","onChildrenChange","_length","_i","child","_parentID","push","addChildAt","index","splice","swapChildren","child2","index1","getChildIndex","index2","indexOf","setChildIndex","currentIndex","removeItems","getChildAt","removeChildAt","removeChildren","beginIndex","endIndex","removed","begin","range","RangeError","sortRequired","j","sort","_calculateBounds","skipChildrenUpdate","result","call","_renderWithCulling","renderer","sourceFrame","renderTexture","_render","intersects","childCullable","render","renderAdvanced","enabled","flush","autoDetect","type","MASK_TYPES","NONE","batch","filter","pop","_renderer","options","destroyChildren","oldChildren","_width","_height","containerUpdateTransform"],"mappings":";;;;;;;kLAoBAA,EAAQA,SAACC,mBAAoB,ECT7B,IAAAC,EAAA,WAsBI,SAAAA,IAEIC,KAAKC,KAAOC,EAAAA,EACZF,KAAKG,KAAOD,EAAAA,EACZF,KAAKI,MAAQF,EAAAA,EACbF,KAAKK,MAAQH,EAAAA,EAEbF,KAAKM,KAAO,KACZN,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+D,EAAKrK,UAAA,QAAA,CAATwG,IAAA,WAEI,OAAOhH,KAAK+I,MAAMjI,EAAId,KAAKuH,iBAAiBvG,OAGhD+I,IAAA,SAAUC,GAEN,IAAMhJ,EAAQhB,KAAKuH,iBAAiBvG,MAIhChB,KAAK+I,MAAMjI,EAFD,IAAVE,EAEegJ,EAAQhJ,EAIR,EAGnBhB,KAAKwO,OAASxE,mCAIlB5F,OAAA0C,eAAI+D,EAAMrK,UAAA,SAAA,CAAVwG,IAAA,WAEI,OAAOhH,KAAK+I,MAAMhI,EAAIf,KAAKuH,iBAAiBtG,QAGhD8I,IAAA,SAAWC,GAEP,IAAM/I,EAASjB,KAAKuH,iBAAiBtG,OAIjCjB,KAAK+I,MAAMhI,EAFA,IAAXE,EAEe+I,EAAQ/I,EAIR,EAGnBjB,KAAKyO,QAAUzE,mCAEtBa,EApvBD,CAAwE/F,GA4vBxE+F,EAAUrK,UAAUkO,yBAA2B7D,EAAUrK,UAAU0G"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/esm/display.min.mjs b/live2d/node_modules/@pixi/display/dist/esm/display.min.mjs new file mode 100644 index 0000000..bcc05de --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/esm/display.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{settings as t}from"@pixi/settings";import{Rectangle as i,RAD_TO_DEG as e,DEG_TO_RAD as n,Transform as r}from"@pixi/math";import{EventEmitter as s,removeItems as o}from"@pixi/utils";import{MASK_TYPES as a}from"@pixi/constants";t.SORTABLE_CHILDREN=!1;var h=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?i.EMPTY:((t=t||new i(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,i){var e=t.a,n=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,h=e*i.x+r*i.y+o,l=n*i.x+s*i.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)},t.prototype.addQuad=function(t){var i=this.minX,e=this.minY,n=this.maxX,r=this.maxY,s=t[0],o=t[1];i=sn?s:n,r=o>r?o:r,i=(s=t[2])n?s:n,r=o>r?o:r,i=(s=t[4])n?s:n,r=o>r?o:r,i=(s=t[6])n?s:n,r=o>r?o:r,this.minX=i,this.minY=e,this.maxX=n,this.maxY=r},t.prototype.addFrame=function(t,i,e,n,r){this.addFrameMatrix(t.worldTransform,i,e,n,r)},t.prototype.addFrameMatrix=function(t,i,e,n,r){var s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,d=t.ty,u=this.minX,p=this.minY,m=this.maxX,c=this.maxY,f=s*i+a*e+l,y=o*i+h*e+d;u=fm?f:m,c=y>c?y:c,u=(f=s*n+a*e+l)m?f:m,c=y>c?y:c,u=(f=s*i+a*r+l)m?f:m,c=y>c?y:c,u=(f=s*n+a*r+l)m?f:m,c=y>c?y:c,this.minX=u,this.minY=p,this.maxX=m,this.maxY=c},t.prototype.addVertexData=function(t,i,e){for(var n=this.minX,r=this.minY,s=this.maxX,o=this.maxY,a=i;as?h:s,o=l>o?l:o}this.minX=n,this.minY=r,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,i,e,n){this.addVerticesMatrix(t.worldTransform,i,e,n)},t.prototype.addVerticesMatrix=function(t,i,e,n,r,s){void 0===r&&(r=0),void 0===s&&(s=r);for(var o=t.a,a=t.b,h=t.c,l=t.d,d=t.tx,u=t.ty,p=this.minX,m=this.minY,c=this.maxX,f=this.maxY,y=e;yn?t.maxX:n,this.maxY=t.maxY>r?t.maxY:r},t.prototype.addBoundsMask=function(t,i){var e=t.minX>i.minX?t.minX:i.minX,n=t.minY>i.minY?t.minY:i.minY,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.addBoundsMatrix=function(t,i){this.addFrameMatrix(i,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,i){var e=t.minX>i.x?t.minX:i.x,n=t.minY>i.y?t.minY:i.y,r=t.maxXh?r:h,this.maxY=s>l?s:l}},t.prototype.pad=function(t,i){void 0===t&&(t=0),void 0===i&&(i=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i)},t.prototype.addFramePad=function(t,i,e,n,r,s){t-=r,i-=s,e+=r,n+=s,this.minX=this.minXe?this.maxX:e,this.minY=this.minYn?this.maxY:n},t}(),l=function(t,i){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])},l(t,i)};function d(t,i){function e(){this.constructor=t}l(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}var u=function(t){function s(){var i=t.call(this)||this;return i.tempDisplayObjectParent=null,i.transform=new r,i.alpha=1,i.visible=!0,i.renderable=!0,i.cullable=!1,i.cullArea=null,i.parent=null,i.worldAlpha=1,i._lastSortedIndex=0,i._zIndex=0,i.filterArea=null,i.filters=null,i._enabledFilters=null,i._bounds=new h,i._localBounds=null,i._boundsID=0,i._boundsRect=null,i._localBoundsRect=null,i._mask=null,i._maskRefCount=0,i._destroyed=!1,i.isSprite=!1,i.isMask=!1,i}return d(s,t),s.mixin=function(t){for(var i=Object.keys(t),e=0;e1)for(var n=0;nthis.children.length)throw new Error(t+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(i,0,t),this._boundsID++,this.onChildrenChange(i),t.emit("added",this),this.emit("childAdded",t,this,i),t},e.prototype.swapChildren=function(t,i){if(t!==i){var e=this.getChildIndex(t),n=this.getChildIndex(i);this.children[e]=i,this.children[n]=t,this.onChildrenChange(e=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var e=this.getChildIndex(t);o(this.children,e,1),this.children.splice(i,0,t),this.onChildrenChange(i)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,i=[],e=0;e1)for(var n=0;n0&&r<=i){e=this.children.splice(n,r);for(var s=0;s1&&this.children.sort(m),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,i=this.children.length;t0&&i.height>0){var n,r;if(this.cullArea?(n=this.cullArea,r=this.worldTransform):this._render!==e.prototype._render&&(n=this.getBounds(!0)),n&&i.intersects(n,r))this._render(t);else if(this.cullArea)return;for(var s=0,o=this.children.length;s this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["settings","SORTABLE_CHILDREN","Bounds","this","minX","Infinity","minY","maxX","maxY","rect","updateID","prototype","isEmpty","clear","getRectangle","Rectangle","EMPTY","x","y","width","height","addPoint","point","Math","min","max","addPointMatrix","matrix","a","b","c","d","tx","ty","addQuad","vertices","addFrame","transform","x0","y0","x1","y1","addFrameMatrix","worldTransform","addVertexData","vertexData","beginOffset","endOffset","i","addVertices","addVerticesMatrix","padX","padY","rawX","rawY","addBounds","bounds","addBoundsMask","mask","_minX","_minY","_maxX","_maxY","addBoundsMatrix","addBoundsArea","area","pad","paddingX","paddingY","addFramePad","extendStatics","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","create","DisplayObject","_super","_this","tempDisplayObjectParent","Transform","alpha","visible","renderable","cullable","cullArea","parent","worldAlpha","_lastSortedIndex","_zIndex","filterArea","filters","_enabledFilters","_bounds","_localBounds","_boundsID","_boundsRect","_localBoundsRect","_mask","_maskRefCount","_destroyed","isSprite","isMask","mixin","source","keys","length","propertyName","defineProperty","getOwnPropertyDescriptor","get","_recursivePostUpdateTransform","updateTransform","_tempDisplayObjectParent","getBounds","skipUpdate","calculateBounds","getLocalBounds","transformRef","parentRef","worldBounds","worldBoundsID","toGlobal","position","displayObjectUpdateTransform","apply","toLocal","from","applyInverse","setParent","container","addChild","Error","setTransform","scaleX","scaleY","rotation","skewX","skewY","pivotX","pivotY","scale","skew","pivot","destroy","_options","removeChild","hitArea","interactive","interactiveChildren","emit","removeAllListeners","TemporaryDisplayObject","enableTempParent","myParent","disableTempParent","cacheParent","set","value","localTransform","copyFrom","RAD_TO_DEG","DEG_TO_RAD","sortDirty","item","maskObject","isMaskData","EventEmitter","arguments","sortChildren","zIndex","Container","children","sortableChildren","onChildrenChange","_length","_i","child","_parentID","push","addChildAt","index","splice","swapChildren","child2","index1","getChildIndex","index2","indexOf","setChildIndex","currentIndex","removeItems","getChildAt","removeChildAt","removeChildren","beginIndex","endIndex","removed","begin","range","RangeError","sortRequired","j","sort","_calculateBounds","skipChildrenUpdate","result","call","_renderWithCulling","renderer","sourceFrame","renderTexture","_render","intersects","childCullable","render","renderAdvanced","enabled","flush","autoDetect","type","MASK_TYPES","NONE","batch","filter","pop","_renderer","options","destroyChildren","oldChildren","_width","_height","containerUpdateTransform"],"mappings":";;;;;;;yOAoBAA,EAASC,mBAAoB,ECT7B,IAAAC,EAAA,WAsBI,SAAAA,IAEIC,KAAKC,KAAOC,EAAAA,EACZF,KAAKG,KAAOD,EAAAA,EACZF,KAAKI,MAAQF,EAAAA,EACbF,KAAKK,MAAQH,EAAAA,EAEbF,KAAKM,KAAO,KACZN,KAAKO,UAAY,EAwYzB,OAjYIR,EAAAS,UAAAC,QAAA,WAEI,OAAOT,KAAKC,KAAOD,KAAKI,MAAQJ,KAAKG,KAAOH,KAAKK,MAIrDN,EAAAS,UAAAE,MAAA,WAEIV,KAAKC,KAAOC,EAAAA,EACZF,KAAKG,KAAOD,EAAAA,EACZF,KAAKI,MAAQF,EAAAA,EACbF,KAAKK,MAAQH,EAAAA,GASjBH,EAAYS,UAAAG,aAAZ,SAAaL,GAET,OAAIN,KAAKC,KAAOD,KAAKI,MAAQJ,KA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AAKuH,iBAAiBtG,OAIjCjB,KAAK+I,MAAMhI,EAFA,IAAXE,EAEe+I,EAAQ/I,EAIR,EAGnBjB,KAAKyO,QAAUzE,mCAEtBa,EApvBD,CAAwE/F,GA4vBxE+F,EAAUrK,UAAUkO,yBAA2B7D,EAAUrK,UAAU0G"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/dist/esm/display.mjs b/live2d/node_modules/@pixi/display/dist/esm/display.mjs new file mode 100644 index 0000000..87077fb --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/esm/display.mjs @@ -0,0 +1,1780 @@ +/*! + * @pixi/display - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { settings } from '@pixi/settings'; +import { Rectangle, RAD_TO_DEG, DEG_TO_RAD, Transform } from '@pixi/math'; +import { EventEmitter, removeItems } from '@pixi/utils'; +import { MASK_TYPES } from '@pixi/constants'; + +/** + * Sets the default value for the container property 'sortableChildren'. + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * @static + * @constant + * @name SORTABLE_CHILDREN + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.SORTABLE_CHILDREN = false; + +/** + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. + * @memberof PIXI + */ +var Bounds = /** @class */ (function () { + function Bounds() { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + this.rect = null; + this.updateID = -1; + } + /** + * Checks if bounds are empty. + * @returns - True if empty. + */ + Bounds.prototype.isEmpty = function () { + return this.minX > this.maxX || this.minY > this.maxY; + }; + /** Clears the bounds and resets. */ + Bounds.prototype.clear = function () { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * @param rect - Temporary object will be used if AABB is not empty + * @returns - A rectangle of the bounds + */ + Bounds.prototype.getRectangle = function (rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return Rectangle.EMPTY; + } + rect = rect || new Rectangle(0, 0, 1, 1); + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + return rect; + }; + /** + * This function should be inlined when its possible. + * @param point - The point to add. + */ + Bounds.prototype.addPoint = function (point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + /** + * Adds a point, after transformed. This should be inlined when its possible. + * @param matrix + * @param point + */ + Bounds.prototype.addPointMatrix = function (matrix, point) { + var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d, tx = matrix.tx, ty = matrix.ty; + var x = (a * point.x) + (c * point.y) + tx; + var y = (b * point.x) + (d * point.y) + ty; + this.minX = Math.min(this.minX, x); + this.maxX = Math.max(this.maxX, x); + this.minY = Math.min(this.minY, y); + this.maxY = Math.max(this.maxY, y); + }; + /** + * Adds a quad, not transformed + * @param vertices - The verts to add. + */ + Bounds.prototype.addQuad = function (vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = vertices[0]; + var y = vertices[1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds sprite frame, transformed. + * @param transform - transform to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { + this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); + }; + /** + * Adds sprite frame, multiplied by matrix + * @param matrix - matrix to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = (a * x0) + (c * y0) + tx; + var y = (b * x0) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y0) + tx; + y = (b * x1) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x0) + (c * y1) + tx; + y = (b * x0) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y1) + tx; + y = (b * x1) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds screen vertices from array + * @param vertexData - calculated vertices + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var x = vertexData[i]; + var y = vertexData[i + 1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Add an array of mesh vertices + * @param transform - mesh transform + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { + this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); + }; + /** + * Add an array of mesh vertices. + * @param matrix - mesh matrix + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + * @param padX - x padding + * @param padY - y padding + */ + Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { + if (padX === void 0) { padX = 0; } + if (padY === void 0) { padY = padX; } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + minX = Math.min(minX, x - padX); + maxX = Math.max(maxX, x + padX); + minY = Math.min(minY, y - padY); + maxY = Math.max(maxY, y + padY); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds other {@link Bounds}. + * @param bounds - The Bounds to be added + */ + Bounds.prototype.addBounds = function (bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + /** + * Adds other Bounds, masked with Bounds. + * @param bounds - The Bounds to be added. + * @param mask - TODO + */ + Bounds.prototype.addBoundsMask = function (bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * @param bounds - other bounds + * @param matrix - multiplicator + */ + Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { + this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); + }; + /** + * Adds other Bounds, masked with Rectangle. + * @param bounds - TODO + * @param area - TODO + */ + Bounds.prototype.addBoundsArea = function (bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + */ + Bounds.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + if (!this.isEmpty()) { + this.minX -= paddingX; + this.maxX += paddingX; + this.minY -= paddingY; + this.maxY += paddingY; + } + }; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + * @param padX - padding X + * @param padY - padding Y + */ + Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { + x0 -= padX; + y0 -= padY; + x1 += padX; + y1 += padY; + this.minX = this.minX < x0 ? this.minX : x0; + this.maxX = this.maxX > x1 ? this.maxX : x1; + this.minY = this.minY < y0 ? this.minY : y0; + this.maxY = this.maxY > y1 ? this.maxY : y1; + }; + return Bounds; +}()); + +/*! ***************************************************************************** +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 __()); +} + +/** + * The base class for all objects that are rendered on the screen. + * + * This is an abstract class and can not be used on its own; rather it should be extended. + * + * ## Display objects implemented in PixiJS + * + * | Display Object | Description | + * | ------------------------------- | --------------------------------------------------------------------- | + * | {@link PIXI.Container} | Adds support for `children` to DisplayObject | + * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API | + * | {@link PIXI.Sprite} | Draws textures (i.e. images) | + * | {@link PIXI.Text} | Draws text using the Canvas API internally | + * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures | + * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion | + * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images | + * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data | + * | {@link PIXI.NineSlicePlane} | Mesh-related | + * | {@link PIXI.SimpleMesh} | v4-compatible mesh | + * | {@link PIXI.SimplePlane} | Mesh-related | + * | {@link PIXI.SimpleRope} | Mesh-related | + * + * ## Transforms + * + * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its + * local coordinate space to its parent's local coordinate space. The following properties are derived + * from the transform: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot} + * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot + * is equal to position, regardless of the other three transformations. In other words, It is the center of + * rotation, scaling, and skewing. + *
[position]{@link PIXI.DisplayObject#position} + * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local + * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object + * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space. + *
[scale]{@link PIXI.DisplayObject#scale} + * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the + * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center + * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}. + *
[rotation]{@link PIXI.DisplayObject#rotation} + * Rotation. This will rotate the display object's projection by this angle (in radians). + *
[skew]{@link PIXI.DisplayObject#skew} + *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

+ *

+ * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be + * thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is + * ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be + * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will + * be rotated by an angle between ⍺ and β. + *

+ *

+ * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying + * a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ. + *

+ *

+ * Another quite interesting observation is that "skew.x", "skew.y", rotation are communtative operations. Indeed, + * because rotation is essentially a careful combination of the two. + *

+ *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width + * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing + * the "requested" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there + * is no concept of user-defined width. + *
height + * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing + * the "requested" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there + * is no concept of user-defined height. + *
+ * + * ## Bounds + * + * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit + * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the + * `worldTransform` to calculate in world space). + * + * There are a few additional types of bounding boxes: + * + * | Bounds | Description | + * | --------------------- | ---------------------------------------------------------------------------------------- | + * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. | + * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. | + * | Render Bounds | The bounds, but including extra rendering effects like filter padding. | + * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. | + * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. | + * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)| + * | Content Bounds | The natural bounds when excluding all children of a `Container`. | + * + * ### calculateBounds + * + * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children. + * + * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and + * `getLocalBounds` to work. This method must write the bounds into `this._bounds`. + * + * Generally, the following technique works for most simple cases: take the list of points + * forming the "hull" of the object (i.e. outline of the object's shape), and then add them + * using {@link PIXI.Bounds#addPointMatrix}. + * + * ```js + * calculateBounds(): void + * { + * const points = [...]; + * + * for (let i = 0, j = points.length; i < j; i++) + * { + * this._bounds.addPointMatrix(this.worldTransform, points[i]); + * } + * } + * ``` + * + * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them + * in one array together. + * + * ## Alpha + * + * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display + * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not + * applied on any ancestor further up the chain). + * + * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}. + * + * ## Renderable vs Visible + * + * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the + * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display + * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not + * be calculated. + * + * It is recommended that applications use the `renderable` property for culling. See + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details. + * + * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This + * one is also better in terms of performance. + * @memberof PIXI + */ +var DisplayObject = /** @class */ (function (_super) { + __extends(DisplayObject, _super); + function DisplayObject() { + var _this = _super.call(this) || this; + _this.tempDisplayObjectParent = null; + // TODO: need to create Transform from factory + _this.transform = new Transform(); + _this.alpha = 1; + _this.visible = true; + _this.renderable = true; + _this.cullable = false; + _this.cullArea = null; + _this.parent = null; + _this.worldAlpha = 1; + _this._lastSortedIndex = 0; + _this._zIndex = 0; + _this.filterArea = null; + _this.filters = null; + _this._enabledFilters = null; + _this._bounds = new Bounds(); + _this._localBounds = null; + _this._boundsID = 0; + _this._boundsRect = null; + _this._localBoundsRect = null; + _this._mask = null; + _this._maskRefCount = 0; + _this._destroyed = false; + _this.isSprite = false; + _this.isMask = false; + return _this; + } + /** + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * @param source - The source of properties and methods to mix in. + */ + DisplayObject.mixin = function (source) { + // in ES8/ES2017, this would be really easy: + // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); + // get all the enumerable property keys + var keys = Object.keys(source); + // loop through properties + for (var i = 0; i < keys.length; ++i) { + var propertyName = keys[i]; + // Set the property using the property descriptor - this works for accessors and normal value properties + Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); + } + }; + Object.defineProperty(DisplayObject.prototype, "destroyed", { + /** + * Fired when this DisplayObject is added to a Container. + * @instance + * @event added + * @param {PIXI.Container} container - The container added to. + */ + /** + * Fired when this DisplayObject is removed from a Container. + * @instance + * @event removed + * @param {PIXI.Container} container - The container removed from. + */ + /** + * Fired when this DisplayObject is destroyed. This event is emitted once + * destroy is finished. + * @instance + * @event destroyed + */ + /** Readonly flag for destroyed display objects. */ + get: function () { + return this._destroyed; + }, + enumerable: false, + configurable: true + }); + /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */ + DisplayObject.prototype._recursivePostUpdateTransform = function () { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } + else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); + } + }; + /** Updates the object transform for rendering. TODO - Optimization pass! */ + DisplayObject.prototype.updateTransform = function () { + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // multiply the alphas.. + this.worldAlpha = this.alpha * this.parent.worldAlpha; + }; + /** + * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}. + * + * This method is expensive on containers with a large subtree (like the stage). This is because the bounds + * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to + * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update + * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using + * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise, + * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as + * its height increases. + * + * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated. + * The world bounds of all display objects in a container's **subtree** will also be recalculated. + * + * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds + * calculation if needed. + * + * ```js + * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect); + * ``` + * + * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This + * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more + * details. + * + * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms + * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain + * cases. + * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The minimum axis-aligned rectangle in world space that fits around this object. + */ + DisplayObject.prototype.getBounds = function (skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } + else { + this._recursivePostUpdateTransform(); + this.updateTransform(); + } + } + if (this._bounds.updateID !== this._boundsID) { + this.calculateBounds(); + this._bounds.updateID = this._boundsID; + } + if (!rect) { + if (!this._boundsRect) { + this._boundsRect = new Rectangle(); + } + rect = this._boundsRect; + } + return this._bounds.getRectangle(rect); + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The rectangular bounding area. + */ + DisplayObject.prototype.getLocalBounds = function (rect) { + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new Rectangle(); + } + rect = this._localBoundsRect; + } + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + var transformRef = this.transform; + var parentRef = this.parent; + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + var worldBounds = this._bounds; + var worldBoundsID = this._boundsID; + this._bounds = this._localBounds; + var bounds = this.getBounds(false, rect); + this.parent = parentRef; + this.transform = transformRef; + this._bounds = worldBounds; + this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects + return bounds; + }; + /** + * Calculates the global position of the display object. + * @param position - The world origin to calculate from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform. + * @returns - A point object representing the position of this object. + */ + DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { + if (skipUpdate === void 0) { skipUpdate = false; } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // don't need to update the lot + return this.worldTransform.apply(position, point); + }; + /** + * Calculates the local position of the display object relative to another point. + * @param position - The world origin to calculate from. + * @param from - The DisplayObject to calculate the global position from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform + * @returns - A point object representing the position of this object + */ + DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { + if (from) { + position = from.toGlobal(position, point, skipUpdate); + } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // simply apply the matrix.. + return this.worldTransform.applyInverse(position, point); + }; + /** + * Set the parent Container of this DisplayObject. + * @param container - The Container to add this DisplayObject to. + * @returns - The Container that this DisplayObject was added to. + */ + DisplayObject.prototype.setParent = function (container) { + if (!container || !container.addChild) { + throw new Error('setParent: Argument must be a Container'); + } + container.addChild(this); + return container; + }; + /** + * Convenience function to set the position, scale, skew and pivot at once. + * @param x - The X position + * @param y - The Y position + * @param scaleX - The X scale value + * @param scaleY - The Y scale value + * @param rotation - The rotation + * @param skewX - The X skew value + * @param skewY - The Y skew value + * @param pivotX - The X pivot value + * @param pivotY - The Y pivot value + * @returns - The DisplayObject instance + */ + DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (scaleX === void 0) { scaleX = 1; } + if (scaleY === void 0) { scaleY = 1; } + if (rotation === void 0) { rotation = 0; } + if (skewX === void 0) { skewX = 0; } + if (skewY === void 0) { skewY = 0; } + if (pivotX === void 0) { pivotX = 0; } + if (pivotY === void 0) { pivotY = 0; } + this.position.x = x; + this.position.y = y; + this.scale.x = !scaleX ? 1 : scaleX; + this.scale.y = !scaleY ? 1 : scaleY; + this.rotation = rotation; + this.skew.x = skewX; + this.skew.y = skewY; + this.pivot.x = pivotX; + this.pivot.y = pivotY; + return this; + }; + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy()`. + * @param _options + */ + DisplayObject.prototype.destroy = function (_options) { + if (this.parent) { + this.parent.removeChild(this); + } + this._destroyed = true; + this.transform = null; + this.parent = null; + this._bounds = null; + this.mask = null; + this.cullArea = null; + this.filters = null; + this.filterArea = null; + this.hitArea = null; + this.interactive = false; + this.interactiveChildren = false; + this.emit('destroyed'); + this.removeAllListeners(); + }; + Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { + /** + * @protected + * @member {PIXI.Container} + */ + get: function () { + if (this.tempDisplayObjectParent === null) { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + this.tempDisplayObjectParent = new TemporaryDisplayObject(); + } + return this.tempDisplayObjectParent; + }, + enumerable: false, + configurable: true + }); + /** + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root + * + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` + * @returns - current parent + */ + DisplayObject.prototype.enableTempParent = function () { + var myParent = this.parent; + this.parent = this._tempDisplayObjectParent; + return myParent; + }; + /** + * Pair method for `enableTempParent` + * @param cacheParent - Actual parent of element + */ + DisplayObject.prototype.disableTempParent = function (cacheParent) { + this.parent = cacheParent; + }; + Object.defineProperty(DisplayObject.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + */ + get: function () { + return this.position.x; + }, + set: function (value) { + this.transform.position.x = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "y", { + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + */ + get: function () { + return this.position.y; + }, + set: function (value) { + this.transform.position.y = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldTransform", { + /** + * Current transform of the object based on world (parent) factors. + * @readonly + */ + get: function () { + return this.transform.worldTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "localTransform", { + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * @readonly + */ + get: function () { + return this.transform.localTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "position", { + /** + * The coordinate of the object relative to the local coordinates of the parent. + * @since 4.0.0 + */ + get: function () { + return this.transform.position; + }, + set: function (value) { + this.transform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "scale", { + /** + * The scale factors of this object along the local coordinate axes. + * + * The default scale is (1, 1). + * @since 4.0.0 + */ + get: function () { + return this.transform.scale; + }, + set: function (value) { + this.transform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "pivot", { + /** + * The center of rotation, scaling, and skewing for this display object in its local space. The `position` + * is the projection of `pivot` in the parent's local space. + * + * By default, the pivot is the origin (0, 0). + * @since 4.0.0 + */ + get: function () { + return this.transform.pivot; + }, + set: function (value) { + this.transform.pivot.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "skew", { + /** + * The skew factor for the object in radians. + * @since 4.0.0 + */ + get: function () { + return this.transform.skew; + }, + set: function (value) { + this.transform.skew.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "rotation", { + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation; + }, + set: function (value) { + this.transform.rotation = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "angle", { + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get: function () { + return this.transform.rotation * RAD_TO_DEG; + }, + set: function (value) { + this.transform.rotation = value * DEG_TO_RAD; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "zIndex", { + /** + * The zIndex of the displayObject. + * + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other display objects within the same container. + * @see PIXI.Container#sortableChildren + */ + get: function () { + return this._zIndex; + }, + set: function (value) { + this._zIndex = value; + if (this.parent) { + this.parent.sortDirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldVisible", { + /** + * Indicates if the object is globally visible. + * @readonly + */ + get: function () { + var item = this; + do { + if (!item.visible) { + return false; + } + item = item.parent; + } while (item); + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "mask", { + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. + * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong. + * To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + */ + get: function () { + return this._mask; + }, + set: function (value) { + if (this._mask === value) { + return; + } + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + maskObject._maskRefCount--; + if (maskObject._maskRefCount === 0) { + maskObject.renderable = true; + maskObject.isMask = false; + } + } + } + this._mask = value; + if (this._mask) { + var maskObject = (this._mask.isMaskData + ? this._mask.maskObject : this._mask); + if (maskObject) { + if (maskObject._maskRefCount === 0) { + maskObject.renderable = false; + maskObject.isMask = true; + } + maskObject._maskRefCount++; + } + } + }, + enumerable: false, + configurable: true + }); + return DisplayObject; +}(EventEmitter)); +/** + * @private + */ +var TemporaryDisplayObject = /** @class */ (function (_super) { + __extends(TemporaryDisplayObject, _super); + function TemporaryDisplayObject() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.sortDirty = null; + return _this; + } + return TemporaryDisplayObject; +}(DisplayObject)); +/** + * DisplayObject default updateTransform, does not update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.DisplayObject# + * @method displayObjectUpdateTransform + */ +DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; + +function sortChildren(a, b) { + if (a.zIndex === b.zIndex) { + return a._lastSortedIndex - b._lastSortedIndex; + } + return a.zIndex - b.zIndex; +} +/** + * Container is a general-purpose display object that holds children. It also adds built-in support for advanced + * rendering features like masking and filtering. + * + * It is the base class of all display objects that act as a container for other objects, including Graphics + * and Sprite. + * + * ```js + * import { BlurFilter } from '@pixi/filter-blur'; + * import { Container } from '@pixi/display'; + * import { Graphics } from '@pixi/graphics'; + * import { Sprite } from '@pixi/sprite'; + * + * let container = new Container(); + * let sprite = Sprite.from("https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png"); + * + * sprite.width = 512; + * sprite.height = 512; + * + * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container + * // is rendered. + * container.addChild(sprite); + * + * // Blurs whatever is rendered by the container + * container.filters = [new BlurFilter()]; + * + * // Only the contents within a circle at the center should be rendered onto the screen. + * container.mask = new Graphics() + * .beginFill(0xffffff) + * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2) + * .endFill(); + * ``` + * @memberof PIXI + */ +var Container = /** @class */ (function (_super) { + __extends(Container, _super); + function Container() { + var _this = _super.call(this) || this; + _this.children = []; + _this.sortableChildren = settings.SORTABLE_CHILDREN; + _this.sortDirty = false; + return _this; + /** + * Fired when a DisplayObject is added to this Container. + * @event PIXI.Container#childAdded + * @param {PIXI.DisplayObject} child - The child added to the Container. + * @param {PIXI.Container} container - The container that added the child. + * @param {number} index - The children's index of the added child. + */ + /** + * Fired when a DisplayObject is removed from this Container. + * @event PIXI.DisplayObject#childRemoved + * @param {PIXI.DisplayObject} child - The child removed from the Container. + * @param {PIXI.Container} container - The container that removed the child. + * @param {number} index - The former children's index of the removed child + */ + } + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified. + * @param _length + */ + Container.prototype.onChildrenChange = function (_length) { + /* empty */ + }; + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container + * @returns {PIXI.DisplayObject} - The first child that was added. + */ + Container.prototype.addChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the array and add all children + for (var i = 0; i < children.length; i++) { + // eslint-disable-next-line prefer-rest-params + this.addChild(children[i]); + } + } + else { + var child = children[0]; + // if the child has a parent then lets remove it as PixiJS objects can only exist in one place + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.push(child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(this.children.length - 1); + this.emit('childAdded', child, this, this.children.length - 1); + child.emit('added', this); + } + return children[0]; + }; + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @returns {PIXI.DisplayObject} The child that was added. + */ + Container.prototype.addChildAt = function (child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); + } + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.splice(index, 0, child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('added', this); + this.emit('childAdded', child, this, index); + return child; + }; + /** + * Swaps the position of 2 Display Objects within this container. + * @param child - First display object to swap + * @param child2 - Second display object to swap + */ + Container.prototype.swapChildren = function (child, child2) { + if (child === child2) { + return; + } + var index1 = this.getChildIndex(child); + var index2 = this.getChildIndex(child2); + this.children[index1] = child2; + this.children[index2] = child; + this.onChildrenChange(index1 < index2 ? index1 : index2); + }; + /** + * Returns the index position of a child DisplayObject instance + * @param child - The DisplayObject instance to identify + * @returns - The index position of the child display object to identify + */ + Container.prototype.getChildIndex = function (child) { + var index = this.children.indexOf(child); + if (index === -1) { + throw new Error('The supplied DisplayObject must be a child of the caller'); + } + return index; + }; + /** + * Changes the position of an existing child in the display object container + * @param child - The child DisplayObject instance for which you want to change the index number + * @param index - The resulting index number for the child display object + */ + Container.prototype.setChildIndex = function (child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); + } + var currentIndex = this.getChildIndex(child); + removeItems(this.children, currentIndex, 1); // remove from old position + this.children.splice(index, 0, child); // add at new position + this.onChildrenChange(index); + }; + /** + * Returns the child at the specified index + * @param index - The index to get the child at + * @returns - The child at the given index, if any. + */ + Container.prototype.getChildAt = function (index) { + if (index < 0 || index >= this.children.length) { + throw new Error("getChildAt: Index (" + index + ") does not exist."); + } + return this.children[index]; + }; + /** + * Removes one or more children from the container. + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove + * @returns {PIXI.DisplayObject} The first child that was removed. + */ + Container.prototype.removeChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the arguments property and remove all children + for (var i = 0; i < children.length; i++) { + this.removeChild(children[i]); + } + } + else { + var child = children[0]; + var index = this.children.indexOf(child); + if (index === -1) + { return null; } + child.parent = null; + // ensure child transform will be recalculated + child.transform._parentID = -1; + removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + } + return children[0]; + }; + /** + * Removes a child from the specified index position. + * @param index - The index to get the child from + * @returns The child that was removed. + */ + Container.prototype.removeChildAt = function (index) { + var child = this.getChildAt(index); + // ensure child transform will be recalculated.. + child.parent = null; + child.transform._parentID = -1; + removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + return child; + }; + /** + * Removes all children from this container that are within the begin and end indexes. + * @param beginIndex - The beginning position. + * @param endIndex - The ending position. Default value is size of the container. + * @returns - List of removed children + */ + Container.prototype.removeChildren = function (beginIndex, endIndex) { + if (beginIndex === void 0) { beginIndex = 0; } + if (endIndex === void 0) { endIndex = this.children.length; } + var begin = beginIndex; + var end = endIndex; + var range = end - begin; + var removed; + if (range > 0 && range <= end) { + removed = this.children.splice(begin, range); + for (var i = 0; i < removed.length; ++i) { + removed[i].parent = null; + if (removed[i].transform) { + removed[i].transform._parentID = -1; + } + } + this._boundsID++; + this.onChildrenChange(beginIndex); + for (var i = 0; i < removed.length; ++i) { + removed[i].emit('removed', this); + this.emit('childRemoved', removed[i], this, i); + } + return removed; + } + else if (range === 0 && this.children.length === 0) { + return []; + } + throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); + }; + /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */ + Container.prototype.sortChildren = function () { + var sortRequired = false; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + child._lastSortedIndex = i; + if (!sortRequired && child.zIndex !== 0) { + sortRequired = true; + } + } + if (sortRequired && this.children.length > 1) { + this.children.sort(sortChildren); + } + this.sortDirty = false; + }; + /** Updates the transform on all children of this container for rendering. */ + Container.prototype.updateTransform = function () { + if (this.sortableChildren && this.sortDirty) { + this.sortChildren(); + } + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // TODO: check render flags, how to process stuff here + this.worldAlpha = this.alpha * this.parent.worldAlpha; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + }; + /** + * Recalculates the bounds of the container. + * + * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds + * is limited to its mask's bounds or filterArea, if any is applied. + */ + Container.prototype.calculateBounds = function () { + this._bounds.clear(); + this._calculateBounds(); + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (!child.visible || !child.renderable) { + continue; + } + child.calculateBounds(); + // TODO: filter+mask, need to mask both somehow + if (child._mask) { + var maskObject = (child._mask.isMaskData + ? child._mask.maskObject : child._mask); + if (maskObject) { + maskObject.calculateBounds(); + this._bounds.addBoundsMask(child._bounds, maskObject._bounds); + } + else { + this._bounds.addBounds(child._bounds); + } + } + else if (child.filterArea) { + this._bounds.addBoundsArea(child._bounds, child.filterArea); + } + else { + this._bounds.addBounds(child._bounds); + } + } + this._bounds.updateID = this._boundsID; + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render() + * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @returns - The rectangular bounding area. + */ + Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { + if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } + var result = _super.prototype.getLocalBounds.call(this, rect); + if (!skipChildrenUpdate) { + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + } + return result; + }; + /** + * Recalculates the content bounds of this object. This should be overriden to + * calculate the bounds of this specific object (not including children). + * @protected + */ + Container.prototype._calculateBounds = function () { + // FILL IN// + }; + /** + * Renders this object and its children with culling. + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype._renderWithCulling = function (renderer) { + var sourceFrame = renderer.renderTexture.sourceFrame; + // If the source frame is empty, stop rendering. + if (!(sourceFrame.width > 0 && sourceFrame.height > 0)) { + return; + } + // Render the content of the container only if its bounds intersect with the source frame. + // All filters are on the stack at this point, and the filter source frame is bound: + // therefore, even if the bounds to non intersect the filter frame, the filter + // is still applied and any filter padding that is in the frame is rendered correctly. + var bounds; + var transform; + // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea + // rectangle must completely contain the container and its children including filter padding. + if (this.cullArea) { + bounds = this.cullArea; + transform = this.worldTransform; + } + // If the container doesn't override _render, we can skip the bounds calculation and intersection test. + else if (this._render !== Container.prototype._render) { + bounds = this.getBounds(true); + } + // Render the container if the source frame intersects the bounds. + if (bounds && sourceFrame.intersects(bounds, transform)) { + this._render(renderer); + } + // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering. + else if (this.cullArea) { + return; + } + // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect + // the source frame, because the children might have filters with nonzero padding, which may intersect + // with the source frame while the bounds do not: filter padding is not included in the bounds. + // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered + // if they are out of frame; otherwise, render the children normally. + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + var childCullable = child.cullable; + child.cullable = childCullable || !this.cullArea; + child.render(renderer); + child.cullable = childCullable; + } + }; + /** + * Renders the object using the WebGL renderer. + * + * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the + * container itself. This `render` method will invoke it, and also invoke the `render` methods of all + * children afterward. + * + * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and + * the bounds of this object are out of frame, this implementation will entirely skip rendering. + * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally, + * setting alpha to zero is not recommended for purely skipping rendering. + * + * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is + * advised to employ **culling** to automatically skip rendering objects outside of the current screen. + * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}. + * Other culling methods might be better suited for a large number static objects; see + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}. + * + * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or + * filtering is applied on a container. This does, however, break batching and can affect performance when + * masking and filtering is applied extensively throughout the scene graph. + * @param renderer - The renderer + */ + Container.prototype.render = function (renderer) { + // if the object is not visible or the alpha is 0 then no need to render this element + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + // do a quick check to see if this element has a mask or a filter. + if (this._mask || (this.filters && this.filters.length)) { + this.renderAdvanced(renderer); + } + else if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + }; + /** + * Render the object using the WebGL renderer and advanced features. + * @param renderer - The renderer + */ + Container.prototype.renderAdvanced = function (renderer) { + var filters = this.filters; + var mask = this._mask; + // push filter first as we need to ensure the stencil buffer is correct for any masking + if (filters) { + if (!this._enabledFilters) { + this._enabledFilters = []; + } + this._enabledFilters.length = 0; + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { + this._enabledFilters.push(filters[i]); + } + } + } + var flush = (filters && this._enabledFilters && this._enabledFilters.length) + || (mask && (!mask.isMaskData + || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE)))); + if (flush) { + renderer.batch.flush(); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.push(this, this._enabledFilters); + } + if (mask) { + renderer.mask.push(this, this._mask); + } + if (this.cullable) { + this._renderWithCulling(renderer); + } + else { + this._render(renderer); + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + if (flush) { + renderer.batch.flush(); + } + if (mask) { + renderer.mask.pop(this); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.pop(); + } + }; + /** + * To be overridden by the subclasses. + * @param _renderer - The renderer + */ + Container.prototype._render = function (_renderer) { + // this is where content itself gets rendered... + }; + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Container.prototype.destroy = function (options) { + _super.prototype.destroy.call(this); + this.sortDirty = false; + var destroyChildren = typeof options === 'boolean' ? options : options && options.children; + var oldChildren = this.removeChildren(0, this.children.length); + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { + oldChildren[i].destroy(options); + } + } + }; + Object.defineProperty(Container.prototype, "width", { + /** The width of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.x * this.getLocalBounds().width; + }, + set: function (value) { + var width = this.getLocalBounds().width; + if (width !== 0) { + this.scale.x = value / width; + } + else { + this.scale.x = 1; + } + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Container.prototype, "height", { + /** The height of the Container, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return this.scale.y * this.getLocalBounds().height; + }, + set: function (value) { + var height = this.getLocalBounds().height; + if (height !== 0) { + this.scale.y = value / height; + } + else { + this.scale.y = 1; + } + this._height = value; + }, + enumerable: false, + configurable: true + }); + return Container; +}(DisplayObject)); +/** + * Container default updateTransform, does update children of container. + * Will crash if there's no parent element. + * @memberof PIXI.Container# + * @method containerUpdateTransform + */ +Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; + +export { Bounds, Container, DisplayObject, TemporaryDisplayObject }; +//# sourceMappingURL=display.mjs.map diff --git a/live2d/node_modules/@pixi/display/dist/esm/display.mjs.map b/live2d/node_modules/@pixi/display/dist/esm/display.mjs.map new file mode 100644 index 0000000..8c446fb --- /dev/null +++ b/live2d/node_modules/@pixi/display/dist/esm/display.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"display.mjs","sources":["../../src/settings.ts","../../src/Bounds.ts","../../../../node_modules/tslib/tslib.es6.js","../../src/DisplayObject.ts","../../src/Container.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n * @memberof PIXI\n */\nexport class Bounds\n{\n /** @default Infinity */\n public minX: number;\n\n /** @default Infinity */\n public minY: number;\n\n /** @default -Infinity */\n public maxX: number;\n\n /** @default -Infinity */\n public maxY: number;\n\n public rect: Rectangle;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n */\n public updateID: number;\n\n constructor()\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n\n this.rect = null;\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n * @returns - True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /** Clears the bounds and resets. */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n * @param rect - Temporary object will be used if AABB is not empty\n * @returns - A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n * @param point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n * @param vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n * @param transform - transform to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n * @param matrix - matrix to apply\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n * @param vertexData - calculated vertices\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n * @param transform - mesh transform\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n * @param matrix - mesh matrix\n * @param vertices - mesh coordinates in array\n * @param beginOffset - begin offset\n * @param endOffset - end offset, excluded\n * @param padX - x padding\n * @param padY - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other {@link Bounds}.\n * @param bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n * @param bounds - The Bounds to be added.\n * @param mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n * @param bounds - other bounds\n * @param matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n * @param bounds - TODO\n * @param area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n * @param x0 - left X of frame\n * @param y0 - top Y of frame\n * @param x1 - right X of frame\n * @param y1 - bottom Y of frame\n * @param padX - padding X\n * @param padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { DEG_TO_RAD, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint, Matrix, Point } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions\n{\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n /** The display object container that contains this display object. */\n public parent: Container;\n\n /**\n * The multiplied alpha of the displayObject.\n * @readonly\n */\n public worldAlpha: number;\n\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n */\n public transform: Transform;\n\n /** The opacity of the object. */\n public alpha: number;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n */\n public visible: boolean;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n */\n public renderable: boolean;\n\n /**\n * Should this object be rendered if the bounds of this object are out of frame?\n *\n * Culling has no effect on whether updateTransform is called.\n */\n public cullable: boolean;\n\n /**\n * If set, this shape is used for culling instead of the bounds of this object.\n * It can improve the culling performance of objects with many children.\n * The culling area is defined in local space.\n */\n public cullArea: Rectangle;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n */\n public filterArea: Rectangle;\n\n /**\n * Sets the filters for the displayObject.\n * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n */\n public filters: Filter[] | null;\n\n /** Used to fast check if a sprite is.. a sprite! */\n public isSprite: boolean;\n\n /** Does any other displayObject use this object as a mask? */\n public isMask: boolean;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n * @protected\n */\n public _lastSortedIndex: number;\n\n /**\n * The original, cached mask of the object.\n * @protected\n */\n public _mask: Container | MaskData;\n\n /** The bounds object, this is used to calculate and store the bounds of the displayObject. */\n public _bounds: Bounds;\n\n /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */\n public _localBounds: Bounds;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n * @protected\n */\n protected _zIndex: number;\n\n /**\n * Currently enabled filters.\n * @protected\n */\n protected _enabledFilters: Filter[];\n\n /** Flags the cached bounds as dirty. */\n protected _boundsID: number;\n\n /** Cache of this display-object's bounds-rectangle. */\n protected _boundsRect: Rectangle;\n\n /** Cache of this display-object's local-bounds rectangle. */\n protected _localBoundsRect: Rectangle;\n\n /** If the object has been destroyed via destroy(). If true, it should not be used. */\n protected _destroyed: boolean;\n\n /** The number of times this object is used as a mask by another object. */\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n * @param source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n this.transform = new Transform();\n this.alpha = 1;\n this.visible = true;\n this.renderable = true;\n this.cullable = false;\n this.cullArea = null;\n\n this.parent = null;\n this.worldAlpha = 1;\n\n this._lastSortedIndex = 0;\n this._zIndex = 0;\n\n this.filterArea = null;\n this.filters = null;\n this._enabledFilters = null;\n\n this._bounds = new Bounds();\n this._localBounds = null;\n this._boundsID = 0;\n this._boundsRect = null;\n this._localBoundsRect = null;\n this._mask = null;\n this._maskRefCount = 0;\n this._destroyed = false;\n\n this.isSprite = false;\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed. This event is emitted once\n * destroy is finished.\n * @instance\n * @event destroyed\n */\n\n /** Readonly flag for destroyed display objects. */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /** Recalculates the bounds of the display object. */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n * @param renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /** Updates the object transform for rendering. TODO - Optimization pass! */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @returns - The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n * @param position - The world origin to calculate from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform.\n * @returns - A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n * @param position - The world origin to calculate from.\n * @param from - The DisplayObject to calculate the global position from.\n * @param point - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param skipUpdate - Should we skip the update transform\n * @returns - A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n * @param container - The Container to add this DisplayObject to.\n * @returns - The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n * @param x - The X position\n * @param y - The Y position\n * @param scaleX - The X scale value\n * @param scaleY - The Y scale value\n * @param rotation - The rotation\n * @param skewX - The X skew value\n * @param skewY - The Y skew value\n * @param pivotX - The X pivot value\n * @param pivotY - The Y pivot value\n * @returns - The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n * @param _options\n */\n destroy(_options?: IDestroyOptions | boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this._destroyed = true;\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.cullArea = null;\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this.emit('destroyed');\n this.removeAllListeners();\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n * @returns - current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n * @param cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n * @since 4.0.0\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: IPointData)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n * @since 4.0.0\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: IPointData)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n * @since 4.0.0\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: IPointData)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n * @since 4.0.0\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: IPointData)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent.\n * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong.\n * To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n */\n get mask(): Container | MaskData | null\n {\n return this._mask;\n }\n\n set mask(value: Container | MaskData | null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).isMaskData\n ? (this._mask as MaskData).maskObject : this._mask) as Container;\n\n if (maskObject)\n {\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport type { Matrix, Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n /**\n * The array of children of this container.\n * @readonly\n */\n public readonly children: T[];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n * @see PIXI.settings.SORTABLE_CHILDREN\n */\n public sortableChildren: boolean;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n */\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n this.children = [];\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n * @event PIXI.DisplayObject#childRemoved\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified.\n * @param _length\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @returns {PIXI.DisplayObject} - The first child that was added.\n */\n addChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @returns {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: U, index: number): U\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n * @param child - First display object to swap\n * @param child2 - Second display object to swap\n */\n swapChildren(child: T, child2: T): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n * @param child - The DisplayObject instance to identify\n * @returns - The index position of the child display object to identify\n */\n getChildIndex(child: T): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n * @param child - The child DisplayObject instance for which you want to change the index number\n * @param index - The resulting index number for the child display object\n */\n setChildIndex(child: T, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n * @param index - The index to get the child at\n * @returns - The child at the given index, if any.\n */\n getChildAt(index: number): T\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @returns {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: U): U[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n * @param index - The index to get the child from\n * @returns The child that was removed.\n */\n removeChildAt(index: number): T\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n * @param beginIndex - The beginning position.\n * @param endIndex - The ending position. Default value is size of the container.\n * @returns - List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): T[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /** Updates the transform on all children of this container for rendering. */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).isMaskData\n ? (child._mask as MaskData).maskObject : child._mask) as Container;\n\n if (maskObject)\n {\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n * @param rect - Optional rectangle to store the result of the bounds calculation.\n * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @returns - The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders this object and its children with culling.\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderWithCulling(renderer: Renderer): void\n {\n const sourceFrame = renderer.renderTexture.sourceFrame;\n\n // If the source frame is empty, stop rendering.\n if (!(sourceFrame.width > 0 && sourceFrame.height > 0))\n {\n return;\n }\n\n // Render the content of the container only if its bounds intersect with the source frame.\n // All filters are on the stack at this point, and the filter source frame is bound:\n // therefore, even if the bounds to non intersect the filter frame, the filter\n // is still applied and any filter padding that is in the frame is rendered correctly.\n\n let bounds: Rectangle;\n let transform: Matrix;\n\n // If cullArea is set, we use this rectangle instead of the bounds of the object. The cullArea\n // rectangle must completely contain the container and its children including filter padding.\n if (this.cullArea)\n {\n bounds = this.cullArea;\n transform = this.worldTransform;\n }\n // If the container doesn't override _render, we can skip the bounds calculation and intersection test.\n else if (this._render !== Container.prototype._render)\n {\n bounds = this.getBounds(true);\n }\n\n // Render the container if the source frame intersects the bounds.\n if (bounds && sourceFrame.intersects(bounds, transform))\n {\n this._render(renderer);\n }\n // If the bounds are defined by cullArea and do not intersect with the source frame, stop rendering.\n else if (this.cullArea)\n {\n return;\n }\n\n // Unless cullArea is set, we cannot skip the children if the bounds of the container do not intersect\n // the source frame, because the children might have filters with nonzero padding, which may intersect\n // with the source frame while the bounds do not: filter padding is not included in the bounds.\n\n // If cullArea is not set, render the children with culling temporarily enabled so that they are not rendered\n // if they are out of frame; otherwise, render the children normally.\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n const childCullable = child.cullable;\n\n child.cullable = childCullable || !this.cullArea;\n child.render(renderer);\n child.cullable = childCullable;\n }\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and\n * the bounds of this object are out of frame, this implementation will entirely skip rendering.\n * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen.\n * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}.\n * Other culling methods might be better suited for a large number static objects; see\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n * @param renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n * @param renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n if (this.cullable)\n {\n this._renderWithCulling(renderer);\n }\n else\n {\n this._render(renderer);\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n * @param _renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /** The width of the Container, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /** The height of the Container, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n"],"names":["arguments"],"mappings":";;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACH,QAAQ,CAAC,iB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AAI,MAAM,KAAK,CAAC,EAChB;gBACI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;AACjC,aAAA;AAED,iBAAA;AACI,gBAAA,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACpB,aAAA;AAED,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACxB;;;AAhBA,KAAA,CAAA,CAAA;IAiBL,OAAC,SAAA,CAAA;AAAD,CApvBA,CAAwE,aAAa,CAovBpF,EAAA;AAED;;;;;AAKG;AACH,SAAS,CAAC,SAAS,CAAC,wBAAwB,GAAG,SAAS,CAAC,SAAS,CAAC,eAAe;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/display/global.d.ts b/live2d/node_modules/@pixi/display/global.d.ts new file mode 100644 index 0000000..864261a --- /dev/null +++ b/live2d/node_modules/@pixi/display/global.d.ts @@ -0,0 +1,14 @@ +declare namespace GlobalMixins +{ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface DisplayObject + { + + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Container + { + + } +} diff --git a/live2d/node_modules/@pixi/display/index.d.ts b/live2d/node_modules/@pixi/display/index.d.ts new file mode 100644 index 0000000..38d4a10 --- /dev/null +++ b/live2d/node_modules/@pixi/display/index.d.ts @@ -0,0 +1,922 @@ +/// + +import type { Dict } from '@pixi/utils'; +import { EventEmitter } from '@pixi/utils'; +import type { Filter } from '@pixi/core'; +import type { IPointData } from '@pixi/math'; +import type { MaskData } from '@pixi/core'; +import type { Matrix } from '@pixi/math'; +import type { ObservablePoint } from '@pixi/math'; +import type { Point } from '@pixi/math'; +import { Rectangle } from '@pixi/math'; +import type { Renderer } from '@pixi/core'; +import { Transform } from '@pixi/math'; + +/** + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. + * @memberof PIXI + */ +export declare class Bounds { + /** @default Infinity */ + minX: number; + /** @default Infinity */ + minY: number; + /** @default -Infinity */ + maxX: number; + /** @default -Infinity */ + maxY: number; + rect: Rectangle; + /** + * It is updated to _boundsID of corresponding object to keep bounds in sync with content. + * Updated from outside, thus public modifier. + */ + updateID: number; + constructor(); + /** + * Checks if bounds are empty. + * @returns - True if empty. + */ + isEmpty(): boolean; + /** Clears the bounds and resets. */ + clear(): void; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * @param rect - Temporary object will be used if AABB is not empty + * @returns - A rectangle of the bounds + */ + getRectangle(rect?: Rectangle): Rectangle; + /** + * This function should be inlined when its possible. + * @param point - The point to add. + */ + addPoint(point: IPointData): void; + /** + * Adds a point, after transformed. This should be inlined when its possible. + * @param matrix + * @param point + */ + addPointMatrix(matrix: Matrix, point: IPointData): void; + /** + * Adds a quad, not transformed + * @param vertices - The verts to add. + */ + addQuad(vertices: Float32Array): void; + /** + * Adds sprite frame, transformed. + * @param transform - transform to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void; + /** + * Adds sprite frame, multiplied by matrix + * @param matrix - matrix to apply + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + */ + addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void; + /** + * Adds screen vertices from array + * @param vertexData - calculated vertices + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void; + /** + * Add an array of mesh vertices + * @param transform - mesh transform + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + */ + addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void; + /** + * Add an array of mesh vertices. + * @param matrix - mesh matrix + * @param vertices - mesh coordinates in array + * @param beginOffset - begin offset + * @param endOffset - end offset, excluded + * @param padX - x padding + * @param padY - y padding + */ + addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number, endOffset: number, padX?: number, padY?: number): void; + /** + * Adds other {@link Bounds}. + * @param bounds - The Bounds to be added + */ + addBounds(bounds: Bounds): void; + /** + * Adds other Bounds, masked with Bounds. + * @param bounds - The Bounds to be added. + * @param mask - TODO + */ + addBoundsMask(bounds: Bounds, mask: Bounds): void; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * @param bounds - other bounds + * @param matrix - multiplicator + */ + addBoundsMatrix(bounds: Bounds, matrix: Matrix): void; + /** + * Adds other Bounds, masked with Rectangle. + * @param bounds - TODO + * @param area - TODO + */ + addBoundsArea(bounds: Bounds, area: Rectangle): void; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + */ + pad(paddingX?: number, paddingY?: number): void; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * @param x0 - left X of frame + * @param y0 - top Y of frame + * @param x1 - right X of frame + * @param y1 - bottom Y of frame + * @param padX - padding X + * @param padY - padding Y + */ + addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void; +} + +export declare interface Container extends GlobalMixins.Container, DisplayObject { +} + +/** + * Container is a general-purpose display object that holds children. It also adds built-in support for advanced + * rendering features like masking and filtering. + * + * It is the base class of all display objects that act as a container for other objects, including Graphics + * and Sprite. + * + * ```js + * import { BlurFilter } from '@pixi/filter-blur'; + * import { Container } from '@pixi/display'; + * import { Graphics } from '@pixi/graphics'; + * import { Sprite } from '@pixi/sprite'; + * + * let container = new Container(); + * let sprite = Sprite.from("https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png"); + * + * sprite.width = 512; + * sprite.height = 512; + * + * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container + * // is rendered. + * container.addChild(sprite); + * + * // Blurs whatever is rendered by the container + * container.filters = [new BlurFilter()]; + * + * // Only the contents within a circle at the center should be rendered onto the screen. + * container.mask = new Graphics() + * .beginFill(0xffffff) + * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2) + * .endFill(); + * ``` + * @memberof PIXI + */ +export declare class Container extends DisplayObject { + /** + * The array of children of this container. + * @readonly + */ + readonly children: T[]; + /** + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * @see PIXI.settings.SORTABLE_CHILDREN + */ + sortableChildren: boolean; + /** + * Should children be sorted by zIndex at the next updateTransform call. + * + * Will get automatically set to true if a new child is added, or if a child's zIndex changes. + */ + sortDirty: boolean; + parent: Container; + containerUpdateTransform: () => void; + protected _width: number; + protected _height: number; + constructor(); + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified. + * @param _length + */ + protected onChildrenChange(_length?: number): void; + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container + * @returns {PIXI.DisplayObject} - The first child that was added. + */ + addChild(...children: U): U[0]; + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @returns {PIXI.DisplayObject} The child that was added. + */ + addChildAt(child: U, index: number): U; + /** + * Swaps the position of 2 Display Objects within this container. + * @param child - First display object to swap + * @param child2 - Second display object to swap + */ + swapChildren(child: T, child2: T): void; + /** + * Returns the index position of a child DisplayObject instance + * @param child - The DisplayObject instance to identify + * @returns - The index position of the child display object to identify + */ + getChildIndex(child: T): number; + /** + * Changes the position of an existing child in the display object container + * @param child - The child DisplayObject instance for which you want to change the index number + * @param index - The resulting index number for the child display object + */ + setChildIndex(child: T, index: number): void; + /** + * Returns the child at the specified index + * @param index - The index to get the child at + * @returns - The child at the given index, if any. + */ + getChildAt(index: number): T; + /** + * Removes one or more children from the container. + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove + * @returns {PIXI.DisplayObject} The first child that was removed. + */ + removeChild(...children: U): U[0]; + /** + * Removes a child from the specified index position. + * @param index - The index to get the child from + * @returns The child that was removed. + */ + removeChildAt(index: number): T; + /** + * Removes all children from this container that are within the begin and end indexes. + * @param beginIndex - The beginning position. + * @param endIndex - The ending position. Default value is size of the container. + * @returns - List of removed children + */ + removeChildren(beginIndex?: number, endIndex?: number): T[]; + /** Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex. */ + sortChildren(): void; + /** Updates the transform on all children of this container for rendering. */ + updateTransform(): void; + /** + * Recalculates the bounds of the container. + * + * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds + * is limited to its mask's bounds or filterArea, if any is applied. + */ + calculateBounds(): void; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render() + * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @param skipChildrenUpdate - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @returns - The rectangular bounding area. + */ + getLocalBounds(rect?: Rectangle, skipChildrenUpdate?: boolean): Rectangle; + /** + * Recalculates the content bounds of this object. This should be overriden to + * calculate the bounds of this specific object (not including children). + * @protected + */ + protected _calculateBounds(): void; + /** + * Renders this object and its children with culling. + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + protected _renderWithCulling(renderer: Renderer): void; + /** + * Renders the object using the WebGL renderer. + * + * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the + * container itself. This `render` method will invoke it, and also invoke the `render` methods of all + * children afterward. + * + * If `renderable` or `visible` is false or if `worldAlpha` is not positive or if `cullable` is true and + * the bounds of this object are out of frame, this implementation will entirely skip rendering. + * See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally, + * setting alpha to zero is not recommended for purely skipping rendering. + * + * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is + * advised to employ **culling** to automatically skip rendering objects outside of the current screen. + * See [cullable]{@link PIXI.DisplayObject#cullable} and [cullArea]{@link PIXI.DisplayObject#cullArea}. + * Other culling methods might be better suited for a large number static objects; see + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull}. + * + * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or + * filtering is applied on a container. This does, however, break batching and can affect performance when + * masking and filtering is applied extensively throughout the scene graph. + * @param renderer - The renderer + */ + render(renderer: Renderer): void; + /** + * Render the object using the WebGL renderer and advanced features. + * @param renderer - The renderer + */ + protected renderAdvanced(renderer: Renderer): void; + /** + * To be overridden by the subclasses. + * @param _renderer - The renderer + */ + protected _render(_renderer: Renderer): void; + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + destroy(options?: IDestroyOptions | boolean): void; + /** The width of the Container, setting this will actually modify the scale to achieve the value set. */ + get width(): number; + set width(value: number); + /** The height of the Container, setting this will actually modify the scale to achieve the value set. */ + get height(): number; + set height(value: number); +} + +export declare interface DisplayObject extends Omit, EventEmitter { +} + +/** + * The base class for all objects that are rendered on the screen. + * + * This is an abstract class and can not be used on its own; rather it should be extended. + * + * ## Display objects implemented in PixiJS + * + * | Display Object | Description | + * | ------------------------------- | --------------------------------------------------------------------- | + * | {@link PIXI.Container} | Adds support for `children` to DisplayObject | + * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API | + * | {@link PIXI.Sprite} | Draws textures (i.e. images) | + * | {@link PIXI.Text} | Draws text using the Canvas API internally | + * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures | + * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion | + * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images | + * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data | + * | {@link PIXI.NineSlicePlane} | Mesh-related | + * | {@link PIXI.SimpleMesh} | v4-compatible mesh | + * | {@link PIXI.SimplePlane} | Mesh-related | + * | {@link PIXI.SimpleRope} | Mesh-related | + * + * ## Transforms + * + * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its + * local coordinate space to its parent's local coordinate space. The following properties are derived + * from the transform: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot} + * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot + * is equal to position, regardless of the other three transformations. In other words, It is the center of + * rotation, scaling, and skewing. + *
[position]{@link PIXI.DisplayObject#position} + * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local + * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object + * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space. + *
[scale]{@link PIXI.DisplayObject#scale} + * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the + * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center + * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}. + *
[rotation]{@link PIXI.DisplayObject#rotation} + * Rotation. This will rotate the display object's projection by this angle (in radians). + *
[skew]{@link PIXI.DisplayObject#skew} + *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

+ *

+ * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be + * thought of the net rotation applied to the coordinate axes (separately). For example, if "skew.x" is + * ⍺ and "skew.y" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be + * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will + * be rotated by an angle between ⍺ and β. + *

+ *

+ * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying + * a rotation. Indeed, if "skew.x" = -ϴ and "skew.y" = ϴ, it will produce an equivalent of "rotation" = ϴ. + *

+ *

+ * Another quite interesting observation is that "skew.x", "skew.y", rotation are communtative operations. Indeed, + * because rotation is essentially a careful combination of the two. + *

+ *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width + * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing + * the "requested" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there + * is no concept of user-defined width. + *
height + * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing + * the "requested" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there + * is no concept of user-defined height. + *
+ * + * ## Bounds + * + * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit + * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the + * `worldTransform` to calculate in world space). + * + * There are a few additional types of bounding boxes: + * + * | Bounds | Description | + * | --------------------- | ---------------------------------------------------------------------------------------- | + * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. | + * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. | + * | Render Bounds | The bounds, but including extra rendering effects like filter padding. | + * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. | + * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. | + * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)| + * | Content Bounds | The natural bounds when excluding all children of a `Container`. | + * + * ### calculateBounds + * + * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children. + * + * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and + * `getLocalBounds` to work. This method must write the bounds into `this._bounds`. + * + * Generally, the following technique works for most simple cases: take the list of points + * forming the "hull" of the object (i.e. outline of the object's shape), and then add them + * using {@link PIXI.Bounds#addPointMatrix}. + * + * ```js + * calculateBounds(): void + * { + * const points = [...]; + * + * for (let i = 0, j = points.length; i < j; i++) + * { + * this._bounds.addPointMatrix(this.worldTransform, points[i]); + * } + * } + * ``` + * + * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them + * in one array together. + * + * ## Alpha + * + * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display + * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not + * applied on any ancestor further up the chain). + * + * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}. + * + * ## Renderable vs Visible + * + * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the + * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display + * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not + * be calculated. + * + * It is recommended that applications use the `renderable` property for culling. See + * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or + * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details. + * + * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This + * one is also better in terms of performance. + * @memberof PIXI + */ +export declare abstract class DisplayObject extends EventEmitter { + abstract sortDirty: boolean; + /** The display object container that contains this display object. */ + parent: Container; + /** + * The multiplied alpha of the displayObject. + * @readonly + */ + worldAlpha: number; + /** + * World transform and local transform of this object. + * This will become read-only later, please do not assign anything there unless you know what are you doing. + */ + transform: Transform; + /** The opacity of the object. */ + alpha: number; + /** + * The visibility of the object. If false the object will not be drawn, and + * the updateTransform function will not be called. + * + * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually. + */ + visible: boolean; + /** + * Can this object be rendered, if false the object will not be drawn but the updateTransform + * methods will still be called. + * + * Only affects recursive calls from parent. You can ask for bounds manually. + */ + renderable: boolean; + /** + * Should this object be rendered if the bounds of this object are out of frame? + * + * Culling has no effect on whether updateTransform is called. + */ + cullable: boolean; + /** + * If set, this shape is used for culling instead of the bounds of this object. + * It can improve the culling performance of objects with many children. + * The culling area is defined in local space. + */ + cullArea: Rectangle; + /** + * The area the filter is applied to. This is used as more of an optimization + * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle. + * + * Also works as an interaction mask. + */ + filterArea: Rectangle; + /** + * Sets the filters for the displayObject. + * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. + * To remove filters simply set this property to `'null'`. + */ + filters: Filter[] | null; + /** Used to fast check if a sprite is.. a sprite! */ + isSprite: boolean; + /** Does any other displayObject use this object as a mask? */ + isMask: boolean; + /** + * Which index in the children array the display component was before the previous zIndex sort. + * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. + * @protected + */ + _lastSortedIndex: number; + /** + * The original, cached mask of the object. + * @protected + */ + _mask: Container | MaskData; + /** The bounds object, this is used to calculate and store the bounds of the displayObject. */ + _bounds: Bounds; + /** Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. */ + _localBounds: Bounds; + /** + * The zIndex of the displayObject. + * A higher value will mean it will be rendered on top of other displayObjects within the same container. + * @protected + */ + protected _zIndex: number; + /** + * Currently enabled filters. + * @protected + */ + protected _enabledFilters: Filter[]; + /** Flags the cached bounds as dirty. */ + protected _boundsID: number; + /** Cache of this display-object's bounds-rectangle. */ + protected _boundsRect: Rectangle; + /** Cache of this display-object's local-bounds rectangle. */ + protected _localBoundsRect: Rectangle; + /** If the object has been destroyed via destroy(). If true, it should not be used. */ + protected _destroyed: boolean; + /** The number of times this object is used as a mask by another object. */ + private _maskRefCount; + private tempDisplayObjectParent; + displayObjectUpdateTransform: () => void; + /** + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * @param source - The source of properties and methods to mix in. + */ + static mixin(source: Dict): void; + constructor(); + /** + * Fired when this DisplayObject is added to a Container. + * @instance + * @event added + * @param {PIXI.Container} container - The container added to. + */ + /** + * Fired when this DisplayObject is removed from a Container. + * @instance + * @event removed + * @param {PIXI.Container} container - The container removed from. + */ + /** + * Fired when this DisplayObject is destroyed. This event is emitted once + * destroy is finished. + * @instance + * @event destroyed + */ + /** Readonly flag for destroyed display objects. */ + get destroyed(): boolean; + /** Recalculates the bounds of the display object. */ + abstract calculateBounds(): void; + abstract removeChild(child: DisplayObject): void; + /** + * Renders the object using the WebGL renderer. + * @param renderer - The renderer. + */ + abstract render(renderer: Renderer): void; + /** Recursively updates transform of all objects from the root to this one internal function for toLocal() */ + protected _recursivePostUpdateTransform(): void; + /** Updates the object transform for rendering. TODO - Optimization pass! */ + updateTransform(): void; + /** + * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}. + * + * This method is expensive on containers with a large subtree (like the stage). This is because the bounds + * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to + * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update + * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using + * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise, + * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as + * its height increases. + * + * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated. + * The world bounds of all display objects in a container's **subtree** will also be recalculated. + * + * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds + * calculation if needed. + * + * ```js + * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect); + * ``` + * + * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This + * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more + * details. + * + * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms + * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain + * cases. + * @param skipUpdate - Setting to `true` will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The minimum axis-aligned rectangle in world space that fits around this object. + */ + getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * @param rect - Optional rectangle to store the result of the bounds calculation. + * @returns - The rectangular bounding area. + */ + getLocalBounds(rect?: Rectangle): Rectangle; + /** + * Calculates the global position of the display object. + * @param position - The world origin to calculate from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform. + * @returns - A point object representing the position of this object. + */ + toGlobal

(position: IPointData, point?: P, skipUpdate?: boolean): P; + /** + * Calculates the local position of the display object relative to another point. + * @param position - The world origin to calculate from. + * @param from - The DisplayObject to calculate the global position from. + * @param point - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param skipUpdate - Should we skip the update transform + * @returns - A point object representing the position of this object + */ + toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P; + /** + * Set the parent Container of this DisplayObject. + * @param container - The Container to add this DisplayObject to. + * @returns - The Container that this DisplayObject was added to. + */ + setParent(container: Container): Container; + /** + * Convenience function to set the position, scale, skew and pivot at once. + * @param x - The X position + * @param y - The Y position + * @param scaleX - The X scale value + * @param scaleY - The Y scale value + * @param rotation - The rotation + * @param skewX - The X skew value + * @param skewY - The Y skew value + * @param pivotX - The X pivot value + * @param pivotY - The Y pivot value + * @returns - The DisplayObject instance + */ + setTransform(x?: number, y?: number, scaleX?: number, scaleY?: number, rotation?: number, skewX?: number, skewY?: number, pivotX?: number, pivotY?: number): this; + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy()`. + * @param _options + */ + destroy(_options?: IDestroyOptions | boolean): void; + /** + * @protected + * @member {PIXI.Container} + */ + get _tempDisplayObjectParent(): TemporaryDisplayObject; + /** + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root + * + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` + * @returns - current parent + */ + enableTempParent(): Container; + /** + * Pair method for `enableTempParent` + * @param cacheParent - Actual parent of element + */ + disableTempParent(cacheParent: Container): void; + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + */ + get x(): number; + set x(value: number); + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + */ + get y(): number; + set y(value: number); + /** + * Current transform of the object based on world (parent) factors. + * @readonly + */ + get worldTransform(): Matrix; + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * @readonly + */ + get localTransform(): Matrix; + /** + * The coordinate of the object relative to the local coordinates of the parent. + * @since 4.0.0 + */ + get position(): ObservablePoint; + set position(value: IPointData); + /** + * The scale factors of this object along the local coordinate axes. + * + * The default scale is (1, 1). + * @since 4.0.0 + */ + get scale(): ObservablePoint; + set scale(value: IPointData); + /** + * The center of rotation, scaling, and skewing for this display object in its local space. The `position` + * is the projection of `pivot` in the parent's local space. + * + * By default, the pivot is the origin (0, 0). + * @since 4.0.0 + */ + get pivot(): ObservablePoint; + set pivot(value: IPointData); + /** + * The skew factor for the object in radians. + * @since 4.0.0 + */ + get skew(): ObservablePoint; + set skew(value: IPointData); + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get rotation(): number; + set rotation(value: number); + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + */ + get angle(): number; + set angle(value: number); + /** + * The zIndex of the displayObject. + * + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other display objects within the same container. + * @see PIXI.Container#sortableChildren + */ + get zIndex(): number; + set zIndex(value: number); + /** + * Indicates if the object is globally visible. + * @readonly + */ + get worldVisible(): boolean; + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. + * Otherwise, `getLocalBounds` may calculate incorrect bounds, which makes the container's width and height wrong. + * To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + */ + get mask(): Container | MaskData | null; + set mask(value: Container | MaskData | null); +} + +export declare interface IDestroyOptions { + children?: boolean; + texture?: boolean; + baseTexture?: boolean; +} + +/** + * @private + */ +export declare class TemporaryDisplayObject extends DisplayObject { + calculateBounds: () => null; + removeChild: (child: DisplayObject) => null; + render: (renderer: Renderer) => null; + sortDirty: boolean; +} + +export { } diff --git a/live2d/node_modules/@pixi/display/package.json b/live2d/node_modules/@pixi/display/package.json new file mode 100644 index 0000000..2a7ee77 --- /dev/null +++ b/live2d/node_modules/@pixi/display/package.json @@ -0,0 +1,47 @@ +{ + "name": "@pixi/display", + "version": "6.5.10", + "main": "dist/cjs/display.js", + "module": "dist/esm/display.mjs", + "bundle": "dist/browser/display.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/display.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/display.js" + } + } + }, + "description": "Core display functionality", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/extensions/LICENSE b/live2d/node_modules/@pixi/extensions/LICENSE new file mode 100644 index 0000000..c871f16 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2022 Matt Karl + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/README.md b/live2d/node_modules/@pixi/extensions/README.md new file mode 100644 index 0000000..ff52b9d --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/README.md @@ -0,0 +1,15 @@ +# @pixi/extensions + +## Installation + +```bash +npm install @pixi/extensions +``` + +## Usage + +```js +import { extensions } from '@pixi/extensions'; + +extensions.add(MyCustomExtension); +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js new file mode 100644 index 0000000..7c1e020 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js @@ -0,0 +1,415 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_extensions = (function (exports) { + '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 __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + 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 __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + 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 __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __createBinding(o, m, k, k2) { + if (k2 === undefined) { k2 = k; } + o[k2] = m[k]; + } + + function __exportStar(m, exports) { + for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + 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."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __spreadArrays() { + var arguments$1 = arguments; + + for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[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 __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + + function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + } + + function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + } + + /** + * Collection of valid extension types. + * @memberof PIXI + * @property {string} Application - Application plugins + * @property {string} RendererPlugin - Plugins for Renderer + * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer + * @property {string} Loader - Plugins to use with Loader + * @property {string} LoadParser - Parsers for Assets loader. + * @property {string} ResolveParser - Parsers for Assets resolvers. + * @property {string} CacheParser - Parsers for Assets cache. + */ + exports.ExtensionType = void 0; + (function (ExtensionType) { + ExtensionType["Application"] = "application"; + ExtensionType["RendererPlugin"] = "renderer-webgl-plugin"; + ExtensionType["CanvasRendererPlugin"] = "renderer-canvas-plugin"; + ExtensionType["Loader"] = "loader"; + ExtensionType["LoadParser"] = "load-parser"; + ExtensionType["ResolveParser"] = "resolve-parser"; + ExtensionType["CacheParser"] = "cache-parser"; + ExtensionType["DetectionParser"] = "detection-parser"; + })(exports.ExtensionType || (exports.ExtensionType = {})); + /** + * Convert input into extension format data. + * @ignore + */ + var normalizeExtension = function (ext) { + // Class/Object submission, use extension object + if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension)) { + if (!ext.extension) { + throw new Error('Extension class must have an extension object'); + } + var metadata = (typeof ext.extension !== 'object') + ? { type: ext.extension } + : ext.extension; + ext = __assign(__assign({}, metadata), { ref: ext }); + } + if (typeof ext === 'object') { + ext = __assign({}, ext); + } + else { + throw new Error('Invalid extension type'); + } + if (typeof ext.type === 'string') { + ext.type = [ext.type]; + } + return ext; + }; + /** + * Global registration of all PixiJS extensions. One-stop-shop for extensibility. + * @memberof PIXI + * @namespace extensions + */ + var extensions = { + /** @ignore */ + _addHandlers: null, + /** @ignore */ + _removeHandlers: null, + /** @ignore */ + _queue: {}, + /** + * Remove extensions from PixiJS. + * @param extensions - Extensions to be removed. + * @returns {PIXI.extensions} For chaining. + */ + remove: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { var _a, _b; return (_b = (_a = _this._removeHandlers)[type]) === null || _b === void 0 ? void 0 : _b.call(_a, ext); }); + }); + return this; + }, + /** + * Register new extensions with PixiJS. + * @param extensions - The spread of extensions to add to PixiJS. + * @returns {PIXI.extensions} For chaining. + */ + add: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + // Handle any extensions either passed as class w/ data or as data + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { + var handlers = _this._addHandlers; + var queue = _this._queue; + if (!handlers[type]) { + queue[type] = queue[type] || []; + queue[type].push(ext); + } + else { + handlers[type](ext); + } + }); + }); + return this; + }, + /** + * Internal method to handle extensions by name. + * @param type - The extension type. + * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}. + * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}. + * @returns {PIXI.extensions} For chaining. + */ + handle: function (type, onAdd, onRemove) { + var addHandlers = this._addHandlers = this._addHandlers || {}; + var removeHandlers = this._removeHandlers = this._removeHandlers || {}; + if (addHandlers[type] || removeHandlers[type]) { + throw new Error("Extension type " + type + " already has a handler"); + } + addHandlers[type] = onAdd; + removeHandlers[type] = onRemove; + // Process the queue + var queue = this._queue; + // Process any plugins that have been registered before the handler + if (queue[type]) { + queue[type].forEach(function (ext) { return onAdd(ext); }); + delete queue[type]; + } + return this; + }, + /** + * Handle a type, but using a map by `name` property. + * @param type - Type of extension to handle. + * @param map - The object map of named extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByMap: function (type, map) { + return this.handle(type, function (extension) { + map[extension.name] = extension.ref; + }, function (extension) { + delete map[extension.name]; + }); + }, + /** + * Handle a type, but using a list of extensions. + * @param type - Type of extension to handle. + * @param list - The list of extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByList: function (type, list) { + return this.handle(type, function (extension) { + var _a, _b; + if (list.includes(extension.ref)) { + return; + } + list.push(extension.ref); + // TODO: remove me later, only added for @pixi/loaders + if (type === exports.ExtensionType.Loader) { + (_b = (_a = extension.ref).add) === null || _b === void 0 ? void 0 : _b.call(_a); + } + }, function (extension) { + var index = list.indexOf(extension.ref); + if (index !== -1) { + list.splice(index, 1); + } + }); + }, + }; + + exports.extensions = extensions; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +Object.assign(this.PIXI, _pixi_extensions); +//# sourceMappingURL=extensions.js.map diff --git a/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js.map b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js.map new file mode 100644 index 0000000..7450137 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extensions.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["arguments","ExtensionType"],"mappings":";;;;;;;;;;;IAAA;IACA;AACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE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SACL;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/dist/browser/extensions.min.js b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.min.js new file mode 100644 index 0000000..d603e20 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/browser/extensions.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_extensions=function(e){"use strict";var n,r=function(){return r=Object.assign||function(e){for(var n,r=arguments,t=1,i=arguments.length;t= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["ExtensionType","__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","exports","normalizeExtension","ext","extension","metadata","type","ref","Error","extensions","_addHandlers","_removeHandlers","_queue","remove","_this","_i","map","forEach","_a","_b","add","handlers","queue","push","handle","onAdd","onRemove","addHandlers","removeHandlers","handleByMap","name","handleByList","list","includes","Loader","index","indexOf","splice"],"mappings":";;;;;;;sEA6BO,IClBFA,EDkBMC,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,QAASC,cAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,EAAUF,GACOJ,OAAOS,UAAU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G,KAAKW,SAAQ,SAACX,GAEd,IAAMe,EAAWP,EAAKJ,aAChBY,EAAQR,EAAKF,OAEdS,EAASf,GAOVe,EAASf,GAAMH,IALfmB,EAAMhB,GAAQgB,EAAMhB,IAAS,GAC7BgB,EAAMhB,GAAMiB,KAAKpB,UAStBH,MAUXwB,OAAA,SAAOlB,EAAqBmB,EAAyBC,GAEjD,IAAMC,EAAc3B,KAAKU,aAAeV,KAAKU,cAAgB,GACvDkB,EAAiB5B,KAAKW,gBAAkBX,KAAKW,iBAAmB,GAStEgB,EAAYrB,GAAQmB,EACpBG,EAAetB,GAAQoB,EAGvB,IAAMJ,EAAQtB,KAAKY,OASnB,OANIU,EAAMhB,KAENgB,EAAMhB,GAAMW,SAAQ,SAACd,GAAQ,OAAAsB,EAAMtB,aAC5BmB,EAAMhB,IAGVN,MASX6B,YAAA,SAAYvB,EAAqBU,GAE7B,OAAOhB,KAAKwB,OAAOlB,GACf,SAACF,GAEGY,EAAIZ,EAAU0B,MAAQ1B,EAAUG,OAEpC,SAACH,UAEUY,EAAIZ,EAAU0B,UAWjCC,aAAA,SAAazB,EAAqB0B,GAE9B,OAAOhC,KAAKwB,OACRlB,GACA,SAACF,WAEO4B,EAAKC,SAAS7B,EAAUG,OAK5ByB,EAAKT,KAAKnB,EAAUG,KAEhBD,IAASrB,EAAaA,cAACiD,iBAEvBf,KAAAf,EAAUG,KAAIa,iCAGtB,SAAChB,GAEG,IAAM+B,EAAQH,EAAKI,QAAQhC,EAAUG,MAEtB,IAAX4B,GAEAH,EAAKK,OAAOF,EAAO"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js new file mode 100644 index 0000000..4bf9e2a --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js @@ -0,0 +1,211 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/*! ***************************************************************************** +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. +***************************************************************************** */ + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); +}; + +/** + * Collection of valid extension types. + * @memberof PIXI + * @property {string} Application - Application plugins + * @property {string} RendererPlugin - Plugins for Renderer + * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer + * @property {string} Loader - Plugins to use with Loader + * @property {string} LoadParser - Parsers for Assets loader. + * @property {string} ResolveParser - Parsers for Assets resolvers. + * @property {string} CacheParser - Parsers for Assets cache. + */ +exports.ExtensionType = void 0; +(function (ExtensionType) { + ExtensionType["Application"] = "application"; + ExtensionType["RendererPlugin"] = "renderer-webgl-plugin"; + ExtensionType["CanvasRendererPlugin"] = "renderer-canvas-plugin"; + ExtensionType["Loader"] = "loader"; + ExtensionType["LoadParser"] = "load-parser"; + ExtensionType["ResolveParser"] = "resolve-parser"; + ExtensionType["CacheParser"] = "cache-parser"; + ExtensionType["DetectionParser"] = "detection-parser"; +})(exports.ExtensionType || (exports.ExtensionType = {})); +/** + * Convert input into extension format data. + * @ignore + */ +var normalizeExtension = function (ext) { + // Class/Object submission, use extension object + if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension)) { + if (!ext.extension) { + throw new Error('Extension class must have an extension object'); + } + var metadata = (typeof ext.extension !== 'object') + ? { type: ext.extension } + : ext.extension; + ext = __assign(__assign({}, metadata), { ref: ext }); + } + if (typeof ext === 'object') { + ext = __assign({}, ext); + } + else { + throw new Error('Invalid extension type'); + } + if (typeof ext.type === 'string') { + ext.type = [ext.type]; + } + return ext; +}; +/** + * Global registration of all PixiJS extensions. One-stop-shop for extensibility. + * @memberof PIXI + * @namespace extensions + */ +var extensions = { + /** @ignore */ + _addHandlers: null, + /** @ignore */ + _removeHandlers: null, + /** @ignore */ + _queue: {}, + /** + * Remove extensions from PixiJS. + * @param extensions - Extensions to be removed. + * @returns {PIXI.extensions} For chaining. + */ + remove: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { var _a, _b; return (_b = (_a = _this._removeHandlers)[type]) === null || _b === void 0 ? void 0 : _b.call(_a, ext); }); + }); + return this; + }, + /** + * Register new extensions with PixiJS. + * @param extensions - The spread of extensions to add to PixiJS. + * @returns {PIXI.extensions} For chaining. + */ + add: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + // Handle any extensions either passed as class w/ data or as data + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { + var handlers = _this._addHandlers; + var queue = _this._queue; + if (!handlers[type]) { + queue[type] = queue[type] || []; + queue[type].push(ext); + } + else { + handlers[type](ext); + } + }); + }); + return this; + }, + /** + * Internal method to handle extensions by name. + * @param type - The extension type. + * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}. + * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}. + * @returns {PIXI.extensions} For chaining. + */ + handle: function (type, onAdd, onRemove) { + var addHandlers = this._addHandlers = this._addHandlers || {}; + var removeHandlers = this._removeHandlers = this._removeHandlers || {}; + if (addHandlers[type] || removeHandlers[type]) { + throw new Error("Extension type " + type + " already has a handler"); + } + addHandlers[type] = onAdd; + removeHandlers[type] = onRemove; + // Process the queue + var queue = this._queue; + // Process any plugins that have been registered before the handler + if (queue[type]) { + queue[type].forEach(function (ext) { return onAdd(ext); }); + delete queue[type]; + } + return this; + }, + /** + * Handle a type, but using a map by `name` property. + * @param type - Type of extension to handle. + * @param map - The object map of named extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByMap: function (type, map) { + return this.handle(type, function (extension) { + map[extension.name] = extension.ref; + }, function (extension) { + delete map[extension.name]; + }); + }, + /** + * Handle a type, but using a list of extensions. + * @param type - Type of extension to handle. + * @param list - The list of extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByList: function (type, list) { + return this.handle(type, function (extension) { + var _a, _b; + if (list.includes(extension.ref)) { + return; + } + list.push(extension.ref); + // TODO: remove me later, only added for @pixi/loaders + if (type === exports.ExtensionType.Loader) { + (_b = (_a = extension.ref).add) === null || _b === void 0 ? void 0 : _b.call(_a); + } + }, function (extension) { + var index = list.indexOf(extension.ref); + if (index !== -1) { + list.splice(index, 1); + } + }); + }, +}; + +exports.extensions = extensions; +//# sourceMappingURL=extensions.js.map diff --git a/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js.map b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js.map new file mode 100644 index 0000000..eb58a9c --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extensions.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["arguments","ExtensionType"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;;AAAC;AACtD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAGA,WAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAA,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC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M,CACd,IAAI,EACJ,UAAC,SAAS,EAAA;;YAEN,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,EAChC;gBACI,OAAO;AACV,aAAA;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;;AAEzB,YAAA,IAAI,IAAI,KAAKC,qBAAa,CAAC,MAAM,EACjC;AACI,gBAAA,CAAA,EAAA,GAAA,MAAA,SAAS,CAAC,GAAG,EAAC,GAAG,kDAAI,CAAC;AACzB,aAAA;SACJ,EACD,UAAC,SAAS,EAAA;YAEN,IAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAE1C,YAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAChB;AACI,gBAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,aAAA;AACL,SAAC,CACJ,CAAC;KACL;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.min.js b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.min.js new file mode 100644 index 0000000..e949ec3 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/cjs/extensions.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=function(){return n=Object.assign||function(e){for(var n,r=arguments,t=1,o=arguments.length;t= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["ExtensionType","__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","normalizeExtension","ext","extension","metadata","type","ref","Error","extensions","_addHandlers","_removeHandlers","_queue","remove","_this","_i","map","forEach","_a","_b","add","handlers","queue","push","handle","onAdd","onRemove","addHandlers","removeHandlers","handleByMap","name","handleByList","list","includes","Loader","index","indexOf","splice"],"mappings":";;;;;;;oEA6BO,IClBFA,EDkBMC,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,QAASC,cAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,EAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,GAEJH,EAASa,MAAMC,KAAMP,YC1B3BR,QAWJA,mBAAA,GAXIA,EAAAA,wBAAAA,QAAAA,cAWJ,KARG,YAAA,cACAA,EAAA,eAAA,wBACAA,EAAA,qBAAA,yBACAA,EAAA,OAAA,SACAA,EAAA,WAAA,cACAA,EAAA,cAAA,iBACAA,EAAA,YAAA,eACAA,EAAA,gBAAA,mBA2CJ,IAAMgB,EAAqB,SAACC,GAGxB,GAAmB,mBAARA,GAAsC,iBAARA,GAAoBA,EAAIC,UACjE,CAOI,IAAMC,EAA+D,iBAAlBF,EAAIC,UACjD,CAAEE,KAAMH,EAAIC,WACZD,EAAIC,UAEVD,SAAWE,GAAQ,CAAEE,IAAKJ,IAE9B,GAAmB,iBAARA,EAMP,MAAM,IAAIK,MAAM,0BAQpB,MALwB,iBAPpBL,EAAGhB,EAAA,GAAQgB,IAOAG,OAEXH,EAAIG,KAAO,CAACH,EAAIG,OAGbH,GAQL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AAIZ,EAAU0B,UAWjCC,aAAA,SAAazB,EAAqB0B,GAE9B,OAAO/B,KAAKuB,OACRlB,GACA,SAACF,WAEO4B,EAAKC,SAAS7B,EAAUG,OAK5ByB,EAAKT,KAAKnB,EAAUG,KAEhBD,IAASpB,QAAaA,cAACgD,iBAEvBf,KAAAf,EAAUG,KAAIa,iCAGtB,SAAChB,GAEG,IAAM+B,EAAQH,EAAKI,QAAQhC,EAAUG,MAEtB,IAAX4B,GAEAH,EAAKK,OAAOF,EAAO"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/dist/esm/extensions.min.mjs b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.min.mjs new file mode 100644 index 0000000..d2cf7e1 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var e,n=function(){return n=Object.assign||function(e){for(var n,r=arguments,t=1,a=arguments.length;t= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["ExtensionType","__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","normalizeExtension","ext","extension","metadata","type","ref","Error","extensions","_addHandlers","_removeHandlers","_queue","remove","_this","_i","map","forEach","_a","_b","add","handlers","queue","push","handle","onAdd","onRemove","addHandlers","removeHandl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/node_modules/@pixi/extensions/dist/esm/extensions.mjs b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.mjs new file mode 100644 index 0000000..8c5a5be --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.mjs @@ -0,0 +1,207 @@ +/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); +}; + +/** + * Collection of valid extension types. + * @memberof PIXI + * @property {string} Application - Application plugins + * @property {string} RendererPlugin - Plugins for Renderer + * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer + * @property {string} Loader - Plugins to use with Loader + * @property {string} LoadParser - Parsers for Assets loader. + * @property {string} ResolveParser - Parsers for Assets resolvers. + * @property {string} CacheParser - Parsers for Assets cache. + */ +var ExtensionType; +(function (ExtensionType) { + ExtensionType["Application"] = "application"; + ExtensionType["RendererPlugin"] = "renderer-webgl-plugin"; + ExtensionType["CanvasRendererPlugin"] = "renderer-canvas-plugin"; + ExtensionType["Loader"] = "loader"; + ExtensionType["LoadParser"] = "load-parser"; + ExtensionType["ResolveParser"] = "resolve-parser"; + ExtensionType["CacheParser"] = "cache-parser"; + ExtensionType["DetectionParser"] = "detection-parser"; +})(ExtensionType || (ExtensionType = {})); +/** + * Convert input into extension format data. + * @ignore + */ +var normalizeExtension = function (ext) { + // Class/Object submission, use extension object + if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension)) { + if (!ext.extension) { + throw new Error('Extension class must have an extension object'); + } + var metadata = (typeof ext.extension !== 'object') + ? { type: ext.extension } + : ext.extension; + ext = __assign(__assign({}, metadata), { ref: ext }); + } + if (typeof ext === 'object') { + ext = __assign({}, ext); + } + else { + throw new Error('Invalid extension type'); + } + if (typeof ext.type === 'string') { + ext.type = [ext.type]; + } + return ext; +}; +/** + * Global registration of all PixiJS extensions. One-stop-shop for extensibility. + * @memberof PIXI + * @namespace extensions + */ +var extensions = { + /** @ignore */ + _addHandlers: null, + /** @ignore */ + _removeHandlers: null, + /** @ignore */ + _queue: {}, + /** + * Remove extensions from PixiJS. + * @param extensions - Extensions to be removed. + * @returns {PIXI.extensions} For chaining. + */ + remove: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { var _a, _b; return (_b = (_a = _this._removeHandlers)[type]) === null || _b === void 0 ? void 0 : _b.call(_a, ext); }); + }); + return this; + }, + /** + * Register new extensions with PixiJS. + * @param extensions - The spread of extensions to add to PixiJS. + * @returns {PIXI.extensions} For chaining. + */ + add: function () { + var arguments$1 = arguments; + + var _this = this; + var extensions = []; + for (var _i = 0; _i < arguments.length; _i++) { + extensions[_i] = arguments$1[_i]; + } + // Handle any extensions either passed as class w/ data or as data + extensions.map(normalizeExtension).forEach(function (ext) { + ext.type.forEach(function (type) { + var handlers = _this._addHandlers; + var queue = _this._queue; + if (!handlers[type]) { + queue[type] = queue[type] || []; + queue[type].push(ext); + } + else { + handlers[type](ext); + } + }); + }); + return this; + }, + /** + * Internal method to handle extensions by name. + * @param type - The extension type. + * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}. + * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}. + * @returns {PIXI.extensions} For chaining. + */ + handle: function (type, onAdd, onRemove) { + var addHandlers = this._addHandlers = this._addHandlers || {}; + var removeHandlers = this._removeHandlers = this._removeHandlers || {}; + if (addHandlers[type] || removeHandlers[type]) { + throw new Error("Extension type " + type + " already has a handler"); + } + addHandlers[type] = onAdd; + removeHandlers[type] = onRemove; + // Process the queue + var queue = this._queue; + // Process any plugins that have been registered before the handler + if (queue[type]) { + queue[type].forEach(function (ext) { return onAdd(ext); }); + delete queue[type]; + } + return this; + }, + /** + * Handle a type, but using a map by `name` property. + * @param type - Type of extension to handle. + * @param map - The object map of named extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByMap: function (type, map) { + return this.handle(type, function (extension) { + map[extension.name] = extension.ref; + }, function (extension) { + delete map[extension.name]; + }); + }, + /** + * Handle a type, but using a list of extensions. + * @param type - Type of extension to handle. + * @param list - The list of extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByList: function (type, list) { + return this.handle(type, function (extension) { + var _a, _b; + if (list.includes(extension.ref)) { + return; + } + list.push(extension.ref); + // TODO: remove me later, only added for @pixi/loaders + if (type === ExtensionType.Loader) { + (_b = (_a = extension.ref).add) === null || _b === void 0 ? void 0 : _b.call(_a); + } + }, function (extension) { + var index = list.indexOf(extension.ref); + if (index !== -1) { + list.splice(index, 1); + } + }); + }, +}; + +export { ExtensionType, extensions }; +//# sourceMappingURL=extensions.mjs.map diff --git a/live2d/node_modules/@pixi/extensions/dist/esm/extensions.mjs.map b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.mjs.map new file mode 100644 index 0000000..63e052e --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/dist/esm/extensions.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"extensions.mjs","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Collection of valid extension types.\n * @memberof PIXI\n * @property {string} Application - Application plugins\n * @property {string} RendererPlugin - Plugins for Renderer\n * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer\n * @property {string} Loader - Plugins to use with Loader\n * @property {string} LoadParser - Parsers for Assets loader.\n * @property {string} ResolveParser - Parsers for Assets resolvers.\n * @property {string} CacheParser - Parsers for Assets cache.\n */\nenum ExtensionType\n// eslint-disable-next-line @typescript-eslint/indent\n{\n Application = 'application',\n RendererPlugin = 'renderer-webgl-plugin',\n CanvasRendererPlugin = 'renderer-canvas-plugin',\n Loader = 'loader',\n LoadParser = 'load-parser',\n ResolveParser = 'resolve-parser',\n CacheParser = 'cache-parser',\n DetectionParser = 'detection-parser',\n}\n\ninterface ExtensionMetadataDetails\n{\n type: ExtensionType | ExtensionType[];\n name?: string;\n}\n\ntype ExtensionMetadata = ExtensionType | ExtensionMetadataDetails;\n\n/**\n * Format when registering an extension. Generally, the extension\n * should have these values as `extension` static property,\n * but you can override name or type by providing an object.\n * @memberof PIXI\n */\ninterface ExtensionFormatLoose\n{\n /** The extension type, can be multiple types */\n type: ExtensionType | ExtensionType[];\n /** Optional. Some plugins provide an API name/property, such as Renderer plugins */\n name?: string;\n /** Reference to the plugin object/class */\n ref: any;\n}\n\n/**\n * Strict extension format that is used internally for registrations.\n * @memberof PIXI\n */\ninterface ExtensionFormat extends ExtensionFormatLoose\n{\n /** The extension type, always expressed as multiple, even if a single */\n type: ExtensionType[];\n}\n\ntype ExtensionHandler = (extension: ExtensionFormat) => void;\n\n/**\n * Convert input into extension format data.\n * @ignore\n */\nconst normalizeExtension = (ext: ExtensionFormatLoose | any): ExtensionFormat =>\n{\n // Class/Object submission, use extension object\n if (typeof ext === 'function' || (typeof ext === 'object' && ext.extension))\n {\n // #if _DEBUG\n if (!ext.extension)\n {\n throw new Error('Extension class must have an extension object');\n }\n // #endif\n const metadata: ExtensionMetadataDetails = (typeof ext.extension !== 'object')\n ? { type: ext.extension }\n : ext.extension;\n\n ext = { ...metadata, ref: ext };\n }\n if (typeof ext === 'object')\n {\n ext = { ...ext };\n }\n else\n {\n throw new Error('Invalid extension type');\n }\n\n if (typeof ext.type === 'string')\n {\n ext.type = [ext.type];\n }\n\n return ext;\n};\n\n/**\n * Global registration of all PixiJS extensions. One-stop-shop for extensibility.\n * @memberof PIXI\n * @namespace extensions\n */\nconst extensions = {\n\n /** @ignore */\n _addHandlers: null as Record,\n\n /** @ignore */\n _removeHandlers: null as Record,\n\n /** @ignore */\n _queue: {} as Record,\n\n /**\n * Remove extensions from PixiJS.\n * @param extensions - Extensions to be removed.\n * @returns {PIXI.extensions} For chaining.\n */\n remove(...extensions: Array)\n {\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) => this._removeHandlers[type]?.(ext));\n });\n\n return this;\n },\n\n /**\n * Register new extensions with PixiJS.\n * @param extensions - The spread of extensions to add to PixiJS.\n * @returns {PIXI.extensions} For chaining.\n */\n add(...extensions: Array)\n {\n // Handle any extensions either passed as class w/ data or as data\n extensions.map(normalizeExtension).forEach((ext) =>\n {\n ext.type.forEach((type) =>\n {\n const handlers = this._addHandlers;\n const queue = this._queue;\n\n if (!handlers[type])\n {\n queue[type] = queue[type] || [];\n queue[type].push(ext);\n }\n else\n {\n handlers[type](ext);\n }\n });\n });\n\n return this;\n },\n\n /**\n * Internal method to handle extensions by name.\n * @param type - The extension type.\n * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}.\n * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}.\n * @returns {PIXI.extensions} For chaining.\n */\n handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler)\n {\n const addHandlers = this._addHandlers = this._addHandlers || {} as Record;\n const removeHandlers = this._removeHandlers = this._removeHandlers || {} as Record;\n\n // #if _DEBUG\n if (addHandlers[type] || removeHandlers[type])\n {\n throw new Error(`Extension type ${type} already has a handler`);\n }\n // #endif\n\n addHandlers[type] = onAdd;\n removeHandlers[type] = onRemove;\n\n // Process the queue\n const queue = this._queue;\n\n // Process any plugins that have been registered before the handler\n if (queue[type])\n {\n queue[type].forEach((ext) => onAdd(ext));\n delete queue[type];\n }\n\n return this;\n },\n\n /**\n * Handle a type, but using a map by `name` property.\n * @param type - Type of extension to handle.\n * @param map - The object map of named extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByMap(type: ExtensionType, map: Record)\n {\n return this.handle(type,\n (extension) =>\n {\n map[extension.name] = extension.ref;\n },\n (extension) =>\n {\n delete map[extension.name];\n }\n );\n },\n\n /**\n * Handle a type, but using a list of extensions.\n * @param type - Type of extension to handle.\n * @param list - The list of extensions.\n * @returns {PIXI.extensions} For chaining.\n */\n handleByList(type: ExtensionType, list: any[])\n {\n return this.handle(\n type,\n (extension) =>\n {\n if (list.includes(extension.ref))\n {\n return;\n }\n\n list.push(extension.ref);\n // TODO: remove me later, only added for @pixi/loaders\n if (type === ExtensionType.Loader)\n {\n extension.ref.add?.();\n }\n },\n (extension) =>\n {\n const index = list.indexOf(extension.ref);\n\n if (index !== -1)\n {\n list.splice(index, 1);\n }\n }\n );\n },\n};\n\nexport {\n extensions,\n ExtensionType,\n};\nexport type {\n ExtensionHandler,\n ExtensionMetadata,\n ExtensionFormatLoose,\n ExtensionFormat,\n};\n"],"names":["arguments"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;;AAAC;AACtD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAA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GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/B,SAAC,CACJ,CAAC;KACL;AAED;;;;;AAKG;AACH,IAAA,YAAY,EAAZ,UAAa,IAAmB,EAAE,IAAW,EAAA;AAEzC,QAAA,OAAO,IAAI,CAAC,MAAM,CACd,IAAI,EACJ,UAAC,SAAS,EAAA;;YAEN,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,EAChC;gBACI,OAAO;AACV,aAAA;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;;AAEzB,YAAA,IAAI,IAAI,KAAK,aAAa,CAAC,MAAM,EACjC;AACI,gBAAA,CAAA,EAAA,GAAA,MAAA,SAAS,CAAC,GAAG,EAAC,GAAG,kDAAI,CAAC;AACzB,aAAA;SACJ,EACD,UAAC,SAAS,EAAA;YAEN,IAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAE1C,YAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAChB;AACI,gBAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,aAAA;AACL,SAAC,CACJ,CAAC;KACL;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/extensions/index.d.ts b/live2d/node_modules/@pixi/extensions/index.d.ts new file mode 100644 index 0000000..b795990 --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/index.d.ts @@ -0,0 +1,104 @@ +/** + * Strict extension format that is used internally for registrations. + * @memberof PIXI + */ +export declare interface ExtensionFormat extends ExtensionFormatLoose { + /** The extension type, always expressed as multiple, even if a single */ + type: ExtensionType[]; +} + +/** + * Format when registering an extension. Generally, the extension + * should have these values as `extension` static property, + * but you can override name or type by providing an object. + * @memberof PIXI + */ +export declare interface ExtensionFormatLoose { + /** The extension type, can be multiple types */ + type: ExtensionType | ExtensionType[]; + /** Optional. Some plugins provide an API name/property, such as Renderer plugins */ + name?: string; + /** Reference to the plugin object/class */ + ref: any; +} + +export declare type ExtensionHandler = (extension: ExtensionFormat) => void; + +export declare type ExtensionMetadata = ExtensionType | ExtensionMetadataDetails; + +declare interface ExtensionMetadataDetails { + type: ExtensionType | ExtensionType[]; + name?: string; +} + +/** + * Global registration of all PixiJS extensions. One-stop-shop for extensibility. + * @memberof PIXI + * @namespace extensions + */ +export declare const extensions: { + /** @ignore */ + _addHandlers: Record; + /** @ignore */ + _removeHandlers: Record; + /** @ignore */ + _queue: Record; + /** + * Remove extensions from PixiJS. + * @param extensions - Extensions to be removed. + * @returns {PIXI.extensions} For chaining. + */ + remove(...extensions: Array): any; + /** + * Register new extensions with PixiJS. + * @param extensions - The spread of extensions to add to PixiJS. + * @returns {PIXI.extensions} For chaining. + */ + add(...extensions: Array): any; + /** + * Internal method to handle extensions by name. + * @param type - The extension type. + * @param onAdd - Function for handling when extensions are added/registered passes {@link PIXI.ExtensionFormat}. + * @param onRemove - Function for handling when extensions are removed/unregistered passes {@link PIXI.ExtensionFormat}. + * @returns {PIXI.extensions} For chaining. + */ + handle(type: ExtensionType, onAdd: ExtensionHandler, onRemove: ExtensionHandler): any; + /** + * Handle a type, but using a map by `name` property. + * @param type - Type of extension to handle. + * @param map - The object map of named extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByMap(type: ExtensionType, map: Record): any; + /** + * Handle a type, but using a list of extensions. + * @param type - Type of extension to handle. + * @param list - The list of extensions. + * @returns {PIXI.extensions} For chaining. + */ + handleByList(type: ExtensionType, list: any[]): any; +}; + +/** + * Collection of valid extension types. + * @memberof PIXI + * @property {string} Application - Application plugins + * @property {string} RendererPlugin - Plugins for Renderer + * @property {string} CanvasRendererPlugin - Plugins for CanvasRenderer + * @property {string} Loader - Plugins to use with Loader + * @property {string} LoadParser - Parsers for Assets loader. + * @property {string} ResolveParser - Parsers for Assets resolvers. + * @property {string} CacheParser - Parsers for Assets cache. + */ +export declare enum ExtensionType { + Application = "application", + RendererPlugin = "renderer-webgl-plugin", + CanvasRendererPlugin = "renderer-canvas-plugin", + Loader = "loader", + LoadParser = "load-parser", + ResolveParser = "resolve-parser", + CacheParser = "cache-parser", + DetectionParser = "detection-parser" +} + +export { } diff --git a/live2d/node_modules/@pixi/extensions/package.json b/live2d/node_modules/@pixi/extensions/package.json new file mode 100644 index 0000000..0185d1b --- /dev/null +++ b/live2d/node_modules/@pixi/extensions/package.json @@ -0,0 +1,38 @@ +{ + "name": "@pixi/extensions", + "version": "6.5.10", + "main": "dist/cjs/extensions.js", + "module": "dist/esm/extensions.mjs", + "bundle": "dist/browser/extensions.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/extensions.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/extensions.js" + } + } + }, + "description": "Installing and uninstalling extensions for PixiJS", + "author": "Matt Karl ", + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/loaders/LICENSE b/live2d/node_modules/@pixi/loaders/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/README.md b/live2d/node_modules/@pixi/loaders/README.md new file mode 100644 index 0000000..7c11ef6 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/README.md @@ -0,0 +1,33 @@ +# @pixi/loaders + +## Installation + +```bash +npm install @pixi/loaders +``` + +## Usage + +Using the loader directly: + +```js +import { Loader } from '@pixi/loaders'; + +const loader = new Loader(); +loader.add('path/to/file.jpg'); +loader.load(() => {}); +``` + +Using the loader as an Application plugin: + +```js +import { AppLoaderPlugin } from '@pixi/loaders'; +import { Application } from '@pixi/app'; +import { extensions } from '@pixi/core'; + +extensions.add(AppLoaderPlugin); + +const app = new Application(); +app.loader.add('path/to/file.jpg'); +app.loader.load(() => {}); +``` diff --git a/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js new file mode 100644 index 0000000..fc5acf3 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js @@ -0,0 +1,2008 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_loaders = (function (exports, core, utils) { + 'use strict'; + + /* jshint -W097 */ + /** + * @memberof PIXI + */ + var SignalBinding = /** @class */ (function () { + /** + * SignalBinding constructor. + * @constructs SignalBinding + * @param {Function} fn - Event handler to be called. + * @param {boolean} [once=false] - Should this listener be removed after dispatch + * @param {object} [thisArg] - The context of the callback function. + * @api private + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function SignalBinding(fn, once, thisArg) { + if (once === void 0) { once = false; } + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + SignalBinding.prototype.detach = function () { + if (this._owner === null) + { return false; } + this._owner.detach(this); + return true; + }; + return SignalBinding; + }()); + /** + * @param self + * @param node + * @private + */ + function _addSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } + else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + node._owner = self; + return node; + } + /** + * @memberof PIXI + */ + var Signal = /** @class */ (function () { + /** + * MiniSignal constructor. + * @example + * let mySignal = new Signal(); + * let binding = mySignal.add(onSignal); + * mySignal.dispatch('foo', 'bar'); + * mySignal.detach(binding); + */ + function Signal() { + this._head = this._tail = undefined; + } + /** + * Return an array of attached SignalBinding. + * @param {boolean} [exists=false] - We only need to know if there are handlers. + * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true + * @api public + */ + Signal.prototype.handlers = function (exists) { + if (exists === void 0) { exists = false; } + var node = this._head; + if (exists) + { return !!node; } + var ee = []; + while (node) { + ee.push(node); + node = node._next; + } + return ee; + }; + /** + * Return true if node is a SignalBinding attached to this MiniSignal + * @param {PIXI.SignalBinding} node - Node to check. + * @returns {boolean} True if node is attache to mini-signal + */ + Signal.prototype.has = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.'); + } + return node._owner === this; + }; + /** + * Dispaches a signal to all registered listeners. + * @param {...any} args + * @returns {boolean} Indication if we've emitted an event. + */ + Signal.prototype.dispatch = function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + var node = this._head; + if (!node) + { return false; } + while (node) { + if (node._once) + { this.detach(node); } + node._fn.apply(node._thisArg, args); + node = node._next; + } + return true; + }; + /** + * Register a new listener. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.add = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, false, thisArg)); + }; + /** + * Register a new listener that will be executed only once. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.once = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, true, thisArg)); + }; + /** + * Remove binding object. + * @param {PIXI.SignalBinding} node - The binding node that will be removed. + * @returns {Signal} The instance on which this method was called. + @api public */ + Signal.prototype.detach = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.'); + } + if (node._owner !== this) + { return this; } // todo: or error? + if (node._prev) + { node._prev._next = node._next; } + if (node._next) + { node._next._prev = node._prev; } + if (node === this._head) { // first node + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } + else if (node === this._tail) { // last node + this._tail = node._prev; + this._tail._next = null; + } + node._owner = null; + return this; + }; + /** + * Detach all listeners. + * @returns {Signal} The instance on which this method was called. + */ + Signal.prototype.detachAll = function () { + var node = this._head; + if (!node) + { return this; } + this._head = this._tail = null; + while (node) { + node._owner = null; + node = node._next; + } + return this; + }; + return Signal; + }()); + + /** + * function from npm package `parseUri`, converted to TS to avoid leftpad incident + * @param {string} str + * @param [opts] - options + * @param {boolean} [opts.strictMode] - type of parser + */ + function parseUri(str, opts) { + opts = opts || {}; + var o = { + // eslint-disable-next-line max-len + key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + // eslint-disable-next-line max-len + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + // eslint-disable-next-line max-len + 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 (_t0, t1, t2) { + if (t1) + { uri[o.q.name][t1] = t2; } + }); + return uri; + } + + // tests if CORS is supported in XHR, if not we need to use XDR + var useXdr; + var tempAnchor = null; + // some status constants + var STATUS_NONE = 0; + var STATUS_OK = 200; + var STATUS_EMPTY = 204; + var STATUS_IE_BUG_EMPTY = 1223; + var STATUS_TYPE_OK = 2; + // noop + function _noop$1() { } + /** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * @ignore + * @param map - The map to set on. + * @param extname - The extension (or key) to set. + * @param val - The value to set. + */ + function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + if (!extname) { + return; + } + map[extname] = val; + } + /** + * Quick helper to get string xhr type. + * @ignore + * @param xhr - The request to check. + * @returns The type. + */ + function reqType(xhr) { + return xhr.toString().replace('object ', ''); + } + /** + * Manages the state and loading of a resource and all child resources. + * + * Can be extended in `GlobalMixins.LoaderResource`. + * @memberof PIXI + */ + exports.LoaderResource = /** @class */ (function () { + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware + * and the Resource object. + */ + function LoaderResource(name, url, options) { + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * @private + * @member {Function} + */ + this._dequeue = _noop$1; + /** + * Used a storage place for the on load binding used privately by the loader. + * @private + * @member {Function} + */ + this._onLoadBinding = null; + /** + * The timer for element loads to check if they timeout. + * @private + */ + this._elementTimer = 0; + /** + * The `complete` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundComplete = null; + /** + * The `_onError` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnError = null; + /** + * The `_onProgress` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnProgress = null; + /** + * The `_onTimeout` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnTimeout = null; + this._boundXhrOnError = null; + this._boundXhrOnTimeout = null; + this._boundXhrOnAbort = null; + this._boundXhrOnLoad = null; + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + options = options || {}; + this._flags = 0; + // set data url flag, needs to be set early for some _determineX checks to work. + this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + this.name = name; + this.url = url; + this.extension = this._getExtension(); + this.data = null; + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + this.timeout = options.timeout || 0; + this.loadType = options.loadType || this._determineLoadType(); + // The type used to load the resource via XHR. If unset, determined automatically. + this.xhrType = options.xhrType; + // Extra info for middleware, and controlling specifics about how the resource loads. + // Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + // Meaning it will modify it as it sees fit. + this.metadata = options.metadata || {}; + // The error that occurred while loading (if any). + this.error = null; + // The XHR object that was used to load this resource. This is only set + // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`. + this.xhr = null; + // The child resources this resource owns. + this.children = []; + // The resource type. + this.type = LoaderResource.TYPE.UNKNOWN; + // The progress chunk owned by this resource. + this.progressChunk = 0; + // The `dequeue` method that will be used a storage place for the async queue dequeue method + // used privately by the loader. + this._dequeue = _noop$1; + // Used a storage place for the on load binding used privately by the loader. + this._onLoadBinding = null; + // The timer for element loads to check if they timeout. + this._elementTimer = 0; + this._boundComplete = this.complete.bind(this); + this._boundOnError = this._onError.bind(this); + this._boundOnProgress = this._onProgress.bind(this); + this._boundOnTimeout = this._onTimeout.bind(this); + // xhr callbacks + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + // Dispatched when the resource beings to load. + this.onStart = new Signal(); + // Dispatched each time progress of this resource load updates. + // Not all resources types and loader systems can support this event + // so sometimes it may not be available. If the resource + // is being loaded on a modern browser, using XHR, and the remote server + // properly sets Content-Length headers, then this will be available. + this.onProgress = new Signal(); + // Dispatched once this resource has loaded, if there was an error it will + // be in the `error` property. + this.onComplete = new Signal(); + // Dispatched after this resource has had all the *after* middleware run on it. + this.onAfterMiddleware = new Signal(); + } + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to. + */ + LoaderResource.setExtensionLoadType = function (extname, loadType) { + setExtMap(LoaderResource._loadTypeMap, extname, loadType); + }; + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + LoaderResource.setExtensionXhrType = function (extname, xhrType) { + setExtMap(LoaderResource._xhrTypeMap, extname, xhrType); + }; + Object.defineProperty(LoaderResource.prototype, "isDataUrl", { + /** + * When the resource starts to load. + * @memberof PIXI.LoaderResource + * @callback OnStartSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * When the resource reports loading progress. + * @memberof PIXI.LoaderResource + * @callback OnProgressSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + /** + * When the resource finishes loading. + * @memberof PIXI.LoaderResource + * @callback OnCompleteSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * @memberof PIXI.LoaderResource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + /** + * Stores whether or not this url is a data url. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isComplete", { + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isLoading", { + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING); + }, + enumerable: false, + configurable: true + }); + /** Marks the resource as complete. */ + LoaderResource.prototype.complete = function () { + this._clearEvents(); + this._finish(); + }; + /** + * Aborts the loading of this resource, with an optional message. + * @param {string} message - The message to use for the error + */ + LoaderResource.prototype.abort = function (message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } + // store error + this.error = new Error(message); + // clear events before calling aborts + this._clearEvents(); + // abort the actual loading + if (this.xhr) { + this.xhr.abort(); + } + else if (this.xdr) { + this.xdr.abort(); + } + else if (this.data) { + // single source + if (this.data.src) { + this.data.src = LoaderResource.EMPTY_GIF; + } + // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } + // done now. + this._finish(); + }; + /** + * Kicks off loading of this resource. This method is asynchronous. + * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + LoaderResource.prototype.load = function (cb) { + var _this = this; + if (this.isLoading) { + return; + } + if (this.isComplete) { + if (cb) { + setTimeout(function () { return cb(_this); }, 1); + } + return; + } + else if (cb) { + this.onComplete.once(cb); + } + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true); + this.onStart.dispatch(this); + // if unset, determine the value + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + switch (this.loadType) { + case LoaderResource.LOAD_TYPE.IMAGE: + this.type = LoaderResource.TYPE.IMAGE; + this._loadElement('image'); + break; + case LoaderResource.LOAD_TYPE.AUDIO: + this.type = LoaderResource.TYPE.AUDIO; + this._loadSourceElement('audio'); + break; + case LoaderResource.LOAD_TYPE.VIDEO: + this.type = LoaderResource.TYPE.VIDEO; + this._loadSourceElement('video'); + break; + case LoaderResource.LOAD_TYPE.XHR: + /* falls through */ + default: + if (typeof useXdr === 'undefined') { + useXdr = !!(globalThis.XDomainRequest && !('withCredentials' in (new XMLHttpRequest()))); + } + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } + else { + this._loadXhr(); + } + break; + } + }; + /** + * Checks if the flag is set. + * @param flag - The flag to check. + * @returns True if the flag is set. + */ + LoaderResource.prototype._hasFlag = function (flag) { + return (this._flags & flag) !== 0; + }; + /** + * (Un)Sets the flag. + * @param flag - The flag to (un)set. + * @param value - Whether to set or (un)set the flag. + */ + LoaderResource.prototype._setFlag = function (flag, value) { + this._flags = value ? (this._flags | flag) : (this._flags & ~flag); + }; + /** Clears all the events from the underlying loading source. */ + LoaderResource.prototype._clearEvents = function () { + clearTimeout(this._elementTimer); + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } + else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + }; + /** Finalizes the load. */ + LoaderResource.prototype._finish = function () { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true); + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false); + this.onComplete.dispatch(this); + }; + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * @private + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'image' && typeof globalThis.Image !== 'undefined') { + this.data = new Image(); + } + else { + this.data = document.createElement(type); + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadSourceElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'audio' && typeof globalThis.Audio !== 'undefined') { + this.data = new Audio(); + } + else { + this.data = document.createElement(type); + } + if (this.data === null) { + this.abort("Unsupported element: " + type); + return; + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } + else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } + else { + var mimeTypes = this.metadata.mimeType; + this.data.appendChild(this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)); + } + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + this.data.load(); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** Loads this resources using an XMLHttpRequest. */ + LoaderResource.prototype._loadXhr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xhr = this.xhr = new XMLHttpRequest(); + // send credentials when crossOrigin with credentials requested + if (this.crossOrigin === 'use-credentials') { + xhr.withCredentials = true; + } + // set the request type and url + xhr.open('GET', this.url, true); + xhr.timeout = this.timeout; + // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON + || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT; + } + else { + xhr.responseType = this.xhrType; + } + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + xhr.send(); + }; + /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */ + LoaderResource.prototype._loadXdr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xdr = this.xhr = new globalThis.XDomainRequest(); // eslint-disable-line no-undef + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + xdr.open('GET', this.url, true); + // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + setTimeout(function () { return xdr.send(); }, 1); + }; + /** + * Creates a source used in loading via an element. + * @param type - The element type (video or audio). + * @param url - The source URL to load from. + * @param [mime] - The mime type of the video + * @returns The source element. + */ + LoaderResource.prototype._createSource = function (type, url, mime) { + if (!mime) { + mime = type + "/" + this._getExtension(url); + } + var source = document.createElement('source'); + source.src = url; + source.type = mime; + return source; + }; + /** + * Called if a load errors out. + * @param event - The error event from the element that emits it. + */ + LoaderResource.prototype._onError = function (event) { + this.abort("Failed to load element using: " + event.target.nodeName); + }; + /** + * Called if a load progress event fires for an element or xhr/xdr. + * @param event - Progress event. + */ + LoaderResource.prototype._onProgress = function (event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + }; + /** Called if a timeout event fires for an element. */ + LoaderResource.prototype._onTimeout = function () { + this.abort("Load timed out."); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnError = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnTimeout = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request timed out."); + }; + /** Called if an abort event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnAbort = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request was aborted by the user."); + }; + /** Called when data successfully loads from an xhr/xdr request. */ + LoaderResource.prototype._xhrOnLoad = function () { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + // responseText is accessible only if responseType is '' or 'text' and on older browsers + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } + // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + var statusType = (status / 100) | 0; + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = LoaderResource.TYPE.TEXT; + } + // if json, parse into json object + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = LoaderResource.TYPE.JSON; + } + catch (e) { + this.abort("Error trying to parse loaded json: " + e); + return; + } + } + // if xml, parse into an xml document or div element + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (globalThis.DOMParser) { + var domparser = new DOMParser(); + this.data = domparser.parseFromString(text, 'text/xml'); + } + else { + var div = document.createElement('div'); + div.innerHTML = text; + this.data = div; + } + this.type = LoaderResource.TYPE.XML; + } + catch (e$1) { + this.abort("Error trying to parse loaded xml: " + e$1); + return; + } + } + // other types just return the response + else { + this.data = xhr.response || text; + } + } + else { + this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); + return; + } + this.complete(); + }; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * @private + * @param url - The url to test. + * @param [loc=globalThis.location] - The location object to test against. + * @returns The crossOrigin value to use (or empty string for none). + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + LoaderResource.prototype._determineCrossOrigin = function (url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match globalThis.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + if (globalThis.origin !== globalThis.location.origin) { + return 'anonymous'; + } + // default is globalThis.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + var parsedUrl = parseUri(tempAnchor.href, { strictMode: true }); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + var protocol = parsedUrl.protocol ? parsedUrl.protocol + ":" : ''; + // if cross origin + if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; + }; + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use. + */ + LoaderResource.prototype._determineXhrType = function () { + return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT; + }; + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use. + */ + LoaderResource.prototype._determineLoadType = function () { + return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR; + }; + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * @param [url] - url to parse, `this.url` by default. + * @returns The extension. + */ + LoaderResource.prototype._getExtension = function (url) { + if (url === void 0) { url = this.url; } + var ext = ''; + if (this.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(); + }; + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * @param type - The type to get a mime type for. + * @private + * @returns The mime type to use. + */ + LoaderResource.prototype._getMimeFromXhrType = function (type) { + switch (type) { + case LoaderResource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + case LoaderResource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + case LoaderResource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT: + case LoaderResource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + default: + return 'text/plain'; + } + }; + return LoaderResource; + }()); + // eslint-disable-next-line @typescript-eslint/no-namespace + (function (LoaderResource) { + /** + * The types of resources a resource could represent. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + var STATUS_FLAGS; + (function (STATUS_FLAGS) { + /** None */ + STATUS_FLAGS[STATUS_FLAGS["NONE"] = 0] = "NONE"; + /** Data URL */ + STATUS_FLAGS[STATUS_FLAGS["DATA_URL"] = 1] = "DATA_URL"; + /** Complete */ + STATUS_FLAGS[STATUS_FLAGS["COMPLETE"] = 2] = "COMPLETE"; + /** Loading */ + STATUS_FLAGS[STATUS_FLAGS["LOADING"] = 4] = "LOADING"; + })(STATUS_FLAGS = LoaderResource.STATUS_FLAGS || (LoaderResource.STATUS_FLAGS = {})); + /** + * The types of resources a resource could represent. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + var TYPE; + (function (TYPE) { + /** Unknown */ + TYPE[TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + /** JSON */ + TYPE[TYPE["JSON"] = 1] = "JSON"; + /** XML */ + TYPE[TYPE["XML"] = 2] = "XML"; + /** Image */ + TYPE[TYPE["IMAGE"] = 3] = "IMAGE"; + /** Audio */ + TYPE[TYPE["AUDIO"] = 4] = "AUDIO"; + /** Video */ + TYPE[TYPE["VIDEO"] = 5] = "VIDEO"; + /** Plain text */ + TYPE[TYPE["TEXT"] = 6] = "TEXT"; + })(TYPE = LoaderResource.TYPE || (LoaderResource.TYPE = {})); + /** + * The types of loading a resource can use. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + var LOAD_TYPE; + (function (LOAD_TYPE) { + /** Uses XMLHttpRequest to load the resource. */ + LOAD_TYPE[LOAD_TYPE["XHR"] = 1] = "XHR"; + /** Uses an `Image` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["IMAGE"] = 2] = "IMAGE"; + /** Uses an `Audio` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["AUDIO"] = 3] = "AUDIO"; + /** Uses a `Video` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["VIDEO"] = 4] = "VIDEO"; + })(LOAD_TYPE = LoaderResource.LOAD_TYPE || (LoaderResource.LOAD_TYPE = {})); + /** + * The XHR ready states, used internally. + * @static + * @readonly + * @enum {string} + * @memberof PIXI.LoaderResource + */ + var XHR_RESPONSE_TYPE; + (function (XHR_RESPONSE_TYPE) { + /** string */ + XHR_RESPONSE_TYPE["DEFAULT"] = "text"; + /** ArrayBuffer */ + XHR_RESPONSE_TYPE["BUFFER"] = "arraybuffer"; + /** Blob */ + XHR_RESPONSE_TYPE["BLOB"] = "blob"; + /** Document */ + XHR_RESPONSE_TYPE["DOCUMENT"] = "document"; + /** Object */ + XHR_RESPONSE_TYPE["JSON"] = "json"; + /** String */ + XHR_RESPONSE_TYPE["TEXT"] = "text"; + })(XHR_RESPONSE_TYPE = LoaderResource.XHR_RESPONSE_TYPE || (LoaderResource.XHR_RESPONSE_TYPE = {})); + LoaderResource._loadTypeMap = { + // images + gif: LoaderResource.LOAD_TYPE.IMAGE, + png: LoaderResource.LOAD_TYPE.IMAGE, + bmp: LoaderResource.LOAD_TYPE.IMAGE, + jpg: LoaderResource.LOAD_TYPE.IMAGE, + jpeg: LoaderResource.LOAD_TYPE.IMAGE, + tif: LoaderResource.LOAD_TYPE.IMAGE, + tiff: LoaderResource.LOAD_TYPE.IMAGE, + webp: LoaderResource.LOAD_TYPE.IMAGE, + tga: LoaderResource.LOAD_TYPE.IMAGE, + avif: LoaderResource.LOAD_TYPE.IMAGE, + svg: LoaderResource.LOAD_TYPE.IMAGE, + 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, + // audio + mp3: LoaderResource.LOAD_TYPE.AUDIO, + ogg: LoaderResource.LOAD_TYPE.AUDIO, + wav: LoaderResource.LOAD_TYPE.AUDIO, + // videos + mp4: LoaderResource.LOAD_TYPE.VIDEO, + webm: LoaderResource.LOAD_TYPE.VIDEO, + }; + LoaderResource._xhrTypeMap = { + // xml + xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // images + gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + png: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + // json + json: LoaderResource.XHR_RESPONSE_TYPE.JSON, + // text + text: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + // fonts + ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + }; + // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + LoaderResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; + })(exports.LoaderResource || (exports.LoaderResource = {})); + + /** + * Smaller version of the async library constructs. + * @ignore + */ + function _noop() { + } + /** + * Ensures a function is only called once. + * @ignore + * @param {Function} fn - The function to wrap. + * @returns {Function} The wrapping function. + */ + function onlyOnce(fn) { + return function onceWrapper() { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + if (fn === null) { + throw new Error('Callback was already called.'); + } + var callFn = fn; + fn = null; + callFn.apply(this, args); + }; + } + /** + * @private + * @memberof PIXI + */ + var AsyncQueueItem = /** @class */ (function () { + /** + * @param data + * @param callback + * @private + */ + function AsyncQueueItem(data, callback) { + this.data = data; + this.callback = callback; + } + return AsyncQueueItem; + }()); + /** + * @private + * @memberof PIXI + */ + var AsyncQueue = /** @class */ (function () { + /** + * @param worker + * @param concurrency + * @private + */ + function AsyncQueue(worker, concurrency) { + var _this = this; + if (concurrency === void 0) { concurrency = 1; } + this.workers = 0; + this.saturated = _noop; + this.unsaturated = _noop; + this.empty = _noop; + this.drain = _noop; + this.error = _noop; + this.started = false; + this.paused = false; + this._tasks = []; + this._insert = function (data, insertAtFront, callback) { + if (callback && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + _this.started = true; + // eslint-disable-next-line no-eq-null,eqeqeq + if (data == null && _this.idle()) { + // call drain immediately if there are no tasks + setTimeout(function () { return _this.drain(); }, 1); + return; + } + var item = new AsyncQueueItem(data, typeof callback === 'function' ? callback : _noop); + if (insertAtFront) { + _this._tasks.unshift(item); + } + else { + _this._tasks.push(item); + } + setTimeout(_this.process, 1); + }; + this.process = function () { + while (!_this.paused && _this.workers < _this.concurrency && _this._tasks.length) { + var task = _this._tasks.shift(); + if (_this._tasks.length === 0) { + _this.empty(); + } + _this.workers += 1; + if (_this.workers === _this.concurrency) { + _this.saturated(); + } + _this._worker(task.data, onlyOnce(_this._next(task))); + } + }; + this._worker = worker; + if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + this.concurrency = concurrency; + this.buffer = concurrency / 4.0; + } + /** + * @param task + * @private + */ + AsyncQueue.prototype._next = function (task) { + var _this = this; + return function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + _this.workers -= 1; + task.callback.apply(task, args); + // eslint-disable-next-line no-eq-null,eqeqeq + if (args[0] != null) { + _this.error(args[0], task.data); + } + if (_this.workers <= (_this.concurrency - _this.buffer)) { + _this.unsaturated(); + } + if (_this.idle()) { + _this.drain(); + } + _this.process(); + }; + }; + // That was in object + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.push = function (data, callback) { + this._insert(data, false, callback); + }; + AsyncQueue.prototype.kill = function () { + this.workers = 0; + this.drain = _noop; + this.started = false; + this._tasks = []; + }; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.unshift = function (data, callback) { + this._insert(data, true, callback); + }; + 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; + // Need to call this.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= this.concurrency; w++) { + this.process(); + } + }; + /** + * Iterates an array in series. + * @param {Array.<*>} array - Array to iterate. + * @param {Function} iterator - Function to call for each element. + * @param {Function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + AsyncQueue.eachSeries = function (array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + return; + } + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } + else { + iterator(array[i++], next); + } + } + next(); + }; + /** + * Async queue implementation, + * @param {Function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @returns {*} The async queue object. + */ + AsyncQueue.queue = function (worker, concurrency) { + return new AsyncQueue(worker, concurrency); + }; + return AsyncQueue; + }()); + + // some constants + var MAX_PROGRESS = 100; + var rgxExtractUrlHash = /(#[\w-]+)?$/; + /** + * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * // or + * const loader = new PIXI.Loader(); // You can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * @memberof PIXI + */ + var Loader = /** @class */ (function () { + /** + * @param baseUrl - The base url for all resources loaded by this loader. + * @param concurrency - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + var _this = this; + if (baseUrl === void 0) { baseUrl = ''; } + if (concurrency === void 0) { concurrency = 10; } + /** The progress percent of the loader going through the queue. */ + this.progress = 0; + /** Loading state of the loader, true if it is currently loading resources. */ + this.loading = false; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + */ + this.defaultQueryString = ''; + /** The middleware to run before loading each resource. */ + this._beforeMiddleware = []; + /** The middleware to run after loading each resource. */ + this._afterMiddleware = []; + /** The tracks the resources we are currently completing parsing for. */ + this._resourcesParsing = []; + /** + * The `_loadResource` function bound with this object context. + * @param r - The resource to load + * @param d - The dequeue function + */ + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + /** All the resources for this loader keyed by name. */ + this.resources = {}; + this.baseUrl = baseUrl; + this._beforeMiddleware = []; + this._afterMiddleware = []; + this._resourcesParsing = []; + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency); + this._queue.pause(); + this.resources = {}; + this.onProgress = new Signal(); + this.onError = new Signal(); + this.onLoad = new Signal(); + this.onStart = new Signal(); + this.onComplete = new Signal(); + for (var i = 0; i < Loader._plugins.length; ++i) { + var plugin = Loader._plugins[i]; + var pre = plugin.pre, use = plugin.use; + if (pre) { + this.pre(pre); + } + if (use) { + this.use(use); + } + } + this._protected = false; + } + /** + * Same as add, params have strict order + * @private + * @param name - The name of the resource to load. + * @param url - The url for this resource, relative to the baseUrl of this loader. + * @param options - The options for the load. + * @param callback - Function to call when this specific resource completes loading. + * @returns The loader itself. + */ + Loader.prototype._add = function (name, url, options, callback) { + // if loading already you can only add resources that have a parent. + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } + // check if resource already exists. + if (this.resources[name]) { + throw new Error("Resource named \"" + name + "\" already exists."); + } + // add base url if this isn't an absolute url + url = this._prepareUrl(url); + // create the store the resource + this.resources[name] = new exports.LoaderResource(name, url, options); + if (typeof callback === 'function') { + this.resources[name].onAfterMiddleware.once(callback); + } + // if actively loading, make sure to adjust progress chunks for that parent and its children + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + for (var i = 0; i < parent.children.length; ++i) { + if (!parent.children[i].isComplete) { + incompleteChildren.push(parent.children[i]); + } + } + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + for (var i = 0; i < incompleteChildren.length; ++i) { + incompleteChildren[i].progressChunk = eachChunk; + } + this.resources[name].progressChunk = eachChunk; + } + // add the resource to the queue + this._queue.push(this.resources[name]); + return this; + }; + /* eslint-enable require-jsdoc,valid-jsdoc */ + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.pre = function (fn) { + this._beforeMiddleware.push(fn); + return this; + }; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.use = function (fn) { + this._afterMiddleware.push(fn); + return this; + }; + /** + * Resets the queue of the loader to prepare for a new load. + * @returns The loader itself. + */ + Loader.prototype.reset = function () { + this.progress = 0; + this.loading = false; + this._queue.kill(); + this._queue.pause(); + // abort all resource loads + for (var k in this.resources) { + var res = this.resources[k]; + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + if (res.isLoading) { + res.abort('loader reset'); + } + } + this.resources = {}; + return this; + }; + /** + * Starts loading the queued resources. + * @param cb - Optional callback that will be bound to the `complete` event. + * @returns The loader itself. + */ + Loader.prototype.load = function (cb) { + utils.deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.'); + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } + // if the queue has already started we are done here + if (this.loading) { + return this; + } + if (this._queue.idle()) { + this._onStart(); + this._onComplete(); + } + else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } + // notify we are starting + this._onStart(); + // start loading + this._queue.resume(); + } + return this; + }; + Object.defineProperty(Loader.prototype, "concurrency", { + /** + * The number of resources to load concurrently. + * @default 10 + */ + get: function () { + return this._queue.concurrency; + }, + set: function (concurrency) { + this._queue.concurrency = concurrency; + }, + enumerable: false, + configurable: true + }); + /** + * Prepares a url for usage based on the configuration of this object + * @param url - The url to prepare. + * @returns The prepared url. + */ + Loader.prototype._prepareUrl = function (url) { + var parsedUrl = parseUri(url, { strictMode: true }); + var result; + // absolute url, just use it as is. + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } + // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length + && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 + && url.charAt(0) !== '/') { + result = this.baseUrl + "/" + url; + } + else { + result = this.baseUrl + url; + } + // if we need to add a default querystring, there is a bit more work + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + result = result.slice(0, result.length - hash.length); + if (result.indexOf('?') !== -1) { + result += "&" + this.defaultQueryString; + } + else { + result += "?" + this.defaultQueryString; + } + result += hash; + } + return result; + }; + /** + * Loads a single resource. + * @param resource - The resource to load. + * @param dequeue - The function to call when we need to dequeue this item. + */ + Loader.prototype._loadResource = function (resource, dequeue) { + var _this = this; + resource._dequeue = dequeue; + // run before middleware + AsyncQueue.eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this._onLoad(resource); + } + else { + resource._onLoadBinding = resource.onComplete.once(_this._onLoad, _this); + resource.load(); + } + }, true); + }; + /** Called once loading has started. */ + Loader.prototype._onStart = function () { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + }; + /** Called once each resource has loaded. */ + Loader.prototype._onComplete = function () { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + }; + /** + * Called each time a resources is loaded. + * @param resource - The resource that was loaded + */ + Loader.prototype._onLoad = function (resource) { + var _this = this; + resource._onLoadBinding = null; + // remove this resource from the async queue, and add it to our list of resources that are being parsed + this._resourcesParsing.push(resource); + resource._dequeue(); + // run all the after middleware for this resource + AsyncQueue.eachSeries(this._afterMiddleware, function (fn, next) { + 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); + // do completion check + if (_this._queue.idle() && _this._resourcesParsing.length === 0) { + _this._onComplete(); + } + }, true); + }; + /** Destroy the loader, removes references. */ + Loader.prototype.destroy = function () { + if (!this._protected) { + this.reset(); + } + }; + Object.defineProperty(Loader, "shared", { + /** A premade instance of the loader that can be used to load resources. */ + get: function () { + var shared = Loader._shared; + if (!shared) { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + return shared; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param plugin - The plugin to add + * @returns Reference to PIXI.Loader for chaining + */ + Loader.registerPlugin = function (plugin) { + utils.deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.'); + core.extensions.add({ + type: core.ExtensionType.Loader, + ref: plugin, + }); + return Loader; + }; + Loader._plugins = []; + return Loader; + }()); + core.extensions.handleByList(core.ExtensionType.Loader, Loader._plugins); + Loader.prototype.add = function add(name, url, options, callback) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + return this; + } + // if an object is passed instead of params + if (typeof name === 'object') { + options = name; + callback = url || options.callback || options.onComplete; + url = options.url; + name = options.name || options.key || options.url; + } + // case where no name is passed shift all args over by one. + if (typeof url !== 'string') { + callback = options; + options = url; + url = name; + } + // now that we shifted make sure we have a proper url. + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } + // options are optional so people might pass a function and no options + if (typeof options === 'function') { + callback = options; + options = null; + } + return this._add(name, url, options, callback); + }; + + /** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {extensions} from '@pixi/core'; + * extensions.add(AppLoaderPlugin); + * @memberof PIXI + */ + var AppLoaderPlugin = /** @class */ (function () { + function AppLoaderPlugin() { + } + /** + * Called on application constructor + * @param options + * @private + */ + AppLoaderPlugin.init = function (options) { + options = Object.assign({ + sharedLoader: false, + }, options); + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + }; + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function () { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + }; + /** @ignore */ + AppLoaderPlugin.extension = core.ExtensionType.Application; + return AppLoaderPlugin; + }()); + + /** + * Loader plugin for handling Texture resources. + * @memberof PIXI + */ + var TextureLoader = /** @class */ (function () { + function TextureLoader() { + } + /** Handle SVG elements a text, render with SVGResource. */ + TextureLoader.add = function () { + exports.LoaderResource.setExtensionLoadType('svg', exports.LoaderResource.LOAD_TYPE.XHR); + exports.LoaderResource.setExtensionXhrType('svg', exports.LoaderResource.XHR_RESPONSE_TYPE.TEXT); + }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param resource + * @param {Function} next + */ + TextureLoader.use = function (resource, next) { + // create a new texture if the data is an Image object + if (resource.data && (resource.type === exports.LoaderResource.TYPE.IMAGE || resource.extension === 'svg')) { + var data = resource.data, url = resource.url, name = resource.name, metadata = resource.metadata; + core.Texture.fromLoader(data, url, name, metadata).then(function (texture) { + resource.texture = texture; + next(); + }) + // TODO: handle errors in Texture.fromLoader + // so we can pass them to the Loader + .catch(next); + } + else { + next(); + } + }; + /** @ignore */ + TextureLoader.extension = core.ExtensionType.Loader; + return TextureLoader; + }()); + + // a simple in-memory cache for resources + var cache = {}; + /** + * A simple in-memory cache for resource. + * @ignore + * @function caching + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.caching); + * @param resource - Current Resource + * @param next - Callback when complete + */ + function caching(resource, next) { + // if cached, then set data and complete the resource + if (cache[resource.url]) { + resource.data = cache[resource.url]; + resource.complete(); // marks resource load complete and stops processing before middlewares + } + // if not cached, wait for complete and store it in the cache. + else { + resource.onComplete.once(function doCache() { cache[this.url] = this.data; }); + } + next(); + } + + var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + /** + * Encodes binary into base64. + * @function encodeBinary + * @param {string} input - The input data to encode. + * @returns {string} The encoded base64 string + */ + function encodeBinary(input) { + var output = ''; + var inx = 0; + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } + else { + bytebuffer[jnx] = 0; + } + } + // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + encodedCharIndexes[0] = bytebuffer[0] >> 2; + // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4); + // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6); + // index 3: forth 6 bits (6 least significant bits from input byte 3) + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; + // Determine whether padding happened, and adjust accordingly + var paddingBytes = inx - (input.length - 1); + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + default: + break; // No padding - proceed + } + // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + for (var jnx = 0; jnx < encodedCharIndexes.length; ++jnx) { + output += _keyStr.charAt(encodedCharIndexes[jnx]); + } + } + return output; + } + + /** + * A middleware for transforming XHR loaded Blobs into more useful objects + * @ignore + * @function parsing + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.parsing); + * @param resource - Current Resource + * @param next - Callback when complete + */ + function parsing(resource, next) { + if (!resource.data) { + next(); + return; + } + // if this was an XHR load of a blob + if (resource.xhr && resource.xhrType === exports.LoaderResource.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!self.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); + // this is an image, convert the binary string into a data url + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); + resource.type = exports.LoaderResource.TYPE.IMAGE; + // wait until the image loads and then callback + resource.data.onload = function () { + resource.data.onload = null; + next(); + }; + // next will be called on load + return; + } + } + // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var Url_1 = globalThis.URL || globalThis.webkitURL; + var src_1 = Url_1.createObjectURL(resource.data); + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src_1; + resource.type = exports.LoaderResource.TYPE.IMAGE; + // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + resource.data.onload = function () { + Url_1.revokeObjectURL(src_1); + resource.data.onload = null; + next(); + }; + // next will be called on load. + return; + } + } + next(); + } + + /** + * Parse any blob into more usable objects (e.g. Image). + * @memberof PIXI + */ + var ParsingLoader = /** @class */ (function () { + function ParsingLoader() { + } + /** @ignore */ + ParsingLoader.extension = core.ExtensionType.Loader; + ParsingLoader.use = parsing; + return ParsingLoader; + }()); + + core.extensions.add(TextureLoader, ParsingLoader); + + exports.AppLoaderPlugin = AppLoaderPlugin; + exports.Loader = Loader; + exports.TextureLoader = TextureLoader; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI.utils); +Object.assign(this.PIXI, _pixi_loaders); +//# sourceMappingURL=loaders.js.map diff --git a/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js.map b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js.map new file mode 100644 index 0000000..e737c20 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loaders.js","sources":["../../src/base/Signal.ts","../../src/base/parseUri.ts","../../src/LoaderResource.ts","../../src/base/AsyncQueue.ts","../../src/Loader.ts","../../src/AppLoaderPlugin.ts","../../src/TextureLoader.ts","../../src/middleware/caching.ts","../../src/base/encodeBinary.ts","../../src/middleware/parsing.ts","../../src/ParsingLoader.ts","../../src/index.ts"],"sourcesContent":["/* jshint -W097 */\n\n/**\n * @memberof PIXI\n */\nexport class SignalBinding\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport type { LoaderResource } from '../LoaderResource';\n\n// a simple in-memory cache for resources\nconst cache: Dict = {};\n\n/**\n * A simple in-memory cache for resource.\n * @ignore\n * @function caching\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.caching);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function caching(resource: LoaderResource, next: (...args: any) => void): void\n{\n // if cached, then set data and complete the resource\n if (cache[resource.url])\n {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else\n {\n resource.onComplete.once(function doCache(this: LoaderResource) { cache[this.url] = this.data; });\n }\n\n next();\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["arguments","_noop","LoaderResource","e","deprecation","extensions","ExtensionType","Texture"],"mappings":";;;;;;;;;;;IAAA;IAEA;;IAEG;IACH,IAAA,aAAA,kBAAA,YAAA;IASI;;;;;;;IAOG;;IAEH,IAAA,SAAA,aAAA,CAAY,EAAU,EAAE,IAAY,EAAE,OAAY,EAAA;IAA1B,QAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAY,GAAA,KAAA,CAAA,EAAA;IAEhC,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IACd,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IACxB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SAChD;IAED,IAAA,aAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;IAEI,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;IAAE,YAAA,EAAA,OAAO,KAAK,CAAC,EAAA;IACvC,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzB,QAAA,OAAO,IAAI,CAAC;SACf,CAAA;QACL,OAAC,aAAA,CAAA;IAAD,CAAC,EAAA,CAAA,CAAA;IAED;;;;IAIG;IACH,SAAS,iBAAiB,CAAS,IAAoB,EAAE,IAA2B,EAAA;IAEhF,IAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EACf;IACI,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACrB,KAAA;IAED,SAAA;IACI,QAAA,IAA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AAQ,CAAC,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;IAC5B,YAAA,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,KAAG,CAAC;gBAExB,QAAQ,CAAC,IAAI,GAAGA,sBAAc,CAAC,IAAI,CAAC,KAAK,CAAC;;;IAI1C,YAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,YAAA;IAEnB,gBAAA,KAAG,CAAC,eAAe,CAAC,KAAG,CAAC,CAAC;IACzB,gBAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IAE5B,gBAAA,IAAI,EAAE,CAAC;IACX,aAAC,CAAC;;gBAGF,OAAO;IACV,SAAA;IACJ,KAAA;IAED,IAAA,IAAI,EAAE,CAAC;IACX;;IC3EA;;;IAGG;IACH,IAAA,aAAA,kBAAA,YAAA;IAAA,IAAA,SAAA,aAAA,GAAA;SAMC;;IAHU,IAAA,aAAA,CAAA,SAAS,GAAsBI,kBAAa,CAAC,MAAM,CAAC;QAEpD,aAAG,CAAA,GAAA,GAAG,OAAO,CAAC;QACzB,OAAC,aAAA,CAAA;IAAA,CAND,EAMC,CAAA;;ACLDD,mBAAU,CAAC,GAAG,CACV,aAAa,EACb,aAAa,CAChB;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/dist/browser/loaders.min.js b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.min.js new file mode 100644 index 0000000..e1f43e8 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/browser/loaders.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_loaders=function(t,e){"use strict";var r=function(){function t(t,e,r){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=r,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function i(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var s,n=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var r=[];e;)r.push(e),e=e._next;return r},t.prototype.has=function(t){if(!(t instanceof r))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],r=0;r0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var s=new DOMParser;this.data=s.parseFromString(r,"text/xml")}else{var n=document.createElement("div");n.innerHTML=r,this.data=n}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,p||(p=document.createElement("a")),p.href=t;var r=o(p.href,{strictMode:!0}),i=!r.port&&""===e.port||r.port===e.port,s=r.protocol?r.protocol+":":"";return r.host===e.hostname&&i&&s===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),s=t.indexOf("#"),n=Math.min(i>-1?i:t.length,s>-1?s:t.length);e=(t=t.substring(0,n)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}(),l=t.LoaderResource||(t.LoaderResource={}),(d=l.STATUS_FLAGS||(l.STATUS_FLAGS={}))[d.NONE=0]="NONE",d[d.DATA_URL=1]="DATA_URL",d[d.COMPLETE=2]="COMPLETE",d[d.LOADING=4]="LOADING",(u=l.TYPE||(l.TYPE={}))[u.UNKNOWN=0]="UNKNOWN",u[u.JSON=1]="JSON",u[u.XML=2]="XML",u[u.IMAGE=3]="IMAGE",u[u.AUDIO=4]="AUDIO",u[u.VIDEO=5]="VIDEO",u[u.TEXT=6]="TEXT",(h=l.LOAD_TYPE||(l.LOAD_TYPE={}))[h.XHR=1]="XHR",h[h.IMAGE=2]="IMAGE",h[h.AUDIO=3]="AUDIO",h[h.VIDEO=4]="VIDEO",(a=l.XHR_RESPONSE_TYPE||(l.XHR_RESPONSE_TYPE={})).DEFAULT="text",a.BUFFER="arraybuffer",a.BLOB="blob",a.DOCUMENT="document",a.JSON="json",a.TEXT="text",l._loadTypeMap={gif:l.LOAD_TYPE.IMAGE,png:l.LOAD_TYPE.IMAGE,bmp:l.LOAD_TYPE.IMAGE,jpg:l.LOAD_TYPE.IMAGE,jpeg:l.LOAD_TYPE.IMAGE,tif:l.LOAD_TYPE.IMAGE,tiff:l.LOAD_TYPE.IMAGE,webp:l.LOAD_TYPE.IMAGE,tga:l.LOAD_TYPE.IMAGE,avif:l.LOAD_TYPE.IMAGE,svg:l.LOAD_TYPE.IMAGE,"svg+xml":l.LOAD_TYPE.IMAGE,mp3:l.LOAD_TYPE.AUDIO,ogg:l.LOAD_TYPE.AUDIO,wav:l.LOAD_TYPE.AUDIO,mp4:l.LOAD_TYPE.VIDEO,webm:l.LOAD_TYPE.VIDEO},l._xhrTypeMap={xhtml:l.XHR_RESPONSE_TYPE.DOCUMENT,html:l.XHR_RESPONSE_TYPE.DOCUMENT,htm:l.XHR_RESPONSE_TYPE.DOCUMENT,xml:l.XHR_RESPONSE_TYPE.DOCUMENT,tmx:l.XHR_RESPONSE_TYPE.DOCUMENT,svg:l.XHR_RESPONSE_TYPE.DOCUMENT,tsx:l.XHR_RESPONSE_TYPE.DOCUMENT,gif:l.XHR_RESPONSE_TYPE.BLOB,png:l.XHR_RESPONSE_TYPE.BLOB,bmp:l.XHR_RESPONSE_TYPE.BLOB,jpg:l.XHR_RESPONSE_TYPE.BLOB,jpeg:l.XHR_RESPONSE_TYPE.BLOB,tif:l.XHR_RESPONSE_TYPE.BLOB,tiff:l.XHR_RESPONSE_TYPE.BLOB,webp:l.XHR_RESPONSE_TYPE.BLOB,tga:l.XHR_RESPONSE_TYPE.BLOB,avif:l.XHR_RESPONSE_TYPE.BLOB,json:l.XHR_RESPONSE_TYPE.JSON,text:l.XHR_RESPONSE_TYPE.TEXT,txt:l.XHR_RESPONSE_TYPE.TEXT,ttf:l.XHR_RESPONSE_TYPE.BUFFER,otf:l.XHR_RESPONSE_TYPE.BUFFER},l.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var g=function(t,e){this.data=t,this.callback=e},O=function(){function t(t,e){var r=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=f,this.unsaturated=f,this.empty=f,this.drain=f,this.error=f,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,i){if(i&&"function"!=typeof i)throw new Error("task callback must be a function");if(r.started=!0,null==t&&r.idle())setTimeout((function(){return r.drain()}),1);else{var s=new g(t,"function"==typeof i?i:f);e?r._tasks.unshift(s):r._tasks.push(s),setTimeout(r.process,1)}},this.process=function(){for(;!r.paused&&r.workers>2,s[1]=(3&i[0])<<4|i[1]>>4,s[2]=(15&i[1])<<2|i[2]>>6,s[3]=63&i[2],r-(t.length-1)){case 2:s[3]=64,s[2]=64;break;case 1:s[3]=64}for(n=0;n\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["SignalBinding","fn","once","thisArg","this","_fn","_once","_thisArg","_next","_prev","_owner","prototype","detach","_addSignalBinding","self","node","_head","_tail","useXdr","Signal","undefined","handlers","exists","ee","push","has","Error","dispatch","args","_i","arguments","length","apply","add","detachAll","parseUri","str","opts","o","key","q","name","parser","strict","loose","m","strictMode","exec","uri","i","replace","_t0","t1","t2","XHR_RESPONSE_TYPE","LOAD_TYPE","TYPE","STATUS_FLAGS","LoaderResource","tempAnchor","_noop","setExtMap","map","extname","val","indexOf","substring","reqType","xhr","toString","onlyOnce","callFn","url","options","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_boundOnTimeout","_boundXhrOnError","_boundXhrOnTimeout","_boundXhrOnAbort","_boundXhrOnLoad","_flags","_setFlag","DATA_URL","extension","_getExtension","data","crossOrigin","timeout","loadType","_determineLoadType","xhrType","metadata","error","children","type","UNKNOWN","progressChunk","complete","bind","_onError","_onProgress","_onTimeout","_xhrOnError","_xhrOnTimeout","_xhrOnAbort","_xhrOnLoad","onStart","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","Object","defineProperty","get","_hasFlag","COMPLETE","LOADING","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","_this","isLoading","isComplete","setTimeout","_determineCrossOrigin","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","globalThis","XDomainRequest","XMLHttpRequest","_loadXdr","_loadXhr","flag","value","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","Array","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","withCredentials","open","JSON","DOCUMENT","responseType","TEXT","send","mime","source","event","target","nodeName","lengthComputable","loaded","total","status","statusText","text","responseText","BUFFER","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parsedUrl","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","queryStart","hashStart","index","Math","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","avif","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","AsyncQueueItem","callback","AsyncQueue","worker","concurrency","workers","saturated","unsaturated","empty","drain","started","paused","_tasks","_insert","insertAtFront","idle","item","unshift","process","task","shift","_worker","buffer","kill","running","pause","resume","w","eachSeries","array","iterator","deferNext","len","next","err","queue","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","d","_loadResource","resources","_queue","onError","onLoad","_plugins","plugin","pre","use","_protected","_add","parentResource","_prepareUrl","parent","incompleteChildren","eachChunk","reset","k","res","_onStart","_onComplete","chunk","set","result","path","charAt","hash","slice","resource","dequeue","call","_onLoad","splice","destroy","shared","_shared","registerPlugin","extensions","ExtensionType","ref","core","handleByList","AppLoaderPlugin","init","assign","sharedLoader","loader","Application","TextureLoader","Texture","fromLoader","then","texture","catch","parsing","Blob","Url_1","URL","webkitURL","src_1","createObjectURL","blob","revokeObjectURL","getResponseHeader","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","encodeBinary","ParsingLoader"],"mappings":";;;;;;;qEAKA,IAAAA,EAAA,WAkBI,SAAAA,EAAYC,EAAYC,EAAcC,QAAd,IAAAD,IAAAA,GAAY,GAEhCE,KAAKC,IAAMJ,EACXG,KAAKE,MAAQJ,EACbE,KAAKG,SAAWJ,EAChBC,KAAKI,MAAQJ,KAAKK,MAAQL,KAAKM,OAAS,KAUhD,OAPIV,EAAAW,UAAAC,OAAA,WAEI,OAAoB,OAAhBR,KAAKM,SACTN,KAAKM,OAAOE,OAAOR,OAEZ,IAEdJ,KAOD,SAASa,EAA0BC,EAAsBC,GAgBrD,OAdKD,EAAKE,OAONF,EAAKG,MAAMT,MAAQO,EACnBA,EAAKN,MAAQK,EAAKG,MAClBH,EAAKG,MAAQF,IAPbD,EAAKE,MAAQD,EACbD,EAAKG,MAAQF,GASjBA,EAAKL,OAASI,EAEPC,EAMX,IC7DIG,ED6DJ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AAG,EAAG,EAAG,GAE5BC,EAAM,EAAGA,EAAMF,EAAWnV,SAAUqV,EAErCH,EAAMF,EAAMhV,OAIZmV,EAAWE,GAAiC,IAA1BL,EAAMM,WAAWJ,KAInCC,EAAWE,GAAO,EAoB1B,OAdAD,EAAmB,GAAKD,EAAW,IAAM,EAGzCC,EAAmB,IAAuB,EAAhBD,EAAW,KAAa,EAAMA,EAAW,IAAM,EAGzEC,EAAmB,IAAuB,GAAhBD,EAAW,KAAc,EAAMA,EAAW,IAAM,EAG1EC,EAAmB,GAAqB,GAAhBD,EAAW,GAGdD,GAAOF,EAAMhV,OAAS,IAIvC,KAAK,EAEDoV,EAAmB,GAAK,GACxBA,EAAmB,GAAK,GACxB,MAEJ,KAAK,EAEDA,EAAmB,GAAK,GAShC,IAASC,EAAM,EAAGA,EAAMD,EAAmBpV,SAAUqV,EAEjDJ,GAtEI,oEAsEcxC,OAAO2C,EAAmBC,IAIpD,OAAOJ,EDvCgDM,CAAa3C,EAASvQ,IAAI8H,cAErEyI,EAASxO,KAAOzC,iBAAeF,KAAKqF,WAGpC8L,EAASjP,KAAKqE,OAAS,WAEnB4K,EAASjP,KAAKqE,OAAS,KAEvBiI,MAkChBA,SA5DIA,IEVR,IAAAuF,EAAA,WAAA,SAAAA,KAMA,OAHWA,EAAA/R,UAA+B6P,EAAaA,cAACjD,OAE7CmF,EAAGhE,IAAG8C,EAChBkB,YCLDnC,EAAAA,WAAWnT,IACP8T,EACAwB"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js new file mode 100644 index 0000000..53c3a9e --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js @@ -0,0 +1,1944 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var core = require('@pixi/core'); +var utils = require('@pixi/utils'); + +/* jshint -W097 */ +/** + * @memberof PIXI + */ +var SignalBinding = /** @class */ (function () { + /** + * SignalBinding constructor. + * @constructs SignalBinding + * @param {Function} fn - Event handler to be called. + * @param {boolean} [once=false] - Should this listener be removed after dispatch + * @param {object} [thisArg] - The context of the callback function. + * @api private + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function SignalBinding(fn, once, thisArg) { + if (once === void 0) { once = false; } + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + SignalBinding.prototype.detach = function () { + if (this._owner === null) + { return false; } + this._owner.detach(this); + return true; + }; + return SignalBinding; +}()); +/** + * @param self + * @param node + * @private + */ +function _addSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } + else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + node._owner = self; + return node; +} +/** + * @memberof PIXI + */ +var Signal = /** @class */ (function () { + /** + * MiniSignal constructor. + * @example + * let mySignal = new Signal(); + * let binding = mySignal.add(onSignal); + * mySignal.dispatch('foo', 'bar'); + * mySignal.detach(binding); + */ + function Signal() { + this._head = this._tail = undefined; + } + /** + * Return an array of attached SignalBinding. + * @param {boolean} [exists=false] - We only need to know if there are handlers. + * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true + * @api public + */ + Signal.prototype.handlers = function (exists) { + if (exists === void 0) { exists = false; } + var node = this._head; + if (exists) + { return !!node; } + var ee = []; + while (node) { + ee.push(node); + node = node._next; + } + return ee; + }; + /** + * Return true if node is a SignalBinding attached to this MiniSignal + * @param {PIXI.SignalBinding} node - Node to check. + * @returns {boolean} True if node is attache to mini-signal + */ + Signal.prototype.has = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.'); + } + return node._owner === this; + }; + /** + * Dispaches a signal to all registered listeners. + * @param {...any} args + * @returns {boolean} Indication if we've emitted an event. + */ + Signal.prototype.dispatch = function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + var node = this._head; + if (!node) + { return false; } + while (node) { + if (node._once) + { this.detach(node); } + node._fn.apply(node._thisArg, args); + node = node._next; + } + return true; + }; + /** + * Register a new listener. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.add = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, false, thisArg)); + }; + /** + * Register a new listener that will be executed only once. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.once = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, true, thisArg)); + }; + /** + * Remove binding object. + * @param {PIXI.SignalBinding} node - The binding node that will be removed. + * @returns {Signal} The instance on which this method was called. + @api public */ + Signal.prototype.detach = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.'); + } + if (node._owner !== this) + { return this; } // todo: or error? + if (node._prev) + { node._prev._next = node._next; } + if (node._next) + { node._next._prev = node._prev; } + if (node === this._head) { // first node + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } + else if (node === this._tail) { // last node + this._tail = node._prev; + this._tail._next = null; + } + node._owner = null; + return this; + }; + /** + * Detach all listeners. + * @returns {Signal} The instance on which this method was called. + */ + Signal.prototype.detachAll = function () { + var node = this._head; + if (!node) + { return this; } + this._head = this._tail = null; + while (node) { + node._owner = null; + node = node._next; + } + return this; + }; + return Signal; +}()); + +/** + * function from npm package `parseUri`, converted to TS to avoid leftpad incident + * @param {string} str + * @param [opts] - options + * @param {boolean} [opts.strictMode] - type of parser + */ +function parseUri(str, opts) { + opts = opts || {}; + var o = { + // eslint-disable-next-line max-len + key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + // eslint-disable-next-line max-len + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + // eslint-disable-next-line max-len + 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 (_t0, t1, t2) { + if (t1) + { uri[o.q.name][t1] = t2; } + }); + return uri; +} + +// tests if CORS is supported in XHR, if not we need to use XDR +var useXdr; +var tempAnchor = null; +// some status constants +var STATUS_NONE = 0; +var STATUS_OK = 200; +var STATUS_EMPTY = 204; +var STATUS_IE_BUG_EMPTY = 1223; +var STATUS_TYPE_OK = 2; +// noop +function _noop$1() { } +/** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * @ignore + * @param map - The map to set on. + * @param extname - The extension (or key) to set. + * @param val - The value to set. + */ +function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + if (!extname) { + return; + } + map[extname] = val; +} +/** + * Quick helper to get string xhr type. + * @ignore + * @param xhr - The request to check. + * @returns The type. + */ +function reqType(xhr) { + return xhr.toString().replace('object ', ''); +} +/** + * Manages the state and loading of a resource and all child resources. + * + * Can be extended in `GlobalMixins.LoaderResource`. + * @memberof PIXI + */ +exports.LoaderResource = /** @class */ (function () { + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware + * and the Resource object. + */ + function LoaderResource(name, url, options) { + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * @private + * @member {Function} + */ + this._dequeue = _noop$1; + /** + * Used a storage place for the on load binding used privately by the loader. + * @private + * @member {Function} + */ + this._onLoadBinding = null; + /** + * The timer for element loads to check if they timeout. + * @private + */ + this._elementTimer = 0; + /** + * The `complete` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundComplete = null; + /** + * The `_onError` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnError = null; + /** + * The `_onProgress` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnProgress = null; + /** + * The `_onTimeout` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnTimeout = null; + this._boundXhrOnError = null; + this._boundXhrOnTimeout = null; + this._boundXhrOnAbort = null; + this._boundXhrOnLoad = null; + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + options = options || {}; + this._flags = 0; + // set data url flag, needs to be set early for some _determineX checks to work. + this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + this.name = name; + this.url = url; + this.extension = this._getExtension(); + this.data = null; + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + this.timeout = options.timeout || 0; + this.loadType = options.loadType || this._determineLoadType(); + // The type used to load the resource via XHR. If unset, determined automatically. + this.xhrType = options.xhrType; + // Extra info for middleware, and controlling specifics about how the resource loads. + // Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + // Meaning it will modify it as it sees fit. + this.metadata = options.metadata || {}; + // The error that occurred while loading (if any). + this.error = null; + // The XHR object that was used to load this resource. This is only set + // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`. + this.xhr = null; + // The child resources this resource owns. + this.children = []; + // The resource type. + this.type = LoaderResource.TYPE.UNKNOWN; + // The progress chunk owned by this resource. + this.progressChunk = 0; + // The `dequeue` method that will be used a storage place for the async queue dequeue method + // used privately by the loader. + this._dequeue = _noop$1; + // Used a storage place for the on load binding used privately by the loader. + this._onLoadBinding = null; + // The timer for element loads to check if they timeout. + this._elementTimer = 0; + this._boundComplete = this.complete.bind(this); + this._boundOnError = this._onError.bind(this); + this._boundOnProgress = this._onProgress.bind(this); + this._boundOnTimeout = this._onTimeout.bind(this); + // xhr callbacks + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + // Dispatched when the resource beings to load. + this.onStart = new Signal(); + // Dispatched each time progress of this resource load updates. + // Not all resources types and loader systems can support this event + // so sometimes it may not be available. If the resource + // is being loaded on a modern browser, using XHR, and the remote server + // properly sets Content-Length headers, then this will be available. + this.onProgress = new Signal(); + // Dispatched once this resource has loaded, if there was an error it will + // be in the `error` property. + this.onComplete = new Signal(); + // Dispatched after this resource has had all the *after* middleware run on it. + this.onAfterMiddleware = new Signal(); + } + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to. + */ + LoaderResource.setExtensionLoadType = function (extname, loadType) { + setExtMap(LoaderResource._loadTypeMap, extname, loadType); + }; + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + LoaderResource.setExtensionXhrType = function (extname, xhrType) { + setExtMap(LoaderResource._xhrTypeMap, extname, xhrType); + }; + Object.defineProperty(LoaderResource.prototype, "isDataUrl", { + /** + * When the resource starts to load. + * @memberof PIXI.LoaderResource + * @callback OnStartSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * When the resource reports loading progress. + * @memberof PIXI.LoaderResource + * @callback OnProgressSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + /** + * When the resource finishes loading. + * @memberof PIXI.LoaderResource + * @callback OnCompleteSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * @memberof PIXI.LoaderResource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + /** + * Stores whether or not this url is a data url. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isComplete", { + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isLoading", { + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING); + }, + enumerable: false, + configurable: true + }); + /** Marks the resource as complete. */ + LoaderResource.prototype.complete = function () { + this._clearEvents(); + this._finish(); + }; + /** + * Aborts the loading of this resource, with an optional message. + * @param {string} message - The message to use for the error + */ + LoaderResource.prototype.abort = function (message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } + // store error + this.error = new Error(message); + // clear events before calling aborts + this._clearEvents(); + // abort the actual loading + if (this.xhr) { + this.xhr.abort(); + } + else if (this.xdr) { + this.xdr.abort(); + } + else if (this.data) { + // single source + if (this.data.src) { + this.data.src = LoaderResource.EMPTY_GIF; + } + // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } + // done now. + this._finish(); + }; + /** + * Kicks off loading of this resource. This method is asynchronous. + * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + LoaderResource.prototype.load = function (cb) { + var _this = this; + if (this.isLoading) { + return; + } + if (this.isComplete) { + if (cb) { + setTimeout(function () { return cb(_this); }, 1); + } + return; + } + else if (cb) { + this.onComplete.once(cb); + } + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true); + this.onStart.dispatch(this); + // if unset, determine the value + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + switch (this.loadType) { + case LoaderResource.LOAD_TYPE.IMAGE: + this.type = LoaderResource.TYPE.IMAGE; + this._loadElement('image'); + break; + case LoaderResource.LOAD_TYPE.AUDIO: + this.type = LoaderResource.TYPE.AUDIO; + this._loadSourceElement('audio'); + break; + case LoaderResource.LOAD_TYPE.VIDEO: + this.type = LoaderResource.TYPE.VIDEO; + this._loadSourceElement('video'); + break; + case LoaderResource.LOAD_TYPE.XHR: + /* falls through */ + default: + if (typeof useXdr === 'undefined') { + useXdr = !!(globalThis.XDomainRequest && !('withCredentials' in (new XMLHttpRequest()))); + } + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } + else { + this._loadXhr(); + } + break; + } + }; + /** + * Checks if the flag is set. + * @param flag - The flag to check. + * @returns True if the flag is set. + */ + LoaderResource.prototype._hasFlag = function (flag) { + return (this._flags & flag) !== 0; + }; + /** + * (Un)Sets the flag. + * @param flag - The flag to (un)set. + * @param value - Whether to set or (un)set the flag. + */ + LoaderResource.prototype._setFlag = function (flag, value) { + this._flags = value ? (this._flags | flag) : (this._flags & ~flag); + }; + /** Clears all the events from the underlying loading source. */ + LoaderResource.prototype._clearEvents = function () { + clearTimeout(this._elementTimer); + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } + else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + }; + /** Finalizes the load. */ + LoaderResource.prototype._finish = function () { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true); + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false); + this.onComplete.dispatch(this); + }; + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * @private + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'image' && typeof globalThis.Image !== 'undefined') { + this.data = new Image(); + } + else { + this.data = document.createElement(type); + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadSourceElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'audio' && typeof globalThis.Audio !== 'undefined') { + this.data = new Audio(); + } + else { + this.data = document.createElement(type); + } + if (this.data === null) { + this.abort("Unsupported element: " + type); + return; + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } + else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } + else { + var mimeTypes = this.metadata.mimeType; + this.data.appendChild(this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)); + } + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + this.data.load(); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** Loads this resources using an XMLHttpRequest. */ + LoaderResource.prototype._loadXhr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xhr = this.xhr = new XMLHttpRequest(); + // send credentials when crossOrigin with credentials requested + if (this.crossOrigin === 'use-credentials') { + xhr.withCredentials = true; + } + // set the request type and url + xhr.open('GET', this.url, true); + xhr.timeout = this.timeout; + // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON + || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT; + } + else { + xhr.responseType = this.xhrType; + } + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + xhr.send(); + }; + /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */ + LoaderResource.prototype._loadXdr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xdr = this.xhr = new globalThis.XDomainRequest(); // eslint-disable-line no-undef + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + xdr.open('GET', this.url, true); + // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + setTimeout(function () { return xdr.send(); }, 1); + }; + /** + * Creates a source used in loading via an element. + * @param type - The element type (video or audio). + * @param url - The source URL to load from. + * @param [mime] - The mime type of the video + * @returns The source element. + */ + LoaderResource.prototype._createSource = function (type, url, mime) { + if (!mime) { + mime = type + "/" + this._getExtension(url); + } + var source = document.createElement('source'); + source.src = url; + source.type = mime; + return source; + }; + /** + * Called if a load errors out. + * @param event - The error event from the element that emits it. + */ + LoaderResource.prototype._onError = function (event) { + this.abort("Failed to load element using: " + event.target.nodeName); + }; + /** + * Called if a load progress event fires for an element or xhr/xdr. + * @param event - Progress event. + */ + LoaderResource.prototype._onProgress = function (event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + }; + /** Called if a timeout event fires for an element. */ + LoaderResource.prototype._onTimeout = function () { + this.abort("Load timed out."); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnError = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnTimeout = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request timed out."); + }; + /** Called if an abort event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnAbort = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request was aborted by the user."); + }; + /** Called when data successfully loads from an xhr/xdr request. */ + LoaderResource.prototype._xhrOnLoad = function () { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + // responseText is accessible only if responseType is '' or 'text' and on older browsers + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } + // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + var statusType = (status / 100) | 0; + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = LoaderResource.TYPE.TEXT; + } + // if json, parse into json object + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = LoaderResource.TYPE.JSON; + } + catch (e) { + this.abort("Error trying to parse loaded json: " + e); + return; + } + } + // if xml, parse into an xml document or div element + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (globalThis.DOMParser) { + var domparser = new DOMParser(); + this.data = domparser.parseFromString(text, 'text/xml'); + } + else { + var div = document.createElement('div'); + div.innerHTML = text; + this.data = div; + } + this.type = LoaderResource.TYPE.XML; + } + catch (e$1) { + this.abort("Error trying to parse loaded xml: " + e$1); + return; + } + } + // other types just return the response + else { + this.data = xhr.response || text; + } + } + else { + this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); + return; + } + this.complete(); + }; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * @private + * @param url - The url to test. + * @param [loc=globalThis.location] - The location object to test against. + * @returns The crossOrigin value to use (or empty string for none). + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + LoaderResource.prototype._determineCrossOrigin = function (url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match globalThis.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + if (globalThis.origin !== globalThis.location.origin) { + return 'anonymous'; + } + // default is globalThis.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + var parsedUrl = parseUri(tempAnchor.href, { strictMode: true }); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + var protocol = parsedUrl.protocol ? parsedUrl.protocol + ":" : ''; + // if cross origin + if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; + }; + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use. + */ + LoaderResource.prototype._determineXhrType = function () { + return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT; + }; + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use. + */ + LoaderResource.prototype._determineLoadType = function () { + return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR; + }; + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * @param [url] - url to parse, `this.url` by default. + * @returns The extension. + */ + LoaderResource.prototype._getExtension = function (url) { + if (url === void 0) { url = this.url; } + var ext = ''; + if (this.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(); + }; + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * @param type - The type to get a mime type for. + * @private + * @returns The mime type to use. + */ + LoaderResource.prototype._getMimeFromXhrType = function (type) { + switch (type) { + case LoaderResource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + case LoaderResource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + case LoaderResource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT: + case LoaderResource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + default: + return 'text/plain'; + } + }; + return LoaderResource; +}()); +// eslint-disable-next-line @typescript-eslint/no-namespace +(function (LoaderResource) { + (function (STATUS_FLAGS) { + /** None */ + STATUS_FLAGS[STATUS_FLAGS["NONE"] = 0] = "NONE"; + /** Data URL */ + STATUS_FLAGS[STATUS_FLAGS["DATA_URL"] = 1] = "DATA_URL"; + /** Complete */ + STATUS_FLAGS[STATUS_FLAGS["COMPLETE"] = 2] = "COMPLETE"; + /** Loading */ + STATUS_FLAGS[STATUS_FLAGS["LOADING"] = 4] = "LOADING"; + })(LoaderResource.STATUS_FLAGS || (LoaderResource.STATUS_FLAGS = {})); + (function (TYPE) { + /** Unknown */ + TYPE[TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + /** JSON */ + TYPE[TYPE["JSON"] = 1] = "JSON"; + /** XML */ + TYPE[TYPE["XML"] = 2] = "XML"; + /** Image */ + TYPE[TYPE["IMAGE"] = 3] = "IMAGE"; + /** Audio */ + TYPE[TYPE["AUDIO"] = 4] = "AUDIO"; + /** Video */ + TYPE[TYPE["VIDEO"] = 5] = "VIDEO"; + /** Plain text */ + TYPE[TYPE["TEXT"] = 6] = "TEXT"; + })(LoaderResource.TYPE || (LoaderResource.TYPE = {})); + (function (LOAD_TYPE) { + /** Uses XMLHttpRequest to load the resource. */ + LOAD_TYPE[LOAD_TYPE["XHR"] = 1] = "XHR"; + /** Uses an `Image` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["IMAGE"] = 2] = "IMAGE"; + /** Uses an `Audio` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["AUDIO"] = 3] = "AUDIO"; + /** Uses a `Video` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["VIDEO"] = 4] = "VIDEO"; + })(LoaderResource.LOAD_TYPE || (LoaderResource.LOAD_TYPE = {})); + (function (XHR_RESPONSE_TYPE) { + /** string */ + XHR_RESPONSE_TYPE["DEFAULT"] = "text"; + /** ArrayBuffer */ + XHR_RESPONSE_TYPE["BUFFER"] = "arraybuffer"; + /** Blob */ + XHR_RESPONSE_TYPE["BLOB"] = "blob"; + /** Document */ + XHR_RESPONSE_TYPE["DOCUMENT"] = "document"; + /** Object */ + XHR_RESPONSE_TYPE["JSON"] = "json"; + /** String */ + XHR_RESPONSE_TYPE["TEXT"] = "text"; + })(LoaderResource.XHR_RESPONSE_TYPE || (LoaderResource.XHR_RESPONSE_TYPE = {})); + LoaderResource._loadTypeMap = { + // images + gif: LoaderResource.LOAD_TYPE.IMAGE, + png: LoaderResource.LOAD_TYPE.IMAGE, + bmp: LoaderResource.LOAD_TYPE.IMAGE, + jpg: LoaderResource.LOAD_TYPE.IMAGE, + jpeg: LoaderResource.LOAD_TYPE.IMAGE, + tif: LoaderResource.LOAD_TYPE.IMAGE, + tiff: LoaderResource.LOAD_TYPE.IMAGE, + webp: LoaderResource.LOAD_TYPE.IMAGE, + tga: LoaderResource.LOAD_TYPE.IMAGE, + avif: LoaderResource.LOAD_TYPE.IMAGE, + svg: LoaderResource.LOAD_TYPE.IMAGE, + 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, + // audio + mp3: LoaderResource.LOAD_TYPE.AUDIO, + ogg: LoaderResource.LOAD_TYPE.AUDIO, + wav: LoaderResource.LOAD_TYPE.AUDIO, + // videos + mp4: LoaderResource.LOAD_TYPE.VIDEO, + webm: LoaderResource.LOAD_TYPE.VIDEO, + }; + LoaderResource._xhrTypeMap = { + // xml + xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // images + gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + png: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + // json + json: LoaderResource.XHR_RESPONSE_TYPE.JSON, + // text + text: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + // fonts + ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + }; + // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + LoaderResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; +})(exports.LoaderResource || (exports.LoaderResource = {})); + +/** + * Smaller version of the async library constructs. + * @ignore + */ +function _noop() { +} +/** + * Ensures a function is only called once. + * @ignore + * @param {Function} fn - The function to wrap. + * @returns {Function} The wrapping function. + */ +function onlyOnce(fn) { + return function onceWrapper() { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + if (fn === null) { + throw new Error('Callback was already called.'); + } + var callFn = fn; + fn = null; + callFn.apply(this, args); + }; +} +/** + * @private + * @memberof PIXI + */ +var AsyncQueueItem = /** @class */ (function () { + /** + * @param data + * @param callback + * @private + */ + function AsyncQueueItem(data, callback) { + this.data = data; + this.callback = callback; + } + return AsyncQueueItem; +}()); +/** + * @private + * @memberof PIXI + */ +var AsyncQueue = /** @class */ (function () { + /** + * @param worker + * @param concurrency + * @private + */ + function AsyncQueue(worker, concurrency) { + var _this = this; + if (concurrency === void 0) { concurrency = 1; } + this.workers = 0; + this.saturated = _noop; + this.unsaturated = _noop; + this.empty = _noop; + this.drain = _noop; + this.error = _noop; + this.started = false; + this.paused = false; + this._tasks = []; + this._insert = function (data, insertAtFront, callback) { + if (callback && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + _this.started = true; + // eslint-disable-next-line no-eq-null,eqeqeq + if (data == null && _this.idle()) { + // call drain immediately if there are no tasks + setTimeout(function () { return _this.drain(); }, 1); + return; + } + var item = new AsyncQueueItem(data, typeof callback === 'function' ? callback : _noop); + if (insertAtFront) { + _this._tasks.unshift(item); + } + else { + _this._tasks.push(item); + } + setTimeout(_this.process, 1); + }; + this.process = function () { + while (!_this.paused && _this.workers < _this.concurrency && _this._tasks.length) { + var task = _this._tasks.shift(); + if (_this._tasks.length === 0) { + _this.empty(); + } + _this.workers += 1; + if (_this.workers === _this.concurrency) { + _this.saturated(); + } + _this._worker(task.data, onlyOnce(_this._next(task))); + } + }; + this._worker = worker; + if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + this.concurrency = concurrency; + this.buffer = concurrency / 4.0; + } + /** + * @param task + * @private + */ + AsyncQueue.prototype._next = function (task) { + var _this = this; + return function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + _this.workers -= 1; + task.callback.apply(task, args); + // eslint-disable-next-line no-eq-null,eqeqeq + if (args[0] != null) { + _this.error(args[0], task.data); + } + if (_this.workers <= (_this.concurrency - _this.buffer)) { + _this.unsaturated(); + } + if (_this.idle()) { + _this.drain(); + } + _this.process(); + }; + }; + // That was in object + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.push = function (data, callback) { + this._insert(data, false, callback); + }; + AsyncQueue.prototype.kill = function () { + this.workers = 0; + this.drain = _noop; + this.started = false; + this._tasks = []; + }; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.unshift = function (data, callback) { + this._insert(data, true, callback); + }; + 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; + // Need to call this.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= this.concurrency; w++) { + this.process(); + } + }; + /** + * Iterates an array in series. + * @param {Array.<*>} array - Array to iterate. + * @param {Function} iterator - Function to call for each element. + * @param {Function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + AsyncQueue.eachSeries = function (array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + return; + } + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } + else { + iterator(array[i++], next); + } + } + next(); + }; + /** + * Async queue implementation, + * @param {Function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @returns {*} The async queue object. + */ + AsyncQueue.queue = function (worker, concurrency) { + return new AsyncQueue(worker, concurrency); + }; + return AsyncQueue; +}()); + +// some constants +var MAX_PROGRESS = 100; +var rgxExtractUrlHash = /(#[\w-]+)?$/; +/** + * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * // or + * const loader = new PIXI.Loader(); // You can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * @memberof PIXI + */ +var Loader = /** @class */ (function () { + /** + * @param baseUrl - The base url for all resources loaded by this loader. + * @param concurrency - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + var _this = this; + if (baseUrl === void 0) { baseUrl = ''; } + if (concurrency === void 0) { concurrency = 10; } + /** The progress percent of the loader going through the queue. */ + this.progress = 0; + /** Loading state of the loader, true if it is currently loading resources. */ + this.loading = false; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + */ + this.defaultQueryString = ''; + /** The middleware to run before loading each resource. */ + this._beforeMiddleware = []; + /** The middleware to run after loading each resource. */ + this._afterMiddleware = []; + /** The tracks the resources we are currently completing parsing for. */ + this._resourcesParsing = []; + /** + * The `_loadResource` function bound with this object context. + * @param r - The resource to load + * @param d - The dequeue function + */ + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + /** All the resources for this loader keyed by name. */ + this.resources = {}; + this.baseUrl = baseUrl; + this._beforeMiddleware = []; + this._afterMiddleware = []; + this._resourcesParsing = []; + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency); + this._queue.pause(); + this.resources = {}; + this.onProgress = new Signal(); + this.onError = new Signal(); + this.onLoad = new Signal(); + this.onStart = new Signal(); + this.onComplete = new Signal(); + for (var i = 0; i < Loader._plugins.length; ++i) { + var plugin = Loader._plugins[i]; + var pre = plugin.pre, use = plugin.use; + if (pre) { + this.pre(pre); + } + if (use) { + this.use(use); + } + } + this._protected = false; + } + /** + * Same as add, params have strict order + * @private + * @param name - The name of the resource to load. + * @param url - The url for this resource, relative to the baseUrl of this loader. + * @param options - The options for the load. + * @param callback - Function to call when this specific resource completes loading. + * @returns The loader itself. + */ + Loader.prototype._add = function (name, url, options, callback) { + // if loading already you can only add resources that have a parent. + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } + // check if resource already exists. + if (this.resources[name]) { + throw new Error("Resource named \"" + name + "\" already exists."); + } + // add base url if this isn't an absolute url + url = this._prepareUrl(url); + // create the store the resource + this.resources[name] = new exports.LoaderResource(name, url, options); + if (typeof callback === 'function') { + this.resources[name].onAfterMiddleware.once(callback); + } + // if actively loading, make sure to adjust progress chunks for that parent and its children + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + for (var i = 0; i < parent.children.length; ++i) { + if (!parent.children[i].isComplete) { + incompleteChildren.push(parent.children[i]); + } + } + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + for (var i = 0; i < incompleteChildren.length; ++i) { + incompleteChildren[i].progressChunk = eachChunk; + } + this.resources[name].progressChunk = eachChunk; + } + // add the resource to the queue + this._queue.push(this.resources[name]); + return this; + }; + /* eslint-enable require-jsdoc,valid-jsdoc */ + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.pre = function (fn) { + this._beforeMiddleware.push(fn); + return this; + }; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.use = function (fn) { + this._afterMiddleware.push(fn); + return this; + }; + /** + * Resets the queue of the loader to prepare for a new load. + * @returns The loader itself. + */ + Loader.prototype.reset = function () { + this.progress = 0; + this.loading = false; + this._queue.kill(); + this._queue.pause(); + // abort all resource loads + for (var k in this.resources) { + var res = this.resources[k]; + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + if (res.isLoading) { + res.abort('loader reset'); + } + } + this.resources = {}; + return this; + }; + /** + * Starts loading the queued resources. + * @param cb - Optional callback that will be bound to the `complete` event. + * @returns The loader itself. + */ + Loader.prototype.load = function (cb) { + utils.deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.'); + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } + // if the queue has already started we are done here + if (this.loading) { + return this; + } + if (this._queue.idle()) { + this._onStart(); + this._onComplete(); + } + else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } + // notify we are starting + this._onStart(); + // start loading + this._queue.resume(); + } + return this; + }; + Object.defineProperty(Loader.prototype, "concurrency", { + /** + * The number of resources to load concurrently. + * @default 10 + */ + get: function () { + return this._queue.concurrency; + }, + set: function (concurrency) { + this._queue.concurrency = concurrency; + }, + enumerable: false, + configurable: true + }); + /** + * Prepares a url for usage based on the configuration of this object + * @param url - The url to prepare. + * @returns The prepared url. + */ + Loader.prototype._prepareUrl = function (url) { + var parsedUrl = parseUri(url, { strictMode: true }); + var result; + // absolute url, just use it as is. + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } + // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length + && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 + && url.charAt(0) !== '/') { + result = this.baseUrl + "/" + url; + } + else { + result = this.baseUrl + url; + } + // if we need to add a default querystring, there is a bit more work + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + result = result.slice(0, result.length - hash.length); + if (result.indexOf('?') !== -1) { + result += "&" + this.defaultQueryString; + } + else { + result += "?" + this.defaultQueryString; + } + result += hash; + } + return result; + }; + /** + * Loads a single resource. + * @param resource - The resource to load. + * @param dequeue - The function to call when we need to dequeue this item. + */ + Loader.prototype._loadResource = function (resource, dequeue) { + var _this = this; + resource._dequeue = dequeue; + // run before middleware + AsyncQueue.eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this._onLoad(resource); + } + else { + resource._onLoadBinding = resource.onComplete.once(_this._onLoad, _this); + resource.load(); + } + }, true); + }; + /** Called once loading has started. */ + Loader.prototype._onStart = function () { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + }; + /** Called once each resource has loaded. */ + Loader.prototype._onComplete = function () { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + }; + /** + * Called each time a resources is loaded. + * @param resource - The resource that was loaded + */ + Loader.prototype._onLoad = function (resource) { + var _this = this; + resource._onLoadBinding = null; + // remove this resource from the async queue, and add it to our list of resources that are being parsed + this._resourcesParsing.push(resource); + resource._dequeue(); + // run all the after middleware for this resource + AsyncQueue.eachSeries(this._afterMiddleware, function (fn, next) { + 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); + // do completion check + if (_this._queue.idle() && _this._resourcesParsing.length === 0) { + _this._onComplete(); + } + }, true); + }; + /** Destroy the loader, removes references. */ + Loader.prototype.destroy = function () { + if (!this._protected) { + this.reset(); + } + }; + Object.defineProperty(Loader, "shared", { + /** A premade instance of the loader that can be used to load resources. */ + get: function () { + var shared = Loader._shared; + if (!shared) { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + return shared; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param plugin - The plugin to add + * @returns Reference to PIXI.Loader for chaining + */ + Loader.registerPlugin = function (plugin) { + utils.deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.'); + core.extensions.add({ + type: core.ExtensionType.Loader, + ref: plugin, + }); + return Loader; + }; + Loader._plugins = []; + return Loader; +}()); +core.extensions.handleByList(core.ExtensionType.Loader, Loader._plugins); +Loader.prototype.add = function add(name, url, options, callback) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + return this; + } + // if an object is passed instead of params + if (typeof name === 'object') { + options = name; + callback = url || options.callback || options.onComplete; + url = options.url; + name = options.name || options.key || options.url; + } + // case where no name is passed shift all args over by one. + if (typeof url !== 'string') { + callback = options; + options = url; + url = name; + } + // now that we shifted make sure we have a proper url. + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } + // options are optional so people might pass a function and no options + if (typeof options === 'function') { + callback = options; + options = null; + } + return this._add(name, url, options, callback); +}; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {extensions} from '@pixi/core'; + * extensions.add(AppLoaderPlugin); + * @memberof PIXI + */ +var AppLoaderPlugin = /** @class */ (function () { + function AppLoaderPlugin() { + } + /** + * Called on application constructor + * @param options + * @private + */ + AppLoaderPlugin.init = function (options) { + options = Object.assign({ + sharedLoader: false, + }, options); + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + }; + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function () { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + }; + /** @ignore */ + AppLoaderPlugin.extension = core.ExtensionType.Application; + return AppLoaderPlugin; +}()); + +/** + * Loader plugin for handling Texture resources. + * @memberof PIXI + */ +var TextureLoader = /** @class */ (function () { + function TextureLoader() { + } + /** Handle SVG elements a text, render with SVGResource. */ + TextureLoader.add = function () { + exports.LoaderResource.setExtensionLoadType('svg', exports.LoaderResource.LOAD_TYPE.XHR); + exports.LoaderResource.setExtensionXhrType('svg', exports.LoaderResource.XHR_RESPONSE_TYPE.TEXT); + }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param resource + * @param {Function} next + */ + TextureLoader.use = function (resource, next) { + // create a new texture if the data is an Image object + if (resource.data && (resource.type === exports.LoaderResource.TYPE.IMAGE || resource.extension === 'svg')) { + var data = resource.data, url = resource.url, name = resource.name, metadata = resource.metadata; + core.Texture.fromLoader(data, url, name, metadata).then(function (texture) { + resource.texture = texture; + next(); + }) + // TODO: handle errors in Texture.fromLoader + // so we can pass them to the Loader + .catch(next); + } + else { + next(); + } + }; + /** @ignore */ + TextureLoader.extension = core.ExtensionType.Loader; + return TextureLoader; +}()); + +var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +/** + * Encodes binary into base64. + * @function encodeBinary + * @param {string} input - The input data to encode. + * @returns {string} The encoded base64 string + */ +function encodeBinary(input) { + var output = ''; + var inx = 0; + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } + else { + bytebuffer[jnx] = 0; + } + } + // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + encodedCharIndexes[0] = bytebuffer[0] >> 2; + // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4); + // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6); + // index 3: forth 6 bits (6 least significant bits from input byte 3) + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; + // Determine whether padding happened, and adjust accordingly + var paddingBytes = inx - (input.length - 1); + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + } + // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + for (var jnx = 0; jnx < encodedCharIndexes.length; ++jnx) { + output += _keyStr.charAt(encodedCharIndexes[jnx]); + } + } + return output; +} + +/** + * A middleware for transforming XHR loaded Blobs into more useful objects + * @ignore + * @function parsing + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.parsing); + * @param resource - Current Resource + * @param next - Callback when complete + */ +function parsing(resource, next) { + if (!resource.data) { + next(); + return; + } + // if this was an XHR load of a blob + if (resource.xhr && resource.xhrType === exports.LoaderResource.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!self.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); + // this is an image, convert the binary string into a data url + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); + resource.type = exports.LoaderResource.TYPE.IMAGE; + // wait until the image loads and then callback + resource.data.onload = function () { + resource.data.onload = null; + next(); + }; + // next will be called on load + return; + } + } + // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var Url_1 = globalThis.URL || globalThis.webkitURL; + var src_1 = Url_1.createObjectURL(resource.data); + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src_1; + resource.type = exports.LoaderResource.TYPE.IMAGE; + // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + resource.data.onload = function () { + Url_1.revokeObjectURL(src_1); + resource.data.onload = null; + next(); + }; + // next will be called on load. + return; + } + } + next(); +} + +/** + * Parse any blob into more usable objects (e.g. Image). + * @memberof PIXI + */ +var ParsingLoader = /** @class */ (function () { + function ParsingLoader() { + } + /** @ignore */ + ParsingLoader.extension = core.ExtensionType.Loader; + ParsingLoader.use = parsing; + return ParsingLoader; +}()); + +core.extensions.add(TextureLoader, ParsingLoader); + +exports.AppLoaderPlugin = AppLoaderPlugin; +exports.Loader = Loader; +exports.TextureLoader = TextureLoader; +//# sourceMappingURL=loaders.js.map diff --git a/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js.map b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js.map new file mode 100644 index 0000000..72972d7 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loaders.js","sources":["../../src/base/Signal.ts","../../src/base/parseUri.ts","../../src/LoaderResource.ts","../../src/base/AsyncQueue.ts","../../src/Loader.ts","../../src/AppLoaderPlugin.ts","../../src/TextureLoader.ts","../../src/base/encodeBinary.ts","../../src/middleware/parsing.ts","../../src/ParsingLoader.ts","../../src/index.ts"],"sourcesContent":["/* jshint -W097 */\n\n/**\n * @memberof PIXI\n */\nexport class SignalBinding\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["arguments","_noop","LoaderResource","e","deprecation","extensions","ExtensionType","Texture"],"mappings":";;;;;;;;;;;;;;AAAA;AAEA;;AAEG;AACH,IAAA,aAAA,kBAAA,YAAA;AASI;;;;;;;AAOG;;AAEH,IAAA,SAAA,aAAA,CAAY,EAAU,EAAE,IAAY,EAAE,OAAY,EAAA;AAA1B,QAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAY,GAAA,KAAA,CAAA,EAAA;AAEhC,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;AACd,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;AACxB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;KAChD;AAED,IAAA,aAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AAEI,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;AAAE,YAAA,EAAA,OAAO,KAAK,CAAC,EAAA;AACvC,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzB,QAAA,OAAO,IAAI,CAAC;KACf,CAAA;IACL,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAED;;;;AAIG;AACH,SAAS,iBAAiB,CAAS,IAAoB,EAAE,IAA2B,EAAA;AAEhF,IAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EACf;AACI,QAAA,IAAI,CAAC,KAAK,GAA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file diff --git a/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.min.js b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.min.js new file mode 100644 index 0000000..a932bb1 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/cjs/loaders.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/core"),e=function(){function t(t,e,r){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=r,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function r(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var i,s=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var r=[];e;)r.push(e),e=e._next;return r},t.prototype.has=function(t){if(!(t instanceof e))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],r=0;r0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var s=new DOMParser;this.data=s.parseFromString(r,"text/xml")}else{var o=document.createElement("div");o.innerHTML=r,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,l||(l=document.createElement("a")),l.href=t;var r=o(l.href,{strictMode:!0}),i=!r.port&&""===e.port||r.port===e.port,s=r.protocol?r.protocol+":":"";return r.host===e.hostname&&i&&s===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),s=t.indexOf("#"),o=Math.min(i>-1?i:t.length,s>-1?s:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}(),n=exports.LoaderResource||(exports.LoaderResource={}),(a=n.STATUS_FLAGS||(n.STATUS_FLAGS={}))[a.NONE=0]="NONE",a[a.DATA_URL=1]="DATA_URL",a[a.COMPLETE=2]="COMPLETE",a[a.LOADING=4]="LOADING",(h=n.TYPE||(n.TYPE={}))[h.UNKNOWN=0]="UNKNOWN",h[h.JSON=1]="JSON",h[h.XML=2]="XML",h[h.IMAGE=3]="IMAGE",h[h.AUDIO=4]="AUDIO",h[h.VIDEO=5]="VIDEO",h[h.TEXT=6]="TEXT",(u=n.LOAD_TYPE||(n.LOAD_TYPE={}))[u.XHR=1]="XHR",u[u.IMAGE=2]="IMAGE",u[u.AUDIO=3]="AUDIO",u[u.VIDEO=4]="VIDEO",(d=n.XHR_RESPONSE_TYPE||(n.XHR_RESPONSE_TYPE={})).DEFAULT="text",d.BUFFER="arraybuffer",d.BLOB="blob",d.DOCUMENT="document",d.JSON="json",d.TEXT="text",n._loadTypeMap={gif:n.LOAD_TYPE.IMAGE,png:n.LOAD_TYPE.IMAGE,bmp:n.LOAD_TYPE.IMAGE,jpg:n.LOAD_TYPE.IMAGE,jpeg:n.LOAD_TYPE.IMAGE,tif:n.LOAD_TYPE.IMAGE,tiff:n.LOAD_TYPE.IMAGE,webp:n.LOAD_TYPE.IMAGE,tga:n.LOAD_TYPE.IMAGE,avif:n.LOAD_TYPE.IMAGE,svg:n.LOAD_TYPE.IMAGE,"svg+xml":n.LOAD_TYPE.IMAGE,mp3:n.LOAD_TYPE.AUDIO,ogg:n.LOAD_TYPE.AUDIO,wav:n.LOAD_TYPE.AUDIO,mp4:n.LOAD_TYPE.VIDEO,webm:n.LOAD_TYPE.VIDEO},n._xhrTypeMap={xhtml:n.XHR_RESPONSE_TYPE.DOCUMENT,html:n.XHR_RESPONSE_TYPE.DOCUMENT,htm:n.XHR_RESPONSE_TYPE.DOCUMENT,xml:n.XHR_RESPONSE_TYPE.DOCUMENT,tmx:n.XHR_RESPONSE_TYPE.DOCUMENT,svg:n.XHR_RESPONSE_TYPE.DOCUMENT,tsx:n.XHR_RESPONSE_TYPE.DOCUMENT,gif:n.XHR_RESPONSE_TYPE.BLOB,png:n.XHR_RESPONSE_TYPE.BLOB,bmp:n.XHR_RESPONSE_TYPE.BLOB,jpg:n.XHR_RESPONSE_TYPE.BLOB,jpeg:n.XHR_RESPONSE_TYPE.BLOB,tif:n.XHR_RESPONSE_TYPE.BLOB,tiff:n.XHR_RESPONSE_TYPE.BLOB,webp:n.XHR_RESPONSE_TYPE.BLOB,tga:n.XHR_RESPONSE_TYPE.BLOB,avif:n.XHR_RESPONSE_TYPE.BLOB,json:n.XHR_RESPONSE_TYPE.JSON,text:n.XHR_RESPONSE_TYPE.TEXT,txt:n.XHR_RESPONSE_TYPE.TEXT,ttf:n.XHR_RESPONSE_TYPE.BUFFER,otf:n.XHR_RESPONSE_TYPE.BUFFER},n.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var T=function(t,e){this.data=t,this.callback=e},g=function(){function t(t,e){var r=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=E,this.unsaturated=E,this.empty=E,this.drain=E,this.error=E,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,i){if(i&&"function"!=typeof i)throw new Error("task callback must be a function");if(r.started=!0,null==t&&r.idle())setTimeout((function(){return r.drain()}),1);else{var s=new T(t,"function"==typeof i?i:E);e?r._tasks.unshift(s):r._tasks.push(s),setTimeout(r.process,1)}},this.process=function(){for(;!r.paused&&r.workers>2,s[1]=(3&i[0])<<4|i[1]>>4,s[2]=(15&i[1])<<2|i[2]>>6,s[3]=63&i[2],r-(t.length-1)){case 2:s[3]=64,s[2]=64;break;case 1:s[3]=64}for(o=0;o\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["SignalBinding","fn","once","thisArg","this","_fn","_once","_thisArg","_next","_prev","_owner","prototype","detach","_addSignalBinding","self","node","_head","_tail","useXdr","Signal","undefined","handlers","exists","ee","push","has","Error","dispatch","args","_i","arguments","length","apply","add","detachAll","parseUri","str","opts","o","key","q","name","parser","strict","loose","m","strictMode","exec","uri","i","replace","_t0","t1","t2","LoaderResource","STATUS_FLAGS","TYPE","LOAD_TYPE","XHR_RESPONSE_TYPE","tempAnchor","_noop","setExtMap","map","extname","val","indexOf","substring","reqType","xhr","toString","onlyOnce","callFn","url","options","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_boundOnTimeout","_boundXhrOnError","_boundXhrOnTimeout","_boundXhrOnAbort","_boundXhrOnLoad","_flags","_setFlag","DATA_URL","extension","_getExtension","data","crossOrigin","timeout","loadType","_determineLoadType","xhrType","metadata","error","children","type","UNKNOWN","progressChunk","complete","bind","_onError","_onProgress","_onTimeout","_xhrOnError","_xhrOnTimeout","_xhrOnAbort","_xhrOnLoad","onStart","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","Object","defineProperty","get","_hasFlag","COMPLETE","LOADING","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","_this","isLoading","isComplete","setTimeout","_determineCrossOrigin","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","globalThis","XDomainRequest","XMLHttpRequest","_loadXdr","_loadXhr","flag","value","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","Array","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","withCredentials","open","JSON","DOCUMENT","responseType","TEXT","send","mime","source","event","target","nodeName","lengthComputable","loaded","total","status","statusText","text","responseText","BUFFER","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parsedUrl","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","queryStart","hashStart","index","Math","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","avif","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","AsyncQueueItem","callback","AsyncQueue","worker","concurrency","workers","saturated","unsaturated","empty","drain","started","paused","_tasks","_insert","insertAtFront","idle","item","unshift","process","task","shift","_worker","buffer","kill","running","pause","resume","w","eachSeries","array","iterator","deferNext","len","next","err","queue","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","d","_loadResource","resources","_queue","onError","onLoad","_plugins","plugin","pre","use","_protected","_add","parentResource","_prepareUrl","parent","incompleteChildren","eachChunk","reset","k","res","_onStart","_onComplete","chunk","set","result","path","charAt","hash","slice","resource","dequeue","call","_onLoad","splice","destroy","shared","_shared","registerPlugin","extensions","ExtensionType","ref","handleByList","AppLoaderPlugin","init","assign","sharedLoader","loader","Application","TextureLoader","Texture","fromLoader","then","texture","catch","parsing","Blob","Url_1","URL","webkitURL","src_1","createObjectURL","blob","revokeObjectURL","getResponseHeader","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","encodeBinary","ParsingLoader"],"mappings":";;;;;;;gGAKAA,EAAA,WAkBI,SAAAA,EAAYC,EAAYC,EAAcC,QAAd,IAAAD,IAAAA,GAAY,GAEhCE,KAAKC,I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AAAA,WAAWnT,IACP6T,EACAwB"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/dist/esm/loaders.min.mjs b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.min.mjs new file mode 100644 index 0000000..2767295 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{extensions as t,ExtensionType as e,Texture as r}from"@pixi/core";var i=function(){function t(t,e,r){void 0===e&&(e=!1),this._fn=t,this._once=e,this._thisArg=r,this._next=this._prev=this._owner=null}return t.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},t}();function n(t,e){return t._head?(t._tail._next=e,e._prev=t._tail,t._tail=e):(t._head=e,t._tail=e),e._owner=t,e}var s,o=function(){function t(){this._head=this._tail=void 0}return t.prototype.handlers=function(t){void 0===t&&(t=!1);var e=this._head;if(t)return!!e;for(var r=[];e;)r.push(e),e=e._next;return r},t.prototype.has=function(t){if(!(t instanceof i))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return t._owner===this},t.prototype.dispatch=function(){for(var t=arguments,e=[],r=0;r0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2===(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var n=new DOMParser;this.data=n.parseFromString(r,"text/xml")}else{var s=document.createElement("div");s.innerHTML=r,this.data=s}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,h||(h=document.createElement("a")),h.href=t;var r=a(h.href,{strictMode:!0}),i=!r.port&&""===e.port||r.port===e.port,n=r.protocol?r.protocol+":":"";return r.host===e.hostname&&i&&n===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),n=t.indexOf("#"),s=Math.min(i>-1?i:t.length,n>-1?n:t.length);e=(t=t.substring(0,s)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}();function c(){}function _(t){return function(){for(var e=arguments,r=[],i=0;i>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(s=0;s\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["SignalBinding","fn","once","thisArg","this","_fn","_once","_thisArg","_next","_prev","_owner","prototype","detach","_addSignalBinding","self","node","_head","_tail","useXdr","Signal","undefined","handlers","exists","ee","push","has","Error","dispatch","args","_i","arguments","length","apply","add","detachAll","parseUri","str","opts","o","key","q","name","parser","strict","loose","m","strictMode","exec","uri","i","replace","_t0","t1","t2","tempAnchor","_noop","setExtMap","map","extname","val","indexOf","substring","reqType","xhr","toString","LoaderResource","url","options","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_boundOnTimeout","_boundXhrOnError","_boundXhrOnTimeout","_boundXhrOnAbort","_boundXhrOnLoad","_flags","_setFlag","STATUS_FLAGS","DATA_URL","extension","_getExtension","data","crossOrigin","timeout","loadType","_determineLoadType","xhrType","metadata","error","children","type","TYPE","UNKNOWN","progressChunk","complete","bind","_onError","_onProgress","_onTimeout","_xhrOnError","_xhrOnTimeout","_xhrOnAbort","_xhrOnLoad","onStart","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","Object","defineProperty","get","_hasFlag","COMPLETE","LOADING","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","_this","isLoading","isComplete","setTimeout","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","globalThis","XDomainRequest","XMLHttpRequest","_loadXdr","_loadXhr","flag","value","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","Array","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","withCredentials","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","mime","source","event","target","nodeName","lengthComputable","loaded","total","status","statusText","text","responseText","BUFFER","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parsedUrl","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","queryStart","hashStart","index","Math","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","onlyOnce","callFn","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","avif","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","AsyncQueueItem","callback","AsyncQueue","worker","concurrency","workers","saturated","unsaturated","empty","drain","started","paused","_tasks","_insert","insertAtFront","idle","item","unshift","process","task","shift","_worker","buffer","kill","running","pause","resume","w","eachSeries","array","iterator","deferNext","len","next","err","queue","rgxExtractUrlHash","Loader","baseUrl","progress","loading","defaultQueryString","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","d","_loadResource","resources","_queue","onError","onLoad","_plugins","plugin","pre","use","_protected","_add","parentResource","_prepareUrl","parent","incompleteChildren","eachChunk","reset","k","res","_onStart","_onComplete","chunk","set","result","path","charAt","hash","slice","resource","dequeue","call","_onLoad","splice","destroy","shared","_shared","registerPlugin","extensions","ExtensionType","ref","handleByList","AppLoaderPlugin","init","assign","sharedLoader","loader","Application","TextureLoader","Texture","fromLoader","then","texture","catch","parsing","Blob","Url_1","URL","webkitURL","src_1","createObjectURL","blob","revokeObjectURL","getResponseHeader","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","encodeBinary","ParsingLoader"],"mappings":";;;;;;;wEAKA,IAAAA,EAAA,WAkBI,SAAAA,EAAYC,EAAYC,EAAcC,QAAd,IAAAD,IAAAA,GAAY,GAEhCE,KAAKC,IAAMJ,EACXG,KAAKE,MAAQJ,EACbE,KAAKG,SAAWJ,EAChBC,KAAKI,MAAQJ,KAAKK,MAAQL,KAAKM,OAAS,KAUhD,OAPIV,EAAAW,UAAAC,OAAA,WAEI,OAAoB,OAAhBR,KAAKM,SACTN,KAAKM,OAAOE,OAAOR,OAEZ,IAEdJ,KAOD,SAASa,EAA0BC,EAAsBC,GAgBrD,OAdKD,EAAKE,OAONF,EAAKG,MAAMT,MAAQO,EACnBA,EAAKN,MAAQK,EAAKG,MAClBH,EAAKG,MAAQF,IAPbD,EAAKE,MAAQD,EACbD,EAAKG,MAAQF,GASjBA,EAAKL,OAASI,EAEPC,EAMX,IC7DIG,ED6DJC,EAAA,WAaI,SAAAA,IAEIf,KAAKY,MAAQZ,KAAKa,WAAQG,EAqJlC,OA5IID,EAAQR,UAAAU,SAAR,SAASC,QAAA,IAAAA,IAAAA,GAAc,GAEnB,IAAIP,EAAOX,KAAKY,MAEhB,GAAIM,EAAQ,QAASP,EAIrB,IAFA,IAAMQ,EAAK,GAEJR,GAEHQ,EAAGC,KAAKT,GACRA,EAAOA,EAAKP,MAGhB,OAAOe,GAQXJ,EAAGR,UAAAc,IAAH,SAAIV,GAEA,KAAMA,aAAgBf,GAElB,MAAM,IAAI0B,MAAM,+DAGpB,OAAOX,EAAKL,SAAWN,MAQ3Be,EAAAR,UAAAgB,SAAA,+BAAuBC,EAAA,GAAAC,EAAA,EAAdA,EAAc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IpD,OAAOJ,EDvCgDM,CAAa1C,EAAS5Q,IAAIiI,cAErE2I,EAAS7O,KAAO7B,EAAe8B,KAAK2C,WAGpCiM,EAAStP,KAAKuE,OAAS,WAEnB+K,EAAStP,KAAKuE,OAAS,KAEvBoI,MAkChBA,SA5DIA,IEVR,IAAAsF,EAAA,WAAA,SAAAA,KAMA,OAHWA,EAAAnS,UAA+BkQ,EAAcjD,OAE7CkF,EAAG/D,IAAG6C,EAChBkB,KCLDlC,EAAWnT,IACP6T,EACAwB"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs new file mode 100644 index 0000000..cf62222 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs @@ -0,0 +1,1938 @@ +/*! + * @pixi/loaders - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { extensions, ExtensionType, Texture } from '@pixi/core'; +import { deprecation } from '@pixi/utils'; + +/* jshint -W097 */ +/** + * @memberof PIXI + */ +var SignalBinding = /** @class */ (function () { + /** + * SignalBinding constructor. + * @constructs SignalBinding + * @param {Function} fn - Event handler to be called. + * @param {boolean} [once=false] - Should this listener be removed after dispatch + * @param {object} [thisArg] - The context of the callback function. + * @api private + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function SignalBinding(fn, once, thisArg) { + if (once === void 0) { once = false; } + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + SignalBinding.prototype.detach = function () { + if (this._owner === null) + { return false; } + this._owner.detach(this); + return true; + }; + return SignalBinding; +}()); +/** + * @param self + * @param node + * @private + */ +function _addSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } + else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + node._owner = self; + return node; +} +/** + * @memberof PIXI + */ +var Signal = /** @class */ (function () { + /** + * MiniSignal constructor. + * @example + * let mySignal = new Signal(); + * let binding = mySignal.add(onSignal); + * mySignal.dispatch('foo', 'bar'); + * mySignal.detach(binding); + */ + function Signal() { + this._head = this._tail = undefined; + } + /** + * Return an array of attached SignalBinding. + * @param {boolean} [exists=false] - We only need to know if there are handlers. + * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true + * @api public + */ + Signal.prototype.handlers = function (exists) { + if (exists === void 0) { exists = false; } + var node = this._head; + if (exists) + { return !!node; } + var ee = []; + while (node) { + ee.push(node); + node = node._next; + } + return ee; + }; + /** + * Return true if node is a SignalBinding attached to this MiniSignal + * @param {PIXI.SignalBinding} node - Node to check. + * @returns {boolean} True if node is attache to mini-signal + */ + Signal.prototype.has = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.'); + } + return node._owner === this; + }; + /** + * Dispaches a signal to all registered listeners. + * @param {...any} args + * @returns {boolean} Indication if we've emitted an event. + */ + Signal.prototype.dispatch = function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + var node = this._head; + if (!node) + { return false; } + while (node) { + if (node._once) + { this.detach(node); } + node._fn.apply(node._thisArg, args); + node = node._next; + } + return true; + }; + /** + * Register a new listener. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.add = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, false, thisArg)); + }; + /** + * Register a new listener that will be executed only once. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + Signal.prototype.once = function (fn, thisArg) { + if (thisArg === void 0) { thisArg = null; } + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addSignalBinding(this, new SignalBinding(fn, true, thisArg)); + }; + /** + * Remove binding object. + * @param {PIXI.SignalBinding} node - The binding node that will be removed. + * @returns {Signal} The instance on which this method was called. + @api public */ + Signal.prototype.detach = function (node) { + if (!(node instanceof SignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.'); + } + if (node._owner !== this) + { return this; } // todo: or error? + if (node._prev) + { node._prev._next = node._next; } + if (node._next) + { node._next._prev = node._prev; } + if (node === this._head) { // first node + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } + else if (node === this._tail) { // last node + this._tail = node._prev; + this._tail._next = null; + } + node._owner = null; + return this; + }; + /** + * Detach all listeners. + * @returns {Signal} The instance on which this method was called. + */ + Signal.prototype.detachAll = function () { + var node = this._head; + if (!node) + { return this; } + this._head = this._tail = null; + while (node) { + node._owner = null; + node = node._next; + } + return this; + }; + return Signal; +}()); + +/** + * function from npm package `parseUri`, converted to TS to avoid leftpad incident + * @param {string} str + * @param [opts] - options + * @param {boolean} [opts.strictMode] - type of parser + */ +function parseUri(str, opts) { + opts = opts || {}; + var o = { + // eslint-disable-next-line max-len + key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + // eslint-disable-next-line max-len + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + // eslint-disable-next-line max-len + 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 (_t0, t1, t2) { + if (t1) + { uri[o.q.name][t1] = t2; } + }); + return uri; +} + +// tests if CORS is supported in XHR, if not we need to use XDR +var useXdr; +var tempAnchor = null; +// some status constants +var STATUS_NONE = 0; +var STATUS_OK = 200; +var STATUS_EMPTY = 204; +var STATUS_IE_BUG_EMPTY = 1223; +var STATUS_TYPE_OK = 2; +// noop +function _noop$1() { } +/** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * @ignore + * @param map - The map to set on. + * @param extname - The extension (or key) to set. + * @param val - The value to set. + */ +function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + if (!extname) { + return; + } + map[extname] = val; +} +/** + * Quick helper to get string xhr type. + * @ignore + * @param xhr - The request to check. + * @returns The type. + */ +function reqType(xhr) { + return xhr.toString().replace('object ', ''); +} +/** + * Manages the state and loading of a resource and all child resources. + * + * Can be extended in `GlobalMixins.LoaderResource`. + * @memberof PIXI + */ +var LoaderResource = /** @class */ (function () { + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware + * and the Resource object. + */ + function LoaderResource(name, url, options) { + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * @private + * @member {Function} + */ + this._dequeue = _noop$1; + /** + * Used a storage place for the on load binding used privately by the loader. + * @private + * @member {Function} + */ + this._onLoadBinding = null; + /** + * The timer for element loads to check if they timeout. + * @private + */ + this._elementTimer = 0; + /** + * The `complete` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundComplete = null; + /** + * The `_onError` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnError = null; + /** + * The `_onProgress` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnProgress = null; + /** + * The `_onTimeout` function bound to this resource's context. + * @private + * @type {Function} + */ + this._boundOnTimeout = null; + this._boundXhrOnError = null; + this._boundXhrOnTimeout = null; + this._boundXhrOnAbort = null; + this._boundXhrOnLoad = null; + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + options = options || {}; + this._flags = 0; + // set data url flag, needs to be set early for some _determineX checks to work. + this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + this.name = name; + this.url = url; + this.extension = this._getExtension(); + this.data = null; + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + this.timeout = options.timeout || 0; + this.loadType = options.loadType || this._determineLoadType(); + // The type used to load the resource via XHR. If unset, determined automatically. + this.xhrType = options.xhrType; + // Extra info for middleware, and controlling specifics about how the resource loads. + // Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + // Meaning it will modify it as it sees fit. + this.metadata = options.metadata || {}; + // The error that occurred while loading (if any). + this.error = null; + // The XHR object that was used to load this resource. This is only set + // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`. + this.xhr = null; + // The child resources this resource owns. + this.children = []; + // The resource type. + this.type = LoaderResource.TYPE.UNKNOWN; + // The progress chunk owned by this resource. + this.progressChunk = 0; + // The `dequeue` method that will be used a storage place for the async queue dequeue method + // used privately by the loader. + this._dequeue = _noop$1; + // Used a storage place for the on load binding used privately by the loader. + this._onLoadBinding = null; + // The timer for element loads to check if they timeout. + this._elementTimer = 0; + this._boundComplete = this.complete.bind(this); + this._boundOnError = this._onError.bind(this); + this._boundOnProgress = this._onProgress.bind(this); + this._boundOnTimeout = this._onTimeout.bind(this); + // xhr callbacks + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + // Dispatched when the resource beings to load. + this.onStart = new Signal(); + // Dispatched each time progress of this resource load updates. + // Not all resources types and loader systems can support this event + // so sometimes it may not be available. If the resource + // is being loaded on a modern browser, using XHR, and the remote server + // properly sets Content-Length headers, then this will be available. + this.onProgress = new Signal(); + // Dispatched once this resource has loaded, if there was an error it will + // be in the `error` property. + this.onComplete = new Signal(); + // Dispatched after this resource has had all the *after* middleware run on it. + this.onAfterMiddleware = new Signal(); + } + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to. + */ + LoaderResource.setExtensionLoadType = function (extname, loadType) { + setExtMap(LoaderResource._loadTypeMap, extname, loadType); + }; + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + LoaderResource.setExtensionXhrType = function (extname, xhrType) { + setExtMap(LoaderResource._xhrTypeMap, extname, xhrType); + }; + Object.defineProperty(LoaderResource.prototype, "isDataUrl", { + /** + * When the resource starts to load. + * @memberof PIXI.LoaderResource + * @callback OnStartSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * When the resource reports loading progress. + * @memberof PIXI.LoaderResource + * @callback OnProgressSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + /** + * When the resource finishes loading. + * @memberof PIXI.LoaderResource + * @callback OnCompleteSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * @memberof PIXI.LoaderResource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + /** + * Stores whether or not this url is a data url. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isComplete", { + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LoaderResource.prototype, "isLoading", { + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * @readonly + * @member {boolean} + */ + get: function () { + return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING); + }, + enumerable: false, + configurable: true + }); + /** Marks the resource as complete. */ + LoaderResource.prototype.complete = function () { + this._clearEvents(); + this._finish(); + }; + /** + * Aborts the loading of this resource, with an optional message. + * @param {string} message - The message to use for the error + */ + LoaderResource.prototype.abort = function (message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } + // store error + this.error = new Error(message); + // clear events before calling aborts + this._clearEvents(); + // abort the actual loading + if (this.xhr) { + this.xhr.abort(); + } + else if (this.xdr) { + this.xdr.abort(); + } + else if (this.data) { + // single source + if (this.data.src) { + this.data.src = LoaderResource.EMPTY_GIF; + } + // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } + // done now. + this._finish(); + }; + /** + * Kicks off loading of this resource. This method is asynchronous. + * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + LoaderResource.prototype.load = function (cb) { + var _this = this; + if (this.isLoading) { + return; + } + if (this.isComplete) { + if (cb) { + setTimeout(function () { return cb(_this); }, 1); + } + return; + } + else if (cb) { + this.onComplete.once(cb); + } + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true); + this.onStart.dispatch(this); + // if unset, determine the value + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + switch (this.loadType) { + case LoaderResource.LOAD_TYPE.IMAGE: + this.type = LoaderResource.TYPE.IMAGE; + this._loadElement('image'); + break; + case LoaderResource.LOAD_TYPE.AUDIO: + this.type = LoaderResource.TYPE.AUDIO; + this._loadSourceElement('audio'); + break; + case LoaderResource.LOAD_TYPE.VIDEO: + this.type = LoaderResource.TYPE.VIDEO; + this._loadSourceElement('video'); + break; + case LoaderResource.LOAD_TYPE.XHR: + /* falls through */ + default: + if (typeof useXdr === 'undefined') { + useXdr = !!(globalThis.XDomainRequest && !('withCredentials' in (new XMLHttpRequest()))); + } + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } + else { + this._loadXhr(); + } + break; + } + }; + /** + * Checks if the flag is set. + * @param flag - The flag to check. + * @returns True if the flag is set. + */ + LoaderResource.prototype._hasFlag = function (flag) { + return (this._flags & flag) !== 0; + }; + /** + * (Un)Sets the flag. + * @param flag - The flag to (un)set. + * @param value - Whether to set or (un)set the flag. + */ + LoaderResource.prototype._setFlag = function (flag, value) { + this._flags = value ? (this._flags | flag) : (this._flags & ~flag); + }; + /** Clears all the events from the underlying loading source. */ + LoaderResource.prototype._clearEvents = function () { + clearTimeout(this._elementTimer); + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } + else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + }; + /** Finalizes the load. */ + LoaderResource.prototype._finish = function () { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true); + this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false); + this.onComplete.dispatch(this); + }; + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * @private + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'image' && typeof globalThis.Image !== 'undefined') { + this.data = new Image(); + } + else { + this.data = document.createElement(type); + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * @param type - The type of element to use. + */ + LoaderResource.prototype._loadSourceElement = function (type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } + else if (type === 'audio' && typeof globalThis.Audio !== 'undefined') { + this.data = new Audio(); + } + else { + this.data = document.createElement(type); + } + if (this.data === null) { + this.abort("Unsupported element: " + type); + return; + } + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } + else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } + else { + var mimeTypes = this.metadata.mimeType; + this.data.appendChild(this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)); + } + } + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + this.data.load(); + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + }; + /** Loads this resources using an XMLHttpRequest. */ + LoaderResource.prototype._loadXhr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xhr = this.xhr = new XMLHttpRequest(); + // send credentials when crossOrigin with credentials requested + if (this.crossOrigin === 'use-credentials') { + xhr.withCredentials = true; + } + // set the request type and url + xhr.open('GET', this.url, true); + xhr.timeout = this.timeout; + // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON + || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT; + } + else { + xhr.responseType = this.xhrType; + } + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + xhr.send(); + }; + /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */ + LoaderResource.prototype._loadXdr = function () { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + var xdr = this.xhr = new globalThis.XDomainRequest(); // eslint-disable-line no-undef + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + xdr.open('GET', this.url, true); + // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + setTimeout(function () { return xdr.send(); }, 1); + }; + /** + * Creates a source used in loading via an element. + * @param type - The element type (video or audio). + * @param url - The source URL to load from. + * @param [mime] - The mime type of the video + * @returns The source element. + */ + LoaderResource.prototype._createSource = function (type, url, mime) { + if (!mime) { + mime = type + "/" + this._getExtension(url); + } + var source = document.createElement('source'); + source.src = url; + source.type = mime; + return source; + }; + /** + * Called if a load errors out. + * @param event - The error event from the element that emits it. + */ + LoaderResource.prototype._onError = function (event) { + this.abort("Failed to load element using: " + event.target.nodeName); + }; + /** + * Called if a load progress event fires for an element or xhr/xdr. + * @param event - Progress event. + */ + LoaderResource.prototype._onProgress = function (event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + }; + /** Called if a timeout event fires for an element. */ + LoaderResource.prototype._onTimeout = function () { + this.abort("Load timed out."); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnError = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); + }; + /** Called if an error event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnTimeout = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request timed out."); + }; + /** Called if an abort event fires for xhr/xdr. */ + LoaderResource.prototype._xhrOnAbort = function () { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request was aborted by the user."); + }; + /** Called when data successfully loads from an xhr/xdr request. */ + LoaderResource.prototype._xhrOnLoad = function () { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + // responseText is accessible only if responseType is '' or 'text' and on older browsers + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } + // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + var statusType = (status / 100) | 0; + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = LoaderResource.TYPE.TEXT; + } + // if json, parse into json object + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = LoaderResource.TYPE.JSON; + } + catch (e) { + this.abort("Error trying to parse loaded json: " + e); + return; + } + } + // if xml, parse into an xml document or div element + else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (globalThis.DOMParser) { + var domparser = new DOMParser(); + this.data = domparser.parseFromString(text, 'text/xml'); + } + else { + var div = document.createElement('div'); + div.innerHTML = text; + this.data = div; + } + this.type = LoaderResource.TYPE.XML; + } + catch (e$1) { + this.abort("Error trying to parse loaded xml: " + e$1); + return; + } + } + // other types just return the response + else { + this.data = xhr.response || text; + } + } + else { + this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); + return; + } + this.complete(); + }; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * @private + * @param url - The url to test. + * @param [loc=globalThis.location] - The location object to test against. + * @returns The crossOrigin value to use (or empty string for none). + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + LoaderResource.prototype._determineCrossOrigin = function (url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match globalThis.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + if (globalThis.origin !== globalThis.location.origin) { + return 'anonymous'; + } + // default is globalThis.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + var parsedUrl = parseUri(tempAnchor.href, { strictMode: true }); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + var protocol = parsedUrl.protocol ? parsedUrl.protocol + ":" : ''; + // if cross origin + if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; + }; + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use. + */ + LoaderResource.prototype._determineXhrType = function () { + return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT; + }; + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use. + */ + LoaderResource.prototype._determineLoadType = function () { + return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR; + }; + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * @param [url] - url to parse, `this.url` by default. + * @returns The extension. + */ + LoaderResource.prototype._getExtension = function (url) { + if (url === void 0) { url = this.url; } + var ext = ''; + if (this.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(); + }; + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * @param type - The type to get a mime type for. + * @private + * @returns The mime type to use. + */ + LoaderResource.prototype._getMimeFromXhrType = function (type) { + switch (type) { + case LoaderResource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + case LoaderResource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + case LoaderResource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT: + case LoaderResource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + default: + return 'text/plain'; + } + }; + return LoaderResource; +}()); +// eslint-disable-next-line @typescript-eslint/no-namespace +(function (LoaderResource) { + (function (STATUS_FLAGS) { + /** None */ + STATUS_FLAGS[STATUS_FLAGS["NONE"] = 0] = "NONE"; + /** Data URL */ + STATUS_FLAGS[STATUS_FLAGS["DATA_URL"] = 1] = "DATA_URL"; + /** Complete */ + STATUS_FLAGS[STATUS_FLAGS["COMPLETE"] = 2] = "COMPLETE"; + /** Loading */ + STATUS_FLAGS[STATUS_FLAGS["LOADING"] = 4] = "LOADING"; + })(LoaderResource.STATUS_FLAGS || (LoaderResource.STATUS_FLAGS = {})); + (function (TYPE) { + /** Unknown */ + TYPE[TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + /** JSON */ + TYPE[TYPE["JSON"] = 1] = "JSON"; + /** XML */ + TYPE[TYPE["XML"] = 2] = "XML"; + /** Image */ + TYPE[TYPE["IMAGE"] = 3] = "IMAGE"; + /** Audio */ + TYPE[TYPE["AUDIO"] = 4] = "AUDIO"; + /** Video */ + TYPE[TYPE["VIDEO"] = 5] = "VIDEO"; + /** Plain text */ + TYPE[TYPE["TEXT"] = 6] = "TEXT"; + })(LoaderResource.TYPE || (LoaderResource.TYPE = {})); + (function (LOAD_TYPE) { + /** Uses XMLHttpRequest to load the resource. */ + LOAD_TYPE[LOAD_TYPE["XHR"] = 1] = "XHR"; + /** Uses an `Image` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["IMAGE"] = 2] = "IMAGE"; + /** Uses an `Audio` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["AUDIO"] = 3] = "AUDIO"; + /** Uses a `Video` object to load the resource. */ + LOAD_TYPE[LOAD_TYPE["VIDEO"] = 4] = "VIDEO"; + })(LoaderResource.LOAD_TYPE || (LoaderResource.LOAD_TYPE = {})); + (function (XHR_RESPONSE_TYPE) { + /** string */ + XHR_RESPONSE_TYPE["DEFAULT"] = "text"; + /** ArrayBuffer */ + XHR_RESPONSE_TYPE["BUFFER"] = "arraybuffer"; + /** Blob */ + XHR_RESPONSE_TYPE["BLOB"] = "blob"; + /** Document */ + XHR_RESPONSE_TYPE["DOCUMENT"] = "document"; + /** Object */ + XHR_RESPONSE_TYPE["JSON"] = "json"; + /** String */ + XHR_RESPONSE_TYPE["TEXT"] = "text"; + })(LoaderResource.XHR_RESPONSE_TYPE || (LoaderResource.XHR_RESPONSE_TYPE = {})); + LoaderResource._loadTypeMap = { + // images + gif: LoaderResource.LOAD_TYPE.IMAGE, + png: LoaderResource.LOAD_TYPE.IMAGE, + bmp: LoaderResource.LOAD_TYPE.IMAGE, + jpg: LoaderResource.LOAD_TYPE.IMAGE, + jpeg: LoaderResource.LOAD_TYPE.IMAGE, + tif: LoaderResource.LOAD_TYPE.IMAGE, + tiff: LoaderResource.LOAD_TYPE.IMAGE, + webp: LoaderResource.LOAD_TYPE.IMAGE, + tga: LoaderResource.LOAD_TYPE.IMAGE, + avif: LoaderResource.LOAD_TYPE.IMAGE, + svg: LoaderResource.LOAD_TYPE.IMAGE, + 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, + // audio + mp3: LoaderResource.LOAD_TYPE.AUDIO, + ogg: LoaderResource.LOAD_TYPE.AUDIO, + wav: LoaderResource.LOAD_TYPE.AUDIO, + // videos + mp4: LoaderResource.LOAD_TYPE.VIDEO, + webm: LoaderResource.LOAD_TYPE.VIDEO, + }; + LoaderResource._xhrTypeMap = { + // xml + xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT, + // images + gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + png: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB, + // json + json: LoaderResource.XHR_RESPONSE_TYPE.JSON, + // text + text: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT, + // fonts + ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER, + }; + // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + LoaderResource.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; +})(LoaderResource || (LoaderResource = {})); + +/** + * Smaller version of the async library constructs. + * @ignore + */ +function _noop() { +} +/** + * Ensures a function is only called once. + * @ignore + * @param {Function} fn - The function to wrap. + * @returns {Function} The wrapping function. + */ +function onlyOnce(fn) { + return function onceWrapper() { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + if (fn === null) { + throw new Error('Callback was already called.'); + } + var callFn = fn; + fn = null; + callFn.apply(this, args); + }; +} +/** + * @private + * @memberof PIXI + */ +var AsyncQueueItem = /** @class */ (function () { + /** + * @param data + * @param callback + * @private + */ + function AsyncQueueItem(data, callback) { + this.data = data; + this.callback = callback; + } + return AsyncQueueItem; +}()); +/** + * @private + * @memberof PIXI + */ +var AsyncQueue = /** @class */ (function () { + /** + * @param worker + * @param concurrency + * @private + */ + function AsyncQueue(worker, concurrency) { + var _this = this; + if (concurrency === void 0) { concurrency = 1; } + this.workers = 0; + this.saturated = _noop; + this.unsaturated = _noop; + this.empty = _noop; + this.drain = _noop; + this.error = _noop; + this.started = false; + this.paused = false; + this._tasks = []; + this._insert = function (data, insertAtFront, callback) { + if (callback && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + _this.started = true; + // eslint-disable-next-line no-eq-null,eqeqeq + if (data == null && _this.idle()) { + // call drain immediately if there are no tasks + setTimeout(function () { return _this.drain(); }, 1); + return; + } + var item = new AsyncQueueItem(data, typeof callback === 'function' ? callback : _noop); + if (insertAtFront) { + _this._tasks.unshift(item); + } + else { + _this._tasks.push(item); + } + setTimeout(_this.process, 1); + }; + this.process = function () { + while (!_this.paused && _this.workers < _this.concurrency && _this._tasks.length) { + var task = _this._tasks.shift(); + if (_this._tasks.length === 0) { + _this.empty(); + } + _this.workers += 1; + if (_this.workers === _this.concurrency) { + _this.saturated(); + } + _this._worker(task.data, onlyOnce(_this._next(task))); + } + }; + this._worker = worker; + if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + this.concurrency = concurrency; + this.buffer = concurrency / 4.0; + } + /** + * @param task + * @private + */ + AsyncQueue.prototype._next = function (task) { + var _this = this; + return function () { + var arguments$1 = arguments; + + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments$1[_i]; + } + _this.workers -= 1; + task.callback.apply(task, args); + // eslint-disable-next-line no-eq-null,eqeqeq + if (args[0] != null) { + _this.error(args[0], task.data); + } + if (_this.workers <= (_this.concurrency - _this.buffer)) { + _this.unsaturated(); + } + if (_this.idle()) { + _this.drain(); + } + _this.process(); + }; + }; + // That was in object + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.push = function (data, callback) { + this._insert(data, false, callback); + }; + AsyncQueue.prototype.kill = function () { + this.workers = 0; + this.drain = _noop; + this.started = false; + this._tasks = []; + }; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + AsyncQueue.prototype.unshift = function (data, callback) { + this._insert(data, true, callback); + }; + 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; + // Need to call this.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= this.concurrency; w++) { + this.process(); + } + }; + /** + * Iterates an array in series. + * @param {Array.<*>} array - Array to iterate. + * @param {Function} iterator - Function to call for each element. + * @param {Function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + AsyncQueue.eachSeries = function (array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + return; + } + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } + else { + iterator(array[i++], next); + } + } + next(); + }; + /** + * Async queue implementation, + * @param {Function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @returns {*} The async queue object. + */ + AsyncQueue.queue = function (worker, concurrency) { + return new AsyncQueue(worker, concurrency); + }; + return AsyncQueue; +}()); + +// some constants +var MAX_PROGRESS = 100; +var rgxExtractUrlHash = /(#[\w-]+)?$/; +/** + * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * // or + * const loader = new PIXI.Loader(); // You can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * @memberof PIXI + */ +var Loader = /** @class */ (function () { + /** + * @param baseUrl - The base url for all resources loaded by this loader. + * @param concurrency - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + var _this = this; + if (baseUrl === void 0) { baseUrl = ''; } + if (concurrency === void 0) { concurrency = 10; } + /** The progress percent of the loader going through the queue. */ + this.progress = 0; + /** Loading state of the loader, true if it is currently loading resources. */ + this.loading = false; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + */ + this.defaultQueryString = ''; + /** The middleware to run before loading each resource. */ + this._beforeMiddleware = []; + /** The middleware to run after loading each resource. */ + this._afterMiddleware = []; + /** The tracks the resources we are currently completing parsing for. */ + this._resourcesParsing = []; + /** + * The `_loadResource` function bound with this object context. + * @param r - The resource to load + * @param d - The dequeue function + */ + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + /** All the resources for this loader keyed by name. */ + this.resources = {}; + this.baseUrl = baseUrl; + this._beforeMiddleware = []; + this._afterMiddleware = []; + this._resourcesParsing = []; + this._boundLoadResource = function (r, d) { return _this._loadResource(r, d); }; + this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency); + this._queue.pause(); + this.resources = {}; + this.onProgress = new Signal(); + this.onError = new Signal(); + this.onLoad = new Signal(); + this.onStart = new Signal(); + this.onComplete = new Signal(); + for (var i = 0; i < Loader._plugins.length; ++i) { + var plugin = Loader._plugins[i]; + var pre = plugin.pre, use = plugin.use; + if (pre) { + this.pre(pre); + } + if (use) { + this.use(use); + } + } + this._protected = false; + } + /** + * Same as add, params have strict order + * @private + * @param name - The name of the resource to load. + * @param url - The url for this resource, relative to the baseUrl of this loader. + * @param options - The options for the load. + * @param callback - Function to call when this specific resource completes loading. + * @returns The loader itself. + */ + Loader.prototype._add = function (name, url, options, callback) { + // if loading already you can only add resources that have a parent. + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } + // check if resource already exists. + if (this.resources[name]) { + throw new Error("Resource named \"" + name + "\" already exists."); + } + // add base url if this isn't an absolute url + url = this._prepareUrl(url); + // create the store the resource + this.resources[name] = new LoaderResource(name, url, options); + if (typeof callback === 'function') { + this.resources[name].onAfterMiddleware.once(callback); + } + // if actively loading, make sure to adjust progress chunks for that parent and its children + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + for (var i = 0; i < parent.children.length; ++i) { + if (!parent.children[i].isComplete) { + incompleteChildren.push(parent.children[i]); + } + } + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + for (var i = 0; i < incompleteChildren.length; ++i) { + incompleteChildren[i].progressChunk = eachChunk; + } + this.resources[name].progressChunk = eachChunk; + } + // add the resource to the queue + this._queue.push(this.resources[name]); + return this; + }; + /* eslint-enable require-jsdoc,valid-jsdoc */ + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.pre = function (fn) { + this._beforeMiddleware.push(fn); + return this; + }; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + Loader.prototype.use = function (fn) { + this._afterMiddleware.push(fn); + return this; + }; + /** + * Resets the queue of the loader to prepare for a new load. + * @returns The loader itself. + */ + Loader.prototype.reset = function () { + this.progress = 0; + this.loading = false; + this._queue.kill(); + this._queue.pause(); + // abort all resource loads + for (var k in this.resources) { + var res = this.resources[k]; + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + if (res.isLoading) { + res.abort('loader reset'); + } + } + this.resources = {}; + return this; + }; + /** + * Starts loading the queued resources. + * @param cb - Optional callback that will be bound to the `complete` event. + * @returns The loader itself. + */ + Loader.prototype.load = function (cb) { + deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.'); + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } + // if the queue has already started we are done here + if (this.loading) { + return this; + } + if (this._queue.idle()) { + this._onStart(); + this._onComplete(); + } + else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } + // notify we are starting + this._onStart(); + // start loading + this._queue.resume(); + } + return this; + }; + Object.defineProperty(Loader.prototype, "concurrency", { + /** + * The number of resources to load concurrently. + * @default 10 + */ + get: function () { + return this._queue.concurrency; + }, + set: function (concurrency) { + this._queue.concurrency = concurrency; + }, + enumerable: false, + configurable: true + }); + /** + * Prepares a url for usage based on the configuration of this object + * @param url - The url to prepare. + * @returns The prepared url. + */ + Loader.prototype._prepareUrl = function (url) { + var parsedUrl = parseUri(url, { strictMode: true }); + var result; + // absolute url, just use it as is. + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } + // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length + && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 + && url.charAt(0) !== '/') { + result = this.baseUrl + "/" + url; + } + else { + result = this.baseUrl + url; + } + // if we need to add a default querystring, there is a bit more work + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + result = result.slice(0, result.length - hash.length); + if (result.indexOf('?') !== -1) { + result += "&" + this.defaultQueryString; + } + else { + result += "?" + this.defaultQueryString; + } + result += hash; + } + return result; + }; + /** + * Loads a single resource. + * @param resource - The resource to load. + * @param dequeue - The function to call when we need to dequeue this item. + */ + Loader.prototype._loadResource = function (resource, dequeue) { + var _this = this; + resource._dequeue = dequeue; + // run before middleware + AsyncQueue.eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this._onLoad(resource); + } + else { + resource._onLoadBinding = resource.onComplete.once(_this._onLoad, _this); + resource.load(); + } + }, true); + }; + /** Called once loading has started. */ + Loader.prototype._onStart = function () { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + }; + /** Called once each resource has loaded. */ + Loader.prototype._onComplete = function () { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + }; + /** + * Called each time a resources is loaded. + * @param resource - The resource that was loaded + */ + Loader.prototype._onLoad = function (resource) { + var _this = this; + resource._onLoadBinding = null; + // remove this resource from the async queue, and add it to our list of resources that are being parsed + this._resourcesParsing.push(resource); + resource._dequeue(); + // run all the after middleware for this resource + AsyncQueue.eachSeries(this._afterMiddleware, function (fn, next) { + 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); + // do completion check + if (_this._queue.idle() && _this._resourcesParsing.length === 0) { + _this._onComplete(); + } + }, true); + }; + /** Destroy the loader, removes references. */ + Loader.prototype.destroy = function () { + if (!this._protected) { + this.reset(); + } + }; + Object.defineProperty(Loader, "shared", { + /** A premade instance of the loader that can be used to load resources. */ + get: function () { + var shared = Loader._shared; + if (!shared) { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + return shared; + }, + enumerable: false, + configurable: true + }); + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param plugin - The plugin to add + * @returns Reference to PIXI.Loader for chaining + */ + Loader.registerPlugin = function (plugin) { + deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.'); + extensions.add({ + type: ExtensionType.Loader, + ref: plugin, + }); + return Loader; + }; + Loader._plugins = []; + return Loader; +}()); +extensions.handleByList(ExtensionType.Loader, Loader._plugins); +Loader.prototype.add = function add(name, url, options, callback) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + return this; + } + // if an object is passed instead of params + if (typeof name === 'object') { + options = name; + callback = url || options.callback || options.onComplete; + url = options.url; + name = options.name || options.key || options.url; + } + // case where no name is passed shift all args over by one. + if (typeof url !== 'string') { + callback = options; + options = url; + url = name; + } + // now that we shifted make sure we have a proper url. + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } + // options are optional so people might pass a function and no options + if (typeof options === 'function') { + callback = options; + options = null; + } + return this._add(name, url, options, callback); +}; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {extensions} from '@pixi/core'; + * extensions.add(AppLoaderPlugin); + * @memberof PIXI + */ +var AppLoaderPlugin = /** @class */ (function () { + function AppLoaderPlugin() { + } + /** + * Called on application constructor + * @param options + * @private + */ + AppLoaderPlugin.init = function (options) { + options = Object.assign({ + sharedLoader: false, + }, options); + this.loader = options.sharedLoader ? Loader.shared : new Loader(); + }; + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function () { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + }; + /** @ignore */ + AppLoaderPlugin.extension = ExtensionType.Application; + return AppLoaderPlugin; +}()); + +/** + * Loader plugin for handling Texture resources. + * @memberof PIXI + */ +var TextureLoader = /** @class */ (function () { + function TextureLoader() { + } + /** Handle SVG elements a text, render with SVGResource. */ + TextureLoader.add = function () { + LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR); + LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT); + }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param resource + * @param {Function} next + */ + TextureLoader.use = function (resource, next) { + // create a new texture if the data is an Image object + if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg')) { + var data = resource.data, url = resource.url, name = resource.name, metadata = resource.metadata; + Texture.fromLoader(data, url, name, metadata).then(function (texture) { + resource.texture = texture; + next(); + }) + // TODO: handle errors in Texture.fromLoader + // so we can pass them to the Loader + .catch(next); + } + else { + next(); + } + }; + /** @ignore */ + TextureLoader.extension = ExtensionType.Loader; + return TextureLoader; +}()); + +var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +/** + * Encodes binary into base64. + * @function encodeBinary + * @param {string} input - The input data to encode. + * @returns {string} The encoded base64 string + */ +function encodeBinary(input) { + var output = ''; + var inx = 0; + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } + else { + bytebuffer[jnx] = 0; + } + } + // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + encodedCharIndexes[0] = bytebuffer[0] >> 2; + // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4); + // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6); + // index 3: forth 6 bits (6 least significant bits from input byte 3) + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; + // Determine whether padding happened, and adjust accordingly + var paddingBytes = inx - (input.length - 1); + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + } + // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + for (var jnx = 0; jnx < encodedCharIndexes.length; ++jnx) { + output += _keyStr.charAt(encodedCharIndexes[jnx]); + } + } + return output; +} + +/** + * A middleware for transforming XHR loaded Blobs into more useful objects + * @ignore + * @function parsing + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.parsing); + * @param resource - Current Resource + * @param next - Callback when complete + */ +function parsing(resource, next) { + if (!resource.data) { + next(); + return; + } + // if this was an XHR load of a blob + if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!self.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); + // this is an image, convert the binary string into a data url + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); + resource.type = LoaderResource.TYPE.IMAGE; + // wait until the image loads and then callback + resource.data.onload = function () { + resource.data.onload = null; + next(); + }; + // next will be called on load + return; + } + } + // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var Url_1 = globalThis.URL || globalThis.webkitURL; + var src_1 = Url_1.createObjectURL(resource.data); + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src_1; + resource.type = LoaderResource.TYPE.IMAGE; + // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + resource.data.onload = function () { + Url_1.revokeObjectURL(src_1); + resource.data.onload = null; + next(); + }; + // next will be called on load. + return; + } + } + next(); +} + +/** + * Parse any blob into more usable objects (e.g. Image). + * @memberof PIXI + */ +var ParsingLoader = /** @class */ (function () { + function ParsingLoader() { + } + /** @ignore */ + ParsingLoader.extension = ExtensionType.Loader; + ParsingLoader.use = parsing; + return ParsingLoader; +}()); + +extensions.add(TextureLoader, ParsingLoader); + +export { AppLoaderPlugin, Loader, LoaderResource, TextureLoader }; +//# sourceMappingURL=loaders.mjs.map diff --git a/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs.map b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs.map new file mode 100644 index 0000000..1c12d6d --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/dist/esm/loaders.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"loaders.mjs","sources":["../../src/base/Signal.ts","../../src/base/parseUri.ts","../../src/LoaderResource.ts","../../src/base/AsyncQueue.ts","../../src/Loader.ts","../../src/AppLoaderPlugin.ts","../../src/TextureLoader.ts","../../src/base/encodeBinary.ts","../../src/middleware/parsing.ts","../../src/ParsingLoader.ts","../../src/index.ts"],"sourcesContent":["/* jshint -W097 */\n\n/**\n * @memberof PIXI\n */\nexport class SignalBinding\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @param self\n * @param node\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n * @param {boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n * @param {...any} args\n * @returns {boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","import type { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nlet useXdr: boolean;\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n * @ignore\n * @param xhr - The request to check.\n * @returns The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /** The element to use for loading, instead of creating one. */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /** used by parsing middleware */\n blob?: Blob;\n\n /**\n * The name of this resource.\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /** The data that was loaded by the resource. */\n data: any;\n /** Is this request cross-origin? If unset, determined automatically. */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n * @private\n * @member {Function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n * @private\n * @member {Function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n * @private\n * @type {Function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /** Marks the resource as complete. */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (typeof useXdr === 'undefined')\n {\n useXdr = !!((globalThis as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\n }\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n * @param flag - The flag to check.\n * @returns True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /** Clears all the events from the underlying loading source. */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /** Finalizes the load. */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof globalThis.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof globalThis.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /** Loads this resources using an XMLHttpRequest. */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // send credentials when crossOrigin with credentials requested\n if (this.crossOrigin === 'use-credentials')\n {\n xhr.withCredentials = true;\n }\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (globalThis as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @returns The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /** Called if a timeout event fires for an element. */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /** Called if an error event fires for xhr/xdr. */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /** Called if an abort event fires for xhr/xdr. */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /** Called when data successfully loads from an xhr/xdr request. */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (globalThis.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\n /**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * @private\n * @param url - The url to test.\n * @param [loc=globalThis.location] - The location object to test against.\n * @returns The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match globalThis.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (globalThis.origin !== globalThis.location.origin)\n {\n return 'anonymous';\n }\n\n // default is globalThis.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n * @private\n * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n * @param [url] - url to parse, `this.url` by default.\n * @returns The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n * @param type - The type to get a mime type for.\n * @private\n * @returns The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource\n{\n /**\n * When the resource starts to load.\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {PIXI.Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** None */\n NONE = 0,\n /** Data URL */\n DATA_URL = (1 << 0),\n /** Complete */\n COMPLETE = (1 << 1),\n /** Loading */\n LOADING = (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Unknown */\n UNKNOWN = 0,\n /** JSON */\n JSON = 1,\n /** XML */\n XML = 2,\n /** Image */\n IMAGE = 3,\n /** Audio */\n AUDIO = 4,\n /** Video */\n VIDEO = 5,\n /** Plain text */\n TEXT = 6,\n }\n\n /**\n * The types of loading a resource can use.\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE\n // eslint-disable-next-line @typescript-eslint/indent\n {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n avif: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n avif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {Function} fn - The function to wrap.\n * @returns {Function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue\n{\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @param data\n * @param callback\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @param worker\n * @param concurrency\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @param task\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n * @param {Array.<*>} array - Array to iterate.\n * @param {Function} iterator - Function to call for each element.\n * @param {Function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n * @param {Function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @returns {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IResourceMetadata } from './LoaderResource';\nimport { LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport type { Dict } from '@pixi/utils';\nimport { deprecation } from '@pixi/utils';\nimport { extensions, ExtensionType } from '@pixi/core';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd\n{\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n * @see Loader#add\n * @property {string} name - The name of the resource to load, if not passed the url is used.\n * @property {string} key - Alias for `name`.\n * @property {string} url - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer\n * than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded?\n * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data\n * being loaded be interpreted when using XHR?\n * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener.\n * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`.\n * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions\n{\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * // or\n * const loader = new PIXI.Loader(); // You can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n * @memberof PIXI\n */\nclass Loader\n{\n /** The base url for all resources loaded by this loader. */\n baseUrl: string;\n\n /** The progress percent of the loader going through the queue. */\n progress = 0;\n\n /** Loading state of the loader, true if it is currently loading resources. */\n loading = false;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n */\n defaultQueryString = '';\n\n /** The middleware to run before loading each resource. */\n private _beforeMiddleware: Array = [];\n\n /** The middleware to run after loading each resource. */\n private _afterMiddleware: Array = [];\n\n /** The tracks the resources we are currently completing parsing for. */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n * @param r - The resource to load\n * @param d - The dequeue function\n */\n private _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /** The resources waiting to be loaded. */\n private _queue: AsyncQueue;\n\n /** All the resources for this loader keyed by name. */\n resources: Dict = {};\n\n /** Dispatched once per loaded or errored resource. */\n onProgress: Signal;\n\n /** Dispatched once per errored resource. */\n onError: Signal;\n\n /** Dispatched once per loaded resource. */\n onLoad: Signal;\n\n /** Dispatched when the loader begins to process the queue. */\n onStart: Signal;\n\n /** Dispatched when the queued resources all load. */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @returns The loader itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n * @param fn - The middleware function to register.\n * @returns The loader itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n * @returns The loader itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param cb - Optional callback that will be bound to the `complete` event.\n * @returns The loader itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // #if _DEBUG\n deprecation('6.5.0', '@pixi/loaders is being replaced with @pixi/assets in the next major release.');\n // #endif\n\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @returns The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.slice(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n * @param resource - The resource to load.\n * @param dequeue - The function to call when we need to dequeue this item.\n */\n private _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /** Called once loading has started. */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /** Called once each resource has loaded. */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /** Destroy the loader, removes references. */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /** A premade instance of the loader that can be used to load resources. */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Use the {@link PIXI.extensions.add} API to register plugins.\n * @deprecated since 6.5.0\n * @param plugin - The plugin to add\n * @returns Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n // #if _DEBUG\n deprecation('6.5.0', 'Loader.registerPlugin() is deprecated, use extensions.add() instead.');\n // #endif\n\n extensions.add({\n type: ExtensionType.Loader,\n ref: plugin,\n });\n\n return Loader;\n }\n}\n\nextensions.handleByList(ExtensionType.Loader, Loader._plugins);\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n * @property {Function} add - Function to call immediate after registering plugin.\n * @property {Function} pre - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property {Function} use - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin\n{\n /** Function to call immediate after registering plugin. */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param {LoaderResource} resource - resource\n * @param {LoaderResource} next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\nimport { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {extensions} from '@pixi/core';\n * extensions.add(AppLoaderPlugin);\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @readonly\n */\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType, Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n /** Handle SVG elements a text, render with SVGResource. */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {Function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const Url = globalThis.URL || globalThis.webkitURL;\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n}\n","import { parsing } from './middleware';\nimport type { ExtensionMetadata } from '@pixi/core';\nimport { ExtensionType } from '@pixi/core';\n\n/**\n * Parse any blob into more usable objects (e.g. Image).\n * @memberof PIXI\n */\nclass ParsingLoader\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Loader;\n\n static use = parsing;\n}\n\nexport { ParsingLoader };\n","export * from './AppLoaderPlugin';\nexport * from './LoaderResource';\nexport * from './Loader';\nexport * from './TextureLoader';\n\nimport { ParsingLoader } from './ParsingLoader';\nimport { TextureLoader } from './TextureLoader';\nimport { extensions } from '@pixi/core';\n\nextensions.add(\n TextureLoader,\n ParsingLoader\n);\n"],"names":["arguments","_noop","e"],"mappings":";;;;;;;;;;AAAA;AAEA;;AAEG;AACH,IAAA,aAAA,kBAAA,YAAA;AASI;;;;;;;AAOG;;AAEH,IAAA,SAAA,aAAA,CAAY,EAAU,EAAE,IAAY,EAAE,OAAY,EAAA;AAA1B,QAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAAY,GAAA,KAAA,CAAA,EAAA;AAEhC,QAAA,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;AACd,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;AACxB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,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C,MAAM,GAAG,IAAI,CAAC;AAE5B,gBAAA,IAAI,EAAE,CAAC;AACX,aAAC,CAAC;;YAGF,OAAO;AACV,SAAA;AACJ,KAAA;AAED,IAAA,IAAI,EAAE,CAAC;AACX;;AC3EA;;;AAGG;AACH,IAAA,aAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,aAAA,GAAA;KAMC;;AAHU,IAAA,aAAA,CAAA,SAAS,GAAsB,aAAa,CAAC,MAAM,CAAC;IAEpD,aAAG,CAAA,GAAA,GAAG,OAAO,CAAC;IACzB,OAAC,aAAA,CAAA;AAAA,CAND,EAMC,CAAA;;ACLD,UAAU,CAAC,GAAG,CACV,aAAa,EACb,aAAa,CAChB;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/loaders/global.d.ts b/live2d/node_modules/@pixi/loaders/global.d.ts new file mode 100644 index 0000000..fdb725c --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/global.d.ts @@ -0,0 +1,31 @@ +declare namespace GlobalMixins +{ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface LoaderResource + { + /** Texture reference for loading images and other textures. */ + texture?: Texture; + } + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface IResourceMetadata + { + + } + + /** @deprecated Use LoaderResource instead */ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface ILoaderResource + { + + } + + interface Application + { + loader: import('@pixi/loaders').Loader; + } + + interface IApplicationOptions + { + sharedLoader?: boolean; + } +} diff --git a/live2d/node_modules/@pixi/loaders/index.d.ts b/live2d/node_modules/@pixi/loaders/index.d.ts new file mode 100644 index 0000000..4ce3314 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/index.d.ts @@ -0,0 +1,984 @@ +/// + +import type { Dict } from '@pixi/utils'; +import type { ExtensionMetadata } from '@pixi/core'; +import type { IBaseTextureOptions } from '@pixi/core'; +import type { Texture } from '@pixi/core'; + +/** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {extensions} from '@pixi/core'; + * extensions.add(AppLoaderPlugin); + * @memberof PIXI + */ +export declare class AppLoaderPlugin { + /** @ignore */ + static extension: ExtensionMetadata; + /** + * Loader instance to help with asset loading. + * @memberof PIXI.Application# + * @readonly + */ + static loader: Loader; + /** + * Called on application constructor + * @param options + * @private + */ + static init(options?: GlobalMixins.IApplicationOptions): void; + /** + * Called when application destroyed + * @private + */ + static destroy(): void; +} + +/** + * Options for a call to `.add()`. + * @see Loader#add + * @property {string} name - The name of the resource to load, if not passed the url is used. + * @property {string} key - Alias for `name`. + * @property {string} url - The url for this resource, relative to the baseUrl of this loader. + * @property {string|boolean} crossOrigin - Is this request cross-origin? Default is to determine automatically. + * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes longer + * than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @property {LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource be loaded? + * @property {LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How should the data + * being loaded be interpreted when using XHR? + * @property {LoaderResource.OnCompleteSignal} onComplete - Callback to add an an onComplete signal istener. + * @property {LoaderResource.OnCompleteSignal} callback - Alias for `onComplete`. + * @property {IResourceMetadata} metadata - Extra configuration for middleware and the Resource object. + */ +export declare interface IAddOptions { + name?: string; + key?: string; + url?: string; + crossOrigin?: string | boolean; + timeout?: number; + parentResource?: LoaderResource; + loadType?: LoaderResource.LOAD_TYPE; + xhrType?: LoaderResource.XHR_RESPONSE_TYPE; + onComplete?: LoaderResource.OnCompleteSignal; + callback?: LoaderResource.OnCompleteSignal; + metadata?: IResourceMetadata; +} + +export declare interface ILoaderAdd { + (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader; + (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader; + (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader; + (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader; + (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader; + (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader; +} + +export declare type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void; + +/** + * Plugin to be installed for handling specific Loader resources. + * @property {Function} add - Function to call immediate after registering plugin. + * @property {Function} pre - Middleware function to run before load, the + * arguments for this are `(resource, next)` + * @property {Function} use - Middleware function to run after load, the + * arguments for this are `(resource, next)` + */ +export declare interface ILoaderPlugin { + /** Function to call immediate after registering plugin. */ + add?(): void; + /** + * Middleware function to run before load + * @param {LoaderResource} resource - resource + * @param {LoaderResource} next - next middleware + */ + pre?(resource: LoaderResource, next: (...args: any[]) => void): void; + /** + * Middleware function to run after load + * @param {LoaderResource} resource - resource + * @param {LoaderResource} next - next middleware + */ + use?(resource: LoaderResource, next: (...args: any[]) => void): void; +} + +/** @deprecated - Use LoaderResource instead */ +export declare type ILoaderResource = LoaderResource; + +/** + * Metadata for loader resource. It is very messy way to pass options for loader middlewares + * + * Can be extended in `GlobalMixins.IResourceMetadata` + * @memberof PIXI + */ +export declare interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions { + /** The element to use for loading, instead of creating one. */ + loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement; + /** + * Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + */ + skipSource?: boolean; + /** + * The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + mimeType?: string | string[]; + /** + * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for + * metadata when loading the child image. + */ + imageMetadata?: IResourceMetadata; +} + +/** + * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * // or + * const loader = new PIXI.Loader(); // You can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * @memberof PIXI + */ +export declare class Loader { + /** The base url for all resources loaded by this loader. */ + baseUrl: string; + /** The progress percent of the loader going through the queue. */ + progress: number; + /** Loading state of the loader, true if it is currently loading resources. */ + loading: boolean; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + */ + defaultQueryString: string; + /** The middleware to run before loading each resource. */ + private _beforeMiddleware; + /** The middleware to run after loading each resource. */ + private _afterMiddleware; + /** The tracks the resources we are currently completing parsing for. */ + private _resourcesParsing; + /** + * The `_loadResource` function bound with this object context. + * @param r - The resource to load + * @param d - The dequeue function + */ + private _boundLoadResource; + /** The resources waiting to be loaded. */ + private _queue; + /** All the resources for this loader keyed by name. */ + resources: Dict; + /** Dispatched once per loaded or errored resource. */ + onProgress: Signal; + /** Dispatched once per errored resource. */ + onError: Signal; + /** Dispatched once per loaded resource. */ + onLoad: Signal; + /** Dispatched when the loader begins to process the queue. */ + onStart: Signal; + /** Dispatched when the queued resources all load. */ + onComplete: Signal; + /** + * @param baseUrl - The base url for all resources loaded by this loader. + * @param concurrency - The number of resources to load concurrently. + */ + constructor(baseUrl?: string, concurrency?: number); + /** + * Adds a resource (or multiple resources) to the loader queue. + * + * This function can take a wide variety of different parameters. The only thing that is always + * required the url to load. All the following will work: + * + * ```js + * loader + * // normal param syntax + * .add('key', 'http://...', function () {}) + * .add('http://...', function () {}) + * .add('http://...') + * + * // object syntax + * .add({ + * name: 'key2', + * url: 'http://...' + * }, function () {}) + * .add({ + * url: 'http://...' + * }, function () {}) + * .add({ + * name: 'key3', + * url: 'http://...' + * onComplete: function () {} + * }) + * .add({ + * url: 'https://...', + * onComplete: function () {}, + * crossOrigin: true + * }) + * + * // you can also pass an array of objects or urls or both + * .add([ + * { name: 'key4', url: 'http://...', onComplete: function () {} }, + * { url: 'http://...', onComplete: function () {} }, + * 'http://...' + * ]) + * + * // and you can use both params and options + * .add('key', 'http://...', { crossOrigin: true }, function () {}) + * .add('http://...', { crossOrigin: true }, function () {}); + * ``` + */ + add: ILoaderAdd; + /** + * Same as add, params have strict order + * @private + * @param name - The name of the resource to load. + * @param url - The url for this resource, relative to the baseUrl of this loader. + * @param options - The options for the load. + * @param callback - Function to call when this specific resource completes loading. + * @returns The loader itself. + */ + protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this; + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + pre(fn: ILoaderMiddleware): this; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * @param fn - The middleware function to register. + * @returns The loader itself. + */ + use(fn: ILoaderMiddleware): this; + /** + * Resets the queue of the loader to prepare for a new load. + * @returns The loader itself. + */ + reset(): this; + /** + * Starts loading the queued resources. + * @param cb - Optional callback that will be bound to the `complete` event. + * @returns The loader itself. + */ + load(cb?: Loader.OnCompleteSignal): this; + /** + * The number of resources to load concurrently. + * @default 10 + */ + get concurrency(): number; + set concurrency(concurrency: number); + /** + * Prepares a url for usage based on the configuration of this object + * @param url - The url to prepare. + * @returns The prepared url. + */ + private _prepareUrl; + /** + * Loads a single resource. + * @param resource - The resource to load. + * @param dequeue - The function to call when we need to dequeue this item. + */ + private _loadResource; + /** Called once loading has started. */ + private _onStart; + /** Called once each resource has loaded. */ + private _onComplete; + /** + * Called each time a resources is loaded. + * @param resource - The resource that was loaded + */ + private _onLoad; + static _plugins: Array; + private static _shared; + /** + * If this loader cannot be destroyed. + * @default false + */ + private _protected; + /** Destroy the loader, removes references. */ + destroy(): void; + /** A premade instance of the loader that can be used to load resources. */ + static get shared(): Loader; + /** + * Use the {@link PIXI.extensions.add} API to register plugins. + * @deprecated since 6.5.0 + * @param plugin - The plugin to add + * @returns Reference to PIXI.Loader for chaining + */ + static registerPlugin(plugin: ILoaderPlugin): typeof Loader; +} + +export declare namespace Loader { + /** + * When the resource starts to load. + * @param resource - The resource that the event happened on. + */ + export type OnStartSignal = (loader: Loader) => void; + /** + * When the progress changes the loader and resource are dispatched. + * @param loader - The loader the progress is advancing on. + * @param resource - The resource that has completed or failed to cause the progress to advance. + */ + export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void; + /** + * When a load completes without error the loader and resource are dispatched. + * @param loader - The loader that has started loading resources. + * @param resource - The resource that has completed. + */ + export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void; + /** + * When the loader starts loading resources it dispatches this callback. + * @param loader - The loader that has started loading resources. + */ + export type OnCompleteSignal = (loader: Loader, resources: Dict) => void; + /** + * When an error occurs the loader and resource are dispatched. + * @param loader - The loader the error happened in. + * @param resource - The resource that caused the error. + */ + export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void; +} + +export declare interface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource { +} + +/** + * Manages the state and loading of a resource and all child resources. + * + * Can be extended in `GlobalMixins.LoaderResource`. + * @memberof PIXI + */ +export declare class LoaderResource { + /** + * Texture reference for loading images and other textures. + * @type {PIXI.Texture} + */ + texture?: Texture; + /** used by parsing middleware */ + blob?: Blob; + /** + * The name of this resource. + * @readonly + * @type {string} + */ + readonly name: string; + /** + * The url used to load this resource. + * @readonly + * @type {string} + */ + readonly url: string; + /** + * The extension used to load this resource. + * @readonly + * @type {string} + */ + readonly extension: string; + /** The data that was loaded by the resource. */ + data: any; + /** Is this request cross-origin? If unset, determined automatically. */ + crossOrigin: string | boolean; + /** + * A timeout in milliseconds for the load. If the load takes longer than this time + * it is cancelled and the load is considered a failure. If this value is set to `0` + * then there is no explicit timeout. + * @type {number} + */ + timeout: number; + /** + * The method of loading to use for this resource. + * @type {PIXI.LoaderResource.LOAD_TYPE} + */ + loadType: LoaderResource.LOAD_TYPE; + /** + * The type used to load the resource via XHR. If unset, determined automatically. + * @member {string} + */ + xhrType: string; + /** + * Extra info for middleware, and controlling specifics about how the resource loads. + * + * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + * Meaning it will modify it as it sees fit. + * @type {PIXI.IResourceMetadata} + */ + metadata: IResourceMetadata; + /** + * The error that occurred while loading (if any). + * @readonly + * @member {Error} + */ + error: Error; + /** + * The XHR object that was used to load this resource. This is only set + * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`. + * @readonly + */ + xhr: XMLHttpRequest; + private xdr; + /** + * The child resources this resource owns. + * @type {PIXI.LoaderResource[]} + */ + readonly children: LoaderResource[]; + /** + * The resource type. + * @readonly + * @type {PIXI.LoaderResource.TYPE} + */ + type: LoaderResource.TYPE; + /** + * The progress chunk owned by this resource. + * @readonly + * @member {number} + */ + progressChunk: number; + /** + * Dispatched when the resource beings to load. + * + * The callback looks like {@link LoaderResource.OnStartSignal}. + * @type {PIXI.Signal} + */ + onStart: Signal; + /** + * Dispatched each time progress of this resource load updates. + * Not all resources types and loader systems can support this event + * so sometimes it may not be available. If the resource + * is being loaded on a modern browser, using XHR, and the remote server + * properly sets Content-Length headers, then this will be available. + * + * The callback looks like {@link LoaderResource.OnProgressSignal}. + * @type {PIXI.Signal} + */ + onProgress: Signal; + /** + * Dispatched once this resource has loaded, if there was an error it will + * be in the `error` property. + * + * The callback looks like {@link LoaderResource.OnCompleteSignal}. + * @type {PIXI.Signal} + */ + onComplete: Signal; + /** + * Dispatched after this resource has had all the *after* middleware run on it. + * + * The callback looks like {@link LoaderResource.OnCompleteSignal}. + * @type {PIXI.Signal} + */ + onAfterMiddleware: Signal; + /** + * The state flags of this resource. + * @private + * @member {number} + */ + private _flags; + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * @private + * @member {Function} + */ + _dequeue: any; + /** + * Used a storage place for the on load binding used privately by the loader. + * @private + * @member {Function} + */ + _onLoadBinding: any; + /** + * The timer for element loads to check if they timeout. + * @private + */ + private _elementTimer; + /** + * The `complete` function bound to this resource's context. + * @private + * @type {Function} + */ + private _boundComplete; + /** + * The `_onError` function bound to this resource's context. + * @private + * @type {Function} + */ + private _boundOnError; + /** + * The `_onProgress` function bound to this resource's context. + * @private + * @type {Function} + */ + private _boundOnProgress; + /** + * The `_onTimeout` function bound to this resource's context. + * @private + * @type {Function} + */ + private _boundOnTimeout; + private _boundXhrOnError; + private _boundXhrOnTimeout; + private _boundXhrOnAbort; + private _boundXhrOnLoad; + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to. + */ + static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void; + /** + * Sets the load type to be used for a specific extension. + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void; + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware + * and the Resource object. + */ + constructor(name: string, url: string | string[], options?: { + crossOrigin?: string | boolean; + timeout?: number; + loadType?: LoaderResource.LOAD_TYPE; + xhrType?: LoaderResource.XHR_RESPONSE_TYPE; + metadata?: IResourceMetadata; + }); + /** + * When the resource starts to load. + * @memberof PIXI.LoaderResource + * @callback OnStartSignal@callback OnStartSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * When the resource reports loading progress. + * @memberof PIXI.LoaderResource + * @callback OnProgressSignal@callback OnProgressSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + /** + * When the resource finishes loading. + * @memberof PIXI.LoaderResource + * @callback OnCompleteSignal@callback OnCompleteSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + /** + * @memberof PIXI.LoaderResource + * @typedef {object} IMetadata@typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + /** + * Stores whether or not this url is a data url. + * @readonly + * @member {boolean} + */ + get isDataUrl(): boolean; + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * @readonly + * @member {boolean} + */ + get isComplete(): boolean; + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * @readonly + * @member {boolean} + */ + get isLoading(): boolean; + /** Marks the resource as complete. */ + complete(): void; + /** + * Aborts the loading of this resource, with an optional message. + * @param {string} message - The message to use for the error + */ + abort(message: string): void; + /** + * Kicks off loading of this resource. This method is asynchronous. + * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + load(cb?: LoaderResource.OnCompleteSignal): void; + /** + * Checks if the flag is set. + * @param flag - The flag to check. + * @returns True if the flag is set. + */ + private _hasFlag; + /** + * (Un)Sets the flag. + * @param flag - The flag to (un)set. + * @param value - Whether to set or (un)set the flag. + */ + private _setFlag; + /** Clears all the events from the underlying loading source. */ + private _clearEvents; + /** Finalizes the load. */ + private _finish; + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * @private + * @param type - The type of element to use. + */ + _loadElement(type: string): void; + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * @param type - The type of element to use. + */ + private _loadSourceElement; + /** Loads this resources using an XMLHttpRequest. */ + private _loadXhr; + /** Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). */ + private _loadXdr; + /** + * Creates a source used in loading via an element. + * @param type - The element type (video or audio). + * @param url - The source URL to load from. + * @param [mime] - The mime type of the video + * @returns The source element. + */ + private _createSource; + /** + * Called if a load errors out. + * @param event - The error event from the element that emits it. + */ + private _onError; + /** + * Called if a load progress event fires for an element or xhr/xdr. + * @param event - Progress event. + */ + private _onProgress; + /** Called if a timeout event fires for an element. */ + private _onTimeout; + /** Called if an error event fires for xhr/xdr. */ + private _xhrOnError; + /** Called if an error event fires for xhr/xdr. */ + private _xhrOnTimeout; + /** Called if an abort event fires for xhr/xdr. */ + private _xhrOnAbort; + /** Called when data successfully loads from an xhr/xdr request. */ + private _xhrOnLoad; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * @private + * @param url - The url to test. + * @param [loc=globalThis.location] - The location object to test against. + * @returns The crossOrigin value to use (or empty string for none). + */ + _determineCrossOrigin(url: string, loc?: any): string; + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use. + */ + private _determineXhrType; + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * @private + * @returns {PIXI.LoaderResource.LOAD_TYPE} The loadType to use. + */ + private _determineLoadType; + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * @param [url] - url to parse, `this.url` by default. + * @returns The extension. + */ + private _getExtension; + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * @param type - The type to get a mime type for. + * @private + * @returns The mime type to use. + */ + _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string; +} + +export declare namespace LoaderResource { + /** + * When the resource starts to load. + * @memberof PIXI.LoaderResource + * @callback OnStartSignal@callback OnStartSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + export type OnStartSignal = (resource: LoaderResource) => void; + /** + * When the resource reports loading progress. + * @memberof PIXI.LoaderResource + * @callback OnProgressSignal@callback OnProgressSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void; + /** + * When the resource finishes loading. + * @memberof PIXI.LoaderResource + * @callback OnCompleteSignal@callback OnCompleteSignal + * @param {PIXI.Resource} resource - The resource that the event happened on. + */ + export type OnCompleteSignal = (resource: LoaderResource) => void; + /** + * The types of resources a resource could represent. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + export enum STATUS_FLAGS { + /** None */ + NONE = 0, + /** Data URL */ + DATA_URL = 1, + /** Complete */ + COMPLETE = 2, + /** Loading */ + LOADING = 4 + } + /** + * The types of resources a resource could represent. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + export enum TYPE { + /** Unknown */ + UNKNOWN = 0, + /** JSON */ + JSON = 1, + /** XML */ + XML = 2, + /** Image */ + IMAGE = 3, + /** Audio */ + AUDIO = 4, + /** Video */ + VIDEO = 5, + /** Plain text */ + TEXT = 6 + } + /** + * The types of loading a resource can use. + * @static + * @readonly + * @enum {number} + * @memberof PIXI.LoaderResource + */ + export enum LOAD_TYPE { + /** Uses XMLHttpRequest to load the resource. */ + XHR = 1, + /** Uses an `Image` object to load the resource. */ + IMAGE = 2, + /** Uses an `Audio` object to load the resource. */ + AUDIO = 3, + /** Uses a `Video` object to load the resource. */ + VIDEO = 4 + } + /** + * The XHR ready states, used internally. + * @static + * @readonly + * @enum {string} + * @memberof PIXI.LoaderResource + */ + export enum XHR_RESPONSE_TYPE { + /** string */ + DEFAULT = "text", + /** ArrayBuffer */ + BUFFER = "arraybuffer", + /** Blob */ + BLOB = "blob", + /** Document */ + DOCUMENT = "document", + /** Object */ + JSON = "json", + /** String */ + TEXT = "text" + } + const _loadTypeMap: Dict; + const _xhrTypeMap: Dict; + const EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="; +} + +/** + * @memberof PIXI + */ +declare class Signal void> { + _head: SignalBinding; + _tail: SignalBinding; + /** + * MiniSignal constructor. + * @example + * let mySignal = new Signal(); + * let binding = mySignal.add(onSignal); + * mySignal.dispatch('foo', 'bar'); + * mySignal.detach(binding); + */ + constructor(); + /** + * Return an array of attached SignalBinding. + * @param {boolean} [exists=false] - We only need to know if there are handlers. + * @returns {PIXI.SignalBinding[] | boolean} Array of attached SignalBinding or Boolean if called with exists = true + * @api public + */ + handlers(exists?: boolean): Array> | boolean; + /** + * Return true if node is a SignalBinding attached to this MiniSignal + * @param {PIXI.SignalBinding} node - Node to check. + * @returns {boolean} True if node is attache to mini-signal + */ + has(node: SignalBinding): boolean; + /** + * Dispaches a signal to all registered listeners. + * @param {...any} args + * @returns {boolean} Indication if we've emitted an event. + */ + dispatch(...args: any[]): boolean; + /** + * Register a new listener. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + add(fn: CbType, thisArg?: any): SignalBinding; + /** + * Register a new listener that will be executed only once. + * @param {Function} fn - Callback function. + * @param {object} [thisArg] - The context of the callback function. + * @returns {PIXI.SignalBinding} The SignalBinding node that was added. + */ + once(fn: CbType, thisArg?: any): SignalBinding; + /** + * Remove binding object. + * @param {PIXI.SignalBinding} node - The binding node that will be removed. + * @returns {Signal} The instance on which this method was called. + @api public */ + detach(node: SignalBinding): this; + /** + * Detach all listeners. + * @returns {Signal} The instance on which this method was called. + */ + detachAll(): this; +} + +/** + * @memberof PIXI + */ +declare class SignalBinding { + _fn: any; + _once: boolean; + _next: SignalBinding; + _prev: SignalBinding; + _owner: Signal; + _thisArg: any; + /** + * SignalBinding constructor. + * @constructs SignalBinding + * @param {Function} fn - Event handler to be called. + * @param {boolean} [once=false] - Should this listener be removed after dispatch + * @param {object} [thisArg] - The context of the callback function. + * @api private + */ + constructor(fn: CbType, once: boolean, thisArg: any); + detach(): boolean; +} + +/** + * Loader plugin for handling Texture resources. + * @memberof PIXI + */ +export declare class TextureLoader { + /** @ignore */ + static extension: ExtensionMetadata; + /** Handle SVG elements a text, render with SVGResource. */ + static add(): void; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param resource + * @param {Function} next + */ + static use(resource: LoaderResource, next: (...args: any[]) => void): void; +} + +export { } diff --git a/live2d/node_modules/@pixi/loaders/package.json b/live2d/node_modules/@pixi/loaders/package.json new file mode 100644 index 0000000..436e112 --- /dev/null +++ b/live2d/node_modules/@pixi/loaders/package.json @@ -0,0 +1,46 @@ +{ + "name": "@pixi/loaders", + "version": "6.5.10", + "main": "dist/cjs/loaders.js", + "module": "dist/esm/loaders.mjs", + "bundle": "dist/browser/loaders.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/loaders.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/loaders.js" + } + } + }, + "description": "Load assets and resources", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/utils": "6.5.10" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/math/LICENSE b/live2d/node_modules/@pixi/math/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/math/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/README.md b/live2d/node_modules/@pixi/math/README.md new file mode 100644 index 0000000..9b143e3 --- /dev/null +++ b/live2d/node_modules/@pixi/math/README.md @@ -0,0 +1,13 @@ +# @pixi/math + +## Installation + +```bash +npm install @pixi/math +``` + +## Usage + +```js +import * as math from '@pixi/math'; +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/dist/browser/math.js b/live2d/node_modules/@pixi/math/dist/browser/math.js new file mode 100644 index 0000000..4d6d90a --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/browser/math.js @@ -0,0 +1,1664 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_math = (function (exports) { + 'use strict'; + + /** + * Two Pi. + * @static + * @member {number} + * @memberof PIXI + */ + var PI_2 = Math.PI * 2; + /** + * Conversion factor for converting radians to degrees. + * @static + * @member {number} RAD_TO_DEG + * @memberof PIXI + */ + var RAD_TO_DEG = 180 / Math.PI; + /** + * Conversion factor for converting degrees to radians. + * @static + * @member {number} + * @memberof PIXI + */ + var DEG_TO_RAD = Math.PI / 180; + /** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * @static + * @memberof PIXI + * @enum {number} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + */ + exports.SHAPES = void 0; + (function (SHAPES) { + SHAPES[SHAPES["POLY"] = 0] = "POLY"; + SHAPES[SHAPES["RECT"] = 1] = "RECT"; + SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; + SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; + SHAPES[SHAPES["RREC"] = 4] = "RREC"; + })(exports.SHAPES || (exports.SHAPES = {})); + + /** + * The Point object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis + * @class + * @memberof PIXI + * @implements {IPoint} + */ + var Point = /** @class */ (function () { + /** + * Creates a new `Point` + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function Point(x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + /** Position of the point on the x axis */ + this.x = 0; + /** Position of the point on the y axis */ + this.y = 0; + this.x = x; + this.y = y; + } + /** + * Creates a clone of this point + * @returns A clone of this point + */ + Point.prototype.clone = function () { + return new Point(this.x, this.y); + }; + /** + * Copies `x` and `y` from the given point into this point + * @param p - The point to copy from + * @returns The point instance itself + */ + Point.prototype.copyFrom = function (p) { + this.set(p.x, p.y); + return this; + }; + /** + * Copies this point's x and y into the given point (`p`). + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + Point.prototype.copyTo = function (p) { + p.set(this.x, this.y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + Point.prototype.equals = function (p) { + return (p.x === this.x) && (p.y === this.y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the `x` axis + * @param {number} [y=x] - position of the point on the `y` axis + * @returns The point instance itself + */ + Point.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + this.x = x; + this.y = y; + return this; + }; + Point.prototype.toString = function () { + return "[@pixi/math:Point x=" + this.x + " y=" + this.y + "]"; + }; + return Point; + }()); + + var tempPoints = [new Point(), new Point(), new Point(), new Point()]; + /** + * Size object, contains width and height + * @memberof PIXI + * @typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ + /** + * 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. + * @memberof PIXI + */ + var Rectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rectangle + * @param y - The Y coordinate of the upper-left corner of the rectangle + * @param width - The overall width of the rectangle + * @param height - The overall height of the rectangle + */ + function Rectangle(x, y, width, height) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this.x = Number(x); + this.y = Number(y); + this.width = Number(width); + this.height = Number(height); + this.type = exports.SHAPES.RECT; + } + Object.defineProperty(Rectangle.prototype, "left", { + /** Returns the left edge of the rectangle. */ + get: function () { + return this.x; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "right", { + /** Returns the right edge of the rectangle. */ + get: function () { + return this.x + this.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "top", { + /** Returns the top edge of the rectangle. */ + get: function () { + return this.y; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "bottom", { + /** Returns the bottom edge of the rectangle. */ + get: function () { + return this.y + this.height; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle, "EMPTY", { + /** A constant empty rectangle. */ + get: function () { + return new Rectangle(0, 0, 0, 0); + }, + enumerable: false, + configurable: true + }); + /** + * Creates a clone of this Rectangle + * @returns a copy of the rectangle + */ + Rectangle.prototype.clone = function () { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + /** + * Copies another rectangle to this one. + * @param rectangle - The rectangle to copy from. + * @returns Returns itself. + */ + Rectangle.prototype.copyFrom = function (rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + return this; + }; + /** + * Copies this rectangle to another one. + * @param rectangle - The rectangle to copy to. + * @returns Returns given parameter. + */ + Rectangle.prototype.copyTo = function (rectangle) { + rectangle.x = this.x; + rectangle.y = this.y; + rectangle.width = this.width; + rectangle.height = this.height; + return rectangle; + }; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Rectangle + */ + Rectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + return false; + }; + /** + * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object. + * Returns true only if the area of the intersection is >0, this means that Rectangles + * sharing a side are not overlapping. Another side effect is that an arealess rectangle + * (width or height equal to zero) can't intersect any other rectangle. + * @param {Rectangle} other - The Rectangle to intersect with `this`. + * @param {Matrix} transform - The transformation matrix of `other`. + * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`. + */ + Rectangle.prototype.intersects = function (other, transform) { + if (!transform) { + var x0_1 = this.x < other.x ? other.x : this.x; + var x1_1 = this.right > other.right ? other.right : this.right; + if (x1_1 <= x0_1) { + return false; + } + var y0_1 = this.y < other.y ? other.y : this.y; + var y1_1 = this.bottom > other.bottom ? other.bottom : this.bottom; + return y1_1 > y0_1; + } + var x0 = this.left; + var x1 = this.right; + var y0 = this.top; + var y1 = this.bottom; + if (x1 <= x0 || y1 <= y0) { + return false; + } + var lt = tempPoints[0].set(other.left, other.top); + var lb = tempPoints[1].set(other.left, other.bottom); + var rt = tempPoints[2].set(other.right, other.top); + var rb = tempPoints[3].set(other.right, other.bottom); + if (rt.x <= lt.x || lb.y <= lt.y) { + return false; + } + var s = Math.sign((transform.a * transform.d) - (transform.b * transform.c)); + if (s === 0) { + return false; + } + transform.apply(lt, lt); + transform.apply(lb, lb); + transform.apply(rt, rt); + transform.apply(rb, rb); + if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 + || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 + || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 + || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) { + return false; + } + var nx = s * (lb.y - lt.y); + var ny = s * (lt.x - lb.x); + var n00 = (nx * x0) + (ny * y0); + var n10 = (nx * x1) + (ny * y0); + var n01 = (nx * x0) + (ny * y1); + var n11 = (nx * x1) + (ny * y1); + if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y) + || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) { + return false; + } + var mx = s * (lt.y - rt.y); + var my = s * (rt.x - lt.x); + var m00 = (mx * x0) + (my * y0); + var m10 = (mx * x1) + (my * y0); + var m01 = (mx * x0) + (my * y1); + var m11 = (mx * x1) + (my * y1); + if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y) + || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) { + return false; + } + return true; + }; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + * @returns Returns itself. + */ + Rectangle.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + this.x -= paddingX; + this.y -= paddingY; + this.width += paddingX * 2; + this.height += paddingY * 2; + return this; + }; + /** + * Fits this rectangle around the passed one. + * @param rectangle - The rectangle to fit. + * @returns Returns itself. + */ + Rectangle.prototype.fit = function (rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + return this; + }; + /** + * Enlarges rectangle that way its corners lie on grid + * @param resolution - resolution + * @param eps - precision + * @returns Returns itself. + */ + Rectangle.prototype.ceil = function (resolution, eps) { + if (resolution === void 0) { resolution = 1; } + if (eps === void 0) { eps = 0.001; } + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + this.width = x2 - this.x; + this.height = y2 - this.y; + return this; + }; + /** + * Enlarges this rectangle to include the passed rectangle. + * @param rectangle - The rectangle to include. + * @returns Returns itself. + */ + Rectangle.prototype.enlarge = function (rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + return this; + }; + Rectangle.prototype.toString = function () { + return "[@pixi/math:Rectangle x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Rectangle; + }()); + + /** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ + var Circle = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this circle + * @param y - The Y coordinate of the center of this circle + * @param radius - The radius of the circle + */ + function Circle(x, y, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (radius === void 0) { radius = 0; } + this.x = x; + this.y = y; + this.radius = radius; + this.type = exports.SHAPES.CIRC; + } + /** + * Creates a clone of this Circle instance + * @returns A copy of the Circle + */ + Circle.prototype.clone = function () { + return new Circle(this.x, this.y, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this circle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Circle + */ + Circle.prototype.contains = function (x, y) { + if (this.radius <= 0) { + return false; + } + var r2 = this.radius * this.radius; + var dx = (this.x - x); + var dy = (this.y - y); + dx *= dx; + dy *= dy; + return (dx + dy <= r2); + }; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * @returns The framing rectangle + */ + Circle.prototype.getBounds = function () { + return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + Circle.prototype.toString = function () { + return "[@pixi/math:Circle x=" + this.x + " y=" + this.y + " radius=" + this.radius + "]"; + }; + return Circle; + }()); + + /** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ + var Ellipse = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this ellipse + * @param y - The Y coordinate of the center of this ellipse + * @param halfWidth - The half width of this ellipse + * @param halfHeight - The half height of this ellipse + */ + function Ellipse(x, y, halfWidth, halfHeight) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (halfWidth === void 0) { halfWidth = 0; } + if (halfHeight === void 0) { halfHeight = 0; } + this.x = x; + this.y = y; + this.width = halfWidth; + this.height = halfHeight; + this.type = exports.SHAPES.ELIP; + } + /** + * Creates a clone of this Ellipse instance + * @returns {PIXI.Ellipse} A copy of the ellipse + */ + Ellipse.prototype.clone = function () { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coords are within this ellipse + */ + Ellipse.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + // normalize the coords to an ellipse with center 0,0 + var normx = ((x - this.x) / this.width); + var normy = ((y - this.y) / this.height); + normx *= normx; + normy *= normy; + return (normx + normy <= 1); + }; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * @returns The framing rectangle + */ + Ellipse.prototype.getBounds = function () { + return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); + }; + Ellipse.prototype.toString = function () { + return "[@pixi/math:Ellipse x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Ellipse; + }()); + + /** + * A class to define a shape via user defined coordinates. + * @memberof PIXI + */ + var Polygon = /** @class */ (function () { + /** + * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + var arguments$1 = arguments; + + var points = []; + for (var _i = 0; _i < arguments.length; _i++) { + points[_i] = arguments$1[_i]; + } + var flat = Array.isArray(points[0]) ? points[0] : points; + // if this is an array of points, convert it to a flat array of numbers + if (typeof flat[0] !== 'number') { + var p = []; + for (var i = 0, il = flat.length; i < il; i++) { + p.push(flat[i].x, flat[i].y); + } + flat = p; + } + this.points = flat; + this.type = exports.SHAPES.POLY; + this.closeStroke = true; + } + /** + * Creates a clone of this polygon. + * @returns - A copy of the polygon. + */ + Polygon.prototype.clone = function () { + var points = this.points.slice(); + var polygon = new Polygon(points); + polygon.closeStroke = this.closeStroke; + return polygon; + }; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon. + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this polygon. + */ + Polygon.prototype.contains = function (x, y) { + var inside = false; + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[(i * 2) + 1]; + var xj = this.points[j * 2]; + var yj = this.points[(j * 2) + 1]; + var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); + if (intersect) { + inside = !inside; + } + } + return inside; + }; + Polygon.prototype.toString = function () { + return "[@pixi/math:Polygon" + + ("closeStroke=" + this.closeStroke) + + ("points=" + this.points.reduce(function (pointsDesc, currentPoint) { return pointsDesc + ", " + currentPoint; }, '') + "]"); + }; + return Polygon; + }()); + + /** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * @memberof PIXI + */ + var RoundedRectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rounded rectangle + * @param y - The Y coordinate of the upper-left corner of the rounded rectangle + * @param width - The overall width of this rounded rectangle + * @param height - The overall height of this rounded rectangle + * @param radius - Controls the radius of the rounded corners + */ + function RoundedRectangle(x, y, width, height, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + if (radius === void 0) { radius = 20; } + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.radius = radius; + this.type = exports.SHAPES.RREC; + } + /** + * Creates a clone of this Rounded Rectangle. + * @returns - A copy of the rounded rectangle. + */ + RoundedRectangle.prototype.clone = function () { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this Rounded Rectangle. + */ + RoundedRectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + var radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2)); + if ((y >= this.y + radius && y <= this.y + this.height - radius) + || (x >= this.x + radius && x <= this.x + this.width - radius)) { + return true; + } + var dx = x - (this.x + radius); + var dy = y - (this.y + radius); + var radius2 = radius * radius; + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.width - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dy = y - (this.y + this.height - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + } + } + return false; + }; + RoundedRectangle.prototype.toString = function () { + return "[@pixi/math:RoundedRectangle x=" + this.x + " y=" + this.y + + ("width=" + this.width + " height=" + this.height + " radius=" + this.radius + "]"); + }; + return RoundedRectangle; + }()); + + /** + * Common interface for points. Both Point and ObservablePoint implement it + * @memberof PIXI + * @interface IPointData + */ + /** + * X coord + * @memberof PIXI.IPointData# + * @member {number} x + */ + /** + * Y coord + * @memberof PIXI.IPointData# + * @member {number} y + */ + + /** + * Common interface for points. Both Point and ObservablePoint implement it + * @memberof PIXI + * @interface IPoint + * @extends PIXI.IPointData + */ + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * @method set + * @memberof PIXI.IPoint# + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + */ + /** + * Copies x and y from the given point + * @method copyFrom + * @memberof PIXI.IPoint# + * @param {PIXI.IPointData} p - The point to copy from + * @returns {this} Returns itself. + */ + /** + * Copies x and y into the given point + * @method copyTo + * @memberof PIXI.IPoint# + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated + */ + /** + * Returns true if the given point is equal to this point + * @method equals + * @memberof PIXI.IPoint# + * @param {PIXI.IPointData} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + + /** + * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis. + * + * An `ObservablePoint` is a point that triggers a callback when the point's position is changed. + * @memberof PIXI + */ + var ObservablePoint = /** @class */ (function () { + /** + * Creates a new `ObservablePoint` + * @param cb - callback function triggered when `x` and/or `y` are changed + * @param scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function ObservablePoint(cb, scope, x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + this._x = x; + this._y = y; + this.cb = cb; + this.scope = scope; + } + /** + * Creates a clone of this point. + * The callback and scope params can be overridden otherwise they will default + * to the clone object's values. + * @override + * @param cb - The callback function triggered when `x` and/or `y` are changed + * @param scope - The owner of the callback + * @returns a copy of this observable point + */ + ObservablePoint.prototype.clone = function (cb, scope) { + if (cb === void 0) { cb = this.cb; } + if (scope === void 0) { scope = this.scope; } + return new ObservablePoint(cb, scope, this._x, this._y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns The observable point instance itself + */ + ObservablePoint.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + if (this._x !== x || this._y !== y) { + this._x = x; + this._y = y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies x and y from the given point (`p`) + * @param p - The point to copy from. Can be any of type that is or extends `IPointData` + * @returns The observable point instance itself + */ + ObservablePoint.prototype.copyFrom = function (p) { + if (this._x !== p.x || this._y !== p.y) { + this._x = p.x; + this._y = p.y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies this point's x and y into that of the given point (`p`) + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + ObservablePoint.prototype.copyTo = function (p) { + p.set(this._x, this._y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + ObservablePoint.prototype.equals = function (p) { + return (p.x === this._x) && (p.y === this._y); + }; + ObservablePoint.prototype.toString = function () { + return "[@pixi/math:ObservablePoint x=" + 0 + " y=" + 0 + " scope=" + this.scope + "]"; + }; + Object.defineProperty(ObservablePoint.prototype, "x", { + /** Position of the observable point on the x axis. */ + get: function () { + return this._x; + }, + set: function (value) { + if (this._x !== value) { + this._x = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservablePoint.prototype, "y", { + /** Position of the observable point on the y axis. */ + get: function () { + return this._y; + }, + set: function (value) { + if (this._y !== value) { + this._y = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + return ObservablePoint; + }()); + + /** + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * ``` + * @memberof PIXI + */ + var Matrix = /** @class */ (function () { + /** + * @param a - x scale + * @param b - y skew + * @param c - x skew + * @param d - y scale + * @param tx - x translation + * @param ty - y translation + */ + function Matrix(a, b, c, d, tx, ty) { + if (a === void 0) { a = 1; } + if (b === void 0) { b = 0; } + if (c === void 0) { c = 0; } + if (d === void 0) { d = 1; } + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + this.array = null; + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + } + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * @param array - The array that the matrix will be populated from. + */ + Matrix.prototype.fromArray = function (array) { + this.a = array[0]; + this.b = array[1]; + this.c = array[3]; + this.d = array[4]; + this.tx = array[2]; + this.ty = array[5]; + }; + /** + * Sets the matrix properties. + * @param a - Matrix component + * @param b - Matrix component + * @param c - Matrix component + * @param d - Matrix component + * @param tx - Matrix component + * @param ty - Matrix component + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.set = function (a, b, c, d, tx, ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + return this; + }; + /** + * Creates an array from the current Matrix object. + * @param transpose - Whether we need to transpose the matrix or not + * @param [out=new Float32Array(9)] - If provided the array will be assigned to out + * @returns The newly created array which contains the matrix + */ + Matrix.prototype.toArray = function (transpose, out) { + if (!this.array) { + this.array = new Float32Array(9); + } + var array = out || this.array; + if (transpose) { + array[0] = this.a; + array[1] = this.b; + array[2] = 0; + array[3] = this.c; + array[4] = this.d; + array[5] = 0; + array[6] = this.tx; + array[7] = this.ty; + array[8] = 1; + } + else { + array[0] = this.a; + array[1] = this.c; + array[2] = this.tx; + array[3] = this.b; + array[4] = this.d; + array[5] = this.ty; + array[6] = 0; + array[7] = 0; + array[8] = 1; + } + return array; + }; + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, transformed through this matrix + */ + Matrix.prototype.apply = function (pos, newPos) { + newPos = (newPos || new Point()); + var x = pos.x; + var y = pos.y; + newPos.x = (this.a * x) + (this.c * y) + this.tx; + newPos.y = (this.b * x) + (this.d * y) + this.ty; + return newPos; + }; + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, inverse-transformed through this matrix + */ + Matrix.prototype.applyInverse = function (pos, newPos) { + newPos = (newPos || new Point()); + var id = 1 / ((this.a * this.d) + (this.c * -this.b)); + var x = pos.x; + var y = pos.y; + newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); + newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); + return newPos; + }; + /** + * Translates the matrix on the x and y. + * @param x - How much to translate x by + * @param y - How much to translate y by + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.translate = function (x, y) { + this.tx += x; + this.ty += y; + return this; + }; + /** + * Applies a scale transformation to the matrix. + * @param x - The amount to scale horizontally + * @param y - The amount to scale vertically + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.scale = function (x, y) { + this.a *= x; + this.d *= y; + this.c *= x; + this.b *= y; + this.tx *= x; + this.ty *= y; + return this; + }; + /** + * Applies a rotation transformation to the matrix. + * @param angle - The angle in radians. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.rotate = function (angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var a1 = this.a; + var c1 = this.c; + var tx1 = this.tx; + this.a = (a1 * cos) - (this.b * sin); + this.b = (a1 * sin) + (this.b * cos); + this.c = (c1 * cos) - (this.d * sin); + this.d = (c1 * sin) + (this.d * cos); + this.tx = (tx1 * cos) - (this.ty * sin); + this.ty = (tx1 * sin) + (this.ty * cos); + return this; + }; + /** + * Appends the given Matrix to this Matrix. + * @param matrix - The matrix to append. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.append = function (matrix) { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + this.a = (matrix.a * a1) + (matrix.b * c1); + this.b = (matrix.a * b1) + (matrix.b * d1); + this.c = (matrix.c * a1) + (matrix.d * c1); + this.d = (matrix.c * b1) + (matrix.d * d1); + this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; + this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; + return this; + }; + /** + * Sets the matrix based on all the available properties + * @param x - Position on the x axis + * @param y - Position on the y axis + * @param pivotX - Pivot on the x axis + * @param pivotY - Pivot on the y axis + * @param scaleX - Scale on the x axis + * @param scaleY - Scale on the y axis + * @param rotation - Rotation in radians + * @param skewX - Skew on the x axis + * @param skewY - Skew on the y axis + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { + this.a = Math.cos(rotation + skewY) * scaleX; + this.b = Math.sin(rotation + skewY) * scaleX; + this.c = -Math.sin(rotation - skewX) * scaleY; + this.d = Math.cos(rotation - skewX) * scaleY; + this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); + this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); + return this; + }; + /** + * Prepends the given Matrix to this Matrix. + * @param matrix - The matrix to prepend + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.prepend = function (matrix) { + var tx1 = this.tx; + if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { + var a1 = this.a; + var c1 = this.c; + this.a = (a1 * matrix.a) + (this.b * matrix.c); + this.b = (a1 * matrix.b) + (this.b * matrix.d); + this.c = (c1 * matrix.a) + (this.d * matrix.c); + this.d = (c1 * matrix.b) + (this.d * matrix.d); + } + this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; + this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; + return this; + }; + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * @param transform - The transform to apply the properties to. + * @returns The transform with the newly applied properties + */ + Matrix.prototype.decompose = function (transform) { + // sort out rotation / skew.. + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var pivot = transform.pivot; + var skewX = -Math.atan2(-c, d); + var skewY = Math.atan2(b, a); + var delta = Math.abs(skewX + skewY); + if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { + transform.rotation = skewY; + transform.skew.x = transform.skew.y = 0; + } + else { + transform.rotation = 0; + transform.skew.x = skewX; + transform.skew.y = skewY; + } + // next set scale + transform.scale.x = Math.sqrt((a * a) + (b * b)); + transform.scale.y = Math.sqrt((c * c) + (d * d)); + // next set position + transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c)); + transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d)); + return transform; + }; + /** + * Inverts this matrix + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.invert = function () { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + var tx1 = this.tx; + var n = (a1 * d1) - (b1 * c1); + this.a = d1 / n; + this.b = -b1 / n; + this.c = -c1 / n; + this.d = a1 / n; + this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; + this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; + return this; + }; + /** + * Resets this Matrix to an identity (default) matrix. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.identity = function () { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + return this; + }; + /** + * Creates a new Matrix object with the same values as this one. + * @returns A copy of this matrix. Good for chaining method calls. + */ + Matrix.prototype.clone = function () { + var matrix = new Matrix(); + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * @param matrix - The matrix to copy to. + * @returns The matrix given in parameter with its values updated. + */ + Matrix.prototype.copyTo = function (matrix) { + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the matrix to be the same as the ones in given matrix + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @returns {PIXI.Matrix} this + */ + Matrix.prototype.copyFrom = function (matrix) { + this.a = matrix.a; + this.b = matrix.b; + this.c = matrix.c; + this.d = matrix.d; + this.tx = matrix.tx; + this.ty = matrix.ty; + return this; + }; + Matrix.prototype.toString = function () { + return "[@pixi/math:Matrix a=" + this.a + " b=" + this.b + " c=" + this.c + " d=" + this.d + " tx=" + this.tx + " ty=" + this.ty + "]"; + }; + Object.defineProperty(Matrix, "IDENTITY", { + /** + * A default (identity) matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Matrix, "TEMP_MATRIX", { + /** + * A temp matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + return Matrix; + }()); + + // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group + /* + * Transform matrix for operation n is: + * | ux | vx | + * | uy | vy | + */ + var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; + var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; + /** + * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * for the composition of each rotation in the dihederal group D8. + * @type {number[][]} + * @private + */ + var rotationCayley = []; + /** + * Matrices for each `GD8Symmetry` rotation. + * @type {PIXI.Matrix[]} + * @private + */ + var rotationMatrices = []; + /* + * Alias for {@code Math.sign}. + */ + var signum = Math.sign; + /* + * Initializes `rotationCayley` and `rotationMatrices`. It is called + * only once below. + */ + function init() { + for (var i = 0; i < 16; i++) { + var row = []; + rotationCayley.push(row); + for (var j = 0; j < 16; j++) { + /* Multiplies rotation matrices i and j. */ + var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); + var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); + var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); + var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); + /* Finds rotation matrix matching the product and pushes it. */ + for (var k = 0; k < 16; k++) { + if (ux[k] === _ux && uy[k] === _uy + && vx[k] === _vx && vy[k] === _vy) { + row.push(k); + break; + } + } + } + } + for (var i = 0; i < 16; i++) { + var mat = new Matrix(); + mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); + rotationMatrices.push(mat); + } + } + init(); + /** + * @memberof PIXI + * @typedef {number} GD8Symmetry + * @see PIXI.groupD8 + */ + /** + * Implements the dihedral group D8, which is similar to + * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; + * D8 is the same but with diagonals, and it is used for texture + * rotations. + * + * The directions the U- and V- axes after rotation + * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` + * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. + * + * **Origin:**
+ * This is the small part of gameofbombs.com portal system. It works. + * @see PIXI.groupD8.E + * @see PIXI.groupD8.SE + * @see PIXI.groupD8.S + * @see PIXI.groupD8.SW + * @see PIXI.groupD8.W + * @see PIXI.groupD8.NW + * @see PIXI.groupD8.N + * @see PIXI.groupD8.NE + * @author Ivan @ivanpopelyshev + * @namespace PIXI.groupD8 + * @memberof PIXI + */ + var groupD8 = { + /** + * | Rotation | Direction | + * |----------|-----------| + * | 0° | East | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + E: 0, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 45°↻ | Southeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SE: 1, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 90°↻ | South | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + S: 2, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 135°↻ | Southwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SW: 3, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 180° | West | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + W: 4, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -135°/225°↻ | Northwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NW: 5, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -90°/270°↻ | North | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + N: 6, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -45°/315°↻ | Northeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NE: 7, + /** + * Reflection about Y-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_VERTICAL: 8, + /** + * Reflection about the main diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MAIN_DIAGONAL: 10, + /** + * Reflection about X-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_HORIZONTAL: 12, + /** + * Reflection about reverse diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + REVERSE_DIAGONAL: 14, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the U-axis + * after rotating the axes. + */ + uX: function (ind) { return ux[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis + * after rotating the axes. + */ + uY: function (ind) { return uy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the V-axis + * after rotating the axes. + */ + vX: function (ind) { return vx[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis + * after rotating the axes. + */ + vY: function (ind) { return vy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite + * is needed. Only rotations have opposite symmetries while + * reflections don't. + * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation` + */ + inv: function (rotation) { + if (rotation & 8) // true only if between 8 & 15 (reflections) + { + return rotation & 15; // or rotation % 16 + } + return (-rotation) & 7; // or (8 - rotation) % 8 + }, + /** + * Composes the two D8 operations. + * + * Taking `^` as reflection: + * + * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | + * |-------|-----|-----|-----|-----|------|-------|-------|-------| + * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | + * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | + * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | + * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | + * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | + * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | + * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | + * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | + * + * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which + * is the row in the above cayley table. + * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which + * is the column in the above cayley table. + * @returns {PIXI.GD8Symmetry} Composed operation + */ + add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, + /** + * Reverse of `add`. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation + * @param {PIXI.GD8Symmetry} rotationFirst - First operation + * @returns {PIXI.GD8Symmetry} Result + */ + sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, + /** + * Adds 180 degrees to rotation, which is a commutative + * operation. + * @memberof PIXI.groupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} Rotated number + */ + rotate180: function (rotation) { return rotation ^ 4; }, + /** + * Checks if the rotation angle is vertical, i.e. south + * or north. It doesn't work for reflections. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: function (rotation) { return (rotation & 3) === 2; }, + /** + * Approximates the vector `V(dx,dy)` into one of the + * eight directions provided by `groupD8`. + * @memberof PIXI.groupD8 + * @param {number} dx - X-component of the vector + * @param {number} dy - Y-component of the vector + * @returns {PIXI.GD8Symmetry} Approximation of the vector into + * one of the eight symmetries. + */ + byDirection: function (dx, dy) { + if (Math.abs(dx) * 2 <= Math.abs(dy)) { + if (dy >= 0) { + return groupD8.S; + } + return groupD8.N; + } + else if (Math.abs(dy) * 2 <= Math.abs(dx)) { + if (dx > 0) { + return groupD8.E; + } + return groupD8.W; + } + else if (dy > 0) { + if (dx > 0) { + return groupD8.SE; + } + return groupD8.SW; + } + else if (dx > 0) { + return groupD8.NE; + } + return groupD8.NW; + }, + /** + * Helps sprite to compensate texture packer rotation. + * @memberof PIXI.groupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: function (matrix, rotation, tx, ty) { + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + // Packer used "rotation", we use "inv(rotation)" + var mat = rotationMatrices[groupD8.inv(rotation)]; + mat.tx = tx; + mat.ty = ty; + matrix.append(mat); + }, + }; + + /** + * Transform that takes care about its versions. + * @memberof PIXI + */ + var Transform = /** @class */ (function () { + function Transform() { + this.worldTransform = new Matrix(); + this.localTransform = new Matrix(); + this.position = new ObservablePoint(this.onChange, this, 0, 0); + this.scale = new ObservablePoint(this.onChange, this, 1, 1); + this.pivot = new ObservablePoint(this.onChange, this, 0, 0); + this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); + this._rotation = 0; + this._cx = 1; + this._sx = 0; + this._cy = 0; + this._sy = 1; + this._localID = 0; + this._currentLocalID = 0; + this._worldID = 0; + this._parentID = 0; + } + /** Called when a value changes. */ + Transform.prototype.onChange = function () { + this._localID++; + }; + /** Called when the skew or the rotation changes. */ + Transform.prototype.updateSkew = function () { + this._cx = Math.cos(this._rotation + this.skew.y); + this._sx = Math.sin(this._rotation + this.skew.y); + this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 + this._localID++; + }; + Transform.prototype.toString = function () { + return "[@pixi/math:Transform " + + ("position=(" + this.position.x + ", " + this.position.y + ") ") + + ("rotation=" + this.rotation + " ") + + ("scale=(" + this.scale.x + ", " + this.scale.y + ") ") + + ("skew=(" + this.skew.x + ", " + this.skew.y + ") ") + + "]"; + }; + /** Updates the local transformation matrix. */ + Transform.prototype.updateLocalTransform = function () { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + }; + /** + * Updates the local and the world transformation matrices. + * @param parentTransform - The parent transform + */ + Transform.prototype.updateTransform = function (parentTransform) { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + if (this._parentID !== parentTransform._worldID) { + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + 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._parentID = parentTransform._worldID; + // update the id of the transform.. + this._worldID++; + } + }; + /** + * Decomposes a matrix and sets the transforms properties based on it. + * @param matrix - The matrix to decompose + */ + Transform.prototype.setFromMatrix = function (matrix) { + matrix.decompose(this); + this._localID++; + }; + Object.defineProperty(Transform.prototype, "rotation", { + /** The rotation of the object in radians. */ + get: function () { + return this._rotation; + }, + set: function (value) { + if (this._rotation !== value) { + this._rotation = value; + this.updateSkew(); + } + }, + enumerable: false, + configurable: true + }); + /** A default (identity) transform. */ + Transform.IDENTITY = new Transform(); + return Transform; + }()); + + /* + * Math classes and utilities mixed into PIXI namespace. + */ + + exports.Circle = Circle; + exports.DEG_TO_RAD = DEG_TO_RAD; + exports.Ellipse = Ellipse; + exports.Matrix = Matrix; + exports.ObservablePoint = ObservablePoint; + exports.PI_2 = PI_2; + exports.Point = Point; + exports.Polygon = Polygon; + exports.RAD_TO_DEG = RAD_TO_DEG; + exports.Rectangle = Rectangle; + exports.RoundedRectangle = RoundedRectangle; + exports.Transform = Transform; + exports.groupD8 = groupD8; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +Object.assign(this.PIXI, _pixi_math); +//# sourceMappingURL=math.js.map diff --git a/live2d/node_modules/@pixi/math/dist/browser/math.js.map b/live2d/node_modules/@pixi/math/dist/browser/math.js.map new file mode 100644 index 0000000..f621e46 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/browser/math.js.map @@ -0,0 +1 @@ +{"version":3,"file":"math.js","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/IPointData.ts","../../src/IPoint.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts","../../src/index.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","export interface IPointData extends GlobalMixins.IPointData\n{\n x: number;\n y: number;\n}\n\n/**\n * Common interface for points. Both Point and ObservablePoint implement it\n * @memberof PIXI\n * @interface IPointData\n */\n\n/**\n * X coord\n * @memberof PIXI.IPointData#\n * @member {number} x\n */\n\n/**\n * Y coord\n * @memberof PIXI.IPointData#\n * @member {number} y\n */\n","import type { IPointData } from './IPointData';\n\nexport interface IPoint extends IPointData\n{\n copyFrom(p: IPointData): this;\n copyTo(p: T): T;\n equals(p: IPointData): boolean;\n set(x?: number, y?: number): void;\n}\n/**\n * Common interface for points. Both Point and ObservablePoint implement it\n * @memberof PIXI\n * @interface IPoint\n * @extends PIXI.IPointData\n */\n\n/**\n * Sets the point to a new x and y position.\n * If y is omitted, both x and y will be set to x.\n * @method set\n * @memberof PIXI.IPoint#\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n */\n\n/**\n * Copies x and y from the given point\n * @method copyFrom\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPointData} p - The point to copy from\n * @returns {this} Returns itself.\n */\n\n/**\n * Copies x and y into the given point\n * @method copyTo\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPoint} p - The point to copy.\n * @returns {PIXI.IPoint} Given point with values updated\n */\n\n/**\n * Returns true if the given point is equal to this point\n * @method equals\n * @memberof PIXI.IPoint#\n * @param {PIXI.IPointData} p - The point to check\n * @returns {boolean} Whether the given point equal to this point\n */\n\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n","/*\n * Math classes and utilities mixed into PIXI namespace.\n */\n\nimport { Circle } from './shapes/Circle';\nimport { Ellipse } from './shapes/Ellipse';\nimport { Polygon } from './shapes/Polygon';\nimport { Rectangle } from './shapes/Rectangle';\nimport { RoundedRectangle } from './shapes/RoundedRectangle';\n\nexport * from './IPointData';\nexport * from './IPoint';\nexport * from './Point';\nexport * from './ObservablePoint';\nexport * from './Matrix';\nexport * from './groupD8';\nexport * from './Transform';\n\nexport { Circle };\nexport { Ellipse };\nexport { Polygon };\nexport { Rectangle };\nexport { RoundedRectangle };\n\nexport * from './const';\n\n/*\n * @description Complex shape type\n */\nexport type IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nexport interface ISize\n{\n width: number;\n height: number;\n}\n"],"names":["SHAPES","arguments"],"mappings":";;;;;;;;;;;IAAA;;;;;IAKG;AACI,QAAM,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE;IAEhC;;;;;IAKG;AACI,QAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG;IAExC;;;;;IAKG;AACI,QAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI;IAExC;;;;;;;;;;IAUG;AACSA,4BAQX;IARD,CAAA,UAAY,MAAM,EAAA;IAGd,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;IACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;IACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;IACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;IACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;IACZ,CAAC,EARWA,cAAM,KAANA,cAAM,GAQjB,EAAA,CAAA,CAAA;;ICtCD;;;;;;IAMG;AACH,QAAA,KAAA,kBAAA,YAAA;IAOI;;;;IAIG;QACH,SAAY,KAAA,CAAA,CAAK,EAAE,CAAK,EAAA;IAAZ,QAAA,IAAA,CAAA,KAAA,KAAA,CAAA,EAA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modules/@pixi/math/dist/browser/math.min.js b/live2d/node_modules/@pixi/math/dist/browser/math.min.js new file mode 100644 index 0000000..0afb3d7 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/browser/math.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_math=function(t){"use strict";var i,h=2*Math.PI,s=180/Math.PI,o=Math.PI/180;t.SHAPES=void 0,(i=t.SHAPES||(t.SHAPES={}))[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC";var n=function(){function t(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=0,this.y=0,this.x=t,this.y=i}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x=t,this.y=i,this},t}(),r=[new n,new n,new n,new n],e=function(){function i(i,h,s,o){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),this.x=Number(i),this.y=Number(h),this.width=Number(s),this.height=Number(o),this.type=t.SHAPES.RECT}return Object.defineProperty(i.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(i,"EMPTY",{get:function(){return new i(0,0,0,0)},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.prototype.contains=function(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t=this.y&&it.right?t.right:this.right)<=h)return!1;var s=this.yt.bottom?t.bottom:this.bottom)>s}var o=this.left,n=this.right,e=this.top,a=this.bottom;if(n<=o||a<=e)return!1;var c=r[0].set(t.left,t.top),y=r[1].set(t.left,t.bottom),u=r[2].set(t.right,t.top),p=r[3].set(t.right,t.bottom);if(u.x<=c.x||y.y<=c.y)return!1;var x=Math.sign(i.a*i.d-i.b*i.c);if(0===x)return!1;if(i.apply(c,c),i.apply(y,y),i.apply(u,u),i.apply(p,p),Math.max(c.x,y.x,u.x,p.x)<=o||Math.min(c.x,y.x,u.x,p.x)>=n||Math.max(c.y,y.y,u.y,p.y)<=e||Math.min(c.y,y.y,u.y,p.y)>=a)return!1;var d=x*(y.y-c.y),f=x*(c.x-y.x),l=d*o+f*e,b=d*n+f*e,v=d*o+f*a,_=d*n+f*a;if(Math.max(l,b,v,_)<=d*c.x+f*c.y||Math.min(l,b,v,_)>=d*p.x+f*p.y)return!1;var w=x*(c.y-u.y),g=x*(u.x-c.x),m=w*o+g*e,M=w*n+g*e,I=w*o+g*a,P=w*n+g*a;return!(Math.max(m,M,I,P)<=w*c.x+g*c.y||Math.min(m,M,I,P)>=w*p.x+g*p.y)},i.prototype.pad=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this},i.prototype.fit=function(t){var i=Math.max(this.x,t.x),h=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(h-i,0),this.y=s,this.height=Math.max(o-s,0),this},i.prototype.ceil=function(t,i){void 0===t&&(t=1),void 0===i&&(i=.001);var h=Math.ceil((this.x+this.width-i)*t)/t,s=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=h-this.x,this.height=s-this.y,this},i.prototype.enlarge=function(t){var i=Math.min(this.x,t.x),h=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=h-i,this.y=s,this.height=o-s,this},i}(),a=function(){function i(i,h,s){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),this.x=i,this.y=h,this.radius=s,this.type=t.SHAPES.CIRC}return i.prototype.clone=function(){return new i(this.x,this.y,this.radius)},i.prototype.contains=function(t,i){if(this.radius<=0)return!1;var h=this.radius*this.radius,s=this.x-t,o=this.y-i;return(s*=s)+(o*=o)<=h},i.prototype.getBounds=function(){return new e(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},i}(),c=function(){function i(i,h,s,o){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),this.x=i,this.y=h,this.width=s,this.height=o,this.type=t.SHAPES.ELIP}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;var h=(t-this.x)/this.width,s=(i-this.y)/this.height;return(h*=h)+(s*=s)<=1},i.prototype.getBounds=function(){return new e(this.x-this.width,this.y-this.height,this.width,this.height)},i}(),y=function(){function i(){for(var i=arguments,h=[],s=0;si!=c>i&&t<(i-e)/(c-e)*(a-r)+r&&(h=!h)}return h},i}(),u=function(){function i(i,h,s,o,n){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===n&&(n=20),this.x=i,this.y=h,this.width=s,this.height=o,this.radius=n,this.type=t.SHAPES.RREC}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.radius)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){var h=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+h&&i<=this.y+this.height-h||t>=this.x+h&&t<=this.x+this.width-h)return!0;var s=t-(this.x+h),o=i-(this.y+h),n=h*h;if(s*s+o*o<=n)return!0;if((s=t-(this.x+this.width-h))*s+o*o<=n)return!0;if(s*s+(o=i-(this.y+this.height-h))*o<=n)return!0;if((s=t-(this.x+h))*s+o*o<=n)return!0}return!1},i}(),p=function(){function t(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0),this._x=h,this._y=s,this.cb=t,this.scope=i}return t.prototype.clone=function(i,h){return void 0===i&&(i=this.cb),void 0===h&&(h=this.scope),new t(i,h,this._x,this._y)},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this._x===t&&this._y===i||(this._x=t,this._y=i,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),x=function(){function t(t,i,h,s,o,n){void 0===t&&(t=1),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===n&&(n=0),this.array=null,this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=n}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,i,h,s,o,n){return this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=n,this},t.prototype.toArray=function(t,i){this.array||(this.array=new Float32Array(9));var h=i||this.array;return t?(h[0]=this.a,h[1]=this.b,h[2]=0,h[3]=this.c,h[4]=this.d,h[5]=0,h[6]=this.tx,h[7]=this.ty,h[8]=1):(h[0]=this.a,h[1]=this.c,h[2]=this.tx,h[3]=this.b,h[4]=this.d,h[5]=this.ty,h[6]=0,h[7]=0,h[8]=1),h},t.prototype.apply=function(t,i){i=i||new n;var h=t.x,s=t.y;return i.x=this.a*h+this.c*s+this.tx,i.y=this.b*h+this.d*s+this.ty,i},t.prototype.applyInverse=function(t,i){i=i||new n;var h=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return i.x=this.d*h*s+-this.c*h*o+(this.ty*this.c-this.tx*this.d)*h,i.y=this.a*h*o+-this.b*h*s+(-this.ty*this.a+this.tx*this.b)*h,i},t.prototype.translate=function(t,i){return this.tx+=t,this.ty+=i,this},t.prototype.scale=function(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this},t.prototype.rotate=function(t){var i=Math.cos(t),h=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*i-this.b*h,this.b=s*h+this.b*i,this.c=o*i-this.d*h,this.d=o*h+this.d*i,this.tx=n*i-this.ty*h,this.ty=n*h+this.ty*i,this},t.prototype.append=function(t){var i=this.a,h=this.b,s=this.c,o=this.d;return this.a=t.a*i+t.b*s,this.b=t.a*h+t.b*o,this.c=t.c*i+t.d*s,this.d=t.c*h+t.d*o,this.tx=t.tx*i+t.ty*s+this.tx,this.ty=t.tx*h+t.ty*o+this.ty,this},t.prototype.setTransform=function(t,i,h,s,o,n,r,e,a){return this.a=Math.cos(r+a)*o,this.b=Math.sin(r+a)*o,this.c=-Math.sin(r-e)*n,this.d=Math.cos(r-e)*n,this.tx=t-(h*this.a+s*this.c),this.ty=i-(h*this.b+s*this.d),this},t.prototype.prepend=function(t){var i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var h=this.a,s=this.c;this.a=h*t.a+this.b*t.c,this.b=h*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var i=this.a,s=this.b,o=this.c,n=this.d,r=t.pivot,e=-Math.atan2(-o,n),a=Math.atan2(s,i),c=Math.abs(e+a);return c<1e-5||Math.abs(h-c)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=e,t.skew.y=a),t.scale.x=Math.sqrt(i*i+s*s),t.scale.y=Math.sqrt(o*o+n*n),t.position.x=this.tx+(r.x*i+r.y*o),t.position.y=this.ty+(r.x*s+r.y*n),t},t.prototype.invert=function(){var t=this.a,i=this.b,h=this.c,s=this.d,o=this.tx,n=t*s-i*h;return this.a=s/n,this.b=-i/n,this.c=-h/n,this.d=t/n,this.tx=(h*this.ty-s*o)/n,this.ty=-(t*this.ty-i*o)/n,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var i=new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},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},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),d=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],f=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],l=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],b=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],v=[],_=[],w=Math.sign;!function(){for(var t=0;t<16;t++){var i=[];v.push(i);for(var h=0;h<16;h++)for(var s=w(d[t]*d[h]+l[t]*f[h]),o=w(f[t]*d[h]+b[t]*f[h]),n=w(d[t]*l[h]+l[t]*b[h]),r=w(f[t]*l[h]+b[t]*b[h]),e=0;e<16;e++)if(d[e]===s&&f[e]===o&&l[e]===n&&b[e]===r){i.push(e);break}}for(t=0;t<16;t++){var a=new x;a.set(d[t],f[t],l[t],b[t],0,0),_.push(a)}}();var g={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return d[t]},uY:function(t){return f[t]},vX:function(t){return l[t]},vY:function(t){return b[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,i){return v[t][i]},sub:function(t,i){return v[t][g.inv(i)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,i){return 2*Math.abs(t)<=Math.abs(i)?i>=0?g.S:g.N:2*Math.abs(i)<=Math.abs(t)?t>0?g.E:g.W:i>0?t>0?g.SE:g.SW:t>0?g.NE:g.NW},matrixAppendRotationInv:function(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0);var o=_[g.inv(i)];o.tx=h,o.ty=s,t.append(o)}},m=function(){function t(){this.worldTransform=new x,this.localTransform=new x,this.position=new p(this.onChange,this,0,0),this.scale=new p(this.onChange,this,1,1),this.pivot=new p(this.onChange,this,0,0),this.skew=new p(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var i=this.localTransform;if(this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var h=t.worldTransform,s=this.worldTransform;s.a=i.a*h.a+i.b*h.c,s.b=i.a*h.b+i.b*h.d,s.c=i.c*h.a+i.d*h.c,s.d=i.c*h.b+i.d*h.d,s.tx=i.tx*h.a+i.ty*h.c+h.tx,s.ty=i.tx*h.b+i.ty*h.d+h.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();return t.Circle=a,t.DEG_TO_RAD=o,t.Ellipse=c,t.Matrix=x,t.ObservablePoint=p,t.PI_2=h,t.Point=n,t.Polygon=y,t.RAD_TO_DEG=s,t.Rectangle=e,t.RoundedRectangle=u,t.Transform=m,t.groupD8=g,Object.defineProperty(t,"__esModule",{value:!0}),t}({});Object.assign(this.PIXI,_pixi_math); +//# sourceMappingURL=math.min.js.map diff --git a/live2d/node_modules/@pixi/math/dist/browser/math.min.js.map b/live2d/node_modules/@pixi/math/dist/browser/math.min.js.map new file mode 100644 index 0000000..fe15432 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/browser/math.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"math.min.js","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n"],"names":["SHAPES","PI_2","Math","PI","RAD_TO_DEG","DEG_TO_RAD","exports","Point","x","y","this","prototype","clone","copyFrom","p","set","copyTo","equals","tempPoints","Rectangle","width","height","Number","type","RECT","Object","defineProperty","get","rectangle","contains","intersects","other","transform","x0_1","right","y0_1","bottom","x0","left","x1","y0","top","y1","lt","lb","rt","rb","s","sign","a","d","b","c","apply","max","min","nx","ny","n00","n10","n01","n11","mx","my","m00","m10","m01","m11","pad","paddingX","paddingY","fit","x2","y2","ceil","resolution","eps","floor","enlarge","Circle","radius","CIRC","r2","dx","dy","getBounds","Ellipse","halfWidth","halfHeight","ELIP","normx","normy","Polygon","points","_i","arguments","length","flat","Array","isArray","i","il","push","POLY","closeStroke","polygon","slice","inside","j","xi","yi","xj","yj","RoundedRectangle","RREC","radius2","ObservablePoint","cb","scope","_x","_y","call","value","Matrix","tx","ty","array","fromArray","toArray","transpose","out","Float32Array","pos","newPos","applyInverse","id","translate","scale","rotate","angle","cos","sin","a1","c1","tx1","append","matrix","b1","d1","setTransform","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","prepend","decompose","pivot","atan2","delta","abs","skew","sqrt","position","invert","n","identity","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","k","mat","init","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","add","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","Transform","worldTransform","localTransform","onChange","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","updateLocalTransform","updateTransform","parentTransform","pt","wt","setFromMatrix","IDENTITY"],"mappings":";;;;;;;gEAMO,IA6BKA,EA7BCC,EAAiB,EAAVC,KAAKC,GAQZC,EAAa,IAAMF,KAAKC,GAQxBE,EAAaH,KAAKC,GAAK,IAqBnCG,EAAAN,YAAA,GARWA,EAAAA,EAAMA,SAANA,SAQX,KALGA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OC9BJ,IAAAO,EAAA,WAYI,SAAYA,EAAAC,EAAOC,QAAP,IAAAD,IAAAA,EAAK,QAAE,IAAAC,IAAAA,EAAK,GATjBC,KAACF,EAAG,EAEJE,KAACD,EAAG,EASPC,KAAKF,EAAIA,EACTE,KAAKD,EAAIA,EAmEjB,OA5DIF,EAAAI,UAAAC,MAAA,WAEI,OAAO,IAAIL,EAAMG,KAAKF,EAAGE,KAAKD,IAQlCF,EAAQI,UAAAE,SAAR,SAASC,GAIL,OAFAJ,KAAKK,IAAID,EAAEN,EAAGM,EAAEL,GAETC,MAQXH,EAAMI,UAAAK,OAAN,SAAyBF,GAIrB,OAFAA,EAAEC,IAAIL,KAAKF,EAAGE,KAAKD,GAEZK,GAQXP,EAAMI,UAAAM,OAAN,SAAOH,GAEH,OAAQA,EAAEN,IAAME,KAAKF,GAAOM,EAAEL,IAAMC,KAAKD,GAU7CF,EAAAI,UAAAI,IAAA,SAAIP,EAAOC,GAKP,YALA,IAAAD,IAAAA,EAAK,QAAE,IAAAC,IAAAA,EAAKD,GAEZE,KAAKF,EAAIA,EACTE,KAAKD,EAAIA,EAEFC,MASdH,KC1FKW,EAAa,CAAC,IAAIX,EAAS,IAAIA,EAAS,IAAIA,EAAS,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GACtExC,KAAKoN,gBAAkBpN,KAAKmN,SAG5BnN,KAAKsN,WAAa,GAGlBtN,KAAKsN,YAAcG,EAAgBJ,SACvC,CAEI,IAAMK,EAAKD,EAAgBf,eACrBiB,EAAK3N,KAAK0M,eAEhBiB,EAAGpL,EAAKN,EAAGM,EAAImL,EAAGnL,EAAMN,EAAGQ,EAAIiL,EAAGhL,EAClCiL,EAAGlL,EAAKR,EAAGM,EAAImL,EAAGjL,EAAMR,EAAGQ,EAAIiL,EAAGlL,EAClCmL,EAAGjL,EAAKT,EAAGS,EAAIgL,EAAGnL,EAAMN,EAAGO,EAAIkL,EAAGhL,EAClCiL,EAAGnL,EAAKP,EAAGS,EAAIgL,EAAGjL,EAAMR,EAAGO,EAAIkL,EAAGlL,EAClCmL,EAAGzG,GAAMjF,EAAGiF,GAAKwG,EAAGnL,EAAMN,EAAGkF,GAAKuG,EAAGhL,EAAKgL,EAAGxG,GAC7CyG,EAAGxG,GAAMlF,EAAGiF,GAAKwG,EAAGjL,EAAMR,EAAGkF,GAAKuG,EAAGlL,EAAKkL,EAAGvG,GAE7CnH,KAAKsN,UAAYG,EAAgBJ,SAGjCrN,KAAKqN,aAQbZ,EAAaxM,UAAA2N,cAAb,SAAcpF,GAEVA,EAAOY,UAAUpJ,MACjBA,KAAKmN,YAITpM,OAAAC,eAAIyL,EAAQxM,UAAA,WAAA,CAAZgB,IAAA,WAEI,OAAOjB,KAAK8M,WAGhBzM,IAAA,SAAa2G,GAELhH,KAAK8M,YAAc9F,IAEnBhH,KAAK8M,UAAY9F,EACjBhH,KAAK6M,+CApMUJ,EAAAoB,SAAW,IAAIpB,EAuMzCA"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/dist/cjs/math.js b/live2d/node_modules/@pixi/math/dist/cjs/math.js new file mode 100644 index 0000000..dc6be8c --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/cjs/math.js @@ -0,0 +1,1601 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * Two Pi. + * @static + * @member {number} + * @memberof PIXI + */ +var PI_2 = Math.PI * 2; +/** + * Conversion factor for converting radians to degrees. + * @static + * @member {number} RAD_TO_DEG + * @memberof PIXI + */ +var RAD_TO_DEG = 180 / Math.PI; +/** + * Conversion factor for converting degrees to radians. + * @static + * @member {number} + * @memberof PIXI + */ +var DEG_TO_RAD = Math.PI / 180; +/** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * @static + * @memberof PIXI + * @enum {number} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + */ +exports.SHAPES = void 0; +(function (SHAPES) { + SHAPES[SHAPES["POLY"] = 0] = "POLY"; + SHAPES[SHAPES["RECT"] = 1] = "RECT"; + SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; + SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; + SHAPES[SHAPES["RREC"] = 4] = "RREC"; +})(exports.SHAPES || (exports.SHAPES = {})); + +/** + * The Point object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis + * @class + * @memberof PIXI + * @implements {IPoint} + */ +var Point = /** @class */ (function () { + /** + * Creates a new `Point` + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function Point(x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + /** Position of the point on the x axis */ + this.x = 0; + /** Position of the point on the y axis */ + this.y = 0; + this.x = x; + this.y = y; + } + /** + * Creates a clone of this point + * @returns A clone of this point + */ + Point.prototype.clone = function () { + return new Point(this.x, this.y); + }; + /** + * Copies `x` and `y` from the given point into this point + * @param p - The point to copy from + * @returns The point instance itself + */ + Point.prototype.copyFrom = function (p) { + this.set(p.x, p.y); + return this; + }; + /** + * Copies this point's x and y into the given point (`p`). + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + Point.prototype.copyTo = function (p) { + p.set(this.x, this.y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + Point.prototype.equals = function (p) { + return (p.x === this.x) && (p.y === this.y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the `x` axis + * @param {number} [y=x] - position of the point on the `y` axis + * @returns The point instance itself + */ + Point.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + this.x = x; + this.y = y; + return this; + }; + Point.prototype.toString = function () { + return "[@pixi/math:Point x=" + this.x + " y=" + this.y + "]"; + }; + return Point; +}()); + +var tempPoints = [new Point(), new Point(), new Point(), new Point()]; +/** + * Size object, contains width and height + * @memberof PIXI + * @typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ +/** + * 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. + * @memberof PIXI + */ +var Rectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rectangle + * @param y - The Y coordinate of the upper-left corner of the rectangle + * @param width - The overall width of the rectangle + * @param height - The overall height of the rectangle + */ + function Rectangle(x, y, width, height) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this.x = Number(x); + this.y = Number(y); + this.width = Number(width); + this.height = Number(height); + this.type = exports.SHAPES.RECT; + } + Object.defineProperty(Rectangle.prototype, "left", { + /** Returns the left edge of the rectangle. */ + get: function () { + return this.x; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "right", { + /** Returns the right edge of the rectangle. */ + get: function () { + return this.x + this.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "top", { + /** Returns the top edge of the rectangle. */ + get: function () { + return this.y; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "bottom", { + /** Returns the bottom edge of the rectangle. */ + get: function () { + return this.y + this.height; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle, "EMPTY", { + /** A constant empty rectangle. */ + get: function () { + return new Rectangle(0, 0, 0, 0); + }, + enumerable: false, + configurable: true + }); + /** + * Creates a clone of this Rectangle + * @returns a copy of the rectangle + */ + Rectangle.prototype.clone = function () { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + /** + * Copies another rectangle to this one. + * @param rectangle - The rectangle to copy from. + * @returns Returns itself. + */ + Rectangle.prototype.copyFrom = function (rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + return this; + }; + /** + * Copies this rectangle to another one. + * @param rectangle - The rectangle to copy to. + * @returns Returns given parameter. + */ + Rectangle.prototype.copyTo = function (rectangle) { + rectangle.x = this.x; + rectangle.y = this.y; + rectangle.width = this.width; + rectangle.height = this.height; + return rectangle; + }; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Rectangle + */ + Rectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + return false; + }; + /** + * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object. + * Returns true only if the area of the intersection is >0, this means that Rectangles + * sharing a side are not overlapping. Another side effect is that an arealess rectangle + * (width or height equal to zero) can't intersect any other rectangle. + * @param {Rectangle} other - The Rectangle to intersect with `this`. + * @param {Matrix} transform - The transformation matrix of `other`. + * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`. + */ + Rectangle.prototype.intersects = function (other, transform) { + if (!transform) { + var x0_1 = this.x < other.x ? other.x : this.x; + var x1_1 = this.right > other.right ? other.right : this.right; + if (x1_1 <= x0_1) { + return false; + } + var y0_1 = this.y < other.y ? other.y : this.y; + var y1_1 = this.bottom > other.bottom ? other.bottom : this.bottom; + return y1_1 > y0_1; + } + var x0 = this.left; + var x1 = this.right; + var y0 = this.top; + var y1 = this.bottom; + if (x1 <= x0 || y1 <= y0) { + return false; + } + var lt = tempPoints[0].set(other.left, other.top); + var lb = tempPoints[1].set(other.left, other.bottom); + var rt = tempPoints[2].set(other.right, other.top); + var rb = tempPoints[3].set(other.right, other.bottom); + if (rt.x <= lt.x || lb.y <= lt.y) { + return false; + } + var s = Math.sign((transform.a * transform.d) - (transform.b * transform.c)); + if (s === 0) { + return false; + } + transform.apply(lt, lt); + transform.apply(lb, lb); + transform.apply(rt, rt); + transform.apply(rb, rb); + if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 + || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 + || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 + || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) { + return false; + } + var nx = s * (lb.y - lt.y); + var ny = s * (lt.x - lb.x); + var n00 = (nx * x0) + (ny * y0); + var n10 = (nx * x1) + (ny * y0); + var n01 = (nx * x0) + (ny * y1); + var n11 = (nx * x1) + (ny * y1); + if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y) + || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) { + return false; + } + var mx = s * (lt.y - rt.y); + var my = s * (rt.x - lt.x); + var m00 = (mx * x0) + (my * y0); + var m10 = (mx * x1) + (my * y0); + var m01 = (mx * x0) + (my * y1); + var m11 = (mx * x1) + (my * y1); + if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y) + || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) { + return false; + } + return true; + }; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + * @returns Returns itself. + */ + Rectangle.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + this.x -= paddingX; + this.y -= paddingY; + this.width += paddingX * 2; + this.height += paddingY * 2; + return this; + }; + /** + * Fits this rectangle around the passed one. + * @param rectangle - The rectangle to fit. + * @returns Returns itself. + */ + Rectangle.prototype.fit = function (rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + return this; + }; + /** + * Enlarges rectangle that way its corners lie on grid + * @param resolution - resolution + * @param eps - precision + * @returns Returns itself. + */ + Rectangle.prototype.ceil = function (resolution, eps) { + if (resolution === void 0) { resolution = 1; } + if (eps === void 0) { eps = 0.001; } + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + this.width = x2 - this.x; + this.height = y2 - this.y; + return this; + }; + /** + * Enlarges this rectangle to include the passed rectangle. + * @param rectangle - The rectangle to include. + * @returns Returns itself. + */ + Rectangle.prototype.enlarge = function (rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + return this; + }; + Rectangle.prototype.toString = function () { + return "[@pixi/math:Rectangle x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Rectangle; +}()); + +/** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +var Circle = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this circle + * @param y - The Y coordinate of the center of this circle + * @param radius - The radius of the circle + */ + function Circle(x, y, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (radius === void 0) { radius = 0; } + this.x = x; + this.y = y; + this.radius = radius; + this.type = exports.SHAPES.CIRC; + } + /** + * Creates a clone of this Circle instance + * @returns A copy of the Circle + */ + Circle.prototype.clone = function () { + return new Circle(this.x, this.y, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this circle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Circle + */ + Circle.prototype.contains = function (x, y) { + if (this.radius <= 0) { + return false; + } + var r2 = this.radius * this.radius; + var dx = (this.x - x); + var dy = (this.y - y); + dx *= dx; + dy *= dy; + return (dx + dy <= r2); + }; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * @returns The framing rectangle + */ + Circle.prototype.getBounds = function () { + return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + Circle.prototype.toString = function () { + return "[@pixi/math:Circle x=" + this.x + " y=" + this.y + " radius=" + this.radius + "]"; + }; + return Circle; +}()); + +/** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +var Ellipse = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this ellipse + * @param y - The Y coordinate of the center of this ellipse + * @param halfWidth - The half width of this ellipse + * @param halfHeight - The half height of this ellipse + */ + function Ellipse(x, y, halfWidth, halfHeight) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (halfWidth === void 0) { halfWidth = 0; } + if (halfHeight === void 0) { halfHeight = 0; } + this.x = x; + this.y = y; + this.width = halfWidth; + this.height = halfHeight; + this.type = exports.SHAPES.ELIP; + } + /** + * Creates a clone of this Ellipse instance + * @returns {PIXI.Ellipse} A copy of the ellipse + */ + Ellipse.prototype.clone = function () { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coords are within this ellipse + */ + Ellipse.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + // normalize the coords to an ellipse with center 0,0 + var normx = ((x - this.x) / this.width); + var normy = ((y - this.y) / this.height); + normx *= normx; + normy *= normy; + return (normx + normy <= 1); + }; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * @returns The framing rectangle + */ + Ellipse.prototype.getBounds = function () { + return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); + }; + Ellipse.prototype.toString = function () { + return "[@pixi/math:Ellipse x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Ellipse; +}()); + +/** + * A class to define a shape via user defined coordinates. + * @memberof PIXI + */ +var Polygon = /** @class */ (function () { + /** + * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + var arguments$1 = arguments; + + var points = []; + for (var _i = 0; _i < arguments.length; _i++) { + points[_i] = arguments$1[_i]; + } + var flat = Array.isArray(points[0]) ? points[0] : points; + // if this is an array of points, convert it to a flat array of numbers + if (typeof flat[0] !== 'number') { + var p = []; + for (var i = 0, il = flat.length; i < il; i++) { + p.push(flat[i].x, flat[i].y); + } + flat = p; + } + this.points = flat; + this.type = exports.SHAPES.POLY; + this.closeStroke = true; + } + /** + * Creates a clone of this polygon. + * @returns - A copy of the polygon. + */ + Polygon.prototype.clone = function () { + var points = this.points.slice(); + var polygon = new Polygon(points); + polygon.closeStroke = this.closeStroke; + return polygon; + }; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon. + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this polygon. + */ + Polygon.prototype.contains = function (x, y) { + var inside = false; + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[(i * 2) + 1]; + var xj = this.points[j * 2]; + var yj = this.points[(j * 2) + 1]; + var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); + if (intersect) { + inside = !inside; + } + } + return inside; + }; + Polygon.prototype.toString = function () { + return "[@pixi/math:Polygon" + + ("closeStroke=" + this.closeStroke) + + ("points=" + this.points.reduce(function (pointsDesc, currentPoint) { return pointsDesc + ", " + currentPoint; }, '') + "]"); + }; + return Polygon; +}()); + +/** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * @memberof PIXI + */ +var RoundedRectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rounded rectangle + * @param y - The Y coordinate of the upper-left corner of the rounded rectangle + * @param width - The overall width of this rounded rectangle + * @param height - The overall height of this rounded rectangle + * @param radius - Controls the radius of the rounded corners + */ + function RoundedRectangle(x, y, width, height, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + if (radius === void 0) { radius = 20; } + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.radius = radius; + this.type = exports.SHAPES.RREC; + } + /** + * Creates a clone of this Rounded Rectangle. + * @returns - A copy of the rounded rectangle. + */ + RoundedRectangle.prototype.clone = function () { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this Rounded Rectangle. + */ + RoundedRectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + var radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2)); + if ((y >= this.y + radius && y <= this.y + this.height - radius) + || (x >= this.x + radius && x <= this.x + this.width - radius)) { + return true; + } + var dx = x - (this.x + radius); + var dy = y - (this.y + radius); + var radius2 = radius * radius; + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.width - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dy = y - (this.y + this.height - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + } + } + return false; + }; + RoundedRectangle.prototype.toString = function () { + return "[@pixi/math:RoundedRectangle x=" + this.x + " y=" + this.y + + ("width=" + this.width + " height=" + this.height + " radius=" + this.radius + "]"); + }; + return RoundedRectangle; +}()); + +/** + * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis. + * + * An `ObservablePoint` is a point that triggers a callback when the point's position is changed. + * @memberof PIXI + */ +var ObservablePoint = /** @class */ (function () { + /** + * Creates a new `ObservablePoint` + * @param cb - callback function triggered when `x` and/or `y` are changed + * @param scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function ObservablePoint(cb, scope, x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + this._x = x; + this._y = y; + this.cb = cb; + this.scope = scope; + } + /** + * Creates a clone of this point. + * The callback and scope params can be overridden otherwise they will default + * to the clone object's values. + * @override + * @param cb - The callback function triggered when `x` and/or `y` are changed + * @param scope - The owner of the callback + * @returns a copy of this observable point + */ + ObservablePoint.prototype.clone = function (cb, scope) { + if (cb === void 0) { cb = this.cb; } + if (scope === void 0) { scope = this.scope; } + return new ObservablePoint(cb, scope, this._x, this._y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns The observable point instance itself + */ + ObservablePoint.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + if (this._x !== x || this._y !== y) { + this._x = x; + this._y = y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies x and y from the given point (`p`) + * @param p - The point to copy from. Can be any of type that is or extends `IPointData` + * @returns The observable point instance itself + */ + ObservablePoint.prototype.copyFrom = function (p) { + if (this._x !== p.x || this._y !== p.y) { + this._x = p.x; + this._y = p.y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies this point's x and y into that of the given point (`p`) + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + ObservablePoint.prototype.copyTo = function (p) { + p.set(this._x, this._y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + ObservablePoint.prototype.equals = function (p) { + return (p.x === this._x) && (p.y === this._y); + }; + ObservablePoint.prototype.toString = function () { + return "[@pixi/math:ObservablePoint x=" + 0 + " y=" + 0 + " scope=" + this.scope + "]"; + }; + Object.defineProperty(ObservablePoint.prototype, "x", { + /** Position of the observable point on the x axis. */ + get: function () { + return this._x; + }, + set: function (value) { + if (this._x !== value) { + this._x = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservablePoint.prototype, "y", { + /** Position of the observable point on the y axis. */ + get: function () { + return this._y; + }, + set: function (value) { + if (this._y !== value) { + this._y = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + return ObservablePoint; +}()); + +/** + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * ``` + * @memberof PIXI + */ +var Matrix = /** @class */ (function () { + /** + * @param a - x scale + * @param b - y skew + * @param c - x skew + * @param d - y scale + * @param tx - x translation + * @param ty - y translation + */ + function Matrix(a, b, c, d, tx, ty) { + if (a === void 0) { a = 1; } + if (b === void 0) { b = 0; } + if (c === void 0) { c = 0; } + if (d === void 0) { d = 1; } + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + this.array = null; + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + } + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * @param array - The array that the matrix will be populated from. + */ + Matrix.prototype.fromArray = function (array) { + this.a = array[0]; + this.b = array[1]; + this.c = array[3]; + this.d = array[4]; + this.tx = array[2]; + this.ty = array[5]; + }; + /** + * Sets the matrix properties. + * @param a - Matrix component + * @param b - Matrix component + * @param c - Matrix component + * @param d - Matrix component + * @param tx - Matrix component + * @param ty - Matrix component + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.set = function (a, b, c, d, tx, ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + return this; + }; + /** + * Creates an array from the current Matrix object. + * @param transpose - Whether we need to transpose the matrix or not + * @param [out=new Float32Array(9)] - If provided the array will be assigned to out + * @returns The newly created array which contains the matrix + */ + Matrix.prototype.toArray = function (transpose, out) { + if (!this.array) { + this.array = new Float32Array(9); + } + var array = out || this.array; + if (transpose) { + array[0] = this.a; + array[1] = this.b; + array[2] = 0; + array[3] = this.c; + array[4] = this.d; + array[5] = 0; + array[6] = this.tx; + array[7] = this.ty; + array[8] = 1; + } + else { + array[0] = this.a; + array[1] = this.c; + array[2] = this.tx; + array[3] = this.b; + array[4] = this.d; + array[5] = this.ty; + array[6] = 0; + array[7] = 0; + array[8] = 1; + } + return array; + }; + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, transformed through this matrix + */ + Matrix.prototype.apply = function (pos, newPos) { + newPos = (newPos || new Point()); + var x = pos.x; + var y = pos.y; + newPos.x = (this.a * x) + (this.c * y) + this.tx; + newPos.y = (this.b * x) + (this.d * y) + this.ty; + return newPos; + }; + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, inverse-transformed through this matrix + */ + Matrix.prototype.applyInverse = function (pos, newPos) { + newPos = (newPos || new Point()); + var id = 1 / ((this.a * this.d) + (this.c * -this.b)); + var x = pos.x; + var y = pos.y; + newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); + newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); + return newPos; + }; + /** + * Translates the matrix on the x and y. + * @param x - How much to translate x by + * @param y - How much to translate y by + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.translate = function (x, y) { + this.tx += x; + this.ty += y; + return this; + }; + /** + * Applies a scale transformation to the matrix. + * @param x - The amount to scale horizontally + * @param y - The amount to scale vertically + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.scale = function (x, y) { + this.a *= x; + this.d *= y; + this.c *= x; + this.b *= y; + this.tx *= x; + this.ty *= y; + return this; + }; + /** + * Applies a rotation transformation to the matrix. + * @param angle - The angle in radians. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.rotate = function (angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var a1 = this.a; + var c1 = this.c; + var tx1 = this.tx; + this.a = (a1 * cos) - (this.b * sin); + this.b = (a1 * sin) + (this.b * cos); + this.c = (c1 * cos) - (this.d * sin); + this.d = (c1 * sin) + (this.d * cos); + this.tx = (tx1 * cos) - (this.ty * sin); + this.ty = (tx1 * sin) + (this.ty * cos); + return this; + }; + /** + * Appends the given Matrix to this Matrix. + * @param matrix - The matrix to append. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.append = function (matrix) { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + this.a = (matrix.a * a1) + (matrix.b * c1); + this.b = (matrix.a * b1) + (matrix.b * d1); + this.c = (matrix.c * a1) + (matrix.d * c1); + this.d = (matrix.c * b1) + (matrix.d * d1); + this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; + this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; + return this; + }; + /** + * Sets the matrix based on all the available properties + * @param x - Position on the x axis + * @param y - Position on the y axis + * @param pivotX - Pivot on the x axis + * @param pivotY - Pivot on the y axis + * @param scaleX - Scale on the x axis + * @param scaleY - Scale on the y axis + * @param rotation - Rotation in radians + * @param skewX - Skew on the x axis + * @param skewY - Skew on the y axis + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { + this.a = Math.cos(rotation + skewY) * scaleX; + this.b = Math.sin(rotation + skewY) * scaleX; + this.c = -Math.sin(rotation - skewX) * scaleY; + this.d = Math.cos(rotation - skewX) * scaleY; + this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); + this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); + return this; + }; + /** + * Prepends the given Matrix to this Matrix. + * @param matrix - The matrix to prepend + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.prepend = function (matrix) { + var tx1 = this.tx; + if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { + var a1 = this.a; + var c1 = this.c; + this.a = (a1 * matrix.a) + (this.b * matrix.c); + this.b = (a1 * matrix.b) + (this.b * matrix.d); + this.c = (c1 * matrix.a) + (this.d * matrix.c); + this.d = (c1 * matrix.b) + (this.d * matrix.d); + } + this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; + this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; + return this; + }; + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * @param transform - The transform to apply the properties to. + * @returns The transform with the newly applied properties + */ + Matrix.prototype.decompose = function (transform) { + // sort out rotation / skew.. + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var pivot = transform.pivot; + var skewX = -Math.atan2(-c, d); + var skewY = Math.atan2(b, a); + var delta = Math.abs(skewX + skewY); + if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { + transform.rotation = skewY; + transform.skew.x = transform.skew.y = 0; + } + else { + transform.rotation = 0; + transform.skew.x = skewX; + transform.skew.y = skewY; + } + // next set scale + transform.scale.x = Math.sqrt((a * a) + (b * b)); + transform.scale.y = Math.sqrt((c * c) + (d * d)); + // next set position + transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c)); + transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d)); + return transform; + }; + /** + * Inverts this matrix + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.invert = function () { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + var tx1 = this.tx; + var n = (a1 * d1) - (b1 * c1); + this.a = d1 / n; + this.b = -b1 / n; + this.c = -c1 / n; + this.d = a1 / n; + this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; + this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; + return this; + }; + /** + * Resets this Matrix to an identity (default) matrix. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.identity = function () { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + return this; + }; + /** + * Creates a new Matrix object with the same values as this one. + * @returns A copy of this matrix. Good for chaining method calls. + */ + Matrix.prototype.clone = function () { + var matrix = new Matrix(); + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * @param matrix - The matrix to copy to. + * @returns The matrix given in parameter with its values updated. + */ + Matrix.prototype.copyTo = function (matrix) { + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the matrix to be the same as the ones in given matrix + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @returns {PIXI.Matrix} this + */ + Matrix.prototype.copyFrom = function (matrix) { + this.a = matrix.a; + this.b = matrix.b; + this.c = matrix.c; + this.d = matrix.d; + this.tx = matrix.tx; + this.ty = matrix.ty; + return this; + }; + Matrix.prototype.toString = function () { + return "[@pixi/math:Matrix a=" + this.a + " b=" + this.b + " c=" + this.c + " d=" + this.d + " tx=" + this.tx + " ty=" + this.ty + "]"; + }; + Object.defineProperty(Matrix, "IDENTITY", { + /** + * A default (identity) matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Matrix, "TEMP_MATRIX", { + /** + * A temp matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + return Matrix; +}()); + +// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group +/* + * Transform matrix for operation n is: + * | ux | vx | + * | uy | vy | + */ +var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; +var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; +var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; +var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; +/** + * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * for the composition of each rotation in the dihederal group D8. + * @type {number[][]} + * @private + */ +var rotationCayley = []; +/** + * Matrices for each `GD8Symmetry` rotation. + * @type {PIXI.Matrix[]} + * @private + */ +var rotationMatrices = []; +/* + * Alias for {@code Math.sign}. + */ +var signum = Math.sign; +/* + * Initializes `rotationCayley` and `rotationMatrices`. It is called + * only once below. + */ +function init() { + for (var i = 0; i < 16; i++) { + var row = []; + rotationCayley.push(row); + for (var j = 0; j < 16; j++) { + /* Multiplies rotation matrices i and j. */ + var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); + var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); + var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); + var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); + /* Finds rotation matrix matching the product and pushes it. */ + for (var k = 0; k < 16; k++) { + if (ux[k] === _ux && uy[k] === _uy + && vx[k] === _vx && vy[k] === _vy) { + row.push(k); + break; + } + } + } + } + for (var i = 0; i < 16; i++) { + var mat = new Matrix(); + mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); + rotationMatrices.push(mat); + } +} +init(); +/** + * @memberof PIXI + * @typedef {number} GD8Symmetry + * @see PIXI.groupD8 + */ +/** + * Implements the dihedral group D8, which is similar to + * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; + * D8 is the same but with diagonals, and it is used for texture + * rotations. + * + * The directions the U- and V- axes after rotation + * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` + * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. + * + * **Origin:**
+ * This is the small part of gameofbombs.com portal system. It works. + * @see PIXI.groupD8.E + * @see PIXI.groupD8.SE + * @see PIXI.groupD8.S + * @see PIXI.groupD8.SW + * @see PIXI.groupD8.W + * @see PIXI.groupD8.NW + * @see PIXI.groupD8.N + * @see PIXI.groupD8.NE + * @author Ivan @ivanpopelyshev + * @namespace PIXI.groupD8 + * @memberof PIXI + */ +var groupD8 = { + /** + * | Rotation | Direction | + * |----------|-----------| + * | 0° | East | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + E: 0, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 45°↻ | Southeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SE: 1, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 90°↻ | South | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + S: 2, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 135°↻ | Southwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SW: 3, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 180° | West | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + W: 4, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -135°/225°↻ | Northwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NW: 5, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -90°/270°↻ | North | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + N: 6, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -45°/315°↻ | Northeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NE: 7, + /** + * Reflection about Y-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_VERTICAL: 8, + /** + * Reflection about the main diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MAIN_DIAGONAL: 10, + /** + * Reflection about X-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_HORIZONTAL: 12, + /** + * Reflection about reverse diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + REVERSE_DIAGONAL: 14, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the U-axis + * after rotating the axes. + */ + uX: function (ind) { return ux[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis + * after rotating the axes. + */ + uY: function (ind) { return uy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the V-axis + * after rotating the axes. + */ + vX: function (ind) { return vx[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis + * after rotating the axes. + */ + vY: function (ind) { return vy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite + * is needed. Only rotations have opposite symmetries while + * reflections don't. + * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation` + */ + inv: function (rotation) { + if (rotation & 8) // true only if between 8 & 15 (reflections) + { + return rotation & 15; // or rotation % 16 + } + return (-rotation) & 7; // or (8 - rotation) % 8 + }, + /** + * Composes the two D8 operations. + * + * Taking `^` as reflection: + * + * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | + * |-------|-----|-----|-----|-----|------|-------|-------|-------| + * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | + * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | + * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | + * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | + * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | + * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | + * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | + * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | + * + * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which + * is the row in the above cayley table. + * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which + * is the column in the above cayley table. + * @returns {PIXI.GD8Symmetry} Composed operation + */ + add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, + /** + * Reverse of `add`. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation + * @param {PIXI.GD8Symmetry} rotationFirst - First operation + * @returns {PIXI.GD8Symmetry} Result + */ + sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, + /** + * Adds 180 degrees to rotation, which is a commutative + * operation. + * @memberof PIXI.groupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} Rotated number + */ + rotate180: function (rotation) { return rotation ^ 4; }, + /** + * Checks if the rotation angle is vertical, i.e. south + * or north. It doesn't work for reflections. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: function (rotation) { return (rotation & 3) === 2; }, + /** + * Approximates the vector `V(dx,dy)` into one of the + * eight directions provided by `groupD8`. + * @memberof PIXI.groupD8 + * @param {number} dx - X-component of the vector + * @param {number} dy - Y-component of the vector + * @returns {PIXI.GD8Symmetry} Approximation of the vector into + * one of the eight symmetries. + */ + byDirection: function (dx, dy) { + if (Math.abs(dx) * 2 <= Math.abs(dy)) { + if (dy >= 0) { + return groupD8.S; + } + return groupD8.N; + } + else if (Math.abs(dy) * 2 <= Math.abs(dx)) { + if (dx > 0) { + return groupD8.E; + } + return groupD8.W; + } + else if (dy > 0) { + if (dx > 0) { + return groupD8.SE; + } + return groupD8.SW; + } + else if (dx > 0) { + return groupD8.NE; + } + return groupD8.NW; + }, + /** + * Helps sprite to compensate texture packer rotation. + * @memberof PIXI.groupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: function (matrix, rotation, tx, ty) { + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + // Packer used "rotation", we use "inv(rotation)" + var mat = rotationMatrices[groupD8.inv(rotation)]; + mat.tx = tx; + mat.ty = ty; + matrix.append(mat); + }, +}; + +/** + * Transform that takes care about its versions. + * @memberof PIXI + */ +var Transform = /** @class */ (function () { + function Transform() { + this.worldTransform = new Matrix(); + this.localTransform = new Matrix(); + this.position = new ObservablePoint(this.onChange, this, 0, 0); + this.scale = new ObservablePoint(this.onChange, this, 1, 1); + this.pivot = new ObservablePoint(this.onChange, this, 0, 0); + this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); + this._rotation = 0; + this._cx = 1; + this._sx = 0; + this._cy = 0; + this._sy = 1; + this._localID = 0; + this._currentLocalID = 0; + this._worldID = 0; + this._parentID = 0; + } + /** Called when a value changes. */ + Transform.prototype.onChange = function () { + this._localID++; + }; + /** Called when the skew or the rotation changes. */ + Transform.prototype.updateSkew = function () { + this._cx = Math.cos(this._rotation + this.skew.y); + this._sx = Math.sin(this._rotation + this.skew.y); + this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 + this._localID++; + }; + Transform.prototype.toString = function () { + return "[@pixi/math:Transform " + + ("position=(" + this.position.x + ", " + this.position.y + ") ") + + ("rotation=" + this.rotation + " ") + + ("scale=(" + this.scale.x + ", " + this.scale.y + ") ") + + ("skew=(" + this.skew.x + ", " + this.skew.y + ") ") + + "]"; + }; + /** Updates the local transformation matrix. */ + Transform.prototype.updateLocalTransform = function () { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + }; + /** + * Updates the local and the world transformation matrices. + * @param parentTransform - The parent transform + */ + Transform.prototype.updateTransform = function (parentTransform) { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + if (this._parentID !== parentTransform._worldID) { + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + 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._parentID = parentTransform._worldID; + // update the id of the transform.. + this._worldID++; + } + }; + /** + * Decomposes a matrix and sets the transforms properties based on it. + * @param matrix - The matrix to decompose + */ + Transform.prototype.setFromMatrix = function (matrix) { + matrix.decompose(this); + this._localID++; + }; + Object.defineProperty(Transform.prototype, "rotation", { + /** The rotation of the object in radians. */ + get: function () { + return this._rotation; + }, + set: function (value) { + if (this._rotation !== value) { + this._rotation = value; + this.updateSkew(); + } + }, + enumerable: false, + configurable: true + }); + /** A default (identity) transform. */ + Transform.IDENTITY = new Transform(); + return Transform; +}()); + +exports.Circle = Circle; +exports.DEG_TO_RAD = DEG_TO_RAD; +exports.Ellipse = Ellipse; +exports.Matrix = Matrix; +exports.ObservablePoint = ObservablePoint; +exports.PI_2 = PI_2; +exports.Point = Point; +exports.Polygon = Polygon; +exports.RAD_TO_DEG = RAD_TO_DEG; +exports.Rectangle = Rectangle; +exports.RoundedRectangle = RoundedRectangle; +exports.Transform = Transform; +exports.groupD8 = groupD8; +//# sourceMappingURL=math.js.map diff --git a/live2d/node_modules/@pixi/math/dist/cjs/math.js.map b/live2d/node_modules/@pixi/math/dist/cjs/math.js.map new file mode 100644 index 0000000..9a1cd17 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/cjs/math.js.map @@ -0,0 +1 @@ +{"version":3,"file":"math.js","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n"],"names":["SHAPES","arguments"],"mappings":";;;;;;;;;;;AAAA;;;;;AAKG;AACI,IAAM,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE;AAEhC;;;;;AAKG;AACI,IAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG;AAExC;;;;;AAKG;AACI,IAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI;AAExC;;;;;;;;;;AAUG;AACSA,wBAQX;AARD,CAAA,UAAY,MAAM,EAAA;AAGd,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,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B,IAAA,SAAA,CAAA,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;IAuMtD,OAAC,SAAA,CAAA;AAAA,CA1MD,EA0MC;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/dist/cjs/math.min.js b/live2d/node_modules/@pixi/math/dist/cjs/math.min.js new file mode 100644 index 0000000..92be56d --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/cjs/math.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,i=2*Math.PI,h=180/Math.PI,s=Math.PI/180;exports.SHAPES=void 0,(t=exports.SHAPES||(exports.SHAPES={}))[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC";var o=function(){function t(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=0,this.y=0,this.x=t,this.y=i}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x=t,this.y=i,this},t}(),r=[new o,new o,new o,new o],e=function(){function t(t,i,h,s){void 0===t&&(t=0),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),this.x=Number(t),this.y=Number(i),this.width=Number(h),this.height=Number(s),this.type=exports.SHAPES.RECT}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t,"EMPTY",{get:function(){return new t(0,0,0,0)},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},t.prototype.contains=function(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t=this.y&&it.right?t.right:this.right)<=h)return!1;var s=this.yt.bottom?t.bottom:this.bottom)>s}var o=this.left,e=this.right,n=this.top,a=this.bottom;if(e<=o||a<=n)return!1;var c=r[0].set(t.left,t.top),y=r[1].set(t.left,t.bottom),u=r[2].set(t.right,t.top),p=r[3].set(t.right,t.bottom);if(u.x<=c.x||y.y<=c.y)return!1;var x=Math.sign(i.a*i.d-i.b*i.c);if(0===x)return!1;if(i.apply(c,c),i.apply(y,y),i.apply(u,u),i.apply(p,p),Math.max(c.x,y.x,u.x,p.x)<=o||Math.min(c.x,y.x,u.x,p.x)>=e||Math.max(c.y,y.y,u.y,p.y)<=n||Math.min(c.y,y.y,u.y,p.y)>=a)return!1;var d=x*(y.y-c.y),f=x*(c.x-y.x),l=d*o+f*n,b=d*e+f*n,v=d*o+f*a,_=d*e+f*a;if(Math.max(l,b,v,_)<=d*c.x+f*c.y||Math.min(l,b,v,_)>=d*p.x+f*p.y)return!1;var w=x*(c.y-u.y),g=x*(u.x-c.x),m=w*o+g*n,M=w*e+g*n,I=w*o+g*a,E=w*e+g*a;return!(Math.max(m,M,I,E)<=w*c.x+g*c.y||Math.min(m,M,I,E)>=w*p.x+g*p.y)},t.prototype.pad=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this},t.prototype.fit=function(t){var i=Math.max(this.x,t.x),h=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(h-i,0),this.y=s,this.height=Math.max(o-s,0),this},t.prototype.ceil=function(t,i){void 0===t&&(t=1),void 0===i&&(i=.001);var h=Math.ceil((this.x+this.width-i)*t)/t,s=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=h-this.x,this.height=s-this.y,this},t.prototype.enlarge=function(t){var i=Math.min(this.x,t.x),h=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=h-i,this.y=s,this.height=o-s,this},t}(),n=function(){function t(t,i,h){void 0===t&&(t=0),void 0===i&&(i=0),void 0===h&&(h=0),this.x=t,this.y=i,this.radius=h,this.type=exports.SHAPES.CIRC}return t.prototype.clone=function(){return new t(this.x,this.y,this.radius)},t.prototype.contains=function(t,i){if(this.radius<=0)return!1;var h=this.radius*this.radius,s=this.x-t,o=this.y-i;return(s*=s)+(o*=o)<=h},t.prototype.getBounds=function(){return new e(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},t}(),a=function(){function t(t,i,h,s){void 0===t&&(t=0),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),this.x=t,this.y=i,this.width=h,this.height=s,this.type=exports.SHAPES.ELIP}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;var h=(t-this.x)/this.width,s=(i-this.y)/this.height;return(h*=h)+(s*=s)<=1},t.prototype.getBounds=function(){return new e(this.x-this.width,this.y-this.height,this.width,this.height)},t}(),c=function(){function t(){for(var t=arguments,i=[],h=0;hi!=c>i&&t<(i-n)/(c-n)*(a-e)+e&&(h=!h)}return h},t}(),y=function(){function t(t,i,h,s,o){void 0===t&&(t=0),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=20),this.x=t,this.y=i,this.width=h,this.height=s,this.radius=o,this.type=exports.SHAPES.RREC}return t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height,this.radius)},t.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){var h=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+h&&i<=this.y+this.height-h||t>=this.x+h&&t<=this.x+this.width-h)return!0;var s=t-(this.x+h),o=i-(this.y+h),r=h*h;if(s*s+o*o<=r)return!0;if((s=t-(this.x+this.width-h))*s+o*o<=r)return!0;if(s*s+(o=i-(this.y+this.height-h))*o<=r)return!0;if((s=t-(this.x+h))*s+o*o<=r)return!0}return!1},t}(),u=function(){function t(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0),this._x=h,this._y=s,this.cb=t,this.scope=i}return t.prototype.clone=function(i,h){return void 0===i&&(i=this.cb),void 0===h&&(h=this.scope),new t(i,h,this._x,this._y)},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this._x===t&&this._y===i||(this._x=t,this._y=i,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),p=function(){function t(t,i,h,s,o,r){void 0===t&&(t=1),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===r&&(r=0),this.array=null,this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=r}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,i,h,s,o,r){return this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=r,this},t.prototype.toArray=function(t,i){this.array||(this.array=new Float32Array(9));var h=i||this.array;return t?(h[0]=this.a,h[1]=this.b,h[2]=0,h[3]=this.c,h[4]=this.d,h[5]=0,h[6]=this.tx,h[7]=this.ty,h[8]=1):(h[0]=this.a,h[1]=this.c,h[2]=this.tx,h[3]=this.b,h[4]=this.d,h[5]=this.ty,h[6]=0,h[7]=0,h[8]=1),h},t.prototype.apply=function(t,i){i=i||new o;var h=t.x,s=t.y;return i.x=this.a*h+this.c*s+this.tx,i.y=this.b*h+this.d*s+this.ty,i},t.prototype.applyInverse=function(t,i){i=i||new o;var h=1/(this.a*this.d+this.c*-this.b),s=t.x,r=t.y;return i.x=this.d*h*s+-this.c*h*r+(this.ty*this.c-this.tx*this.d)*h,i.y=this.a*h*r+-this.b*h*s+(-this.ty*this.a+this.tx*this.b)*h,i},t.prototype.translate=function(t,i){return this.tx+=t,this.ty+=i,this},t.prototype.scale=function(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this},t.prototype.rotate=function(t){var i=Math.cos(t),h=Math.sin(t),s=this.a,o=this.c,r=this.tx;return this.a=s*i-this.b*h,this.b=s*h+this.b*i,this.c=o*i-this.d*h,this.d=o*h+this.d*i,this.tx=r*i-this.ty*h,this.ty=r*h+this.ty*i,this},t.prototype.append=function(t){var i=this.a,h=this.b,s=this.c,o=this.d;return this.a=t.a*i+t.b*s,this.b=t.a*h+t.b*o,this.c=t.c*i+t.d*s,this.d=t.c*h+t.d*o,this.tx=t.tx*i+t.ty*s+this.tx,this.ty=t.tx*h+t.ty*o+this.ty,this},t.prototype.setTransform=function(t,i,h,s,o,r,e,n,a){return this.a=Math.cos(e+a)*o,this.b=Math.sin(e+a)*o,this.c=-Math.sin(e-n)*r,this.d=Math.cos(e-n)*r,this.tx=t-(h*this.a+s*this.c),this.ty=i-(h*this.b+s*this.d),this},t.prototype.prepend=function(t){var i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var h=this.a,s=this.c;this.a=h*t.a+this.b*t.c,this.b=h*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var h=this.a,s=this.b,o=this.c,r=this.d,e=t.pivot,n=-Math.atan2(-o,r),a=Math.atan2(s,h),c=Math.abs(n+a);return c<1e-5||Math.abs(i-c)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=n,t.skew.y=a),t.scale.x=Math.sqrt(h*h+s*s),t.scale.y=Math.sqrt(o*o+r*r),t.position.x=this.tx+(e.x*h+e.y*o),t.position.y=this.ty+(e.x*s+e.y*r),t},t.prototype.invert=function(){var t=this.a,i=this.b,h=this.c,s=this.d,o=this.tx,r=t*s-i*h;return this.a=s/r,this.b=-i/r,this.c=-h/r,this.d=t/r,this.tx=(h*this.ty-s*o)/r,this.ty=-(t*this.ty-i*o)/r,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var i=new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},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},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),x=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],d=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],f=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],l=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],b=[],v=[],_=Math.sign;!function(){for(var t=0;t<16;t++){var i=[];b.push(i);for(var h=0;h<16;h++)for(var s=_(x[t]*x[h]+f[t]*d[h]),o=_(d[t]*x[h]+l[t]*d[h]),r=_(x[t]*f[h]+f[t]*l[h]),e=_(d[t]*f[h]+l[t]*l[h]),n=0;n<16;n++)if(x[n]===s&&d[n]===o&&f[n]===r&&l[n]===e){i.push(n);break}}for(t=0;t<16;t++){var a=new p;a.set(x[t],d[t],f[t],l[t],0,0),v.push(a)}}();var w={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return x[t]},uY:function(t){return d[t]},vX:function(t){return f[t]},vY:function(t){return l[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,i){return b[t][i]},sub:function(t,i){return b[t][w.inv(i)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,i){return 2*Math.abs(t)<=Math.abs(i)?i>=0?w.S:w.N:2*Math.abs(i)<=Math.abs(t)?t>0?w.E:w.W:i>0?t>0?w.SE:w.SW:t>0?w.NE:w.NW},matrixAppendRotationInv:function(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0);var o=v[w.inv(i)];o.tx=h,o.ty=s,t.append(o)}},g=function(){function t(){this.worldTransform=new p,this.localTransform=new p,this.position=new u(this.onChange,this,0,0),this.scale=new u(this.onChange,this,1,1),this.pivot=new u(this.onChange,this,0,0),this.skew=new u(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var i=this.localTransform;if(this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var h=t.worldTransform,s=this.worldTransform;s.a=i.a*h.a+i.b*h.c,s.b=i.a*h.b+i.b*h.d,s.c=i.c*h.a+i.d*h.c,s.d=i.c*h.b+i.d*h.d,s.tx=i.tx*h.a+i.ty*h.c+h.tx,s.ty=i.tx*h.b+i.ty*h.d+h.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();exports.Circle=n,exports.DEG_TO_RAD=s,exports.Ellipse=a,exports.Matrix=p,exports.ObservablePoint=u,exports.PI_2=i,exports.Point=o,exports.Polygon=c,exports.RAD_TO_DEG=h,exports.Rectangle=e,exports.RoundedRectangle=y,exports.Transform=g,exports.groupD8=w; +//# sourceMappingURL=math.min.js.map diff --git a/live2d/node_modules/@pixi/math/dist/cjs/math.min.js.map b/live2d/node_modules/@pixi/math/dist/cjs/math.min.js.map new file mode 100644 index 0000000..66d09ef --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/cjs/math.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"math.min.js","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n"],"names":["SHAPES","PI_2","Math","PI","RAD_TO_DEG","DEG_TO_RAD","Point","x","y","this","prototype","clone","copyFrom","p","set","copyTo","equals","tempPoints","Rectangle","width","height","Number","type","RECT","Object","defineProperty","get","rectangle","contains","intersects","other","transform","x0_1","right","y0_1","bottom","x0","left","x1","y0","top","y1","lt","lb","rt","rb","s","sign","a","d","b","c","apply","max","min","nx","ny","n00","n10","n01","n11","mx","my","m00","m10","m01","m11","pad","paddingX","paddingY","fit","x2","y2","ceil","resolution","eps","floor","enlarge","Circle","radius","CIRC","r2","dx","dy","getBounds","Ellipse","halfWidth","halfHeight","ELIP","normx","normy","Polygon","points","_i","arguments","length","flat","Array","isArray","i","il","push","POLY","closeStroke","polygon","slice","inside","j","xi","yi","xj","yj","RoundedRectangle","RREC","radius2","ObservablePoint","cb","scope","_x","_y","call","value","Matrix","tx","ty","array","fromArray","toArray","transpose","out","Float32Array","pos","newPos","applyInverse","id","translate","scale","rotate","angle","cos","sin","a1","c1","tx1","append","matrix","b1","d1","setTransform","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","prepend","decompose","pivot","atan2","delta","abs","skew","sqrt","position","invert","n","identity","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","k","mat","init","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","add","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","Transform","worldTransform","localTransform","onChange","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","updateLocalTransform","updateTransform","parentTransform","pt","wt","setFromMatrix","IDENTITY"],"mappings":";;;;;;;oEAMO,IA6BKA,EA7BCC,EAAiB,EAAVC,KAAKC,GAQZC,EAAa,IAAMF,KAAKC,GAQxBE,EAAaH,KAAKC,GAAK,IAaxBH,QAQXA,YAAA,GARWA,EAAAA,QAAMA,SAANA,eAQX,KALGA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OC9BJ,IAAAM,EAAA,WAYI,SAAYA,EAAAC,EAAOC,QAAP,IAAAD,IAAAA,EAAK,QAAE,IAAAC,IAAAA,EAAK,GATjBC,KAACF,EAAG,EAEJE,KAACD,EAAG,EASPC,KAAKF,EAAIA,EACTE,KAAKD,EAAIA,EAmEjB,OA5DIF,EAAAI,UAAAC,MAAA,WAEI,OAAO,IAAIL,EAAMG,KAAKF,EAAGE,KAAKD,IAQlCF,EAAQI,UAAAE,SAAR,SAASC,GAIL,OAFAJ,KAAKK,IAAID,EAAEN,EAAGM,EAAEL,GAETC,MAQXH,EAAMI,UAAAK,OAAN,SAAyBF,GAIrB,OAFAA,EAAEC,IAAIL,KAAKF,EAAGE,KAAKD,GAEZK,GAQXP,EAAMI,UAAAM,OAAN,SAAOH,GAEH,OAAQA,EAAEN,IAAME,KAAKF,GAAOM,EAAEL,IAAMC,KAAKD,GAU7CF,EAAAI,UAAAI,IAAA,SAAIP,EAAOC,GAKP,YALA,IAAAD,IAAAA,EAAK,QAAE,IAAAC,IAAAA,EAAKD,GAEZ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index 0000000..1367477 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/esm/math.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var t,i=2*Math.PI,h=180/Math.PI,s=Math.PI/180;!function(t){t[t.POLY=0]="POLY",t[t.RECT=1]="RECT",t[t.CIRC=2]="CIRC",t[t.ELIP=3]="ELIP",t[t.RREC=4]="RREC"}(t||(t={}));var o=function(){function t(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=0,this.y=0,this.x=t,this.y=i}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x=t,this.y=i,this},t}(),n=[new o,new o,new o,new o],r=function(){function i(i,h,s,o){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),this.x=Number(i),this.y=Number(h),this.width=Number(s),this.height=Number(o),this.type=t.RECT}return Object.defineProperty(i.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(i,"EMPTY",{get:function(){return new i(0,0,0,0)},enumerable:!1,configurable:!0}),i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.prototype.contains=function(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t=this.y&&it.right?t.right:this.right)<=h)return!1;var s=this.yt.bottom?t.bottom:this.bottom)>s}var o=this.left,r=this.right,e=this.top,a=this.bottom;if(r<=o||a<=e)return!1;var c=n[0].set(t.left,t.top),y=n[1].set(t.left,t.bottom),u=n[2].set(t.right,t.top),p=n[3].set(t.right,t.bottom);if(u.x<=c.x||y.y<=c.y)return!1;var x=Math.sign(i.a*i.d-i.b*i.c);if(0===x)return!1;if(i.apply(c,c),i.apply(y,y),i.apply(u,u),i.apply(p,p),Math.max(c.x,y.x,u.x,p.x)<=o||Math.min(c.x,y.x,u.x,p.x)>=r||Math.max(c.y,y.y,u.y,p.y)<=e||Math.min(c.y,y.y,u.y,p.y)>=a)return!1;var d=x*(y.y-c.y),f=x*(c.x-y.x),l=d*o+f*e,b=d*r+f*e,v=d*o+f*a,w=d*r+f*a;if(Math.max(l,b,v,w)<=d*c.x+f*c.y||Math.min(l,b,v,w)>=d*p.x+f*p.y)return!1;var _=x*(c.y-u.y),g=x*(u.x-c.x),m=_*o+g*e,M=_*r+g*e,I=_*o+g*a,D=_*r+g*a;return!(Math.max(m,M,I,D)<=_*c.x+g*c.y||Math.min(m,M,I,D)>=_*p.x+g*p.y)},i.prototype.pad=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this},i.prototype.fit=function(t){var i=Math.max(this.x,t.x),h=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(h-i,0),this.y=s,this.height=Math.max(o-s,0),this},i.prototype.ceil=function(t,i){void 0===t&&(t=1),void 0===i&&(i=.001);var h=Math.ceil((this.x+this.width-i)*t)/t,s=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=h-this.x,this.height=s-this.y,this},i.prototype.enlarge=function(t){var i=Math.min(this.x,t.x),h=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=h-i,this.y=s,this.height=o-s,this},i}(),e=function(){function i(i,h,s){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),this.x=i,this.y=h,this.radius=s,this.type=t.CIRC}return i.prototype.clone=function(){return new i(this.x,this.y,this.radius)},i.prototype.contains=function(t,i){if(this.radius<=0)return!1;var h=this.radius*this.radius,s=this.x-t,o=this.y-i;return(s*=s)+(o*=o)<=h},i.prototype.getBounds=function(){return new r(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},i}(),a=function(){function i(i,h,s,o){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),this.x=i,this.y=h,this.width=s,this.height=o,this.type=t.ELIP}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;var h=(t-this.x)/this.width,s=(i-this.y)/this.height;return(h*=h)+(s*=s)<=1},i.prototype.getBounds=function(){return new r(this.x-this.width,this.y-this.height,this.width,this.height)},i}(),c=function(){function i(){for(var i=arguments,h=[],s=0;si!=c>i&&t<(i-e)/(c-e)*(a-r)+r&&(h=!h)}return h},i}(),y=function(){function i(i,h,s,o,n){void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===n&&(n=20),this.x=i,this.y=h,this.width=s,this.height=o,this.radius=n,this.type=t.RREC}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.radius)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){var h=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(i>=this.y+h&&i<=this.y+this.height-h||t>=this.x+h&&t<=this.x+this.width-h)return!0;var s=t-(this.x+h),o=i-(this.y+h),n=h*h;if(s*s+o*o<=n)return!0;if((s=t-(this.x+this.width-h))*s+o*o<=n)return!0;if(s*s+(o=i-(this.y+this.height-h))*o<=n)return!0;if((s=t-(this.x+h))*s+o*o<=n)return!0}return!1},i}(),u=function(){function t(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0),this._x=h,this._y=s,this.cb=t,this.scope=i}return t.prototype.clone=function(i,h){return void 0===i&&(i=this.cb),void 0===h&&(h=this.scope),new t(i,h,this._x,this._y)},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this._x===t&&this._y===i||(this._x=t,this._y=i,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),p=function(){function t(t,i,h,s,o,n){void 0===t&&(t=1),void 0===i&&(i=0),void 0===h&&(h=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===n&&(n=0),this.array=null,this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=n}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,i,h,s,o,n){return this.a=t,this.b=i,this.c=h,this.d=s,this.tx=o,this.ty=n,this},t.prototype.toArray=function(t,i){this.array||(this.array=new Float32Array(9));var h=i||this.array;return t?(h[0]=this.a,h[1]=this.b,h[2]=0,h[3]=this.c,h[4]=this.d,h[5]=0,h[6]=this.tx,h[7]=this.ty,h[8]=1):(h[0]=this.a,h[1]=this.c,h[2]=this.tx,h[3]=this.b,h[4]=this.d,h[5]=this.ty,h[6]=0,h[7]=0,h[8]=1),h},t.prototype.apply=function(t,i){i=i||new o;var h=t.x,s=t.y;return i.x=this.a*h+this.c*s+this.tx,i.y=this.b*h+this.d*s+this.ty,i},t.prototype.applyInverse=function(t,i){i=i||new o;var h=1/(this.a*this.d+this.c*-this.b),s=t.x,n=t.y;return i.x=this.d*h*s+-this.c*h*n+(this.ty*this.c-this.tx*this.d)*h,i.y=this.a*h*n+-this.b*h*s+(-this.ty*this.a+this.tx*this.b)*h,i},t.prototype.translate=function(t,i){return this.tx+=t,this.ty+=i,this},t.prototype.scale=function(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this},t.prototype.rotate=function(t){var i=Math.cos(t),h=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*i-this.b*h,this.b=s*h+this.b*i,this.c=o*i-this.d*h,this.d=o*h+this.d*i,this.tx=n*i-this.ty*h,this.ty=n*h+this.ty*i,this},t.prototype.append=function(t){var i=this.a,h=this.b,s=this.c,o=this.d;return this.a=t.a*i+t.b*s,this.b=t.a*h+t.b*o,this.c=t.c*i+t.d*s,this.d=t.c*h+t.d*o,this.tx=t.tx*i+t.ty*s+this.tx,this.ty=t.tx*h+t.ty*o+this.ty,this},t.prototype.setTransform=function(t,i,h,s,o,n,r,e,a){return this.a=Math.cos(r+a)*o,this.b=Math.sin(r+a)*o,this.c=-Math.sin(r-e)*n,this.d=Math.cos(r-e)*n,this.tx=t-(h*this.a+s*this.c),this.ty=i-(h*this.b+s*this.d),this},t.prototype.prepend=function(t){var i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var h=this.a,s=this.c;this.a=h*t.a+this.b*t.c,this.b=h*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var h=this.a,s=this.b,o=this.c,n=this.d,r=t.pivot,e=-Math.atan2(-o,n),a=Math.atan2(s,h),c=Math.abs(e+a);return c<1e-5||Math.abs(i-c)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=e,t.skew.y=a),t.scale.x=Math.sqrt(h*h+s*s),t.scale.y=Math.sqrt(o*o+n*n),t.position.x=this.tx+(r.x*h+r.y*o),t.position.y=this.ty+(r.x*s+r.y*n),t},t.prototype.invert=function(){var t=this.a,i=this.b,h=this.c,s=this.d,o=this.tx,n=t*s-i*h;return this.a=s/n,this.b=-i/n,this.c=-h/n,this.d=t/n,this.tx=(h*this.ty-s*o)/n,this.ty=-(t*this.ty-i*o)/n,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var i=new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},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},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),x=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],d=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],f=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],l=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],b=[],v=[],w=Math.sign;!function(){for(var t=0;t<16;t++){var i=[];b.push(i);for(var h=0;h<16;h++)for(var s=w(x[t]*x[h]+f[t]*d[h]),o=w(d[t]*x[h]+l[t]*d[h]),n=w(x[t]*f[h]+f[t]*l[h]),r=w(d[t]*f[h]+l[t]*l[h]),e=0;e<16;e++)if(x[e]===s&&d[e]===o&&f[e]===n&&l[e]===r){i.push(e);break}}for(t=0;t<16;t++){var a=new p;a.set(x[t],d[t],f[t],l[t],0,0),v.push(a)}}();var _={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return x[t]},uY:function(t){return d[t]},vX:function(t){return f[t]},vY:function(t){return l[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,i){return b[t][i]},sub:function(t,i){return b[t][_.inv(i)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,i){return 2*Math.abs(t)<=Math.abs(i)?i>=0?_.S:_.N:2*Math.abs(i)<=Math.abs(t)?t>0?_.E:_.W:i>0?t>0?_.SE:_.SW:t>0?_.NE:_.NW},matrixAppendRotationInv:function(t,i,h,s){void 0===h&&(h=0),void 0===s&&(s=0);var o=v[_.inv(i)];o.tx=h,o.ty=s,t.append(o)}},g=function(){function t(){this.worldTransform=new p,this.localTransform=new p,this.position=new u(this.onChange,this,0,0),this.scale=new u(this.onChange,this,1,1),this.pivot=new u(this.onChange,this,0,0),this.skew=new u(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var i=this.localTransform;if(this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var h=t.worldTransform,s=this.worldTransform;s.a=i.a*h.a+i.b*h.c,s.b=i.a*h.b+i.b*h.d,s.c=i.c*h.a+i.d*h.c,s.d=i.c*h.b+i.d*h.d,s.tx=i.tx*h.a+i.ty*h.c+h.tx,s.ty=i.tx*h.b+i.ty*h.d+h.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();export{e as Circle,s as DEG_TO_RAD,a as Ellipse,p as Matrix,u as ObservablePoint,i as PI_2,o as Point,c as Polygon,h as RAD_TO_DEG,r as Rectangle,y as RoundedRectangle,t as SHAPES,g as Transform,_ as groupD8}; +//# sourceMappingURL=math.min.mjs.map diff --git a/live2d/node_modules/@pixi/math/dist/esm/math.min.mjs.map b/live2d/node_modules/@pixi/math/dist/esm/math.min.mjs.map new file mode 100644 index 0000000..5a4f405 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/esm/math.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"math.min.mjs","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n"],"names":["SHAPES","PI_2","Math","PI","RAD_TO_DEG","DEG_TO_RAD","Point","x","y","this","prototype","clone","copyFrom","p","set","copyTo","equals","tempPoints","Rectangle","width","height","Number","type","RECT","Object","defineProperty","get","rectangle","contains","intersects","other","transform","x0_1","right","y0_1","bottom","x0","left","x1","y0","top","y1","lt","lb","rt","rb","s","sign","a","d","b","c","apply","max","min","nx","ny","n00","n10","n01","n11","mx","my","m00","m10","m01","m11","pad","paddingX","paddingY","fit","x2","y2","ceil","resolution","eps","floor","enlarge","Circle","radius","CIRC","r2","dx","dy","getBounds","Ellipse","halfWidth","halfHeight","ELIP","normx","normy","Polygon","points","_i","arguments","length","flat","Array","isArray","i","il","push","POLY","closeStroke","polygon","slice","inside","j","xi","yi","xj","yj","RoundedRectangle","RREC","radius2","ObservablePoint","cb","scope","_x","_y","call","value","Matrix","tx","ty","array","fromArray","toArray","transpose","out","Float32Array","pos","newPos","applyInverse","id","translate","scale","rotate","angle","cos","sin","a1","c1","tx1","append","matrix","b1","d1","setTransform","pivotX","pivotY","scaleX","scaleY","rotation","skewX","skewY","prepend","decompose","pivot","atan2","delta","abs","skew","sqrt","position","invert","n","identity","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","k","mat","init","groupD8","E","SE","S","SW","W","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","add","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","Transform","worldTransform","localTransform","onChange","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","updateLocalTransform","updateTransform","parentTransform","pt","wt","setFromMatrix","IDENTITY"],"mappings":";;;;;;;AAMO,IA6BKA,EA7BCC,EAAiB,EAAVC,KAAKC,GAQZC,EAAa,IAAMF,KAAK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AAImL,EAAGjL,EAAMR,EAAGQ,EAAIiL,EAAGlL,EAClCmL,EAAGjL,EAAKT,EAAGS,EAAIgL,EAAGnL,EAAMN,EAAGO,EAAIkL,EAAGhL,EAClCiL,EAAGnL,EAAKP,EAAGS,EAAIgL,EAAGjL,EAAMR,EAAGO,EAAIkL,EAAGlL,EAClCmL,EAAGzG,GAAMjF,EAAGiF,GAAKwG,EAAGnL,EAAMN,EAAGkF,GAAKuG,EAAGhL,EAAKgL,EAAGxG,GAC7CyG,EAAGxG,GAAMlF,EAAGiF,GAAKwG,EAAGjL,EAAMR,EAAGkF,GAAKuG,EAAGlL,EAAKkL,EAAGvG,GAE7CnH,KAAKsN,UAAYG,EAAgBJ,SAGjCrN,KAAKqN,aAQbZ,EAAaxM,UAAA2N,cAAb,SAAcpF,GAEVA,EAAOY,UAAUpJ,MACjBA,KAAKmN,YAITpM,OAAAC,eAAIyL,EAAQxM,UAAA,WAAA,CAAZgB,IAAA,WAEI,OAAOjB,KAAK8M,WAGhBzM,IAAA,SAAa2G,GAELhH,KAAK8M,YAAc9F,IAEnBhH,KAAK8M,UAAY9F,EACjBhH,KAAK6M,+CApMUJ,EAAAoB,SAAW,IAAIpB,EAuMzCA"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/dist/esm/math.mjs b/live2d/node_modules/@pixi/math/dist/esm/math.mjs new file mode 100644 index 0000000..19346a4 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/esm/math.mjs @@ -0,0 +1,1585 @@ +/*! + * @pixi/math - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +/** + * Two Pi. + * @static + * @member {number} + * @memberof PIXI + */ +var PI_2 = Math.PI * 2; +/** + * Conversion factor for converting radians to degrees. + * @static + * @member {number} RAD_TO_DEG + * @memberof PIXI + */ +var RAD_TO_DEG = 180 / Math.PI; +/** + * Conversion factor for converting degrees to radians. + * @static + * @member {number} + * @memberof PIXI + */ +var DEG_TO_RAD = Math.PI / 180; +/** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * @static + * @memberof PIXI + * @enum {number} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + */ +var SHAPES; +(function (SHAPES) { + SHAPES[SHAPES["POLY"] = 0] = "POLY"; + SHAPES[SHAPES["RECT"] = 1] = "RECT"; + SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; + SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; + SHAPES[SHAPES["RREC"] = 4] = "RREC"; +})(SHAPES || (SHAPES = {})); + +/** + * The Point object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis + * @class + * @memberof PIXI + * @implements {IPoint} + */ +var Point = /** @class */ (function () { + /** + * Creates a new `Point` + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function Point(x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + /** Position of the point on the x axis */ + this.x = 0; + /** Position of the point on the y axis */ + this.y = 0; + this.x = x; + this.y = y; + } + /** + * Creates a clone of this point + * @returns A clone of this point + */ + Point.prototype.clone = function () { + return new Point(this.x, this.y); + }; + /** + * Copies `x` and `y` from the given point into this point + * @param p - The point to copy from + * @returns The point instance itself + */ + Point.prototype.copyFrom = function (p) { + this.set(p.x, p.y); + return this; + }; + /** + * Copies this point's x and y into the given point (`p`). + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + Point.prototype.copyTo = function (p) { + p.set(this.x, this.y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + Point.prototype.equals = function (p) { + return (p.x === this.x) && (p.y === this.y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the `x` axis + * @param {number} [y=x] - position of the point on the `y` axis + * @returns The point instance itself + */ + Point.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + this.x = x; + this.y = y; + return this; + }; + Point.prototype.toString = function () { + return "[@pixi/math:Point x=" + this.x + " y=" + this.y + "]"; + }; + return Point; +}()); + +var tempPoints = [new Point(), new Point(), new Point(), new Point()]; +/** + * Size object, contains width and height + * @memberof PIXI + * @typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ +/** + * 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. + * @memberof PIXI + */ +var Rectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rectangle + * @param y - The Y coordinate of the upper-left corner of the rectangle + * @param width - The overall width of the rectangle + * @param height - The overall height of the rectangle + */ + function Rectangle(x, y, width, height) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + this.x = Number(x); + this.y = Number(y); + this.width = Number(width); + this.height = Number(height); + this.type = SHAPES.RECT; + } + Object.defineProperty(Rectangle.prototype, "left", { + /** Returns the left edge of the rectangle. */ + get: function () { + return this.x; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "right", { + /** Returns the right edge of the rectangle. */ + get: function () { + return this.x + this.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "top", { + /** Returns the top edge of the rectangle. */ + get: function () { + return this.y; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "bottom", { + /** Returns the bottom edge of the rectangle. */ + get: function () { + return this.y + this.height; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle, "EMPTY", { + /** A constant empty rectangle. */ + get: function () { + return new Rectangle(0, 0, 0, 0); + }, + enumerable: false, + configurable: true + }); + /** + * Creates a clone of this Rectangle + * @returns a copy of the rectangle + */ + Rectangle.prototype.clone = function () { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + /** + * Copies another rectangle to this one. + * @param rectangle - The rectangle to copy from. + * @returns Returns itself. + */ + Rectangle.prototype.copyFrom = function (rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + return this; + }; + /** + * Copies this rectangle to another one. + * @param rectangle - The rectangle to copy to. + * @returns Returns given parameter. + */ + Rectangle.prototype.copyTo = function (rectangle) { + rectangle.x = this.x; + rectangle.y = this.y; + rectangle.width = this.width; + rectangle.height = this.height; + return rectangle; + }; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Rectangle + */ + Rectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + return false; + }; + /** + * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object. + * Returns true only if the area of the intersection is >0, this means that Rectangles + * sharing a side are not overlapping. Another side effect is that an arealess rectangle + * (width or height equal to zero) can't intersect any other rectangle. + * @param {Rectangle} other - The Rectangle to intersect with `this`. + * @param {Matrix} transform - The transformation matrix of `other`. + * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`. + */ + Rectangle.prototype.intersects = function (other, transform) { + if (!transform) { + var x0_1 = this.x < other.x ? other.x : this.x; + var x1_1 = this.right > other.right ? other.right : this.right; + if (x1_1 <= x0_1) { + return false; + } + var y0_1 = this.y < other.y ? other.y : this.y; + var y1_1 = this.bottom > other.bottom ? other.bottom : this.bottom; + return y1_1 > y0_1; + } + var x0 = this.left; + var x1 = this.right; + var y0 = this.top; + var y1 = this.bottom; + if (x1 <= x0 || y1 <= y0) { + return false; + } + var lt = tempPoints[0].set(other.left, other.top); + var lb = tempPoints[1].set(other.left, other.bottom); + var rt = tempPoints[2].set(other.right, other.top); + var rb = tempPoints[3].set(other.right, other.bottom); + if (rt.x <= lt.x || lb.y <= lt.y) { + return false; + } + var s = Math.sign((transform.a * transform.d) - (transform.b * transform.c)); + if (s === 0) { + return false; + } + transform.apply(lt, lt); + transform.apply(lb, lb); + transform.apply(rt, rt); + transform.apply(rb, rb); + if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0 + || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1 + || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0 + || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) { + return false; + } + var nx = s * (lb.y - lt.y); + var ny = s * (lt.x - lb.x); + var n00 = (nx * x0) + (ny * y0); + var n10 = (nx * x1) + (ny * y0); + var n01 = (nx * x0) + (ny * y1); + var n11 = (nx * x1) + (ny * y1); + if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y) + || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) { + return false; + } + var mx = s * (lt.y - rt.y); + var my = s * (rt.x - lt.x); + var m00 = (mx * x0) + (my * y0); + var m10 = (mx * x1) + (my * y0); + var m01 = (mx * x0) + (my * y1); + var m11 = (mx * x1) + (my * y1); + if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y) + || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) { + return false; + } + return true; + }; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + * @returns Returns itself. + */ + Rectangle.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + this.x -= paddingX; + this.y -= paddingY; + this.width += paddingX * 2; + this.height += paddingY * 2; + return this; + }; + /** + * Fits this rectangle around the passed one. + * @param rectangle - The rectangle to fit. + * @returns Returns itself. + */ + Rectangle.prototype.fit = function (rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + return this; + }; + /** + * Enlarges rectangle that way its corners lie on grid + * @param resolution - resolution + * @param eps - precision + * @returns Returns itself. + */ + Rectangle.prototype.ceil = function (resolution, eps) { + if (resolution === void 0) { resolution = 1; } + if (eps === void 0) { eps = 0.001; } + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + this.width = x2 - this.x; + this.height = y2 - this.y; + return this; + }; + /** + * Enlarges this rectangle to include the passed rectangle. + * @param rectangle - The rectangle to include. + * @returns Returns itself. + */ + Rectangle.prototype.enlarge = function (rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + return this; + }; + Rectangle.prototype.toString = function () { + return "[@pixi/math:Rectangle x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Rectangle; +}()); + +/** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +var Circle = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this circle + * @param y - The Y coordinate of the center of this circle + * @param radius - The radius of the circle + */ + function Circle(x, y, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (radius === void 0) { radius = 0; } + this.x = x; + this.y = y; + this.radius = radius; + this.type = SHAPES.CIRC; + } + /** + * Creates a clone of this Circle instance + * @returns A copy of the Circle + */ + Circle.prototype.clone = function () { + return new Circle(this.x, this.y, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this circle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Circle + */ + Circle.prototype.contains = function (x, y) { + if (this.radius <= 0) { + return false; + } + var r2 = this.radius * this.radius; + var dx = (this.x - x); + var dy = (this.y - y); + dx *= dx; + dy *= dy; + return (dx + dy <= r2); + }; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * @returns The framing rectangle + */ + Circle.prototype.getBounds = function () { + return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + Circle.prototype.toString = function () { + return "[@pixi/math:Circle x=" + this.x + " y=" + this.y + " radius=" + this.radius + "]"; + }; + return Circle; +}()); + +/** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +var Ellipse = /** @class */ (function () { + /** + * @param x - The X coordinate of the center of this ellipse + * @param y - The Y coordinate of the center of this ellipse + * @param halfWidth - The half width of this ellipse + * @param halfHeight - The half height of this ellipse + */ + function Ellipse(x, y, halfWidth, halfHeight) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (halfWidth === void 0) { halfWidth = 0; } + if (halfHeight === void 0) { halfHeight = 0; } + this.x = x; + this.y = y; + this.width = halfWidth; + this.height = halfHeight; + this.type = SHAPES.ELIP; + } + /** + * Creates a clone of this Ellipse instance + * @returns {PIXI.Ellipse} A copy of the ellipse + */ + Ellipse.prototype.clone = function () { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coords are within this ellipse + */ + Ellipse.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + // normalize the coords to an ellipse with center 0,0 + var normx = ((x - this.x) / this.width); + var normy = ((y - this.y) / this.height); + normx *= normx; + normy *= normy; + return (normx + normy <= 1); + }; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * @returns The framing rectangle + */ + Ellipse.prototype.getBounds = function () { + return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); + }; + Ellipse.prototype.toString = function () { + return "[@pixi/math:Ellipse x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + "]"; + }; + return Ellipse; +}()); + +/** + * A class to define a shape via user defined coordinates. + * @memberof PIXI + */ +var Polygon = /** @class */ (function () { + /** + * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + var arguments$1 = arguments; + + var points = []; + for (var _i = 0; _i < arguments.length; _i++) { + points[_i] = arguments$1[_i]; + } + var flat = Array.isArray(points[0]) ? points[0] : points; + // if this is an array of points, convert it to a flat array of numbers + if (typeof flat[0] !== 'number') { + var p = []; + for (var i = 0, il = flat.length; i < il; i++) { + p.push(flat[i].x, flat[i].y); + } + flat = p; + } + this.points = flat; + this.type = SHAPES.POLY; + this.closeStroke = true; + } + /** + * Creates a clone of this polygon. + * @returns - A copy of the polygon. + */ + Polygon.prototype.clone = function () { + var points = this.points.slice(); + var polygon = new Polygon(points); + polygon.closeStroke = this.closeStroke; + return polygon; + }; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon. + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this polygon. + */ + Polygon.prototype.contains = function (x, y) { + var inside = false; + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[(i * 2) + 1]; + var xj = this.points[j * 2]; + var yj = this.points[(j * 2) + 1]; + var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); + if (intersect) { + inside = !inside; + } + } + return inside; + }; + Polygon.prototype.toString = function () { + return "[@pixi/math:Polygon" + + ("closeStroke=" + this.closeStroke) + + ("points=" + this.points.reduce(function (pointsDesc, currentPoint) { return pointsDesc + ", " + currentPoint; }, '') + "]"); + }; + return Polygon; +}()); + +/** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * @memberof PIXI + */ +var RoundedRectangle = /** @class */ (function () { + /** + * @param x - The X coordinate of the upper-left corner of the rounded rectangle + * @param y - The Y coordinate of the upper-left corner of the rounded rectangle + * @param width - The overall width of this rounded rectangle + * @param height - The overall height of this rounded rectangle + * @param radius - Controls the radius of the rounded corners + */ + function RoundedRectangle(x, y, width, height, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + if (radius === void 0) { radius = 20; } + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.radius = radius; + this.type = SHAPES.RREC; + } + /** + * Creates a clone of this Rounded Rectangle. + * @returns - A copy of the rounded rectangle. + */ + RoundedRectangle.prototype.clone = function () { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this Rounded Rectangle. + */ + RoundedRectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + var radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2)); + if ((y >= this.y + radius && y <= this.y + this.height - radius) + || (x >= this.x + radius && x <= this.x + this.width - radius)) { + return true; + } + var dx = x - (this.x + radius); + var dy = y - (this.y + radius); + var radius2 = radius * radius; + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.width - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dy = y - (this.y + this.height - radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + } + } + return false; + }; + RoundedRectangle.prototype.toString = function () { + return "[@pixi/math:RoundedRectangle x=" + this.x + " y=" + this.y + + ("width=" + this.width + " height=" + this.height + " radius=" + this.radius + "]"); + }; + return RoundedRectangle; +}()); + +/** + * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis. + * + * An `ObservablePoint` is a point that triggers a callback when the point's position is changed. + * @memberof PIXI + */ +var ObservablePoint = /** @class */ (function () { + /** + * Creates a new `ObservablePoint` + * @param cb - callback function triggered when `x` and/or `y` are changed + * @param scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function ObservablePoint(cb, scope, x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + this._x = x; + this._y = y; + this.cb = cb; + this.scope = scope; + } + /** + * Creates a clone of this point. + * The callback and scope params can be overridden otherwise they will default + * to the clone object's values. + * @override + * @param cb - The callback function triggered when `x` and/or `y` are changed + * @param scope - The owner of the callback + * @returns a copy of this observable point + */ + ObservablePoint.prototype.clone = function (cb, scope) { + if (cb === void 0) { cb = this.cb; } + if (scope === void 0) { scope = this.scope; } + return new ObservablePoint(cb, scope, this._x, this._y); + }; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns The observable point instance itself + */ + ObservablePoint.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + if (this._x !== x || this._y !== y) { + this._x = x; + this._y = y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies x and y from the given point (`p`) + * @param p - The point to copy from. Can be any of type that is or extends `IPointData` + * @returns The observable point instance itself + */ + ObservablePoint.prototype.copyFrom = function (p) { + if (this._x !== p.x || this._y !== p.y) { + this._x = p.x; + this._y = p.y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies this point's x and y into that of the given point (`p`) + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + ObservablePoint.prototype.copyTo = function (p) { + p.set(this._x, this._y); + return p; + }; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + ObservablePoint.prototype.equals = function (p) { + return (p.x === this._x) && (p.y === this._y); + }; + ObservablePoint.prototype.toString = function () { + return "[@pixi/math:ObservablePoint x=" + 0 + " y=" + 0 + " scope=" + this.scope + "]"; + }; + Object.defineProperty(ObservablePoint.prototype, "x", { + /** Position of the observable point on the x axis. */ + get: function () { + return this._x; + }, + set: function (value) { + if (this._x !== value) { + this._x = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservablePoint.prototype, "y", { + /** Position of the observable point on the y axis. */ + get: function () { + return this._y; + }, + set: function (value) { + if (this._y !== value) { + this._y = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + return ObservablePoint; +}()); + +/** + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * ``` + * @memberof PIXI + */ +var Matrix = /** @class */ (function () { + /** + * @param a - x scale + * @param b - y skew + * @param c - x skew + * @param d - y scale + * @param tx - x translation + * @param ty - y translation + */ + function Matrix(a, b, c, d, tx, ty) { + if (a === void 0) { a = 1; } + if (b === void 0) { b = 0; } + if (c === void 0) { c = 0; } + if (d === void 0) { d = 1; } + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + this.array = null; + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + } + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * @param array - The array that the matrix will be populated from. + */ + Matrix.prototype.fromArray = function (array) { + this.a = array[0]; + this.b = array[1]; + this.c = array[3]; + this.d = array[4]; + this.tx = array[2]; + this.ty = array[5]; + }; + /** + * Sets the matrix properties. + * @param a - Matrix component + * @param b - Matrix component + * @param c - Matrix component + * @param d - Matrix component + * @param tx - Matrix component + * @param ty - Matrix component + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.set = function (a, b, c, d, tx, ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + return this; + }; + /** + * Creates an array from the current Matrix object. + * @param transpose - Whether we need to transpose the matrix or not + * @param [out=new Float32Array(9)] - If provided the array will be assigned to out + * @returns The newly created array which contains the matrix + */ + Matrix.prototype.toArray = function (transpose, out) { + if (!this.array) { + this.array = new Float32Array(9); + } + var array = out || this.array; + if (transpose) { + array[0] = this.a; + array[1] = this.b; + array[2] = 0; + array[3] = this.c; + array[4] = this.d; + array[5] = 0; + array[6] = this.tx; + array[7] = this.ty; + array[8] = 1; + } + else { + array[0] = this.a; + array[1] = this.c; + array[2] = this.tx; + array[3] = this.b; + array[4] = this.d; + array[5] = this.ty; + array[6] = 0; + array[7] = 0; + array[8] = 1; + } + return array; + }; + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, transformed through this matrix + */ + Matrix.prototype.apply = function (pos, newPos) { + newPos = (newPos || new Point()); + var x = pos.x; + var y = pos.y; + newPos.x = (this.a * x) + (this.c * y) + this.tx; + newPos.y = (this.b * x) + (this.d * y) + this.ty; + return newPos; + }; + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, inverse-transformed through this matrix + */ + Matrix.prototype.applyInverse = function (pos, newPos) { + newPos = (newPos || new Point()); + var id = 1 / ((this.a * this.d) + (this.c * -this.b)); + var x = pos.x; + var y = pos.y; + newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); + newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); + return newPos; + }; + /** + * Translates the matrix on the x and y. + * @param x - How much to translate x by + * @param y - How much to translate y by + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.translate = function (x, y) { + this.tx += x; + this.ty += y; + return this; + }; + /** + * Applies a scale transformation to the matrix. + * @param x - The amount to scale horizontally + * @param y - The amount to scale vertically + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.scale = function (x, y) { + this.a *= x; + this.d *= y; + this.c *= x; + this.b *= y; + this.tx *= x; + this.ty *= y; + return this; + }; + /** + * Applies a rotation transformation to the matrix. + * @param angle - The angle in radians. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.rotate = function (angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var a1 = this.a; + var c1 = this.c; + var tx1 = this.tx; + this.a = (a1 * cos) - (this.b * sin); + this.b = (a1 * sin) + (this.b * cos); + this.c = (c1 * cos) - (this.d * sin); + this.d = (c1 * sin) + (this.d * cos); + this.tx = (tx1 * cos) - (this.ty * sin); + this.ty = (tx1 * sin) + (this.ty * cos); + return this; + }; + /** + * Appends the given Matrix to this Matrix. + * @param matrix - The matrix to append. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.append = function (matrix) { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + this.a = (matrix.a * a1) + (matrix.b * c1); + this.b = (matrix.a * b1) + (matrix.b * d1); + this.c = (matrix.c * a1) + (matrix.d * c1); + this.d = (matrix.c * b1) + (matrix.d * d1); + this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; + this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; + return this; + }; + /** + * Sets the matrix based on all the available properties + * @param x - Position on the x axis + * @param y - Position on the y axis + * @param pivotX - Pivot on the x axis + * @param pivotY - Pivot on the y axis + * @param scaleX - Scale on the x axis + * @param scaleY - Scale on the y axis + * @param rotation - Rotation in radians + * @param skewX - Skew on the x axis + * @param skewY - Skew on the y axis + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { + this.a = Math.cos(rotation + skewY) * scaleX; + this.b = Math.sin(rotation + skewY) * scaleX; + this.c = -Math.sin(rotation - skewX) * scaleY; + this.d = Math.cos(rotation - skewX) * scaleY; + this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); + this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); + return this; + }; + /** + * Prepends the given Matrix to this Matrix. + * @param matrix - The matrix to prepend + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.prepend = function (matrix) { + var tx1 = this.tx; + if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { + var a1 = this.a; + var c1 = this.c; + this.a = (a1 * matrix.a) + (this.b * matrix.c); + this.b = (a1 * matrix.b) + (this.b * matrix.d); + this.c = (c1 * matrix.a) + (this.d * matrix.c); + this.d = (c1 * matrix.b) + (this.d * matrix.d); + } + this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; + this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; + return this; + }; + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * @param transform - The transform to apply the properties to. + * @returns The transform with the newly applied properties + */ + Matrix.prototype.decompose = function (transform) { + // sort out rotation / skew.. + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var pivot = transform.pivot; + var skewX = -Math.atan2(-c, d); + var skewY = Math.atan2(b, a); + var delta = Math.abs(skewX + skewY); + if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { + transform.rotation = skewY; + transform.skew.x = transform.skew.y = 0; + } + else { + transform.rotation = 0; + transform.skew.x = skewX; + transform.skew.y = skewY; + } + // next set scale + transform.scale.x = Math.sqrt((a * a) + (b * b)); + transform.scale.y = Math.sqrt((c * c) + (d * d)); + // next set position + transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c)); + transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d)); + return transform; + }; + /** + * Inverts this matrix + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.invert = function () { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + var tx1 = this.tx; + var n = (a1 * d1) - (b1 * c1); + this.a = d1 / n; + this.b = -b1 / n; + this.c = -c1 / n; + this.d = a1 / n; + this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; + this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; + return this; + }; + /** + * Resets this Matrix to an identity (default) matrix. + * @returns This matrix. Good for chaining method calls. + */ + Matrix.prototype.identity = function () { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + return this; + }; + /** + * Creates a new Matrix object with the same values as this one. + * @returns A copy of this matrix. Good for chaining method calls. + */ + Matrix.prototype.clone = function () { + var matrix = new Matrix(); + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * @param matrix - The matrix to copy to. + * @returns The matrix given in parameter with its values updated. + */ + Matrix.prototype.copyTo = function (matrix) { + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the matrix to be the same as the ones in given matrix + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @returns {PIXI.Matrix} this + */ + Matrix.prototype.copyFrom = function (matrix) { + this.a = matrix.a; + this.b = matrix.b; + this.c = matrix.c; + this.d = matrix.d; + this.tx = matrix.tx; + this.ty = matrix.ty; + return this; + }; + Matrix.prototype.toString = function () { + return "[@pixi/math:Matrix a=" + this.a + " b=" + this.b + " c=" + this.c + " d=" + this.d + " tx=" + this.tx + " ty=" + this.ty + "]"; + }; + Object.defineProperty(Matrix, "IDENTITY", { + /** + * A default (identity) matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Matrix, "TEMP_MATRIX", { + /** + * A temp matrix + * @readonly + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + return Matrix; +}()); + +// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group +/* + * Transform matrix for operation n is: + * | ux | vx | + * | uy | vy | + */ +var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; +var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; +var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; +var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; +/** + * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * for the composition of each rotation in the dihederal group D8. + * @type {number[][]} + * @private + */ +var rotationCayley = []; +/** + * Matrices for each `GD8Symmetry` rotation. + * @type {PIXI.Matrix[]} + * @private + */ +var rotationMatrices = []; +/* + * Alias for {@code Math.sign}. + */ +var signum = Math.sign; +/* + * Initializes `rotationCayley` and `rotationMatrices`. It is called + * only once below. + */ +function init() { + for (var i = 0; i < 16; i++) { + var row = []; + rotationCayley.push(row); + for (var j = 0; j < 16; j++) { + /* Multiplies rotation matrices i and j. */ + var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); + var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); + var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); + var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); + /* Finds rotation matrix matching the product and pushes it. */ + for (var k = 0; k < 16; k++) { + if (ux[k] === _ux && uy[k] === _uy + && vx[k] === _vx && vy[k] === _vy) { + row.push(k); + break; + } + } + } + } + for (var i = 0; i < 16; i++) { + var mat = new Matrix(); + mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); + rotationMatrices.push(mat); + } +} +init(); +/** + * @memberof PIXI + * @typedef {number} GD8Symmetry + * @see PIXI.groupD8 + */ +/** + * Implements the dihedral group D8, which is similar to + * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; + * D8 is the same but with diagonals, and it is used for texture + * rotations. + * + * The directions the U- and V- axes after rotation + * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` + * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. + * + * **Origin:**
+ * This is the small part of gameofbombs.com portal system. It works. + * @see PIXI.groupD8.E + * @see PIXI.groupD8.SE + * @see PIXI.groupD8.S + * @see PIXI.groupD8.SW + * @see PIXI.groupD8.W + * @see PIXI.groupD8.NW + * @see PIXI.groupD8.N + * @see PIXI.groupD8.NE + * @author Ivan @ivanpopelyshev + * @namespace PIXI.groupD8 + * @memberof PIXI + */ +var groupD8 = { + /** + * | Rotation | Direction | + * |----------|-----------| + * | 0° | East | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + E: 0, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 45°↻ | Southeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SE: 1, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 90°↻ | South | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + S: 2, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 135°↻ | Southwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SW: 3, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 180° | West | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + W: 4, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -135°/225°↻ | Northwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NW: 5, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -90°/270°↻ | North | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + N: 6, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -45°/315°↻ | Northeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NE: 7, + /** + * Reflection about Y-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_VERTICAL: 8, + /** + * Reflection about the main diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MAIN_DIAGONAL: 10, + /** + * Reflection about X-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_HORIZONTAL: 12, + /** + * Reflection about reverse diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + REVERSE_DIAGONAL: 14, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the U-axis + * after rotating the axes. + */ + uX: function (ind) { return ux[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis + * after rotating the axes. + */ + uY: function (ind) { return uy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the V-axis + * after rotating the axes. + */ + vX: function (ind) { return vx[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis + * after rotating the axes. + */ + vY: function (ind) { return vy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite + * is needed. Only rotations have opposite symmetries while + * reflections don't. + * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation` + */ + inv: function (rotation) { + if (rotation & 8) // true only if between 8 & 15 (reflections) + { + return rotation & 15; // or rotation % 16 + } + return (-rotation) & 7; // or (8 - rotation) % 8 + }, + /** + * Composes the two D8 operations. + * + * Taking `^` as reflection: + * + * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | + * |-------|-----|-----|-----|-----|------|-------|-------|-------| + * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | + * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | + * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | + * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | + * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | + * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | + * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | + * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | + * + * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which + * is the row in the above cayley table. + * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which + * is the column in the above cayley table. + * @returns {PIXI.GD8Symmetry} Composed operation + */ + add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, + /** + * Reverse of `add`. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation + * @param {PIXI.GD8Symmetry} rotationFirst - First operation + * @returns {PIXI.GD8Symmetry} Result + */ + sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, + /** + * Adds 180 degrees to rotation, which is a commutative + * operation. + * @memberof PIXI.groupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} Rotated number + */ + rotate180: function (rotation) { return rotation ^ 4; }, + /** + * Checks if the rotation angle is vertical, i.e. south + * or north. It doesn't work for reflections. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: function (rotation) { return (rotation & 3) === 2; }, + /** + * Approximates the vector `V(dx,dy)` into one of the + * eight directions provided by `groupD8`. + * @memberof PIXI.groupD8 + * @param {number} dx - X-component of the vector + * @param {number} dy - Y-component of the vector + * @returns {PIXI.GD8Symmetry} Approximation of the vector into + * one of the eight symmetries. + */ + byDirection: function (dx, dy) { + if (Math.abs(dx) * 2 <= Math.abs(dy)) { + if (dy >= 0) { + return groupD8.S; + } + return groupD8.N; + } + else if (Math.abs(dy) * 2 <= Math.abs(dx)) { + if (dx > 0) { + return groupD8.E; + } + return groupD8.W; + } + else if (dy > 0) { + if (dx > 0) { + return groupD8.SE; + } + return groupD8.SW; + } + else if (dx > 0) { + return groupD8.NE; + } + return groupD8.NW; + }, + /** + * Helps sprite to compensate texture packer rotation. + * @memberof PIXI.groupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: function (matrix, rotation, tx, ty) { + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + // Packer used "rotation", we use "inv(rotation)" + var mat = rotationMatrices[groupD8.inv(rotation)]; + mat.tx = tx; + mat.ty = ty; + matrix.append(mat); + }, +}; + +/** + * Transform that takes care about its versions. + * @memberof PIXI + */ +var Transform = /** @class */ (function () { + function Transform() { + this.worldTransform = new Matrix(); + this.localTransform = new Matrix(); + this.position = new ObservablePoint(this.onChange, this, 0, 0); + this.scale = new ObservablePoint(this.onChange, this, 1, 1); + this.pivot = new ObservablePoint(this.onChange, this, 0, 0); + this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); + this._rotation = 0; + this._cx = 1; + this._sx = 0; + this._cy = 0; + this._sy = 1; + this._localID = 0; + this._currentLocalID = 0; + this._worldID = 0; + this._parentID = 0; + } + /** Called when a value changes. */ + Transform.prototype.onChange = function () { + this._localID++; + }; + /** Called when the skew or the rotation changes. */ + Transform.prototype.updateSkew = function () { + this._cx = Math.cos(this._rotation + this.skew.y); + this._sx = Math.sin(this._rotation + this.skew.y); + this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 + this._localID++; + }; + Transform.prototype.toString = function () { + return "[@pixi/math:Transform " + + ("position=(" + this.position.x + ", " + this.position.y + ") ") + + ("rotation=" + this.rotation + " ") + + ("scale=(" + this.scale.x + ", " + this.scale.y + ") ") + + ("skew=(" + this.skew.x + ", " + this.skew.y + ") ") + + "]"; + }; + /** Updates the local transformation matrix. */ + Transform.prototype.updateLocalTransform = function () { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + }; + /** + * Updates the local and the world transformation matrices. + * @param parentTransform - The parent transform + */ + Transform.prototype.updateTransform = function (parentTransform) { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + if (this._parentID !== parentTransform._worldID) { + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + 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._parentID = parentTransform._worldID; + // update the id of the transform.. + this._worldID++; + } + }; + /** + * Decomposes a matrix and sets the transforms properties based on it. + * @param matrix - The matrix to decompose + */ + Transform.prototype.setFromMatrix = function (matrix) { + matrix.decompose(this); + this._localID++; + }; + Object.defineProperty(Transform.prototype, "rotation", { + /** The rotation of the object in radians. */ + get: function () { + return this._rotation; + }, + set: function (value) { + if (this._rotation !== value) { + this._rotation = value; + this.updateSkew(); + } + }, + enumerable: false, + configurable: true + }); + /** A default (identity) transform. */ + Transform.IDENTITY = new Transform(); + return Transform; +}()); + +export { Circle, DEG_TO_RAD, Ellipse, Matrix, ObservablePoint, PI_2, Point, Polygon, RAD_TO_DEG, Rectangle, RoundedRectangle, SHAPES, Transform, groupD8 }; +//# sourceMappingURL=math.mjs.map diff --git a/live2d/node_modules/@pixi/math/dist/esm/math.mjs.map b/live2d/node_modules/@pixi/math/dist/esm/math.mjs.map new file mode 100644 index 0000000..0ae21f4 --- /dev/null +++ b/live2d/node_modules/@pixi/math/dist/esm/math.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"math.mjs","sources":["../../src/const.ts","../../src/Point.ts","../../src/shapes/Rectangle.ts","../../src/shapes/Circle.ts","../../src/shapes/Ellipse.ts","../../src/shapes/Polygon.ts","../../src/shapes/RoundedRectangle.ts","../../src/ObservablePoint.ts","../../src/Matrix.ts","../../src/groupD8.ts","../../src/Transform.ts"],"sourcesContent":["/**\n * Two Pi.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const PI_2 = Math.PI * 2;\n\n/**\n * Conversion factor for converting radians to degrees.\n * @static\n * @member {number} RAD_TO_DEG\n * @memberof PIXI\n */\nexport const RAD_TO_DEG = 180 / Math.PI;\n\n/**\n * Conversion factor for converting degrees to radians.\n * @static\n * @member {number}\n * @memberof PIXI\n */\nexport const DEG_TO_RAD = Math.PI / 180;\n\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nexport enum SHAPES\n// eslint-disable-next-line @typescript-eslint/indent\n{\n POLY = 0,\n RECT = 1,\n CIRC = 2,\n ELIP = 3,\n RREC = 4,\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n * @class\n * @memberof PIXI\n * @implements {IPoint}\n */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\n /**\n * Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /**\n * Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\n\n /**\n * Copies `x` and `y` from the given point into this point\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\n\n /**\n * Copies this point's x and y into the given point (`p`).\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { Matrix } from '../Matrix';\nimport { Point } from '../Point';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n * @memberof PIXI\n * @typedef {object} ISize\n * @property {number} width - Width component\n * @property {number} height - Height component\n */\n\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n * @memberof PIXI\n */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n constructor(x: string | number = 0, y: string | number = 0, width: string | number = 0, height: string | number = 0)\n {\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n * @returns a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n * @param rectangle - The rectangle to copy from.\n * @returns Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\n\n /**\n * Copies this rectangle to another one.\n * @param rectangle - The rectangle to copy to.\n * @returns Returns given parameter.\n */\n copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.\n * Returns true only if the area of the intersection is >0, this means that Rectangles\n * sharing a side are not overlapping. Another side effect is that an arealess rectangle\n * (width or height equal to zero) can't intersect any other rectangle.\n * @param {Rectangle} other - The Rectangle to intersect with `this`.\n * @param {Matrix} transform - The transformation matrix of `other`.\n * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.\n */\n intersects(other: Rectangle, transform?: Matrix): boolean\n {\n if (!transform)\n {\n const x0 = this.x < other.x ? other.x : this.x;\n const x1 = this.right > other.right ? other.right : this.right;\n\n if (x1 <= x0)\n {\n return false;\n }\n\n const y0 = this.y < other.y ? other.y : this.y;\n const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;\n\n return y1 > y0;\n }\n\n const x0 = this.left;\n const x1 = this.right;\n const y0 = this.top;\n const y1 = this.bottom;\n\n if (x1 <= x0 || y1 <= y0)\n {\n return false;\n }\n\n const lt = tempPoints[0].set(other.left, other.top);\n const lb = tempPoints[1].set(other.left, other.bottom);\n const rt = tempPoints[2].set(other.right, other.top);\n const rb = tempPoints[3].set(other.right, other.bottom);\n\n if (rt.x <= lt.x || lb.y <= lt.y)\n {\n return false;\n }\n\n const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));\n\n if (s === 0)\n {\n return false;\n }\n\n transform.apply(lt, lt);\n transform.apply(lb, lb);\n transform.apply(rt, rt);\n transform.apply(rb, rb);\n\n if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0\n || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1\n || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0\n || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1)\n {\n return false;\n }\n\n const nx = s * (lb.y - lt.y);\n const ny = s * (lt.x - lb.x);\n const n00 = (nx * x0) + (ny * y0);\n const n10 = (nx * x1) + (ny * y0);\n const n01 = (nx * x0) + (ny * y1);\n const n11 = (nx * x1) + (ny * y1);\n\n if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)\n || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y))\n {\n return false;\n }\n\n const mx = s * (lt.y - rt.y);\n const my = s * (rt.x - lt.x);\n const m00 = (mx * x0) + (my * y0);\n const m10 = (mx * x1) + (my * y0);\n const m01 = (mx * x0) + (my * y1);\n const m11 = (mx * x1) + (my * y1);\n\n if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)\n || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y))\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @returns Returns itself.\n */\n pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n * @param rectangle - The rectangle to fit.\n * @returns Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n\n return this;\n }\n\n /**\n * Enlarges rectangle that way its corners lie on grid\n * @param resolution - resolution\n * @param eps - precision\n * @returns Returns itself.\n */\n ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\n\n /**\n * Enlarges this rectangle to include the passed rectangle.\n * @param rectangle - The rectangle to include.\n * @returns Returns itself.\n */\n enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n * @returns A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coordinates are within this Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n * @returns {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @returns Whether the x/y coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n * @returns The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[] | number[]);\n constructor(...points: IPointData[] | number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[] | number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n * @returns - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /** @default 20 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RREC;\n\n /**\n * @param x - The X coordinate of the upper-left corner of the rounded rectangle\n * @param y - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param width - The overall width of this rounded rectangle\n * @param height - The overall height of this rounded rectangle\n * @param radius - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.radius = radius;\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle.\n * @returns - A copy of the rounded rectangle.\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n * @param x - The X coordinate of the point to test.\n * @param y - The Y coordinate of the point to test.\n * @returns - Whether the x/y coordinates are within this Rounded Rectangle.\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n * @memberof PIXI\n */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\n /**\n * Creates a new `ObservablePoint`\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\n\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @returns a copy of this observable point\n */\n clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\n\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies x and y from the given point (`p`)\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\n\n /**\n * Copies this point's x and y into that of the given point (`p`)\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\n\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n * @memberof PIXI\n */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array | null = null;\n\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n * @param array - The array that the matrix will be populated from.\n */\n fromArray(array: number[]): void\n {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n }\n\n /**\n * Sets the matrix properties.\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @returns This matrix. Good for chaining method calls.\n */\n set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n\n return this;\n }\n\n /**\n * Creates an array from the current Matrix object.\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @returns The newly created array which contains the matrix\n */\n toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else\n {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n\n return array;\n }\n\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, transformed through this matrix\n */\n apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\n\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @returns {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n\n return newPos;\n }\n\n /**\n * Translates the matrix on the x and y.\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @returns This matrix. Good for chaining method calls.\n */\n translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\n\n /**\n * Applies a scale transformation to the matrix.\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @returns This matrix. Good for chaining method calls.\n */\n scale(x: number, y: number): this\n {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n\n return this;\n }\n\n /**\n * Applies a rotation transformation to the matrix.\n * @param angle - The angle in radians.\n * @returns This matrix. Good for chaining method calls.\n */\n rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n\n return this;\n }\n\n /**\n * Appends the given Matrix to this Matrix.\n * @param matrix - The matrix to append.\n * @returns This matrix. Good for chaining method calls.\n */\n append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\n\n /**\n * Sets the matrix based on all the available properties\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @returns This matrix. Good for chaining method calls.\n */\n setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\n\n /**\n * Prepends the given Matrix to this Matrix.\n * @param matrix - The matrix to prepend\n * @returns This matrix. Good for chaining method calls.\n */\n prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n\n return this;\n }\n\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n * @param transform - The transform to apply the properties to.\n * @returns The transform with the newly applied properties\n */\n decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n\n return transform;\n }\n\n /**\n * Inverts this matrix\n * @returns This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n * @returns This matrix. Good for chaining method calls.\n */\n identity(): this\n {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n\n return this;\n }\n\n /**\n * Creates a new Matrix object with the same values as this one.\n * @returns A copy of this matrix. Good for chaining method calls.\n */\n clone(): Matrix\n {\n const matrix = new Matrix();\n\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n * @param matrix - The matrix to copy to.\n * @returns The matrix given in parameter with its values updated.\n */\n copyTo(matrix: Matrix): Matrix\n {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n\n return matrix;\n }\n\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @returns {PIXI.Matrix} this\n */\n copyFrom(matrix: Matrix): this\n {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`;\n }\n // #endif\n\n /**\n * A default (identity) matrix\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n * @type {number[][]}\n * @private\n */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n * @type {PIXI.Matrix[]}\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\n\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @returns {PIXI.GD8Symmetry} Composed operation\n */\n add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\n /**\n * Reverse of `add`.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @returns {PIXI.GD8Symmetry} Result\n */\n sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: (rotation: number): number => rotation ^ 4,\n\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @returns {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\n\n /**\n * Helps sprite to compensate texture packer rotation.\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */\n protected _currentLocalID: number;\n\n constructor()\n {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Transform `\n + `position=(${this.position.x}, ${this.position.y}) `\n + `rotation=${this.rotation} `\n + `scale=(${this.scale.x}, ${this.scale.y}) `\n + `skew=(${this.skew.x}, ${this.skew.y}) `\n + `]`;\n }\n // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\n }\n\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n * @param matrix - The matrix to decompose\n */\n setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\n }\n}\n"],"names":["arguments"],"mappings":";;;;;;;AAAA;;;;;AAKG;AACI,IAAM,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE;AAEhC;;;;;AAKG;AACI,IAAM,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG;AAExC;;;;;AAKG;AACI,IAAM,UAAU,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI;AAExC;;;;;;;;;;AAUG;AACH,IAAY,OAQX;AARD,CAAA,UAAY,MAAM,EAAA;AAGd,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACR,IAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACZ,CAAC,EARW,MAAM,KAAN,MAAM,GAQjB,EAAA,CAAA,CAAA;;ACtCD;;;;;;AAMG;AACH,IAAA,KAAA,kBAAA,YAAA;AAOI;;;;AAIG;IACH,SAAY,KAAA,CAAA,CAAK,EAAE,CAAK,EAAA;AAAZ,QAAA,IAAA,CAAA,KAAA,KAAA,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AAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;AAEhD,YAAA,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,QAAQ,CAAC;;YAG1C,IAAI,CAAC,QAAQ,EAAE,CAAC;AACnB,SAAA;KACJ,CAAA;AAED;;;AAGG;IACH,SAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,MAAc,EAAA;AAExB,QAAA,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;KACnB,CAAA;AAGD,IAAA,MAAA,CAAA,cAAA,CAAI,SAAQ,CAAA,SAAA,EAAA,UAAA,EAAA;;AAAZ,QAAA,GAAA,EAAA,YAAA;YAEI,OAAO,IAAI,CAAC,SAAS,CAAC;SACzB;AAED,QAAA,GAAA,EAAA,UAAa,KAAa,EAAA;AAEtB,YAAA,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAC5B;AACI,gBAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,IAAI,CAAC,UAAU,EAAE,CAAC;AACrB,aAAA;SACJ;;;AATA,KAAA,CAAA,CAAA;;AA7LsB,IAAA,SAAA,CAAA,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;IAuMtD,OAAC,SAAA,CAAA;AAAA,CA1MD,EA0MC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/math/global.d.ts b/live2d/node_modules/@pixi/math/global.d.ts new file mode 100644 index 0000000..87946a9 --- /dev/null +++ b/live2d/node_modules/@pixi/math/global.d.ts @@ -0,0 +1,28 @@ +declare namespace GlobalMixins +{ + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface IPointData + { + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Point + { + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface ObservablePoint + { + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Rectangle + { + } + + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Transform + { + } +} diff --git a/live2d/node_modules/@pixi/math/index.d.ts b/live2d/node_modules/@pixi/math/index.d.ts new file mode 100644 index 0000000..b1fd6dd --- /dev/null +++ b/live2d/node_modules/@pixi/math/index.d.ts @@ -0,0 +1,935 @@ +/// + +/** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +export declare class Circle { + /** @default 0 */ + x: number; + /** @default 0 */ + y: number; + /** @default 0 */ + radius: number; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * @default PIXI.SHAPES.CIRC + * @see PIXI.SHAPES + */ + readonly type: SHAPES.CIRC; + /** + * @param x - The X coordinate of the center of this circle + * @param y - The Y coordinate of the center of this circle + * @param radius - The radius of the circle + */ + constructor(x?: number, y?: number, radius?: number); + /** + * Creates a clone of this Circle instance + * @returns A copy of the Circle + */ + clone(): Circle; + /** + * Checks whether the x and y coordinates given are contained within this circle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Circle + */ + contains(x: number, y: number): boolean; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * @returns The framing rectangle + */ + getBounds(): Rectangle; + toString(): string; +} + +/** + * Conversion factor for converting degrees to radians. + * @static + * @member {number} + * @memberof PIXI + */ +export declare const DEG_TO_RAD: number; + +/** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * @memberof PIXI + */ +export declare class Ellipse { + /** @default 0 */ + x: number; + /** @default 0 */ + y: number; + /** @default 0 */ + width: number; + /** @default 0 */ + height: number; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * @default PIXI.SHAPES.ELIP + * @see PIXI.SHAPES + */ + readonly type: SHAPES.ELIP; + /** + * @param x - The X coordinate of the center of this ellipse + * @param y - The Y coordinate of the center of this ellipse + * @param halfWidth - The half width of this ellipse + * @param halfHeight - The half height of this ellipse + */ + constructor(x?: number, y?: number, halfWidth?: number, halfHeight?: number); + /** + * Creates a clone of this Ellipse instance + * @returns {PIXI.Ellipse} A copy of the ellipse + */ + clone(): Ellipse; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coords are within this ellipse + */ + contains(x: number, y: number): boolean; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * @returns The framing rectangle + */ + getBounds(): Rectangle; + toString(): string; +} + +declare type GD8Symmetry = number; + +/** + * Implements the dihedral group D8, which is similar to + * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; + * D8 is the same but with diagonals, and it is used for texture + * rotations. + * + * The directions the U- and V- axes after rotation + * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` + * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. + * + * **Origin:**
+ * This is the small part of gameofbombs.com portal system. It works. + * @see PIXI.groupD8.E + * @see PIXI.groupD8.SE + * @see PIXI.groupD8.S + * @see PIXI.groupD8.SW + * @see PIXI.groupD8.W + * @see PIXI.groupD8.NW + * @see PIXI.groupD8.N + * @see PIXI.groupD8.NE + * @author Ivan @ivanpopelyshev + * @namespace PIXI.groupD8 + * @memberof PIXI + */ +export declare const groupD8: { + /** + * | Rotation | Direction | + * |----------|-----------| + * | 0° | East | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + E: number; + /** + * | Rotation | Direction | + * |----------|-----------| + * | 45°↻ | Southeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SE: number; + /** + * | Rotation | Direction | + * |----------|-----------| + * | 90°↻ | South | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + S: number; + /** + * | Rotation | Direction | + * |----------|-----------| + * | 135°↻ | Southwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SW: number; + /** + * | Rotation | Direction | + * |----------|-----------| + * | 180° | West | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + W: number; + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -135°/225°↻ | Northwest | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NW: number; + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -90°/270°↻ | North | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + N: number; + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -45°/315°↻ | Northeast | + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NE: number; + /** + * Reflection about Y-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_VERTICAL: number; + /** + * Reflection about the main diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MAIN_DIAGONAL: number; + /** + * Reflection about X-axis. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_HORIZONTAL: number; + /** + * Reflection about reverse diagonal. + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + REVERSE_DIAGONAL: number; + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the U-axis + * after rotating the axes. + */ + uX: (ind: GD8Symmetry) => GD8Symmetry; + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the U-axis + * after rotating the axes. + */ + uY: (ind: GD8Symmetry) => GD8Symmetry; + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The X-component of the V-axis + * after rotating the axes. + */ + vX: (ind: GD8Symmetry) => GD8Symmetry; + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @returns {PIXI.GD8Symmetry} The Y-component of the V-axis + * after rotating the axes. + */ + vY: (ind: GD8Symmetry) => GD8Symmetry; + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite + * is needed. Only rotations have opposite symmetries while + * reflections don't. + * @returns {PIXI.GD8Symmetry} The opposite symmetry of `rotation` + */ + inv: (rotation: GD8Symmetry) => GD8Symmetry; + /** + * Composes the two D8 operations. + * + * Taking `^` as reflection: + * + * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | + * |-------|-----|-----|-----|-----|------|-------|-------|-------| + * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | + * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | + * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | + * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | + * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | + * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | + * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | + * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | + * + * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which + * is the row in the above cayley table. + * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which + * is the column in the above cayley table. + * @returns {PIXI.GD8Symmetry} Composed operation + */ + add: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry) => GD8Symmetry; + /** + * Reverse of `add`. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation + * @param {PIXI.GD8Symmetry} rotationFirst - First operation + * @returns {PIXI.GD8Symmetry} Result + */ + sub: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry) => GD8Symmetry; + /** + * Adds 180 degrees to rotation, which is a commutative + * operation. + * @memberof PIXI.groupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} Rotated number + */ + rotate180: (rotation: number) => number; + /** + * Checks if the rotation angle is vertical, i.e. south + * or north. It doesn't work for reflections. + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: (rotation: GD8Symmetry) => boolean; + /** + * Approximates the vector `V(dx,dy)` into one of the + * eight directions provided by `groupD8`. + * @memberof PIXI.groupD8 + * @param {number} dx - X-component of the vector + * @param {number} dy - Y-component of the vector + * @returns {PIXI.GD8Symmetry} Approximation of the vector into + * one of the eight symmetries. + */ + byDirection: (dx: number, dy: number) => GD8Symmetry; + /** + * Helps sprite to compensate texture packer rotation. + * @memberof PIXI.groupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: (matrix: Matrix, rotation: GD8Symmetry, tx?: number, ty?: number) => void; +}; + +export declare interface IPoint extends IPointData { + copyFrom(p: IPointData): this; + copyTo(p: T): T; + equals(p: IPointData): boolean; + set(x?: number, y?: number): void; +} + +export declare interface IPointData extends GlobalMixins.IPointData { + x: number; + y: number; +} + +export declare type IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle; + +export declare interface ISize { + width: number; + height: number; +} + +/** + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * ``` + * @memberof PIXI + */ +export declare class Matrix { + /** @default 1 */ + a: number; + /** @default 0 */ + b: number; + /** @default 0 */ + c: number; + /** @default 1 */ + d: number; + /** @default 0 */ + tx: number; + /** @default 0 */ + ty: number; + array: Float32Array | null; + /** + * @param a - x scale + * @param b - y skew + * @param c - x skew + * @param d - y scale + * @param tx - x translation + * @param ty - y translation + */ + constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number); + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * @param array - The array that the matrix will be populated from. + */ + fromArray(array: number[]): void; + /** + * Sets the matrix properties. + * @param a - Matrix component + * @param b - Matrix component + * @param c - Matrix component + * @param d - Matrix component + * @param tx - Matrix component + * @param ty - Matrix component + * @returns This matrix. Good for chaining method calls. + */ + set(a: number, b: number, c: number, d: number, tx: number, ty: number): this; + /** + * Creates an array from the current Matrix object. + * @param transpose - Whether we need to transpose the matrix or not + * @param [out=new Float32Array(9)] - If provided the array will be assigned to out + * @returns The newly created array which contains the matrix + */ + toArray(transpose: boolean, out?: Float32Array): Float32Array; + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, transformed through this matrix + */ + apply

(pos: IPointData, newPos?: P): P; + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * @param pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @returns {PIXI.Point} The new point, inverse-transformed through this matrix + */ + applyInverse

(pos: IPointData, newPos?: P): P; + /** + * Translates the matrix on the x and y. + * @param x - How much to translate x by + * @param y - How much to translate y by + * @returns This matrix. Good for chaining method calls. + */ + translate(x: number, y: number): this; + /** + * Applies a scale transformation to the matrix. + * @param x - The amount to scale horizontally + * @param y - The amount to scale vertically + * @returns This matrix. Good for chaining method calls. + */ + scale(x: number, y: number): this; + /** + * Applies a rotation transformation to the matrix. + * @param angle - The angle in radians. + * @returns This matrix. Good for chaining method calls. + */ + rotate(angle: number): this; + /** + * Appends the given Matrix to this Matrix. + * @param matrix - The matrix to append. + * @returns This matrix. Good for chaining method calls. + */ + append(matrix: Matrix): this; + /** + * Sets the matrix based on all the available properties + * @param x - Position on the x axis + * @param y - Position on the y axis + * @param pivotX - Pivot on the x axis + * @param pivotY - Pivot on the y axis + * @param scaleX - Scale on the x axis + * @param scaleY - Scale on the y axis + * @param rotation - Rotation in radians + * @param skewX - Skew on the x axis + * @param skewY - Skew on the y axis + * @returns This matrix. Good for chaining method calls. + */ + setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): this; + /** + * Prepends the given Matrix to this Matrix. + * @param matrix - The matrix to prepend + * @returns This matrix. Good for chaining method calls. + */ + prepend(matrix: Matrix): this; + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * @param transform - The transform to apply the properties to. + * @returns The transform with the newly applied properties + */ + decompose(transform: Transform): Transform; + /** + * Inverts this matrix + * @returns This matrix. Good for chaining method calls. + */ + invert(): this; + /** + * Resets this Matrix to an identity (default) matrix. + * @returns This matrix. Good for chaining method calls. + */ + identity(): this; + /** + * Creates a new Matrix object with the same values as this one. + * @returns A copy of this matrix. Good for chaining method calls. + */ + clone(): Matrix; + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * @param matrix - The matrix to copy to. + * @returns The matrix given in parameter with its values updated. + */ + copyTo(matrix: Matrix): Matrix; + /** + * Changes the values of the matrix to be the same as the ones in given matrix + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @returns {PIXI.Matrix} this + */ + copyFrom(matrix: Matrix): this; + toString(): string; + /** + * A default (identity) matrix + * @readonly + */ + static get IDENTITY(): Matrix; + /** + * A temp matrix + * @readonly + */ + static get TEMP_MATRIX(): Matrix; +} + +export declare interface ObservablePoint extends GlobalMixins.Point, IPoint { +} + +/** + * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis. + * + * An `ObservablePoint` is a point that triggers a callback when the point's position is changed. + * @memberof PIXI + */ +export declare class ObservablePoint implements IPoint { + /** The callback function triggered when `x` and/or `y` are changed */ + cb: (this: T) => any; + /** The owner of the callback */ + scope: any; + _x: number; + _y: number; + /** + * Creates a new `ObservablePoint` + * @param cb - callback function triggered when `x` and/or `y` are changed + * @param scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + constructor(cb: (this: T) => any, scope: T, x?: number, y?: number); + /** + * Creates a clone of this point. + * The callback and scope params can be overridden otherwise they will default + * to the clone object's values. + * @override + * @param cb - The callback function triggered when `x` and/or `y` are changed + * @param scope - The owner of the callback + * @returns a copy of this observable point + */ + clone(cb?: (this: T) => any, scope?: any): ObservablePoint; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns The observable point instance itself + */ + set(x?: number, y?: number): this; + /** + * Copies x and y from the given point (`p`) + * @param p - The point to copy from. Can be any of type that is or extends `IPointData` + * @returns The observable point instance itself + */ + copyFrom(p: IPointData): this; + /** + * Copies this point's x and y into that of the given point (`p`) + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + copyTo(p: T): T; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + equals(p: IPointData): boolean; + toString(): string; + /** Position of the observable point on the x axis. */ + get x(): number; + set x(value: number); + /** Position of the observable point on the y axis. */ + get y(): number; + set y(value: number); +} + +/** + * Two Pi. + * @static + * @member {number} + * @memberof PIXI + */ +export declare const PI_2: number; + +export declare interface Point extends GlobalMixins.Point, IPoint { +} + +/** + * The Point object represents a location in a two-dimensional coordinate system, where `x` represents + * the position on the horizontal axis and `y` represents the position on the vertical axis + * @class + * @memberof PIXI + * @implements {IPoint} + */ +export declare class Point implements IPoint { + /** Position of the point on the x axis */ + x: number; + /** Position of the point on the y axis */ + y: number; + /** + * Creates a new `Point` + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + constructor(x?: number, y?: number); + /** + * Creates a clone of this point + * @returns A clone of this point + */ + clone(): Point; + /** + * Copies `x` and `y` from the given point into this point + * @param p - The point to copy from + * @returns The point instance itself + */ + copyFrom(p: IPointData): this; + /** + * Copies this point's x and y into the given point (`p`). + * @param p - The point to copy to. Can be any of type that is or extends `IPointData` + * @returns The point (`p`) with values updated + */ + copyTo(p: T): T; + /** + * Accepts another point (`p`) and returns `true` if the given point is equal to this point + * @param p - The point to check + * @returns Returns `true` if both `x` and `y` are equal + */ + equals(p: IPointData): boolean; + /** + * Sets the point to a new `x` and `y` position. + * If `y` is omitted, both `x` and `y` will be set to `x`. + * @param {number} [x=0] - position of the point on the `x` axis + * @param {number} [y=x] - position of the point on the `y` axis + * @returns The point instance itself + */ + set(x?: number, y?: number): this; + toString(): string; +} + +/** + * A class to define a shape via user defined coordinates. + * @memberof PIXI + */ +export declare class Polygon { + /** An array of the points of this polygon. */ + points: number[]; + /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */ + closeStroke: boolean; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * @default PIXI.SHAPES.POLY + * @see PIXI.SHAPES + */ + readonly type: SHAPES.POLY; + constructor(points: IPointData[] | number[]); + constructor(...points: IPointData[] | number[]); + /** + * Creates a clone of this polygon. + * @returns - A copy of the polygon. + */ + clone(): Polygon; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon. + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this polygon. + */ + contains(x: number, y: number): boolean; + toString(): string; +} + +/** + * Conversion factor for converting radians to degrees. + * @static + * @member {number} RAD_TO_DEG + * @memberof PIXI + */ +export declare const RAD_TO_DEG: number; + +export declare interface Rectangle extends GlobalMixins.Rectangle { +} + +/** + * Size object, contains width and height + * @memberof PIXI + * @typedef {object} ISize@typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ +/** + * 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. + * @memberof PIXI + */ +export declare class Rectangle { + /** @default 0 */ + x: number; + /** @default 0 */ + y: number; + /** @default 0 */ + width: number; + /** @default 0 */ + height: number; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * @default PIXI.SHAPES.RECT + * @see PIXI.SHAPES + */ + readonly type: SHAPES.RECT; + /** + * @param x - The X coordinate of the upper-left corner of the rectangle + * @param y - The Y coordinate of the upper-left corner of the rectangle + * @param width - The overall width of the rectangle + * @param height - The overall height of the rectangle + */ + constructor(x?: string | number, y?: string | number, width?: string | number, height?: string | number); + /** Returns the left edge of the rectangle. */ + get left(): number; + /** Returns the right edge of the rectangle. */ + get right(): number; + /** Returns the top edge of the rectangle. */ + get top(): number; + /** Returns the bottom edge of the rectangle. */ + get bottom(): number; + /** A constant empty rectangle. */ + static get EMPTY(): Rectangle; + /** + * Creates a clone of this Rectangle + * @returns a copy of the rectangle + */ + clone(): Rectangle; + /** + * Copies another rectangle to this one. + * @param rectangle - The rectangle to copy from. + * @returns Returns itself. + */ + copyFrom(rectangle: Rectangle): Rectangle; + /** + * Copies this rectangle to another one. + * @param rectangle - The rectangle to copy to. + * @returns Returns given parameter. + */ + copyTo(rectangle: Rectangle): Rectangle; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * @param x - The X coordinate of the point to test + * @param y - The Y coordinate of the point to test + * @returns Whether the x/y coordinates are within this Rectangle + */ + contains(x: number, y: number): boolean; + /** + * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object. + * Returns true only if the area of the intersection is >0, this means that Rectangles + * sharing a side are not overlapping. Another side effect is that an arealess rectangle + * (width or height equal to zero) can't intersect any other rectangle. + * @param {Rectangle} other - The Rectangle to intersect with `this`. + * @param {Matrix} transform - The transformation matrix of `other`. + * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`. + */ + intersects(other: Rectangle, transform?: Matrix): boolean; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * @param paddingX - The horizontal padding amount. + * @param paddingY - The vertical padding amount. + * @returns Returns itself. + */ + pad(paddingX?: number, paddingY?: number): this; + /** + * Fits this rectangle around the passed one. + * @param rectangle - The rectangle to fit. + * @returns Returns itself. + */ + fit(rectangle: Rectangle): this; + /** + * Enlarges rectangle that way its corners lie on grid + * @param resolution - resolution + * @param eps - precision + * @returns Returns itself. + */ + ceil(resolution?: number, eps?: number): this; + /** + * Enlarges this rectangle to include the passed rectangle. + * @param rectangle - The rectangle to include. + * @returns Returns itself. + */ + enlarge(rectangle: Rectangle): this; + toString(): string; +} + +/** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * @memberof PIXI + */ +export declare class RoundedRectangle { + /** @default 0 */ + x: number; + /** @default 0 */ + y: number; + /** @default 0 */ + width: number; + /** @default 0 */ + height: number; + /** @default 20 */ + radius: number; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * @default PIXI.SHAPES.RREC + * @see PIXI.SHAPES + */ + readonly type: SHAPES.RREC; + /** + * @param x - The X coordinate of the upper-left corner of the rounded rectangle + * @param y - The Y coordinate of the upper-left corner of the rounded rectangle + * @param width - The overall width of this rounded rectangle + * @param height - The overall height of this rounded rectangle + * @param radius - Controls the radius of the rounded corners + */ + constructor(x?: number, y?: number, width?: number, height?: number, radius?: number); + /** + * Creates a clone of this Rounded Rectangle. + * @returns - A copy of the rounded rectangle. + */ + clone(): RoundedRectangle; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * @param x - The X coordinate of the point to test. + * @param y - The Y coordinate of the point to test. + * @returns - Whether the x/y coordinates are within this Rounded Rectangle. + */ + contains(x: number, y: number): boolean; + toString(): string; +} + +/** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * @static + * @memberof PIXI + * @enum {number} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + */ +export declare enum SHAPES { + POLY = 0, + RECT = 1, + CIRC = 2, + ELIP = 3, + RREC = 4 +} + +export declare interface Transform extends GlobalMixins.Transform { +} + +/** + * Transform that takes care about its versions. + * @memberof PIXI + */ +export declare class Transform { + /** A default (identity) transform. */ + static readonly IDENTITY: Transform; + /** The world transformation matrix. */ + worldTransform: Matrix; + /** The local transformation matrix. */ + localTransform: Matrix; + /** The coordinate of the object relative to the local coordinates of the parent. */ + position: ObservablePoint; + /** The scale factor of the object. */ + scale: ObservablePoint; + /** The pivot point of the displayObject that it rotates around. */ + pivot: ObservablePoint; + /** The skew amount, on the x and y axis. */ + skew: ObservablePoint; + /** The locally unique ID of the parent's world transform used to calculate the current world transformation matrix. */ + _parentID: number; + /** The locally unique ID of the world transform. */ + _worldID: number; + /** The rotation amount. */ + protected _rotation: number; + /** + * The X-coordinate value of the normalized local X axis, + * the first column of the local transformation matrix without a scale. + */ + protected _cx: number; + /** + * The Y-coordinate value of the normalized local X axis, + * the first column of the local transformation matrix without a scale. + */ + protected _sx: number; + /** + * The X-coordinate value of the normalized local Y axis, + * the second column of the local transformation matrix without a scale. + */ + protected _cy: number; + /** + * The Y-coordinate value of the normalized local Y axis, + * the second column of the local transformation matrix without a scale. + */ + protected _sy: number; + /** The locally unique ID of the local transform. */ + protected _localID: number; + /** The locally unique ID of the local transform used to calculate the current local transformation matrix. */ + protected _currentLocalID: number; + constructor(); + /** Called when a value changes. */ + protected onChange(): void; + /** Called when the skew or the rotation changes. */ + protected updateSkew(): void; + toString(): string; + /** Updates the local transformation matrix. */ + updateLocalTransform(): void; + /** + * Updates the local and the world transformation matrices. + * @param parentTransform - The parent transform + */ + updateTransform(parentTransform: Transform): void; + /** + * Decomposes a matrix and sets the transforms properties based on it. + * @param matrix - The matrix to decompose + */ + setFromMatrix(matrix: Matrix): void; + /** The rotation of the object in radians. */ + get rotation(): number; + set rotation(value: number); +} + +export { } diff --git a/live2d/node_modules/@pixi/math/package.json b/live2d/node_modules/@pixi/math/package.json new file mode 100644 index 0000000..eb09794 --- /dev/null +++ b/live2d/node_modules/@pixi/math/package.json @@ -0,0 +1,41 @@ +{ + "name": "@pixi/math", + "version": "6.5.10", + "main": "dist/cjs/math.js", + "module": "dist/esm/math.mjs", + "bundle": "dist/browser/math.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/math.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/math.js" + } + } + }, + "description": "Collection of math utilities", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/runner/LICENSE b/live2d/node_modules/@pixi/runner/LICENSE new file mode 100644 index 0000000..d9de993 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2017 Mathew Groves, Chad Engler + +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. diff --git a/live2d/node_modules/@pixi/runner/README.md b/live2d/node_modules/@pixi/runner/README.md new file mode 100644 index 0000000..ef4c6ac --- /dev/null +++ b/live2d/node_modules/@pixi/runner/README.md @@ -0,0 +1,85 @@ +# @pixi/runner + +A simple alternative to events and signals with an emphasis on performance. + +Can be used as an alternative to events / signals. + +## Installation + +```bash +npm install @pixi/runner +``` + +## Usage + +```js +import { Runner } from '@pixi/runner'; + +const onComplete = new Runner('onComplete'); + +//listenerObject needs to have a 'onComplete' function +onComplete.add(listenerObject); + +//emit and all listeners will have their 'onComplete' functions called +onComplete.emit(data); +``` + +Can be used to execute a function on many objects. Handy for games. If you need to update you game elements each frame: + +```js +import { Runner } from '@pixi/runner'; + +const updateRunner = new Runner('update'); + +// gameItems should all have a 'update' function +updateRunner.add(gameItem1); +updateRunner.add(gameItem2); +updateRunner.add(gameItem3); + +// update game elements.. +updateRunner.emit(); +``` + +## Features + +- Easy to use familiar API. +- Under the hood it dynamically creates a looping function that is highly optimised. +- Avoids using 'call' and runs the function directly (which is faster!). +- You can pass parameters when emitting. + +Pros: +- Doesn't rely on strings. +- Code-completion works properly. +- Trying to dispatch or listen to an event type that doesn't exist throws errors (helps you find errors early). +- No need to create constants to store string values. +- Easy to identify which signals the object dispatch. +- Favor composition over inheritance. +- Doesn't mess with the prototype chain. +- Its fast, a lot faster than events and signals. +- Great for when performance matters. +- Its light weight, with a tiny memory footprint (smaller than events and signals) + + +Cons: +- Not quite as flexible. All listeners / items in the runner must have the correct function name specified within the runners constructor. + +## When to Use + +In practice I have found the Runner incredibly useful and so thought it would be nice to share with the world. It currently forms the backbone of the messaging system in our game engine. Its working out great for things like update events, collision events etc. + +Great to use if you are say looping through and array and calling the same function on each object. The resulting code is cleaner than a loop whilst still keeping the performance as fast as possible. + +So yeah, if you are dispatching signals/events to a lot of listeners often (like everyframe often), then I would consider using this alternative. For most cases, this performance boost is not really important enough to switch from your current fave. + +Think of this as a nice alternative for when speed really counts! + +to run the tests, move to the runner-benchmark folder then run the following: + +```bash +npm run benchmark +``` + +Next open you browser (http://localhost:9966). The test is run in the console. +The test result above comes from macbook pro chrome 58. + +Any thoughts or comments hit me up on twitter [@doormat23](https://twitter.com/doormat23), I'd love to hear them! diff --git a/live2d/node_modules/@pixi/runner/dist/browser/runner.js b/live2d/node_modules/@pixi/runner/dist/browser/runner.js new file mode 100644 index 0000000..941b068 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/browser/runner.js @@ -0,0 +1,197 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_runner = (function (exports) { + 'use strict'; + + /** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.loaded.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject); + * + * myGame.update.emit(time); + * ``` + * @memberof PIXI + */ + var Runner = /** @class */ (function () { + /** + * @param name - The function name that will be executed on the listeners added to this Runner. + */ + function Runner(name) { + this.items = []; + this._name = name; + this._aliasCount = 0; + } + /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */ + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - (optional) parameters to pass to each listener + */ + /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */ + Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { + if (arguments.length > 8) { + throw new Error('max arguments reached'); + } + var _a = this, name = _a.name, items = _a.items; + this._aliasCount++; + for (var i = 0, len = items.length; i < len; i++) { + items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); + } + if (items === this.items) { + this._aliasCount--; + } + return this; + }; + Runner.prototype.ensureNonAliasedItems = function () { + if (this._aliasCount > 0 && this.items.length > 1) { + this._aliasCount = 0; + this.items = this.items.slice(0); + } + }; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * @param {any} item - The object that will be listening. + */ + Runner.prototype.add = function (item) { + if (item[this._name]) { + this.ensureNonAliasedItems(); + this.remove(item); + this.items.push(item); + } + return this; + }; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listener that you would like to remove. + */ + Runner.prototype.remove = function (item) { + var index = this.items.indexOf(item); + if (index !== -1) { + this.ensureNonAliasedItems(); + this.items.splice(index, 1); + } + return this; + }; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + Runner.prototype.contains = function (item) { + return this.items.indexOf(item) !== -1; + }; + /** Remove all listeners from the Runner */ + Runner.prototype.removeAll = function () { + this.ensureNonAliasedItems(); + this.items.length = 0; + return this; + }; + /** Remove all references, don't use after this. */ + Runner.prototype.destroy = function () { + this.removeAll(); + this.items = null; + this._name = null; + }; + Object.defineProperty(Runner.prototype, "empty", { + /** + * `true` if there are no this Runner contains no listeners + * @readonly + */ + get: function () { + return this.items.length === 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Runner.prototype, "name", { + /** + * The name of the runner. + * @readonly + */ + get: function () { + return this._name; + }, + enumerable: false, + configurable: true + }); + return Runner; + }()); + Object.defineProperties(Runner.prototype, { + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method dispatch + * @see PIXI.Runner#emit + */ + dispatch: { value: Runner.prototype.emit }, + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method run + * @see PIXI.Runner#emit + */ + run: { value: Runner.prototype.emit }, + }); + + exports.Runner = Runner; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +Object.assign(this.PIXI, _pixi_runner); +//# sourceMappingURL=runner.js.map diff --git a/live2d/node_modules/@pixi/runner/dist/browser/runner.js.map b/live2d/node_modules/@pixi/runner/dist/browser/runner.js.map new file mode 100644 index 0000000..e6797ab --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/browser/runner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.js","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":[],"mappings":";;;;;;;;;;;IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2CG;AACH,QAAA,MAAA,kBAAA,YAAA;IAMI;;IAEG;IACH,IAAA,SAAA,MAAA,CAAY,IAAY,EAAA;IAEpB,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAChB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;SACxB;;IAGD;;;IAGG;;IAEI,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAX,UAAY,EAAY,EAAE,EAAY,EAAE,EAAY,EAAE,EAAY,EAC9D,EAAY,EAAE,EAAY,EAAE,EAAY,EAAE,EAAY,EAAA;IAEtD,QAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EACxB;IACI,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC5C,SAAA;YAEK,IAAA,EAAA,GAAkB,IAAI,EAApB,IAAI,UAAA,EAAE,KAAK,WAAS,CAAC;YAE7B,IAAI,CAAC,WAAW,EAAE,CAAC;IAEnB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAChD;gBACI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,E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;IAC1C;;;;;IAKG;QACH,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;IACxC,CAAA,CAAC;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js b/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js new file mode 100644 index 0000000..03f3e07 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_runner=function(t){"use strict";var e=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,n,s,r,o,u){if(arguments.length>8)throw new Error("max arguments reached");var h=this,a=h.name,m=h.items;this._aliasCount++;for(var p=0,l=m.length;p0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();return Object.defineProperties(e.prototype,{dispatch:{value:e.prototype.emit},run:{value:e.prototype.emit}}),t.Runner=e,Object.defineProperty(t,"__esModule",{value:!0}),t}({});Object.assign(this.PIXI,_pixi_runner); +//# sourceMappingURL=runner.min.js.map diff --git a/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js.map b/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js.map new file mode 100644 index 0000000..7268bbd --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/browser/runner.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.min.js","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":["Runner","name","this","items","_name","_aliasCount","prototype","emit","a0","a1","a2","a3","a4","a5","a6","a7","arguments","length","Error","_a","i","len","ensureNonAliasedItems","slice","add","item","remove","push","index","indexOf","splice","contains","removeAll","destroy","Object","defineProperty","get","defineProperties","dispatch","value","run"],"mappings":";;;;;;;kEA4CA,IAAAA,EAAA,WASI,SAAAA,EAAYC,GAERC,KAAKC,MAAQ,GACbD,KAAKE,MAAQH,EACbC,KAAKG,YAAc,EAqI3B,OA5HWL,EAAAM,UAAAC,KAAP,SAAYC,EAAcC,EAAcC,EAAcC,EAClDC,EAAcC,EAAcC,EAAcC,GAE1C,GAAIC,UAAUC,OAAS,EAEnB,MAAM,IAAIC,MAAM,yBAGd,IAAAC,EAAkBjB,KAAhBD,SAAME,UAEdD,KAAKG,cAEL,IAAK,IAAIe,EAAI,EAAGC,EAAMlB,EAAMc,OAAQG,EAAIC,EAAKD,IAEzCjB,EAAMiB,GAAGnB,GAAMO,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,GAQ/C,OALIZ,IAAUD,KAAKC,OAEfD,KAAKG,cAGFH,MAGHF,EAAAM,UAAAgB,sBAAR,WAEQpB,KAAKG,YAAc,GAAKH,KAAKC,MAAMc,OAAS,IAE5Cf,KAAKG,YAAc,EACnBH,KAAKC,MAAQD,KAAKC,MAAMoB,MAAM,KAsB/BvB,EAAGM,UAAAkB,IAAV,SAAWC,GASP,OAPKA,EAAavB,KAAKE,SAEnBF,KAAKoB,wBACLpB,KAAKwB,OAAOD,GACZvB,KAAKC,MAAMwB,KAAKF,IAGbvB,MAOJF,EAAMM,UAAAoB,OAAb,SAAcD,GAEV,IAAMG,EAAQ1B,KAAKC,MAAM0B,QAAQJ,GAQjC,OANe,IAAXG,IAEA1B,KAAKoB,wBACLpB,KAAKC,MAAM2B,OAAOF,EAAO,IAGtB1B,MAOJF,EAAQM,UAAAyB,SAAf,SAAgBN,GAEZ,OAAqC,IAA9BvB,KAAKC,MAAM0B,QAAQJ,IAIvBzB,EAAAM,UAAA0B,UAAP,WAKI,OAHA9B,KAAKoB,wBACLpB,KAAKC,MAAMc,OAAS,EAEbf,MAIJF,EAAAM,UAAA2B,QAAP,WAEI/B,KAAK8B,YACL9B,KAAKC,MAAQ,KACbD,KAAKE,MAAQ,MAOjB8B,OAAAC,eAAWnC,EAAKM,UAAA,QAAA,CAAhB8B,IAAA,WAEI,OAA6B,IAAtBlC,KAAKC,MAAMc,wCAOtBiB,OAAAC,eAAWnC,EAAIM,UAAA,OAAA,CAAf8B,IAAA,WAEI,OAAOlC,KAAKE,uCAEnBJ,YAEDkC,OAAOG,iBAAiBrC,EAAOM,UAAW,CAOtCgC,SAAU,CAAEC,MAAOvC,EAAOM,UAAUC,MAOpCiC,IAAK,CAAED,MAAOvC,EAAOM,UAAUC"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/dist/cjs/runner.js b/live2d/node_modules/@pixi/runner/dist/cjs/runner.js new file mode 100644 index 0000000..b569d6f --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/cjs/runner.js @@ -0,0 +1,190 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +/** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.loaded.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject); + * + * myGame.update.emit(time); + * ``` + * @memberof PIXI + */ +var Runner = /** @class */ (function () { + /** + * @param name - The function name that will be executed on the listeners added to this Runner. + */ + function Runner(name) { + this.items = []; + this._name = name; + this._aliasCount = 0; + } + /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */ + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - (optional) parameters to pass to each listener + */ + /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */ + Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { + if (arguments.length > 8) { + throw new Error('max arguments reached'); + } + var _a = this, name = _a.name, items = _a.items; + this._aliasCount++; + for (var i = 0, len = items.length; i < len; i++) { + items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); + } + if (items === this.items) { + this._aliasCount--; + } + return this; + }; + Runner.prototype.ensureNonAliasedItems = function () { + if (this._aliasCount > 0 && this.items.length > 1) { + this._aliasCount = 0; + this.items = this.items.slice(0); + } + }; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * @param {any} item - The object that will be listening. + */ + Runner.prototype.add = function (item) { + if (item[this._name]) { + this.ensureNonAliasedItems(); + this.remove(item); + this.items.push(item); + } + return this; + }; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listener that you would like to remove. + */ + Runner.prototype.remove = function (item) { + var index = this.items.indexOf(item); + if (index !== -1) { + this.ensureNonAliasedItems(); + this.items.splice(index, 1); + } + return this; + }; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + Runner.prototype.contains = function (item) { + return this.items.indexOf(item) !== -1; + }; + /** Remove all listeners from the Runner */ + Runner.prototype.removeAll = function () { + this.ensureNonAliasedItems(); + this.items.length = 0; + return this; + }; + /** Remove all references, don't use after this. */ + Runner.prototype.destroy = function () { + this.removeAll(); + this.items = null; + this._name = null; + }; + Object.defineProperty(Runner.prototype, "empty", { + /** + * `true` if there are no this Runner contains no listeners + * @readonly + */ + get: function () { + return this.items.length === 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Runner.prototype, "name", { + /** + * The name of the runner. + * @readonly + */ + get: function () { + return this._name; + }, + enumerable: false, + configurable: true + }); + return Runner; +}()); +Object.defineProperties(Runner.prototype, { + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method dispatch + * @see PIXI.Runner#emit + */ + dispatch: { value: Runner.prototype.emit }, + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method run + * @see PIXI.Runner#emit + */ + run: { value: Runner.prototype.emit }, +}); + +exports.Runner = Runner; +//# sourceMappingURL=runner.js.map diff --git a/live2d/node_modules/@pixi/runner/dist/cjs/runner.js.map b/live2d/node_modules/@pixi/runner/dist/cjs/runner.js.map new file mode 100644 index 0000000..98ab407 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/cjs/runner.js.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.js","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CG;AACH,IAAA,MAAA,kBAAA,YAAA;AAMI;;AAEG;AACH,IAAA,SAAA,MAAA,CAAY,IAAY,EAAA;AAEpB,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;KACxB;;AAGD;;;AAGG;;AAEI,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAX,UAAY,EAAY,EAAE,EAAY,EAAE,EAAY,EAAE,EAAY,EAC9D,EAAY,EAAE,EAAY,EAAE,EAAY,EAAE,EAAY,EAAA;AAEtD,QAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EACxB;AACI,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC5C,SAAA;QAEK,IAAA,EAAA,GAAkB,IAAI,EAApB,IAAI,UAAA,EAAE,KAAK,WAAS,CAAC;QAE7B,IAAI,CAAC,WA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IACL,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE;AACtC;;;;;AAKG;IACH,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;AAC1C;;;;;AAKG;IACH,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;AACxC,CAAA,CAAC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js b/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js new file mode 100644 index 0000000..2ae8666 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,s,n,r,o,u){if(arguments.length>8)throw new Error("max arguments reached");var h=this,a=h.name,m=h.items;this._aliasCount++;for(var p=0,l=m.length;p0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(t.prototype,{dispatch:{value:t.prototype.emit},run:{value:t.prototype.emit}}),exports.Runner=t; +//# sourceMappingURL=runner.min.js.map diff --git a/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js.map b/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js.map new file mode 100644 index 0000000..d2a0fac --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/cjs/runner.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.min.js","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":["Runner","name","this","items","_name","_aliasCount","prototype","emit","a0","a1","a2","a3","a4","a5","a6","a7","arguments","length","Error","_a","i","len","ensureNonAliasedItems","slice","add","item","remove","push","index","indexOf","splice","contains","removeAll","destroy","Object","defineProperty","get","defineProperties","dispatch","value","run"],"mappings":";;;;;;;oEA4CA,IAAAA,EAAA,WASI,SAAAA,EAAYC,GAERC,KAAKC,MAAQ,GACbD,KAAKE,MAAQH,EACbC,KAAKG,YAAc,EAqI3B,OA5HWL,EAAAM,UAAAC,KAAP,SAAYC,EAAcC,EAAcC,EAAcC,EAClDC,EAAcC,EAAcC,EAAcC,GAE1C,GAAIC,UAAUC,OAAS,EAEnB,MAAM,IAAIC,MAAM,yBAGd,IAAAC,EAAkBjB,KAAhBD,SAAME,UAEdD,KAAKG,cAEL,IAAK,IAAIe,EAAI,EAAGC,EAAMlB,EAAMc,OAAQG,EAAIC,EAAKD,IAEzCjB,EAAMiB,GAAGnB,GAAMO,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,GAQ/C,OALIZ,IAAUD,KAAKC,OAEfD,KAAKG,cAGFH,MAGHF,EAAAM,UAAAgB,sBAAR,WAEQpB,KAAKG,YAAc,GAAKH,KAAKC,MAAMc,OAAS,IAE5Cf,KAAKG,YAAc,EACnBH,KAAKC,MAAQD,KAAKC,MAAMoB,MAAM,KAsB/BvB,EAAGM,UAAAkB,IAAV,SAAWC,GASP,OAPKA,EAAavB,KAAKE,SAEnBF,KAAKoB,wBACLpB,KAAKwB,OAAOD,GACZvB,KAAKC,MAAMwB,KAAKF,IAGbvB,MAOJF,EAAMM,UAAAoB,OAAb,SAAcD,GAEV,IAAMG,EAAQ1B,KAAKC,MAAM0B,QAAQJ,GAQjC,OANe,IAAXG,IAEA1B,KAAKoB,wBACLpB,KAAKC,MAAM2B,OAAOF,EAAO,IAGtB1B,MAOJF,EAAQM,UAAAyB,SAAf,SAAgBN,GAEZ,OAAqC,IAA9BvB,KAAKC,MAAM0B,QAAQJ,IAIvBzB,EAAAM,UAAA0B,UAAP,WAKI,OAHA9B,KAAKoB,wBACLpB,KAAKC,MAAMc,OAAS,EAEbf,MAIJF,EAAAM,UAAA2B,QAAP,WAEI/B,KAAK8B,YACL9B,KAAKC,MAAQ,KACbD,KAAKE,MAAQ,MAOjB8B,OAAAC,eAAWnC,EAAKM,UAAA,QAAA,CAAhB8B,IAAA,WAEI,OAA6B,IAAtBlC,KAAKC,MAAMc,wCAOtBiB,OAAAC,eAAWnC,EAAIM,UAAA,OAAA,CAAf8B,IAAA,WAEI,OAAOlC,KAAKE,uCAEnBJ,KAEDkC,OAAOG,iBAAiBrC,EAAOM,UAAW,CAOtCgC,SAAU,CAAEC,MAAOvC,EAAOM,UAAUC,MAOpCiC,IAAK,CAAED,MAAOvC,EAAOM,UAAUC"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs b/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs new file mode 100644 index 0000000..d014b24 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var t=function(){function t(t){this.items=[],this._name=t,this._aliasCount=0}return t.prototype.emit=function(t,e,i,n,s,r,o,h){if(arguments.length>8)throw new Error("max arguments reached");var u=this,a=u.name,m=u.items;this._aliasCount++;for(var p=0,l=m.length;p0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(t.prototype,{dispatch:{value:t.prototype.emit},run:{value:t.prototype.emit}});export{t as Runner}; +//# sourceMappingURL=runner.min.mjs.map diff --git a/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs.map b/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs.map new file mode 100644 index 0000000..c1ceb61 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/esm/runner.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.min.mjs","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":["Runner","name","this","items","_name","_aliasCount","prototype","emit","a0","a1","a2","a3","a4","a5","a6","a7","arguments","length","Error","_a","i","len","ensureNonAliasedItems","slice","add","item","remove","push","index","indexOf","splice","contains","removeAll","destroy","Object","defineProperty","get","defineProperties","dispatch","value","run"],"mappings":";;;;;;;AA4CA,IAAAA,EAAA,WASI,SAAAA,EAAYC,GAERC,KAAKC,MAAQ,GACbD,KAAKE,MAAQH,EACbC,KAAKG,YAAc,EAqI3B,OA5HWL,EAAAM,UAAAC,KAAP,SAAYC,EAAcC,EAAcC,EAAcC,EAClDC,EAAcC,EAAcC,EAAcC,GAE1C,GAAIC,UAAUC,OAAS,EAEnB,MAAM,IAAIC,MAAM,yBAGd,IAAAC,EAAkBjB,KAAhBD,SAAME,UAEdD,KAAKG,cAEL,IAAK,IAAIe,EAAI,EAAGC,EAAMlB,EAAMc,OAAQG,EAAIC,EAAKD,IAEzCjB,EAAMiB,GAAGnB,GAAMO,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,GAQ/C,OALIZ,IAAUD,KAAKC,OAEfD,KAAKG,cAGFH,MAGHF,EAAAM,UAAAgB,sBAAR,WAEQpB,KAAKG,YAAc,GAAKH,KAAKC,MAAMc,OAAS,IAE5Cf,KAAKG,YAAc,EACnBH,KAAKC,MAAQD,KAAKC,MAAMoB,MAAM,KAsB/BvB,EAAGM,UAAAkB,IAAV,SAAWC,GASP,OAPKA,EAAavB,KAAKE,SAEnBF,KAAKoB,wBACLpB,KAAKwB,OAAOD,GACZvB,KAAKC,MAAMwB,KAAKF,IAGbvB,MAOJF,EAAMM,UAAAoB,OAAb,SAAcD,GAEV,IAAMG,EAAQ1B,KAAKC,MAAM0B,QAAQJ,GAQjC,OANe,IAAXG,IAEA1B,KAAKoB,wBACLpB,KAAKC,MAAM2B,OAAOF,EAAO,IAGtB1B,MAOJF,EAAQM,UAAAyB,SAAf,SAAgBN,GAEZ,OAAqC,IAA9BvB,KAAKC,MAAM0B,QAAQJ,IAIvBzB,EAAAM,UAAA0B,UAAP,WAKI,OAHA9B,KAAKoB,wBACLpB,KAAKC,MAAMc,OAAS,EAEbf,MAIJF,EAAAM,UAAA2B,QAAP,WAEI/B,KAAK8B,YACL9B,KAAKC,MAAQ,KACbD,KAAKE,MAAQ,MAOjB8B,OAAAC,eAAWnC,EAAKM,UAAA,QAAA,CAAhB8B,IAAA,WAEI,OAA6B,IAAtBlC,KAAKC,MAAMc,wCAOtBiB,OAAAC,eAAWnC,EAAIM,UAAA,OAAA,CAAf8B,IAAA,WAEI,OAAOlC,KAAKE,uCAEnBJ,KAEDkC,OAAOG,iBAAiBrC,EAAOM,UAAW,CAOtCgC,SAAU,CAAEC,MAAOvC,EAAOM,UAAUC,MAOpCiC,IAAK,CAAED,MAAOvC,EAAOM,UAAUC"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs b/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs new file mode 100644 index 0000000..57e7814 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs @@ -0,0 +1,186 @@ +/*! + * @pixi/runner - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +/** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.loaded.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject); + * + * myGame.update.emit(time); + * ``` + * @memberof PIXI + */ +var Runner = /** @class */ (function () { + /** + * @param name - The function name that will be executed on the listeners added to this Runner. + */ + function Runner(name) { + this.items = []; + this._name = name; + this._aliasCount = 0; + } + /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */ + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - (optional) parameters to pass to each listener + */ + /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */ + Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { + if (arguments.length > 8) { + throw new Error('max arguments reached'); + } + var _a = this, name = _a.name, items = _a.items; + this._aliasCount++; + for (var i = 0, len = items.length; i < len; i++) { + items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); + } + if (items === this.items) { + this._aliasCount--; + } + return this; + }; + Runner.prototype.ensureNonAliasedItems = function () { + if (this._aliasCount > 0 && this.items.length > 1) { + this._aliasCount = 0; + this.items = this.items.slice(0); + } + }; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * @param {any} item - The object that will be listening. + */ + Runner.prototype.add = function (item) { + if (item[this._name]) { + this.ensureNonAliasedItems(); + this.remove(item); + this.items.push(item); + } + return this; + }; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listener that you would like to remove. + */ + Runner.prototype.remove = function (item) { + var index = this.items.indexOf(item); + if (index !== -1) { + this.ensureNonAliasedItems(); + this.items.splice(index, 1); + } + return this; + }; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + Runner.prototype.contains = function (item) { + return this.items.indexOf(item) !== -1; + }; + /** Remove all listeners from the Runner */ + Runner.prototype.removeAll = function () { + this.ensureNonAliasedItems(); + this.items.length = 0; + return this; + }; + /** Remove all references, don't use after this. */ + Runner.prototype.destroy = function () { + this.removeAll(); + this.items = null; + this._name = null; + }; + Object.defineProperty(Runner.prototype, "empty", { + /** + * `true` if there are no this Runner contains no listeners + * @readonly + */ + get: function () { + return this.items.length === 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Runner.prototype, "name", { + /** + * The name of the runner. + * @readonly + */ + get: function () { + return this._name; + }, + enumerable: false, + configurable: true + }); + return Runner; +}()); +Object.defineProperties(Runner.prototype, { + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method dispatch + * @see PIXI.Runner#emit + */ + dispatch: { value: Runner.prototype.emit }, + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method run + * @see PIXI.Runner#emit + */ + run: { value: Runner.prototype.emit }, +}); + +export { Runner }; +//# sourceMappingURL=runner.mjs.map diff --git a/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs.map b/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs.map new file mode 100644 index 0000000..1bd735f --- /dev/null +++ b/live2d/node_modules/@pixi/runner/dist/esm/runner.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"runner.mjs","sources":["../../src/Runner.ts"],"sourcesContent":["/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n * @memberof PIXI\n */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n\n /* eslint-disable jsdoc/require-param, jsdoc/check-param-names */\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n /* eslint-enable jsdoc/require-param, jsdoc/check-param-names */\n public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n }\n\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n * @param {any} item - The object that will be listening.\n */\n public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\n\n /**\n * Remove a single listener from the dispatch queue.\n * @param {any} item - The listener that you would like to remove.\n */\n public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Check to see if the listener is already in the Runner\n * @param {any} item - The listener that you would like to check.\n */\n public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\n\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CG;AACH,IAAA,MAAA,kBAAA,YAAA;AAMI;;AAEG;AACH,IAAA,SAAA,MAAA,CAAY,IAAY,EAAA;AAEpB,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;KACxB;;AAGD;;;AAGG;;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,CAAW,MAAK,CAAA,SAAA,EAAA,OAAA,EAAA;AAJhB;;;AAGG;AACH,QAAA,GAAA,EAAA,YAAA;AAEI,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;SAClC;;;AAAA,KAAA,CAAA,CAAA;AAMD,IAAA,MAAA,CAAA,cAAA,CAAW,MAAI,CAAA,SAAA,EAAA,MAAA,EAAA;AAJf;;;AAGG;AACH,QAAA,GAAA,EAAA,YAAA;YAEI,OAAO,IAAI,CAAC,KAAK,CAAC;SACrB;;;AAAA,KAAA,CAAA,CAAA;IACL,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE;AACtC;;;;;AAKG;IACH,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;AAC1C;;;;;AAKG;IACH,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;AACxC,CAAA,CAAC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/runner/index.d.ts b/live2d/node_modules/@pixi/runner/index.d.ts new file mode 100644 index 0000000..9d85999 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/index.d.ts @@ -0,0 +1,104 @@ +/** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.loaded.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject); + * + * myGame.update.emit(time); + * ``` + * @memberof PIXI + */ +export declare class Runner { + items: any[]; + private _name; + private _aliasCount; + /** + * @param name - The function name that will be executed on the listeners added to this Runner. + */ + constructor(name: string); + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - (optional) parameters to pass to each listener + */ + emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown, a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this; + private ensureNonAliasedItems; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * @param {any} item - The object that will be listening. + */ + add(item: unknown): this; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listener that you would like to remove. + */ + remove(item: unknown): this; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + contains(item: unknown): boolean; + /** Remove all listeners from the Runner */ + removeAll(): this; + /** Remove all references, don't use after this. */ + destroy(): void; + /** + * `true` if there are no this Runner contains no listeners + * @readonly + */ + get empty(): boolean; + /** + * The name of the runner. + * @readonly + */ + get name(): string; +} + +export { } diff --git a/live2d/node_modules/@pixi/runner/package.json b/live2d/node_modules/@pixi/runner/package.json new file mode 100644 index 0000000..c110da2 --- /dev/null +++ b/live2d/node_modules/@pixi/runner/package.json @@ -0,0 +1,56 @@ +{ + "name": "@pixi/runner", + "version": "6.5.10", + "main": "dist/cjs/runner.js", + "module": "dist/esm/runner.mjs", + "bundle": "dist/browser/runner.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/runner.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/runner.js" + } + } + }, + "description": "A simple alternative to events and signals with an emphasis on performance.", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "keywords": [ + "runner", + "signals", + "event", + "messaging", + "publish", + "subscribe", + "observer", + "pub/sub", + "fast" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "test": "floss --path test", + "benchmark": "cd benchmark && npm start" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/settings/LICENSE b/live2d/node_modules/@pixi/settings/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/settings/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/README.md b/live2d/node_modules/@pixi/settings/README.md new file mode 100644 index 0000000..1ed0aab --- /dev/null +++ b/live2d/node_modules/@pixi/settings/README.md @@ -0,0 +1,13 @@ +# @pixi/settings + +## Installation + +```bash +npm install @pixi/settings +``` + +## Usage + +```js +import { settings } from '@pixi/settings'; +``` diff --git a/live2d/node_modules/@pixi/settings/dist/browser/settings.js b/live2d/node_modules/@pixi/settings/dist/browser/settings.js new file mode 100644 index 0000000..f32ccdd --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/browser/settings.js @@ -0,0 +1,437 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_settings = (function (exports, constants) { + 'use strict'; + + var BrowserAdapter = { + /** + * Creates a canvas element of the given size. + * This canvas is created using the browser's native canvas element. + * @param width - width of the canvas + * @param height - height of the canvas + */ + createCanvas: function (width, height) { + var canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + return canvas; + }, + getWebGLRenderingContext: function () { return WebGLRenderingContext; }, + getNavigator: function () { return navigator; }, + getBaseUrl: function () { var _a; return ((_a = document.baseURI) !== null && _a !== void 0 ? _a : window.location.href); }, + fetch: function (url, options) { return fetch(url, options); }, + }; + + var appleIphone = /iPhone/i; + var appleIpod = /iPod/i; + var appleTablet = /iPad/i; + var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; + var androidPhone = /\bAndroid(?:.+)Mobile\b/i; + var androidTablet = /Android/i; + var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; + var amazonTablet = /Silk/i; + var windowsPhone = /Windows Phone/i; + var windowsTablet = /\bWindows(?:.+)ARM\b/i; + var otherBlackBerry = /BlackBerry/i; + var otherBlackBerry10 = /BB10/i; + var otherOpera = /Opera Mini/i; + var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; + var otherFirefox = /Mobile(?:.+)Firefox\b/i; + var isAppleTabletOnIos13 = function (navigator) { + return (typeof navigator !== 'undefined' && + navigator.platform === 'MacIntel' && + typeof navigator.maxTouchPoints === 'number' && + navigator.maxTouchPoints > 1 && + typeof MSStream === 'undefined'); + }; + function createMatch(userAgent) { + return function (regex) { return regex.test(userAgent); }; + } + function isMobile$1(param) { + var nav = { + userAgent: '', + platform: '', + maxTouchPoints: 0 + }; + if (!param && typeof navigator !== 'undefined') { + nav = { + userAgent: navigator.userAgent, + platform: navigator.platform, + maxTouchPoints: navigator.maxTouchPoints || 0 + }; + } + else if (typeof param === 'string') { + nav.userAgent = param; + } + else if (param && param.userAgent) { + nav = { + userAgent: param.userAgent, + platform: param.platform, + maxTouchPoints: param.maxTouchPoints || 0 + }; + } + var userAgent = nav.userAgent; + var tmp = userAgent.split('[FBAN'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + tmp = userAgent.split('Twitter'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + var match = createMatch(userAgent); + var result = { + apple: { + phone: match(appleIphone) && !match(windowsPhone), + ipod: match(appleIpod), + tablet: !match(appleIphone) && + (match(appleTablet) || isAppleTabletOnIos13(nav)) && + !match(windowsPhone), + universal: match(appleUniversal), + device: (match(appleIphone) || + match(appleIpod) || + match(appleTablet) || + match(appleUniversal) || + isAppleTabletOnIos13(nav)) && + !match(windowsPhone) + }, + amazon: { + phone: match(amazonPhone), + tablet: !match(amazonPhone) && match(amazonTablet), + device: match(amazonPhone) || match(amazonTablet) + }, + android: { + phone: (!match(windowsPhone) && match(amazonPhone)) || + (!match(windowsPhone) && match(androidPhone)), + tablet: !match(windowsPhone) && + !match(amazonPhone) && + !match(androidPhone) && + (match(amazonTablet) || match(androidTablet)), + device: (!match(windowsPhone) && + (match(amazonPhone) || + match(amazonTablet) || + match(androidPhone) || + match(androidTablet))) || + match(/\bokhttp\b/i) + }, + windows: { + phone: match(windowsPhone), + tablet: match(windowsTablet), + device: match(windowsPhone) || match(windowsTablet) + }, + other: { + blackberry: match(otherBlackBerry), + blackberry10: match(otherBlackBerry10), + opera: match(otherOpera), + firefox: match(otherFirefox), + chrome: match(otherChrome), + device: match(otherBlackBerry) || + match(otherBlackBerry10) || + match(otherOpera) || + match(otherFirefox) || + match(otherChrome) + }, + any: false, + phone: false, + tablet: false + }; + result.any = + result.apple.device || + result.android.device || + result.windows.device || + result.other.device; + result.phone = + result.apple.phone || result.android.phone || result.windows.phone; + result.tablet = + result.apple.tablet || result.android.tablet || result.windows.tablet; + return result; + } + + var isMobile = isMobile$1(globalThis.navigator); + + /** + * Uploading the same buffer multiple times in a single frame can cause performance issues. + * Apparent on iOS so only check for that at the moment + * This check may become more complex if this issue pops up elsewhere. + * @private + * @returns {boolean} `true` if the same buffer may be uploaded more than once. + */ + function canUploadSameBuffer() { + return !isMobile.apple.device; + } + + /** + * The maximum recommended texture units to use. + * In theory the bigger the better, and for desktop we'll use as many as we can. + * But some mobile devices slow down if there is to many branches in the shader. + * So in practice there seems to be a sweet spot size that varies depending on the device. + * + * In v4, all mobile devices were limited to 4 texture units because for this. + * In v5, we allow all texture units to be used on modern Apple or Android devices. + * @private + * @param {number} max + * @returns {number} The maximum recommended texture units to use. + */ + function maxRecommendedTextures(max) { + var allowMax = true; + if (isMobile.tablet || isMobile.phone) { + if (isMobile.apple.device) { + var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below iOS 11, which will be older hardware + if (majorVersion < 11) { + allowMax = false; + } + } + } + if (isMobile.android.device) { + var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below Android 7 (Nougat), which will be older hardware + if (majorVersion < 7) { + allowMax = false; + } + } + } + } + return allowMax ? max : 4; + } + + /** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float precision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio; + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ + var settings = { + /** + * This adapter is used to call methods that are platform dependent. + * For example `document.createElement` only runs on the web but fails in node environments. + * This allows us to support more platforms by abstracting away specific implementations per platform. + * + * By default the adapter is set to work in the browser. However you can create your own + * by implementing the `IAdapter` interface. See `IAdapter` for more information. + * @name ADAPTER + * @memberof PIXI.settings + * @type {PIXI.IAdapter} + * @default PIXI.BrowserAdapter + */ + ADAPTER: BrowserAdapter, + /** + * If set to true WebGL will attempt make textures mimpaped by default. + * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. + * @static + * @name MIPMAP_TEXTURES + * @memberof PIXI.settings + * @type {PIXI.MIPMAP_MODES} + * @default PIXI.MIPMAP_MODES.POW2 + */ + MIPMAP_TEXTURES: constants.MIPMAP_MODES.POW2, + /** + * Default anisotropic filtering level of textures. + * Usually from 0 to 16 + * @static + * @name ANISOTROPIC_LEVEL + * @memberof PIXI.settings + * @type {number} + * @default 0 + */ + ANISOTROPIC_LEVEL: 0, + /** + * Default resolution / device pixel ratio of the renderer. + * @static + * @name RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + RESOLUTION: 1, + /** + * Default filter resolution. + * @static + * @name FILTER_RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + FILTER_RESOLUTION: 1, + /** + * Default filter samples. + * @static + * @name FILTER_MULTISAMPLE + * @memberof PIXI.settings + * @type {PIXI.MSAA_QUALITY} + * @default PIXI.MSAA_QUALITY.NONE + */ + FILTER_MULTISAMPLE: constants.MSAA_QUALITY.NONE, + /** + * The maximum textures that this device supports. + * @static + * @name SPRITE_MAX_TEXTURES + * @memberof PIXI.settings + * @type {number} + * @default 32 + */ + SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** + * The default sprite batch size. + * + * The default aims to balance desktop and mobile devices. + * @static + * @name SPRITE_BATCH_SIZE + * @memberof PIXI.settings + * @type {number} + * @default 4096 + */ + SPRITE_BATCH_SIZE: 4096, + /** + * The default render options if none are supplied to {@link PIXI.Renderer} + * or {@link PIXI.CanvasRenderer}. + * @static + * @name RENDER_OPTIONS + * @memberof PIXI.settings + * @type {object} + * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias} + * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity} + * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha} + * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor} + * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender} + * @property {number} [height=600] - {@link PIXI.IRendererOptions.height} + * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer} + * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha} + * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view} + * @property {number} [width=800] - {@link PIXI.IRendererOptions.width} + */ + RENDER_OPTIONS: { + view: null, + width: 800, + height: 600, + autoDensity: false, + backgroundColor: 0x000000, + backgroundAlpha: 1, + useContextAlpha: true, + clearBeforeRender: true, + antialias: false, + preserveDrawingBuffer: false, + }, + /** + * Default Garbage Collection mode. + * @static + * @name GC_MODE + * @memberof PIXI.settings + * @type {PIXI.GC_MODES} + * @default PIXI.GC_MODES.AUTO + */ + GC_MODE: constants.GC_MODES.AUTO, + /** + * Default Garbage Collection max idle. + * @static + * @name GC_MAX_IDLE + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + /** + * Default Garbage Collection maximum check count. + * @static + * @name GC_MAX_CHECK_COUNT + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + /** + * Default wrap modes that are supported by pixi. + * @static + * @name WRAP_MODE + * @memberof PIXI.settings + * @type {PIXI.WRAP_MODES} + * @default PIXI.WRAP_MODES.CLAMP + */ + WRAP_MODE: constants.WRAP_MODES.CLAMP, + /** + * Default scale mode for textures. + * @static + * @name SCALE_MODE + * @memberof PIXI.settings + * @type {PIXI.SCALE_MODES} + * @default PIXI.SCALE_MODES.LINEAR + */ + SCALE_MODE: constants.SCALE_MODES.LINEAR, + /** + * Default specify float precision in vertex shader. + * @static + * @name PRECISION_VERTEX + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.HIGH + */ + PRECISION_VERTEX: constants.PRECISION.HIGH, + /** + * Default specify float precision in fragment shader. + * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 + * @static + * @name PRECISION_FRAGMENT + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.MEDIUM + */ + PRECISION_FRAGMENT: isMobile.apple.device ? constants.PRECISION.HIGH : constants.PRECISION.MEDIUM, + /** + * Can we upload the same buffer in a single frame? + * @static + * @name CAN_UPLOAD_SAME_BUFFER + * @memberof PIXI.settings + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + /** + * Enables bitmap creation before image load. This feature is experimental. + * @static + * @name CREATE_IMAGE_BITMAP + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + CREATE_IMAGE_BITMAP: false, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * @static + * @constant + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + ROUND_PIXELS: false, + }; + + exports.BrowserAdapter = BrowserAdapter; + exports.isMobile = isMobile; + exports.settings = settings; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI); +Object.assign(this.PIXI, _pixi_settings); +//# sourceMappingURL=settings.js.map diff --git a/live2d/node_modules/@pixi/settings/dist/browser/settings.js.map b/live2d/node_modules/@pixi/settings/dist/browser/settings.js.map new file mode 100644 index 0000000..8296fcd --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/browser/settings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.js","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/utils/canUploadSameBuffer.ts","../../src/utils/maxRecommendedTextures.ts","../../src/settings.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n"],"names":["isMobile","isMobileCall","MIPMAP_MODES","MSAA_QUALITY","GC_MODES","WRAP_MODES","SCALE_MODES","PRECISION"],"mappings":";;;;;;;;;;;AAoBO,QAAM,cAAc,GAAG;IAC1B;;;;;IAKG;IACH,IAAA,YAAY,EAAE,UAAC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;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js b/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js new file mode 100644 index 0000000..ffdfa16 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_settings=function(e,t){"use strict";var i={createCanvas:function(e,t){var i=document.createElement("canvas");return i.width=e,i.height=t,i},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var e;return null!==(e=document.baseURI)&&void 0!==e?e:window.location.href},fetch:function(e,t){return fetch(e,t)}},n=/iPhone/i,r=/iPod/i,o=/iPad/i,a=/\biOS-universal(?:.+)Mac\b/i,d=/\bAndroid(?:.+)Mobile\b/i,s=/Android/i,u=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,l=/Silk/i,c=/Windows Phone/i,p=/\bWindows(?:.+)ARM\b/i,E=/BlackBerry/i,A=/BB10/i,v=/Opera Mini/i,I=/\b(CriOS|Chrome)(?:.+)Mobile/i,h=/Mobile(?:.+)Firefox\b/i,b=function(e){return void 0!==e&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&"undefined"==typeof MSStream};var f=function(e){var t={userAgent:"",platform:"",maxTouchPoints:0};e||"undefined"==typeof navigator?"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0}):t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var i=t.userAgent,f=i.split("[FBAN");void 0!==f[1]&&(i=f[0]),void 0!==(f=i.split("Twitter"))[1]&&(i=f[0]);var P=function(e){return function(t){return t.test(e)}}(i),_={apple:{phone:P(n)&&!P(c),ipod:P(r),tablet:!P(n)&&(P(o)||b(t))&&!P(c),universal:P(a),device:(P(n)||P(r)||P(o)||P(a)||b(t))&&!P(c)},amazon:{phone:P(u),tablet:!P(u)&&P(l),device:P(u)||P(l)},android:{phone:!P(c)&&P(u)||!P(c)&&P(d),tablet:!P(c)&&!P(u)&&!P(d)&&(P(l)||P(s)),device:!P(c)&&(P(u)||P(l)||P(d)||P(s))||P(/\bokhttp\b/i)},windows:{phone:P(c),tablet:P(p),device:P(c)||P(p)},other:{blackberry:P(E),blackberry10:P(A),opera:P(v),firefox:P(h),chrome:P(I),device:P(E)||P(A)||P(v)||P(h)||P(I)},any:!1,phone:!1,tablet:!1};return _.any=_.apple.device||_.android.device||_.windows.device||_.other.device,_.phone=_.apple.phone||_.android.phone||_.windows.phone,_.tablet=_.apple.tablet||_.android.tablet||_.windows.tablet,_}(globalThis.navigator);var P={ADAPTER:i,MIPMAP_TEXTURES:t.MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:t.MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(e){var t=!0;if(f.tablet||f.phone){var i;if(f.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(t=!1);if(f.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(t=!1)}return t?e:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:t.GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:t.WRAP_MODES.CLAMP,SCALE_MODE:t.SCALE_MODES.LINEAR,PRECISION_VERTEX:t.PRECISION.HIGH,PRECISION_FRAGMENT:f.apple.device?t.PRECISION.HIGH:t.PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!f.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};return e.BrowserAdapter=i,e.isMobile=f,e.settings=P,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI);Object.assign(this.PIXI,_pixi_settings); +//# sourceMappingURL=settings.min.js.map diff --git a/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js.map b/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js.map new file mode 100644 index 0000000..ea43e86 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/browser/settings.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.min.js","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/settings.ts","../../src/utils/maxRecommendedTextures.ts","../../src/utils/canUploadSameBuffer.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n"],"names":["BrowserAdapter","createCanvas","width","height","canvas","document","createElement","getWebGLRenderingContext","WebGLRenderingContext","getNavigator","navigator","getBaseUrl","_a","baseURI","window","location","href","fetch","url","options","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","platform","maxTouchPoints","MSStream","isMobile","param","nav","userAgent","tmp","split","match","regex","test","createMatch","result","apple","phone","ipod","tablet","universal","device","amazon","android","windows","other","blackberry","blackberry10","opera","firefox","chrome","any","isMobileCall","globalThis","settings","ADAPTER","MIPMAP_TEXTURES","MIPMAP_MODES","POW2","ANISOTROPIC_LEVEL","RESOLUTION","FILTER_RESOLUTION","FILTER_MULTISAMPLE","MSAA_QUALITY","NONE","SPRITE_MAX_TEXTURES","max","allowMax","parseInt","maxRecommendedTextures","SPRITE_BATCH_SIZE","RENDER_OPTIONS","view","autoDensity","backgroundColor","backgroundAlpha","useContextAlpha","clearBeforeRender","antialias","preserveDrawingBuffer","GC_MODE","GC_MODES","AUTO","GC_MAX_IDLE","GC_MAX_CHECK_COUNT","WRAP_MODE","WRAP_MODES","CLAMP","SCALE_MODE","SCALE_MODES","LINEAR","PRECISION_VERTEX","PRECISION","HIGH","PRECISION_FRAGMENT","MEDIUM","CAN_UPLOAD_SAME_BUFFER","CREATE_IMAGE_BITMAP","ROUND_PIXELS"],"mappings":";;;;;;;sEAoBO,IAAMA,EAAiB,CAO1BC,aAAc,SAACC,EAAeC,GAE1B,IAAMC,EAASC,SAASC,cAAc,UAKtC,OAHAF,EAAOF,MAAQA,EACfE,EAAOD,OAASA,EAETC,GAEXG,yBAA0B,WAAM,OAAAC,uBAChCC,aAAc,WAAM,OAAAC,WACpBC,WAAY,WAAM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,kBAAmB,EAUnBC,WAAY,EAUZC,kBAAmB,EAUnBC,mBAAoBC,EAAYA,aAACC,KAUjCC,oBC9HE,SAAiCC,GAEnC,IAAIC,GAAW,EAEf,GAAI1C,EAASc,QAAUd,EAASY,MAChC,CAGQ,IAeMN,EAjBV,GAAIN,EAASW,MAAMK,OAIf,GAFMV,EAASnC,UAAmB,UAAEmC,MAAM,mBAIjBqC,SAASrC,EAAM,GAAI,IAGrB,KAEfoC,GAAW,GAIvB,GAAI1C,EAASkB,QAAQF,OAIjB,GAFMV,EAASnC,UAAmB,UAAEmC,MAAM,sBAIjBqC,SAASrC,EAAM,GAAI,IAGrB,IAEfoC,GAAW,GAM3B,OAAOA,EAAWD,EAAM,EDwFHG,CAAuB,IAe5CC,kBAAmB,KAoBnBC,eAAgB,CACZC,KAAM,KACNpF,MAAO,IACPC,OAAQ,IACRoF,aAAa,EACbC,gBAAiB,EACjBC,gBAAiB,EACjBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,uBAAuB,GAW3BC,QAASC,EAAQA,SAACC,KAUlBC,YAAa,KAUbC,mBAAoB,IAUpBC,UAAWC,EAAUA,WAACC,MAUtBC,WAAYC,EAAWA,YAACC,OAUxBC,iBAAkBC,EAASA,UAACC,KAW5BC,mBAAoBrE,EAASW,MAAMK,OAASmD,EAAAA,UAAUC,KAAOD,EAAAA,UAAUG,OASvEC,wBE/PQvE,EAASW,MAAMK,OFyQvBwD,qBAAqB,EAYrBC,cAAc"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/dist/cjs/settings.js b/live2d/node_modules/@pixi/settings/dist/cjs/settings.js new file mode 100644 index 0000000..98b4a9b --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/cjs/settings.js @@ -0,0 +1,432 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var constants = require('@pixi/constants'); + +var BrowserAdapter = { + /** + * Creates a canvas element of the given size. + * This canvas is created using the browser's native canvas element. + * @param width - width of the canvas + * @param height - height of the canvas + */ + createCanvas: function (width, height) { + var canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + return canvas; + }, + getWebGLRenderingContext: function () { return WebGLRenderingContext; }, + getNavigator: function () { return navigator; }, + getBaseUrl: function () { var _a; return ((_a = document.baseURI) !== null && _a !== void 0 ? _a : window.location.href); }, + fetch: function (url, options) { return fetch(url, options); }, +}; + +var appleIphone = /iPhone/i; +var appleIpod = /iPod/i; +var appleTablet = /iPad/i; +var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; +var androidPhone = /\bAndroid(?:.+)Mobile\b/i; +var androidTablet = /Android/i; +var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; +var amazonTablet = /Silk/i; +var windowsPhone = /Windows Phone/i; +var windowsTablet = /\bWindows(?:.+)ARM\b/i; +var otherBlackBerry = /BlackBerry/i; +var otherBlackBerry10 = /BB10/i; +var otherOpera = /Opera Mini/i; +var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; +var otherFirefox = /Mobile(?:.+)Firefox\b/i; +var isAppleTabletOnIos13 = function (navigator) { + return (typeof navigator !== 'undefined' && + navigator.platform === 'MacIntel' && + typeof navigator.maxTouchPoints === 'number' && + navigator.maxTouchPoints > 1 && + typeof MSStream === 'undefined'); +}; +function createMatch(userAgent) { + return function (regex) { return regex.test(userAgent); }; +} +function isMobile$1(param) { + var nav = { + userAgent: '', + platform: '', + maxTouchPoints: 0 + }; + if (!param && typeof navigator !== 'undefined') { + nav = { + userAgent: navigator.userAgent, + platform: navigator.platform, + maxTouchPoints: navigator.maxTouchPoints || 0 + }; + } + else if (typeof param === 'string') { + nav.userAgent = param; + } + else if (param && param.userAgent) { + nav = { + userAgent: param.userAgent, + platform: param.platform, + maxTouchPoints: param.maxTouchPoints || 0 + }; + } + var userAgent = nav.userAgent; + var tmp = userAgent.split('[FBAN'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + tmp = userAgent.split('Twitter'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + var match = createMatch(userAgent); + var result = { + apple: { + phone: match(appleIphone) && !match(windowsPhone), + ipod: match(appleIpod), + tablet: !match(appleIphone) && + (match(appleTablet) || isAppleTabletOnIos13(nav)) && + !match(windowsPhone), + universal: match(appleUniversal), + device: (match(appleIphone) || + match(appleIpod) || + match(appleTablet) || + match(appleUniversal) || + isAppleTabletOnIos13(nav)) && + !match(windowsPhone) + }, + amazon: { + phone: match(amazonPhone), + tablet: !match(amazonPhone) && match(amazonTablet), + device: match(amazonPhone) || match(amazonTablet) + }, + android: { + phone: (!match(windowsPhone) && match(amazonPhone)) || + (!match(windowsPhone) && match(androidPhone)), + tablet: !match(windowsPhone) && + !match(amazonPhone) && + !match(androidPhone) && + (match(amazonTablet) || match(androidTablet)), + device: (!match(windowsPhone) && + (match(amazonPhone) || + match(amazonTablet) || + match(androidPhone) || + match(androidTablet))) || + match(/\bokhttp\b/i) + }, + windows: { + phone: match(windowsPhone), + tablet: match(windowsTablet), + device: match(windowsPhone) || match(windowsTablet) + }, + other: { + blackberry: match(otherBlackBerry), + blackberry10: match(otherBlackBerry10), + opera: match(otherOpera), + firefox: match(otherFirefox), + chrome: match(otherChrome), + device: match(otherBlackBerry) || + match(otherBlackBerry10) || + match(otherOpera) || + match(otherFirefox) || + match(otherChrome) + }, + any: false, + phone: false, + tablet: false + }; + result.any = + result.apple.device || + result.android.device || + result.windows.device || + result.other.device; + result.phone = + result.apple.phone || result.android.phone || result.windows.phone; + result.tablet = + result.apple.tablet || result.android.tablet || result.windows.tablet; + return result; +} + +var isMobile = isMobile$1(globalThis.navigator); + +/** + * Uploading the same buffer multiple times in a single frame can cause performance issues. + * Apparent on iOS so only check for that at the moment + * This check may become more complex if this issue pops up elsewhere. + * @private + * @returns {boolean} `true` if the same buffer may be uploaded more than once. + */ +function canUploadSameBuffer() { + return !isMobile.apple.device; +} + +/** + * The maximum recommended texture units to use. + * In theory the bigger the better, and for desktop we'll use as many as we can. + * But some mobile devices slow down if there is to many branches in the shader. + * So in practice there seems to be a sweet spot size that varies depending on the device. + * + * In v4, all mobile devices were limited to 4 texture units because for this. + * In v5, we allow all texture units to be used on modern Apple or Android devices. + * @private + * @param {number} max + * @returns {number} The maximum recommended texture units to use. + */ +function maxRecommendedTextures(max) { + var allowMax = true; + if (isMobile.tablet || isMobile.phone) { + if (isMobile.apple.device) { + var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below iOS 11, which will be older hardware + if (majorVersion < 11) { + allowMax = false; + } + } + } + if (isMobile.android.device) { + var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below Android 7 (Nougat), which will be older hardware + if (majorVersion < 7) { + allowMax = false; + } + } + } + } + return allowMax ? max : 4; +} + +/** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float precision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio; + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ +var settings = { + /** + * This adapter is used to call methods that are platform dependent. + * For example `document.createElement` only runs on the web but fails in node environments. + * This allows us to support more platforms by abstracting away specific implementations per platform. + * + * By default the adapter is set to work in the browser. However you can create your own + * by implementing the `IAdapter` interface. See `IAdapter` for more information. + * @name ADAPTER + * @memberof PIXI.settings + * @type {PIXI.IAdapter} + * @default PIXI.BrowserAdapter + */ + ADAPTER: BrowserAdapter, + /** + * If set to true WebGL will attempt make textures mimpaped by default. + * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. + * @static + * @name MIPMAP_TEXTURES + * @memberof PIXI.settings + * @type {PIXI.MIPMAP_MODES} + * @default PIXI.MIPMAP_MODES.POW2 + */ + MIPMAP_TEXTURES: constants.MIPMAP_MODES.POW2, + /** + * Default anisotropic filtering level of textures. + * Usually from 0 to 16 + * @static + * @name ANISOTROPIC_LEVEL + * @memberof PIXI.settings + * @type {number} + * @default 0 + */ + ANISOTROPIC_LEVEL: 0, + /** + * Default resolution / device pixel ratio of the renderer. + * @static + * @name RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + RESOLUTION: 1, + /** + * Default filter resolution. + * @static + * @name FILTER_RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + FILTER_RESOLUTION: 1, + /** + * Default filter samples. + * @static + * @name FILTER_MULTISAMPLE + * @memberof PIXI.settings + * @type {PIXI.MSAA_QUALITY} + * @default PIXI.MSAA_QUALITY.NONE + */ + FILTER_MULTISAMPLE: constants.MSAA_QUALITY.NONE, + /** + * The maximum textures that this device supports. + * @static + * @name SPRITE_MAX_TEXTURES + * @memberof PIXI.settings + * @type {number} + * @default 32 + */ + SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** + * The default sprite batch size. + * + * The default aims to balance desktop and mobile devices. + * @static + * @name SPRITE_BATCH_SIZE + * @memberof PIXI.settings + * @type {number} + * @default 4096 + */ + SPRITE_BATCH_SIZE: 4096, + /** + * The default render options if none are supplied to {@link PIXI.Renderer} + * or {@link PIXI.CanvasRenderer}. + * @static + * @name RENDER_OPTIONS + * @memberof PIXI.settings + * @type {object} + * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias} + * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity} + * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha} + * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor} + * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender} + * @property {number} [height=600] - {@link PIXI.IRendererOptions.height} + * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer} + * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha} + * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view} + * @property {number} [width=800] - {@link PIXI.IRendererOptions.width} + */ + RENDER_OPTIONS: { + view: null, + width: 800, + height: 600, + autoDensity: false, + backgroundColor: 0x000000, + backgroundAlpha: 1, + useContextAlpha: true, + clearBeforeRender: true, + antialias: false, + preserveDrawingBuffer: false, + }, + /** + * Default Garbage Collection mode. + * @static + * @name GC_MODE + * @memberof PIXI.settings + * @type {PIXI.GC_MODES} + * @default PIXI.GC_MODES.AUTO + */ + GC_MODE: constants.GC_MODES.AUTO, + /** + * Default Garbage Collection max idle. + * @static + * @name GC_MAX_IDLE + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + /** + * Default Garbage Collection maximum check count. + * @static + * @name GC_MAX_CHECK_COUNT + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + /** + * Default wrap modes that are supported by pixi. + * @static + * @name WRAP_MODE + * @memberof PIXI.settings + * @type {PIXI.WRAP_MODES} + * @default PIXI.WRAP_MODES.CLAMP + */ + WRAP_MODE: constants.WRAP_MODES.CLAMP, + /** + * Default scale mode for textures. + * @static + * @name SCALE_MODE + * @memberof PIXI.settings + * @type {PIXI.SCALE_MODES} + * @default PIXI.SCALE_MODES.LINEAR + */ + SCALE_MODE: constants.SCALE_MODES.LINEAR, + /** + * Default specify float precision in vertex shader. + * @static + * @name PRECISION_VERTEX + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.HIGH + */ + PRECISION_VERTEX: constants.PRECISION.HIGH, + /** + * Default specify float precision in fragment shader. + * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 + * @static + * @name PRECISION_FRAGMENT + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.MEDIUM + */ + PRECISION_FRAGMENT: isMobile.apple.device ? constants.PRECISION.HIGH : constants.PRECISION.MEDIUM, + /** + * Can we upload the same buffer in a single frame? + * @static + * @name CAN_UPLOAD_SAME_BUFFER + * @memberof PIXI.settings + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + /** + * Enables bitmap creation before image load. This feature is experimental. + * @static + * @name CREATE_IMAGE_BITMAP + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + CREATE_IMAGE_BITMAP: false, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * @static + * @constant + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + ROUND_PIXELS: false, +}; + +exports.BrowserAdapter = BrowserAdapter; +exports.isMobile = isMobile; +exports.settings = settings; +//# sourceMappingURL=settings.js.map diff --git a/live2d/node_modules/@pixi/settings/dist/cjs/settings.js.map b/live2d/node_modules/@pixi/settings/dist/cjs/settings.js.map new file mode 100644 index 0000000..6e8b106 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/cjs/settings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.js","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/utils/canUploadSameBuffer.ts","../../src/utils/maxRecommendedTextures.ts","../../src/settings.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n"],"names":["isMobile","isMobileCall","MIPMAP_MODES","MSAA_QUALITY","GC_MODES","WRAP_MODES","SCALE_MODES","PRECISION"],"mappings":";;;;;;;;;;;;;AAoBO,IAAM,cAAc,GAAG;AAC1B;;;;;AAKG;AACH,IAAA,YAAY,EAAE,UAAC,KAAa,EAAE,MAAc,EAAA;QAExC,IAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAEhD,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AAEvB,QAAA,OAAO,MAAM,CAAC;KACjB;AACD,IAAA,wBAAwB,EAAE,YAAA,EAAM,OAAA,qBAAqB,GAAA;AACrD,IAAA,YAAY,EAAE,YAAA,EAAM,OAAA,SAAS,GAAA;AAC7B,IAAA,UAAU,EAAE,YAAM,EAAA,IAAA,EAAA,CAAA,CAAA,QAAC,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA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AAE,IAAI;AACrB,QAAA,iBAAiB,EAAE,IAAI;AACvB,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,qBAAqB,EAAE,KAAK;AAC/B,KAAA;AAED;;;;;;;AAOG;IACH,OAAO,EAAEC,kBAAQ,CAAC,IAAI;AAEtB;;;;;;;AAOG;IACH,WAAW,EAAE,EAAE,GAAG,EAAE;AAEpB;;;;;;;AAOG;IACH,kBAAkB,EAAE,EAAE,GAAG,EAAE;AAE3B;;;;;;;AAOG;IACH,SAAS,EAAEC,oBAAU,CAAC,KAAK;AAE3B;;;;;;;AAOG;IACH,UAAU,EAAEC,qBAAW,CAAC,MAAM;AAE9B;;;;;;;AAOG;IACH,gBAAgB,EAAEC,mBAAS,CAAC,IAAI;AAEhC;;;;;;;;AAQG;AACH,IAAA,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAGA,mBAAS,CAAC,IAAI,GAAGA,mBAAS,CAAC,MAAM;AAE7E;;;;;;AAMG;IACH,sBAAsB,EAAE,mBAAmB,EAAE;AAE7C;;;;;;;AAOG;AACH,IAAA,mBAAmB,EAAE,KAAK;AAE1B;;;;;;;;;AASG;AACH,IAAA,YAAY,EAAE,KAAK;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js b/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js new file mode 100644 index 0000000..88fa343 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/constants"),t={createCanvas:function(e,t){var i=document.createElement("canvas");return i.width=e,i.height=t,i},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var e;return null!==(e=document.baseURI)&&void 0!==e?e:window.location.href},fetch:function(e,t){return fetch(e,t)}},i=/iPhone/i,n=/iPod/i,r=/iPad/i,o=/\biOS-universal(?:.+)Mac\b/i,a=/\bAndroid(?:.+)Mobile\b/i,d=/Android/i,u=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,l=/Silk/i,s=/Windows Phone/i,c=/\bWindows(?:.+)ARM\b/i,p=/BlackBerry/i,E=/BB10/i,A=/Opera Mini/i,v=/\b(CriOS|Chrome)(?:.+)Mobile/i,b=/Mobile(?:.+)Firefox\b/i,h=function(e){return void 0!==e&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&"undefined"==typeof MSStream};var f=function(e){var t={userAgent:"",platform:"",maxTouchPoints:0};e||"undefined"==typeof navigator?"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0}):t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var f=t.userAgent,I=f.split("[FBAN");void 0!==I[1]&&(f=I[0]),void 0!==(I=f.split("Twitter"))[1]&&(f=I[0]);var M=function(e){return function(t){return t.test(e)}}(f),P={apple:{phone:M(i)&&!M(s),ipod:M(n),tablet:!M(i)&&(M(r)||h(t))&&!M(s),universal:M(o),device:(M(i)||M(n)||M(r)||M(o)||h(t))&&!M(s)},amazon:{phone:M(u),tablet:!M(u)&&M(l),device:M(u)||M(l)},android:{phone:!M(s)&&M(u)||!M(s)&&M(a),tablet:!M(s)&&!M(u)&&!M(a)&&(M(l)||M(d)),device:!M(s)&&(M(u)||M(l)||M(a)||M(d))||M(/\bokhttp\b/i)},windows:{phone:M(s),tablet:M(c),device:M(s)||M(c)},other:{blackberry:M(p),blackberry10:M(E),opera:M(A),firefox:M(b),chrome:M(v),device:M(p)||M(E)||M(A)||M(b)||M(v)},any:!1,phone:!1,tablet:!1};return P.any=P.apple.device||P.android.device||P.windows.device||P.other.device,P.phone=P.apple.phone||P.android.phone||P.windows.phone,P.tablet=P.apple.tablet||P.android.tablet||P.windows.tablet,P}(globalThis.navigator);var I={ADAPTER:t,MIPMAP_TEXTURES:e.MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:e.MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(e){var t=!0;if(f.tablet||f.phone){var i;if(f.apple.device)if(i=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(i[1],10)<11&&(t=!1);if(f.android.device)if(i=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(i[1],10)<7&&(t=!1)}return t?e:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:e.GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:e.WRAP_MODES.CLAMP,SCALE_MODE:e.SCALE_MODES.LINEAR,PRECISION_VERTEX:e.PRECISION.HIGH,PRECISION_FRAGMENT:f.apple.device?e.PRECISION.HIGH:e.PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!f.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};exports.BrowserAdapter=t,exports.isMobile=f,exports.settings=I; +//# sourceMappingURL=settings.min.js.map diff --git a/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js.map b/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js.map new file mode 100644 index 0000000..ad2b1c5 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/cjs/settings.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.min.js","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/settings.ts","../../src/utils/maxRecommendedTextures.ts","../../src/utils/canUploadSameBuffer.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n"],"names":["BrowserAdapter","createCanvas","width","height","canvas","document","createElement","getWebGLRenderingContext","WebGLRenderingContext","getNavigator","navigator","getBaseUrl","_a","baseURI","window","location","href","fetch","url","options","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","platform","maxTouchPoints","MSStream","isMobile","param","nav","userAgent","tmp","split","match","regex","test","createMatch","result","apple","phone","ipod","tablet","universal","device","amazon","android","windows","other","blackberry","blackberry10","opera","firefox","chrome","any","isMobileCall","globalThis","settings","ADAPTER","MIPMAP_TEXTURES","MIPMAP_MODES","POW2","ANISOTROPIC_LEVEL","RESOLUTION","FILTER_RESOLUTION","FILTER_MULTISAMPLE","MSAA_QUALITY","NONE","SPRITE_MAX_TEXTURES","max","allowMax","parseInt","maxRecommendedTextures","SPRITE_BATCH_SIZE","RENDER_OPTIONS","view","autoDensity","backgroundColor","backgroundAlpha","useContextAlpha","clearBeforeRender","antialias","preserveDrawingBuffer","GC_MODE","GC_MODES","AUTO","GC_MAX_IDLE","GC_MAX_CHECK_COUNT","WRAP_MODE","WRAP_MODES","CLAMP","SCALE_MODE","SCALE_MODES","LINEAR","PRECISION_VERTEX","PRECISION","HIGH","PRECISION_FRAGMENT","MEDIUM","CAN_UPLOAD_SAME_BUFFER","CREATE_IMAGE_BITMAP","ROUND_PIXELS"],"mappings":";;;;;;;qGAoBaA,EAAiB,CAO1BC,aAAc,SAACC,EAAeC,GAE1B,IAAMC,EAASC,SAASC,cAAc,UAKtC,OAHAF,EAAOF,MAAQA,EACfE,EAAOD,OAASA,EAETC,GAEXG,yBAA0B,WAAM,OAAAC,uBAChCC,aAAc,WAAM,OAAAC,WACpBC,WAAY,WAAM,IAAAC,EAAA,OAAqB,QAApBA,EAAAP,SAASQ,eAAW,IAAAD,EAAAA,EAAAE,OAAOC,SAASC,MACvDC,MAAO,SAACC,EAAkBC,GAA0B,OAAAF,MAAMC,EAAKC,KCvC/DC,EAAc,UACdC,EAAY,QACZC,EAAc,QACdC,EAAiB,8BACjBC,EAAe,2BACfC,EAAgB,WAChBC,EAAc,qCACdC,EAAe,QACfC,EAAe,iBACfC,EAAgB,wBAChBC,EAAkB,cAClBC,EAAoB,QACpBC,EAAa,cACbC,EAAc,gCACdC,EAAe,yBACfC,EAAuB,SAAUzB,GACjC,YAA6B,IAAdA,GACY,aAAvBA,EAAU0B,UAC0B,iBAA7B1B,EAAU2B,gBACjB3B,EAAU2B,eAAiB,GACP,oBAAbC,UCkBR,IAAMC,EDbE,SAAkBC,GAC7B,IAAIC,EAAM,CACNC,UAAW,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RoF,aAAa,EACbC,gBAAiB,EACjBC,gBAAiB,EACjBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,uBAAuB,GAW3BC,QAASC,EAAQA,SAACC,KAUlBC,YAAa,KAUbC,mBAAoB,IAUpBC,UAAWC,EAAUA,WAACC,MAUtBC,WAAYC,EAAWA,YAACC,OAUxBC,iBAAkBC,EAASA,UAACC,KAW5BC,mBAAoBrE,EAASW,MAAMK,OAASmD,EAAAA,UAAUC,KAAOD,EAAAA,UAAUG,OASvEC,wBE/PQvE,EAASW,MAAMK,OFyQvBwD,qBAAqB,EAYrBC,cAAc"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs b/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs new file mode 100644 index 0000000..90b8476 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{MIPMAP_MODES as e,MSAA_QUALITY as t,GC_MODES as n,WRAP_MODES as i,SCALE_MODES as o,PRECISION as r}from"@pixi/constants";var a={createCanvas:function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var e;return null!==(e=document.baseURI)&&void 0!==e?e:window.location.href},fetch:function(e,t){return fetch(e,t)}},d=/iPhone/i,l=/iPod/i,u=/iPad/i,c=/\biOS-universal(?:.+)Mac\b/i,p=/\bAndroid(?:.+)Mobile\b/i,s=/Android/i,v=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,h=/Silk/i,A=/Windows Phone/i,E=/\bWindows(?:.+)ARM\b/i,b=/BlackBerry/i,f=/BB10/i,g=/Opera Mini/i,T=/\b(CriOS|Chrome)(?:.+)Mobile/i,I=/Mobile(?:.+)Firefox\b/i,P=function(e){return void 0!==e&&"MacIntel"===e.platform&&"number"==typeof e.maxTouchPoints&&e.maxTouchPoints>1&&"undefined"==typeof MSStream};var R=function(e){var t={userAgent:"",platform:"",maxTouchPoints:0};e||"undefined"==typeof navigator?"string"==typeof e?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0}):t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var n=t.userAgent,i=n.split("[FBAN");void 0!==i[1]&&(n=i[0]),void 0!==(i=n.split("Twitter"))[1]&&(n=i[0]);var o=function(e){return function(t){return t.test(e)}}(n),r={apple:{phone:o(d)&&!o(A),ipod:o(l),tablet:!o(d)&&(o(u)||P(t))&&!o(A),universal:o(c),device:(o(d)||o(l)||o(u)||o(c)||P(t))&&!o(A)},amazon:{phone:o(v),tablet:!o(v)&&o(h),device:o(v)||o(h)},android:{phone:!o(A)&&o(v)||!o(A)&&o(p),tablet:!o(A)&&!o(v)&&!o(p)&&(o(h)||o(s)),device:!o(A)&&(o(v)||o(h)||o(p)||o(s))||o(/\bokhttp\b/i)},windows:{phone:o(A),tablet:o(E),device:o(A)||o(E)},other:{blackberry:o(b),blackberry10:o(f),opera:o(g),firefox:o(I),chrome:o(T),device:o(b)||o(f)||o(g)||o(I)||o(T)},any:!1,phone:!1,tablet:!1};return r.any=r.apple.device||r.android.device||r.windows.device||r.other.device,r.phone=r.apple.phone||r.android.phone||r.windows.phone,r.tablet=r.apple.tablet||r.android.tablet||r.windows.tablet,r}(globalThis.navigator);var M={ADAPTER:a,MIPMAP_TEXTURES:e.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:t.NONE,SPRITE_MAX_TEXTURES:function(e){var t=!0;if(R.tablet||R.phone){var n;if(R.apple.device)if(n=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(n[1],10)<11&&(t=!1);if(R.android.device)if(n=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(n[1],10)<7&&(t=!1)}return t?e:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:n.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:i.CLAMP,SCALE_MODE:o.LINEAR,PRECISION_VERTEX:r.HIGH,PRECISION_FRAGMENT:R.apple.device?r.HIGH:r.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!R.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};export{a as BrowserAdapter,R as isMobile,M as settings}; +//# sourceMappingURL=settings.min.mjs.map diff --git a/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs.map b/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs.map new file mode 100644 index 0000000..3c32500 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/esm/settings.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.min.mjs","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/settings.ts","../../src/utils/maxRecommendedTextures.ts","../../src/utils/canUploadSameBuffer.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n"],"names":["BrowserAdapter","createCanvas","width","height","canvas","document","createElement","getWebGLRenderingContext","WebGLRenderingContext","getNavigator","navigator","getBaseUrl","_a","baseURI","window","location","href","fetch","url","options","appleIphone","appleIpod","appleTablet","appleUniversal","androidPhone","androidTablet","amazonPhone","amazonTablet","windowsPhone","windowsTablet","otherBlackBerry","otherBlackBerry10","otherOpera","otherChrome","otherFirefox","isAppleTabletOnIos13","platform","maxTouchPoints","MSStream","isMobile","param","nav","userAgent","tmp","split","match","regex","test","createMatch","result","apple","phone","ipod","tablet","universal","device","amazon","android","windows","other","blackberry","blackberry10","opera","firefox","chrome","any","isMobileCall","globalThis","settings","ADAPTER","MIPMAP_TEXTURES","MIPMAP_MODES","POW2","ANISOTROPIC_LEVEL","RESOLUTION","FILTER_RESOLUTION","FILTER_MULTISAMPLE","MSAA_QUALITY","NONE","SPRITE_MAX_TEXTURES","max","allowMax","parseInt","maxRecommendedTextures","SPRITE_BATCH_SIZE","RENDER_OPTIONS","view","autoDensity","backgroundColor","backgroundAlpha","useContextAlpha","clearBeforeRender","antialias","preserveDrawingBuffer","GC_MODE","GC_MODES","AUTO","GC_MAX_IDLE","GC_MAX_CHECK_COUNT","WRAP_MODE","WRAP_MODES","CLAMP","SCALE_MODE","SCALE_MODES","LINEAR","PRECISION_VERTEX","PRECISION","HIGH","PRECISION_FRAGMENT","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/@pixi/settings/dist/esm/settings.mjs new file mode 100644 index 0000000..1da54f7 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/esm/settings.mjs @@ -0,0 +1,426 @@ +/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { MIPMAP_MODES, MSAA_QUALITY, GC_MODES, WRAP_MODES, SCALE_MODES, PRECISION } from '@pixi/constants'; + +var BrowserAdapter = { + /** + * Creates a canvas element of the given size. + * This canvas is created using the browser's native canvas element. + * @param width - width of the canvas + * @param height - height of the canvas + */ + createCanvas: function (width, height) { + var canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + return canvas; + }, + getWebGLRenderingContext: function () { return WebGLRenderingContext; }, + getNavigator: function () { return navigator; }, + getBaseUrl: function () { var _a; return ((_a = document.baseURI) !== null && _a !== void 0 ? _a : window.location.href); }, + fetch: function (url, options) { return fetch(url, options); }, +}; + +var appleIphone = /iPhone/i; +var appleIpod = /iPod/i; +var appleTablet = /iPad/i; +var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; +var androidPhone = /\bAndroid(?:.+)Mobile\b/i; +var androidTablet = /Android/i; +var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; +var amazonTablet = /Silk/i; +var windowsPhone = /Windows Phone/i; +var windowsTablet = /\bWindows(?:.+)ARM\b/i; +var otherBlackBerry = /BlackBerry/i; +var otherBlackBerry10 = /BB10/i; +var otherOpera = /Opera Mini/i; +var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; +var otherFirefox = /Mobile(?:.+)Firefox\b/i; +var isAppleTabletOnIos13 = function (navigator) { + return (typeof navigator !== 'undefined' && + navigator.platform === 'MacIntel' && + typeof navigator.maxTouchPoints === 'number' && + navigator.maxTouchPoints > 1 && + typeof MSStream === 'undefined'); +}; +function createMatch(userAgent) { + return function (regex) { return regex.test(userAgent); }; +} +function isMobile$1(param) { + var nav = { + userAgent: '', + platform: '', + maxTouchPoints: 0 + }; + if (!param && typeof navigator !== 'undefined') { + nav = { + userAgent: navigator.userAgent, + platform: navigator.platform, + maxTouchPoints: navigator.maxTouchPoints || 0 + }; + } + else if (typeof param === 'string') { + nav.userAgent = param; + } + else if (param && param.userAgent) { + nav = { + userAgent: param.userAgent, + platform: param.platform, + maxTouchPoints: param.maxTouchPoints || 0 + }; + } + var userAgent = nav.userAgent; + var tmp = userAgent.split('[FBAN'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + tmp = userAgent.split('Twitter'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + var match = createMatch(userAgent); + var result = { + apple: { + phone: match(appleIphone) && !match(windowsPhone), + ipod: match(appleIpod), + tablet: !match(appleIphone) && + (match(appleTablet) || isAppleTabletOnIos13(nav)) && + !match(windowsPhone), + universal: match(appleUniversal), + device: (match(appleIphone) || + match(appleIpod) || + match(appleTablet) || + match(appleUniversal) || + isAppleTabletOnIos13(nav)) && + !match(windowsPhone) + }, + amazon: { + phone: match(amazonPhone), + tablet: !match(amazonPhone) && match(amazonTablet), + device: match(amazonPhone) || match(amazonTablet) + }, + android: { + phone: (!match(windowsPhone) && match(amazonPhone)) || + (!match(windowsPhone) && match(androidPhone)), + tablet: !match(windowsPhone) && + !match(amazonPhone) && + !match(androidPhone) && + (match(amazonTablet) || match(androidTablet)), + device: (!match(windowsPhone) && + (match(amazonPhone) || + match(amazonTablet) || + match(androidPhone) || + match(androidTablet))) || + match(/\bokhttp\b/i) + }, + windows: { + phone: match(windowsPhone), + tablet: match(windowsTablet), + device: match(windowsPhone) || match(windowsTablet) + }, + other: { + blackberry: match(otherBlackBerry), + blackberry10: match(otherBlackBerry10), + opera: match(otherOpera), + firefox: match(otherFirefox), + chrome: match(otherChrome), + device: match(otherBlackBerry) || + match(otherBlackBerry10) || + match(otherOpera) || + match(otherFirefox) || + match(otherChrome) + }, + any: false, + phone: false, + tablet: false + }; + result.any = + result.apple.device || + result.android.device || + result.windows.device || + result.other.device; + result.phone = + result.apple.phone || result.android.phone || result.windows.phone; + result.tablet = + result.apple.tablet || result.android.tablet || result.windows.tablet; + return result; +} + +var isMobile = isMobile$1(globalThis.navigator); + +/** + * Uploading the same buffer multiple times in a single frame can cause performance issues. + * Apparent on iOS so only check for that at the moment + * This check may become more complex if this issue pops up elsewhere. + * @private + * @returns {boolean} `true` if the same buffer may be uploaded more than once. + */ +function canUploadSameBuffer() { + return !isMobile.apple.device; +} + +/** + * The maximum recommended texture units to use. + * In theory the bigger the better, and for desktop we'll use as many as we can. + * But some mobile devices slow down if there is to many branches in the shader. + * So in practice there seems to be a sweet spot size that varies depending on the device. + * + * In v4, all mobile devices were limited to 4 texture units because for this. + * In v5, we allow all texture units to be used on modern Apple or Android devices. + * @private + * @param {number} max + * @returns {number} The maximum recommended texture units to use. + */ +function maxRecommendedTextures(max) { + var allowMax = true; + if (isMobile.tablet || isMobile.phone) { + if (isMobile.apple.device) { + var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below iOS 11, which will be older hardware + if (majorVersion < 11) { + allowMax = false; + } + } + } + if (isMobile.android.device) { + var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below Android 7 (Nougat), which will be older hardware + if (majorVersion < 7) { + allowMax = false; + } + } + } + } + return allowMax ? max : 4; +} + +/** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float precision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio; + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ +var settings = { + /** + * This adapter is used to call methods that are platform dependent. + * For example `document.createElement` only runs on the web but fails in node environments. + * This allows us to support more platforms by abstracting away specific implementations per platform. + * + * By default the adapter is set to work in the browser. However you can create your own + * by implementing the `IAdapter` interface. See `IAdapter` for more information. + * @name ADAPTER + * @memberof PIXI.settings + * @type {PIXI.IAdapter} + * @default PIXI.BrowserAdapter + */ + ADAPTER: BrowserAdapter, + /** + * If set to true WebGL will attempt make textures mimpaped by default. + * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. + * @static + * @name MIPMAP_TEXTURES + * @memberof PIXI.settings + * @type {PIXI.MIPMAP_MODES} + * @default PIXI.MIPMAP_MODES.POW2 + */ + MIPMAP_TEXTURES: MIPMAP_MODES.POW2, + /** + * Default anisotropic filtering level of textures. + * Usually from 0 to 16 + * @static + * @name ANISOTROPIC_LEVEL + * @memberof PIXI.settings + * @type {number} + * @default 0 + */ + ANISOTROPIC_LEVEL: 0, + /** + * Default resolution / device pixel ratio of the renderer. + * @static + * @name RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + RESOLUTION: 1, + /** + * Default filter resolution. + * @static + * @name FILTER_RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + FILTER_RESOLUTION: 1, + /** + * Default filter samples. + * @static + * @name FILTER_MULTISAMPLE + * @memberof PIXI.settings + * @type {PIXI.MSAA_QUALITY} + * @default PIXI.MSAA_QUALITY.NONE + */ + FILTER_MULTISAMPLE: MSAA_QUALITY.NONE, + /** + * The maximum textures that this device supports. + * @static + * @name SPRITE_MAX_TEXTURES + * @memberof PIXI.settings + * @type {number} + * @default 32 + */ + SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** + * The default sprite batch size. + * + * The default aims to balance desktop and mobile devices. + * @static + * @name SPRITE_BATCH_SIZE + * @memberof PIXI.settings + * @type {number} + * @default 4096 + */ + SPRITE_BATCH_SIZE: 4096, + /** + * The default render options if none are supplied to {@link PIXI.Renderer} + * or {@link PIXI.CanvasRenderer}. + * @static + * @name RENDER_OPTIONS + * @memberof PIXI.settings + * @type {object} + * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias} + * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity} + * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha} + * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor} + * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender} + * @property {number} [height=600] - {@link PIXI.IRendererOptions.height} + * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer} + * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha} + * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view} + * @property {number} [width=800] - {@link PIXI.IRendererOptions.width} + */ + RENDER_OPTIONS: { + view: null, + width: 800, + height: 600, + autoDensity: false, + backgroundColor: 0x000000, + backgroundAlpha: 1, + useContextAlpha: true, + clearBeforeRender: true, + antialias: false, + preserveDrawingBuffer: false, + }, + /** + * Default Garbage Collection mode. + * @static + * @name GC_MODE + * @memberof PIXI.settings + * @type {PIXI.GC_MODES} + * @default PIXI.GC_MODES.AUTO + */ + GC_MODE: GC_MODES.AUTO, + /** + * Default Garbage Collection max idle. + * @static + * @name GC_MAX_IDLE + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + /** + * Default Garbage Collection maximum check count. + * @static + * @name GC_MAX_CHECK_COUNT + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + /** + * Default wrap modes that are supported by pixi. + * @static + * @name WRAP_MODE + * @memberof PIXI.settings + * @type {PIXI.WRAP_MODES} + * @default PIXI.WRAP_MODES.CLAMP + */ + WRAP_MODE: WRAP_MODES.CLAMP, + /** + * Default scale mode for textures. + * @static + * @name SCALE_MODE + * @memberof PIXI.settings + * @type {PIXI.SCALE_MODES} + * @default PIXI.SCALE_MODES.LINEAR + */ + SCALE_MODE: SCALE_MODES.LINEAR, + /** + * Default specify float precision in vertex shader. + * @static + * @name PRECISION_VERTEX + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.HIGH + */ + PRECISION_VERTEX: PRECISION.HIGH, + /** + * Default specify float precision in fragment shader. + * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 + * @static + * @name PRECISION_FRAGMENT + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.MEDIUM + */ + PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM, + /** + * Can we upload the same buffer in a single frame? + * @static + * @name CAN_UPLOAD_SAME_BUFFER + * @memberof PIXI.settings + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + /** + * Enables bitmap creation before image load. This feature is experimental. + * @static + * @name CREATE_IMAGE_BITMAP + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + CREATE_IMAGE_BITMAP: false, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * @static + * @constant + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + ROUND_PIXELS: false, +}; + +export { BrowserAdapter, isMobile, settings }; +//# sourceMappingURL=settings.mjs.map diff --git a/live2d/node_modules/@pixi/settings/dist/esm/settings.mjs.map b/live2d/node_modules/@pixi/settings/dist/esm/settings.mjs.map new file mode 100644 index 0000000..cdad157 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/dist/esm/settings.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.mjs","sources":["../../src/adapter.ts","../../../../node_modules/ismobilejs/esm/isMobile.js","../../src/utils/isMobile.ts","../../src/utils/canUploadSameBuffer.ts","../../src/utils/maxRecommendedTextures.ts","../../src/settings.ts"],"sourcesContent":["export type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2';\n\n/**\n * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase\n * Implementations of this interface can be used to make sure Pixi will work in any environment\n * such as browser, web workers, and node\n */\nexport interface IAdapter\n{\n /** Returns a canvas object that can be used to create a webgl context. */\n createCanvas: (width?: number, height?: number) => HTMLCanvasElement;\n /** Returns a webgl rendering context. */\n getWebGLRenderingContext: () => typeof WebGLRenderingContext;\n /** Returns a partial implementation of the browsers window.navigator */\n getNavigator: () => { userAgent: string };\n /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */\n getBaseUrl: () => string;\n fetch: (url: RequestInfo, options?: RequestInit) => Promise;\n}\n\nexport const BrowserAdapter = {\n /**\n * Creates a canvas element of the given size.\n * This canvas is created using the browser's native canvas element.\n * @param width - width of the canvas\n * @param height - height of the canvas\n */\n createCanvas: (width: number, height: number): HTMLCanvasElement =>\n {\n const canvas = document.createElement('canvas');\n\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n },\n getWebGLRenderingContext: () => WebGLRenderingContext,\n getNavigator: () => navigator,\n getBaseUrl: () => (document.baseURI ?? window.location.href),\n fetch: (url: RequestInfo, options?: RequestInit) => fetch(url, options),\n} as IAdapter;\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","import isMobileCall from 'ismobilejs';\n\ntype isMobileResult = {\n apple: {\n phone: boolean;\n ipod: boolean;\n tablet: boolean;\n universal: boolean;\n device: boolean;\n };\n amazon: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n android: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n windows: {\n phone: boolean;\n tablet: boolean;\n device: boolean;\n };\n other: {\n blackberry: boolean;\n blackberry10: boolean;\n opera: boolean;\n firefox: boolean;\n chrome: boolean;\n device: boolean;\n };\n phone: boolean;\n tablet: boolean;\n any: boolean;\n};\n\nexport const isMobile: isMobileResult = isMobileCall(globalThis.navigator);\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n * @private\n * @returns {boolean} `true` if the same buffer may be uploaded more than once.\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n * @private\n * @param {number} max\n * @returns {number} The maximum recommended texture units to use.\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import type { ENV } from '@pixi/constants';\nimport { GC_MODES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, SCALE_MODES, WRAP_MODES } from '@pixi/constants';\nimport type { IAdapter } from './adapter';\nimport { BrowserAdapter } from './adapter';\nimport { canUploadSameBuffer } from './utils/canUploadSameBuffer';\nimport { isMobile } from './utils/isMobile';\nimport { maxRecommendedTextures } from './utils/maxRecommendedTextures';\n\nexport interface IRenderOptions\n{\n view: HTMLCanvasElement;\n width: number;\n height: number;\n autoDensity: boolean;\n backgroundColor: number;\n backgroundAlpha: number;\n useContextAlpha: boolean | 'notMultiplied';\n clearBeforeRender: boolean;\n antialias: boolean;\n preserveDrawingBuffer: boolean;\n}\n\nexport interface ISettings\n{\n ADAPTER: IAdapter;\n MIPMAP_TEXTURES: MIPMAP_MODES;\n ANISOTROPIC_LEVEL: number;\n RESOLUTION: number;\n FILTER_RESOLUTION: number;\n FILTER_MULTISAMPLE: MSAA_QUALITY;\n SPRITE_MAX_TEXTURES: number;\n SPRITE_BATCH_SIZE: number;\n RENDER_OPTIONS: IRenderOptions;\n GC_MODE: GC_MODES;\n GC_MAX_IDLE: number;\n GC_MAX_CHECK_COUNT: number;\n WRAP_MODE: WRAP_MODES;\n SCALE_MODE: SCALE_MODES;\n PRECISION_VERTEX: PRECISION;\n PRECISION_FRAGMENT: PRECISION;\n CAN_UPLOAD_SAME_BUFFER: boolean;\n CREATE_IMAGE_BITMAP: boolean;\n ROUND_PIXELS: boolean;\n RETINA_PREFIX?: RegExp;\n FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean;\n UPLOADS_PER_FRAME?: number;\n SORTABLE_CHILDREN?: boolean;\n PREFER_ENV?: ENV;\n STRICT_TEXTURE_CACHE?: boolean;\n MESH_CANVAS_PADDING?: number;\n TARGET_FPMS?: number;\n}\n\n/**\n * User's customizable globals for overriding the default PIXI settings, such\n * as a renderer's default resolution, framerate, float precision, etc.\n * @example\n * // Use the native window resolution as the default resolution\n * // will support high-density displays when rendering\n * PIXI.settings.RESOLUTION = window.devicePixelRatio;\n *\n * // Disable interpolation when scaling, will make texture be pixelated\n * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;\n * @namespace PIXI.settings\n */\nexport const settings: ISettings = {\n\n /**\n * This adapter is used to call methods that are platform dependent.\n * For example `document.createElement` only runs on the web but fails in node environments.\n * This allows us to support more platforms by abstracting away specific implementations per platform.\n *\n * By default the adapter is set to work in the browser. However you can create your own\n * by implementing the `IAdapter` interface. See `IAdapter` for more information.\n * @name ADAPTER\n * @memberof PIXI.settings\n * @type {PIXI.IAdapter}\n * @default PIXI.BrowserAdapter\n */\n ADAPTER: BrowserAdapter,\n /**\n * If set to true WebGL will attempt make textures mimpaped by default.\n * Mipmapping will only succeed if the base texture uploaded has power of two dimensions.\n * @static\n * @name MIPMAP_TEXTURES\n * @memberof PIXI.settings\n * @type {PIXI.MIPMAP_MODES}\n * @default PIXI.MIPMAP_MODES.POW2\n */\n MIPMAP_TEXTURES: MIPMAP_MODES.POW2,\n\n /**\n * Default anisotropic filtering level of textures.\n * Usually from 0 to 16\n * @static\n * @name ANISOTROPIC_LEVEL\n * @memberof PIXI.settings\n * @type {number}\n * @default 0\n */\n ANISOTROPIC_LEVEL: 0,\n\n /**\n * Default resolution / device pixel ratio of the renderer.\n * @static\n * @name RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n RESOLUTION: 1,\n\n /**\n * Default filter resolution.\n * @static\n * @name FILTER_RESOLUTION\n * @memberof PIXI.settings\n * @type {number}\n * @default 1\n */\n FILTER_RESOLUTION: 1,\n\n /**\n * Default filter samples.\n * @static\n * @name FILTER_MULTISAMPLE\n * @memberof PIXI.settings\n * @type {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n FILTER_MULTISAMPLE: MSAA_QUALITY.NONE,\n\n /**\n * The maximum textures that this device supports.\n * @static\n * @name SPRITE_MAX_TEXTURES\n * @memberof PIXI.settings\n * @type {number}\n * @default 32\n */\n SPRITE_MAX_TEXTURES: maxRecommendedTextures(32),\n\n // TODO: maybe change to SPRITE.BATCH_SIZE: 2000\n // TODO: maybe add PARTICLE.BATCH_SIZE: 15000\n\n /**\n * The default sprite batch size.\n *\n * The default aims to balance desktop and mobile devices.\n * @static\n * @name SPRITE_BATCH_SIZE\n * @memberof PIXI.settings\n * @type {number}\n * @default 4096\n */\n SPRITE_BATCH_SIZE: 4096,\n\n /**\n * The default render options if none are supplied to {@link PIXI.Renderer}\n * or {@link PIXI.CanvasRenderer}.\n * @static\n * @name RENDER_OPTIONS\n * @memberof PIXI.settings\n * @type {object}\n * @property {boolean} [antialias=false] - {@link PIXI.IRendererOptions.antialias}\n * @property {boolean} [autoDensity=false] - {@link PIXI.IRendererOptions.autoDensity}\n * @property {number} [backgroundAlpha=1] - {@link PIXI.IRendererOptions.backgroundAlpha}\n * @property {number} [backgroundColor=0x000000] - {@link PIXI.IRendererOptions.backgroundColor}\n * @property {boolean} [clearBeforeRender=true] - {@link PIXI.IRendererOptions.clearBeforeRender}\n * @property {number} [height=600] - {@link PIXI.IRendererOptions.height}\n * @property {boolean} [preserveDrawingBuffer=false] - {@link PIXI.IRendererOptions.preserveDrawingBuffer}\n * @property {boolean|'notMultiplied'} [useContextAlpha=true] - {@link PIXI.IRendererOptions.useContextAlpha}\n * @property {HTMLCanvasElement} [view=null] - {@link PIXI.IRendererOptions.view}\n * @property {number} [width=800] - {@link PIXI.IRendererOptions.width}\n */\n RENDER_OPTIONS: {\n view: null,\n width: 800,\n height: 600,\n autoDensity: false,\n backgroundColor: 0x000000,\n backgroundAlpha: 1,\n useContextAlpha: true,\n clearBeforeRender: true,\n antialias: false,\n preserveDrawingBuffer: false,\n },\n\n /**\n * Default Garbage Collection mode.\n * @static\n * @name GC_MODE\n * @memberof PIXI.settings\n * @type {PIXI.GC_MODES}\n * @default PIXI.GC_MODES.AUTO\n */\n GC_MODE: GC_MODES.AUTO,\n\n /**\n * Default Garbage Collection max idle.\n * @static\n * @name GC_MAX_IDLE\n * @memberof PIXI.settings\n * @type {number}\n * @default 3600\n */\n GC_MAX_IDLE: 60 * 60,\n\n /**\n * Default Garbage Collection maximum check count.\n * @static\n * @name GC_MAX_CHECK_COUNT\n * @memberof PIXI.settings\n * @type {number}\n * @default 600\n */\n GC_MAX_CHECK_COUNT: 60 * 10,\n\n /**\n * Default wrap modes that are supported by pixi.\n * @static\n * @name WRAP_MODE\n * @memberof PIXI.settings\n * @type {PIXI.WRAP_MODES}\n * @default PIXI.WRAP_MODES.CLAMP\n */\n WRAP_MODE: WRAP_MODES.CLAMP,\n\n /**\n * Default scale mode for textures.\n * @static\n * @name SCALE_MODE\n * @memberof PIXI.settings\n * @type {PIXI.SCALE_MODES}\n * @default PIXI.SCALE_MODES.LINEAR\n */\n SCALE_MODE: SCALE_MODES.LINEAR,\n\n /**\n * Default specify float precision in vertex shader.\n * @static\n * @name PRECISION_VERTEX\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.HIGH\n */\n PRECISION_VERTEX: PRECISION.HIGH,\n\n /**\n * Default specify float precision in fragment shader.\n * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742\n * @static\n * @name PRECISION_FRAGMENT\n * @memberof PIXI.settings\n * @type {PIXI.PRECISION}\n * @default PIXI.PRECISION.MEDIUM\n */\n PRECISION_FRAGMENT: isMobile.apple.device ? PRECISION.HIGH : PRECISION.MEDIUM,\n\n /**\n * Can we upload the same buffer in a single frame?\n * @static\n * @name CAN_UPLOAD_SAME_BUFFER\n * @memberof PIXI.settings\n * @type {boolean}\n */\n CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(),\n\n /**\n * Enables bitmap creation before image load. This feature is experimental.\n * @static\n * @name CREATE_IMAGE_BITMAP\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n CREATE_IMAGE_BITMAP: false,\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * @static\n * @constant\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\n ROUND_PIXELS: false,\n};\n"],"names":["isMobile","isMobileCall"],"mappings":";;;;;;;;;AAoBO,IAAM,cAAc,GAAG;AAC1B;;;;;AAKG;AACH,IAAA,YAAY,EAAE,UAAC,KAAa,EAAE,MAAc,EAAA;QAExC,IAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAEhD,QAAA,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACrB,QAAA,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;AAEvB,QAAA,OAAO,MAAM,CAAC;KACjB;AACD,IAAA,wBAAwB,EAAE,YAAA,EAAM,OAAA,qBAAqB,GAAA;AACrD,IAAA,YAAY,EAAE,YAAA,EAA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AAG;AACV,QAAA,MAAM,EAAE,GAAG;AACX,QAAA,WAAW,EAAE,KAAK;AAClB,QAAA,eAAe,EAAE,QAAQ;AACzB,QAAA,eAAe,EAAE,CAAC;AAClB,QAAA,eAAe,EAAE,IAAI;AACrB,QAAA,iBAAiB,EAAE,IAAI;AACvB,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,qBAAqB,EAAE,KAAK;AAC/B,KAAA;AAED;;;;;;;AAOG;IACH,OAAO,EAAE,QAAQ,CAAC,IAAI;AAEtB;;;;;;;AAOG;IACH,WAAW,EAAE,EAAE,GAAG,EAAE;AAEpB;;;;;;;AAOG;IACH,kBAAkB,EAAE,EAAE,GAAG,EAAE;AAE3B;;;;;;;AAOG;IACH,SAAS,EAAE,UAAU,CAAC,KAAK;AAE3B;;;;;;;AAOG;IACH,UAAU,EAAE,WAAW,CAAC,MAAM;AAE9B;;;;;;;AAOG;IACH,gBAAgB,EAAE,SAAS,CAAC,IAAI;AAEhC;;;;;;;;AAQG;AACH,IAAA,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM;AAE7E;;;;;;AAMG;IACH,sBAAsB,EAAE,mBAAmB,EAAE;AAE7C;;;;;;;AAOG;AACH,IAAA,mBAAmB,EAAE,KAAK;AAE1B;;;;;;;;;AASG;AACH,IAAA,YAAY,EAAE,KAAK;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/settings/index.d.ts b/live2d/node_modules/@pixi/settings/index.d.ts new file mode 100644 index 0000000..c0b47a2 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/index.d.ts @@ -0,0 +1,127 @@ +import type { ENV } from '@pixi/constants'; +import { GC_MODES } from '@pixi/constants'; +import { MIPMAP_MODES } from '@pixi/constants'; +import { MSAA_QUALITY } from '@pixi/constants'; +import { PRECISION } from '@pixi/constants'; +import { SCALE_MODES } from '@pixi/constants'; +import { WRAP_MODES } from '@pixi/constants'; + +export declare const BrowserAdapter: IAdapter; + +export declare type ContextIds = '2d' | 'webgl' | 'experimental-webgl' | 'webgl2'; + +/** + * This interface describes all the DOM dependent calls that Pixi makes throughout its codebase + * Implementations of this interface can be used to make sure Pixi will work in any environment + * such as browser, web workers, and node + */ +export declare interface IAdapter { + /** Returns a canvas object that can be used to create a webgl context. */ + createCanvas: (width?: number, height?: number) => HTMLCanvasElement; + /** Returns a webgl rendering context. */ + getWebGLRenderingContext: () => typeof WebGLRenderingContext; + /** Returns a partial implementation of the browsers window.navigator */ + getNavigator: () => { + userAgent: string; + }; + /** Returns the current base URL For browser environments this is either the document.baseURI or window.location.href */ + getBaseUrl: () => string; + fetch: (url: RequestInfo, options?: RequestInit) => Promise; +} + +export declare interface IRenderOptions { + view: HTMLCanvasElement; + width: number; + height: number; + autoDensity: boolean; + backgroundColor: number; + backgroundAlpha: number; + useContextAlpha: boolean | 'notMultiplied'; + clearBeforeRender: boolean; + antialias: boolean; + preserveDrawingBuffer: boolean; +} + +export declare interface ISettings { + ADAPTER: IAdapter; + MIPMAP_TEXTURES: MIPMAP_MODES; + ANISOTROPIC_LEVEL: number; + RESOLUTION: number; + FILTER_RESOLUTION: number; + FILTER_MULTISAMPLE: MSAA_QUALITY; + SPRITE_MAX_TEXTURES: number; + SPRITE_BATCH_SIZE: number; + RENDER_OPTIONS: IRenderOptions; + GC_MODE: GC_MODES; + GC_MAX_IDLE: number; + GC_MAX_CHECK_COUNT: number; + WRAP_MODE: WRAP_MODES; + SCALE_MODE: SCALE_MODES; + PRECISION_VERTEX: PRECISION; + PRECISION_FRAGMENT: PRECISION; + CAN_UPLOAD_SAME_BUFFER: boolean; + CREATE_IMAGE_BITMAP: boolean; + ROUND_PIXELS: boolean; + RETINA_PREFIX?: RegExp; + FAIL_IF_MAJOR_PERFORMANCE_CAVEAT?: boolean; + UPLOADS_PER_FRAME?: number; + SORTABLE_CHILDREN?: boolean; + PREFER_ENV?: ENV; + STRICT_TEXTURE_CACHE?: boolean; + MESH_CANVAS_PADDING?: number; + TARGET_FPMS?: number; +} + +export declare const isMobile: isMobileResult; + +declare type isMobileResult = { + apple: { + phone: boolean; + ipod: boolean; + tablet: boolean; + universal: boolean; + device: boolean; + }; + amazon: { + phone: boolean; + tablet: boolean; + device: boolean; + }; + android: { + phone: boolean; + tablet: boolean; + device: boolean; + }; + windows: { + phone: boolean; + tablet: boolean; + device: boolean; + }; + other: { + blackberry: boolean; + blackberry10: boolean; + opera: boolean; + firefox: boolean; + chrome: boolean; + device: boolean; + }; + phone: boolean; + tablet: boolean; + any: boolean; +}; + +/** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float precision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio; + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ +export declare const settings: ISettings; + +export { } diff --git a/live2d/node_modules/@pixi/settings/package.json b/live2d/node_modules/@pixi/settings/package.json new file mode 100644 index 0000000..93c6907 --- /dev/null +++ b/live2d/node_modules/@pixi/settings/package.json @@ -0,0 +1,47 @@ +{ + "name": "@pixi/settings", + "version": "6.5.10", + "main": "dist/cjs/settings.js", + "module": "dist/esm/settings.mjs", + "bundle": "dist/browser/settings.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/settings.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/settings.js" + } + } + }, + "description": "Collecting of user configurable settings used throughout PixiJS", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "peerDependencies": { + "@pixi/constants": "6.5.10" + }, + "devDependencies": { + "ismobilejs": "^1.1.0" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/sprite/LICENSE b/live2d/node_modules/@pixi/sprite/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/sprite/README.md b/live2d/node_modules/@pixi/sprite/README.md new file mode 100644 index 0000000..1972ceb --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/README.md @@ -0,0 +1,15 @@ +# @pixi/sprite + +## Installation + +```bash +npm install @pixi/sprite +``` + +## Usage + +```js +import { Sprite } from '@pixi/sprite'; + +const sprite = new Sprite(); +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js new file mode 100644 index 0000000..69b55d0 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js @@ -0,0 +1,654 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_sprite = (function (exports, constants, core, display, math, settings, utils) { + '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 __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + 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 __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + 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 __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __createBinding(o, m, k, k2) { + if (k2 === undefined) { k2 = k; } + o[k2] = m[k]; + } + + function __exportStar(m, exports) { + for (var p in m) { if (p !== "default" && !exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + 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."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __spreadArrays() { + var arguments$1 = arguments; + + for (var s = 0, i = 0, il = arguments.length; i < il; i++) { s += arguments$1[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 __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + + function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); + } + + function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; + } + + var tempPoint = new math.Point(); + var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); + /** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = PIXI.Sprite.from('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * @memberof PIXI + */ + var Sprite = /** @class */ (function (_super) { + __extends(Sprite, _super); + /** @param texture - The texture for this sprite. */ + function Sprite(texture) { + var _this = _super.call(this) || this; + _this._anchor = new math.ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); + _this._texture = null; + _this._width = 0; + _this._height = 0; + _this._tint = null; + _this._tintRGB = null; + _this.tint = 0xFFFFFF; + _this.blendMode = constants.BLEND_MODES.NORMAL; + _this._cachedTint = 0xFFFFFF; + _this.uvs = null; + // call texture setter + _this.texture = texture || core.Texture.EMPTY; + _this.vertexData = new Float32Array(8); + _this.vertexTrimmedData = null; + _this._transformID = -1; + _this._textureID = -1; + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; + // Batchable stuff.. + // TODO could make this a mixin? + _this.indices = indices; + _this.pluginName = 'batch'; + /** + * Used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + _this.isSprite = true; + _this._roundPixels = settings.settings.ROUND_PIXELS; + return _this; + } + /** When the texture is updated, this event will fire to update the scale and frame. */ + Sprite.prototype._onTextureUpdate = function () { + this._textureID = -1; + this._textureTrimmedID = -1; + this._cachedTint = 0xFFFFFF; + // so if _width is 0 then width was not set.. + if (this._width) { + this.scale.x = utils.sign(this.scale.x) * this._width / this._texture.orig.width; + } + if (this._height) { + this.scale.y = utils.sign(this.scale.y) * this._height / this._texture.orig.height; + } + }; + /** Called when the anchor position updates. */ + Sprite.prototype._onAnchorUpdate = function () { + this._transformID = -1; + this._transformTrimmedID = -1; + }; + /** Calculates worldTransform * vertices, store it in vertexData. */ + Sprite.prototype.calculateVertices = function () { + var texture = this._texture; + if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { + return; + } + // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` + if (this._textureID !== texture._updateID) { + this.uvs = this._texture._uvs.uvsFloat32; + } + this._transformID = this.transform._worldID; + this._textureID = texture._updateID; + // set the vertex data + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + var trim = texture.trim; + var orig = texture.orig; + var anchor = this._anchor; + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the extra + // space before transforming the sprite coords. + w1 = trim.x - (anchor._x * orig.width); + w0 = w1 + trim.width; + h1 = trim.y - (anchor._y * orig.height); + h0 = h1 + trim.height; + } + else { + w1 = -anchor._x * orig.width; + w0 = w1 + orig.width; + h1 = -anchor._y * orig.height; + h0 = h1 + orig.height; + } + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + if (this._roundPixels) { + var resolution = settings.settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + }; + /** + * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData. + * + * This is used to ensure that the true width and height of a trimmed texture is respected. + */ + Sprite.prototype.calculateTrimmedVertices = function () { + if (!this.vertexTrimmedData) { + this.vertexTrimmedData = new Float32Array(8); + } + else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { + return; + } + this._transformTrimmedID = this.transform._worldID; + this._textureTrimmedID = this._texture._updateID; + // lets do some special trim code! + var texture = this._texture; + var vertexData = this.vertexTrimmedData; + var orig = texture.orig; + var anchor = this._anchor; + // lets calculate the new untrimmed bounds.. + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var w1 = -anchor._x * orig.width; + var w0 = w1 + orig.width; + var h1 = -anchor._y * orig.height; + var h0 = h1 + orig.height; + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + }; + /** + * + * Renders the object using the WebGL renderer + * @param renderer - The webgl renderer to use. + */ + Sprite.prototype._render = function (renderer) { + this.calculateVertices(); + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + /** Updates the bounds of the sprite. */ + Sprite.prototype._calculateBounds = function () { + var trim = this._texture.trim; + var orig = this._texture.orig; + // First lets check to see if the current texture has a trim.. + if (!trim || (trim.width === orig.width && trim.height === orig.height)) { + // no trim! lets use the usual calculations.. + this.calculateVertices(); + this._bounds.addQuad(this.vertexData); + } + else { + // lets calculate a special trimmed bounds... + this.calculateTrimmedVertices(); + this._bounds.addQuad(this.vertexTrimmedData); + } + }; + /** + * Gets the local bounds of the sprite object. + * @param rect - Optional output rectangle. + * @returns The bounds. + */ + Sprite.prototype.getLocalBounds = function (rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + if (!this._localBounds) { + this._localBounds = new display.Bounds(); + } + this._localBounds.minX = this._texture.orig.width * -this._anchor._x; + this._localBounds.minY = this._texture.orig.height * -this._anchor._y; + this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x); + this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y); + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new math.Rectangle(); + } + rect = this._localBoundsRect; + } + return this._localBounds.getRectangle(rect); + } + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * Tests if a point is inside this sprite + * @param point - the point to test + * @returns The result of the test + */ + Sprite.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, tempPoint); + var width = this._texture.orig.width; + var height = this._texture.orig.height; + var x1 = -width * this.anchor.x; + var y1 = 0; + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + y1 = -height * this.anchor.y; + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + return false; + }; + /** + * Destroys this sprite and optionally its texture and children. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + Sprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this._texture.off('update', this._onTextureUpdate, this); + this._anchor = null; + var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; + if (destroyTexture) { + var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; + this._texture.destroy(!!destroyBaseTexture); + } + this._texture = null; + }; + // some helper functions.. + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns The newly created sprite + */ + Sprite.from = function (source, options) { + var texture = (source instanceof core.Texture) + ? source + : core.Texture.from(source, options); + return new Sprite(texture); + }; + Object.defineProperty(Sprite.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}. + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "width", { + /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + var s = utils.sign(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "height", { + /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + var s = utils.sign(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "anchor", { + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + */ + get: function () { + return this._anchor; + }, + set: function (value) { + this._anchor.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "tint", { + /** + * The tint applied to the sprite. This is a hex value. + * + * A value of 0xFFFFFF will remove any tint effect. + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "texture", { + /** The texture that the sprite is using. */ + get: function () { + return this._texture; + }, + set: function (value) { + if (this._texture === value) { + return; + } + if (this._texture) { + this._texture.off('update', this._onTextureUpdate, this); + } + this._texture = value || core.Texture.EMPTY; + this._cachedTint = 0xFFFFFF; + this._textureID = -1; + this._textureTrimmedID = -1; + if (value) { + // wait for the texture to load + if (value.baseTexture.valid) { + this._onTextureUpdate(); + } + else { + value.once('update', this._onTextureUpdate, this); + } + } + }, + enumerable: false, + configurable: true + }); + return Sprite; + }(display.Container)); + + exports.Sprite = Sprite; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI, PIXI, PIXI, PIXI, PIXI.utils); +Object.assign(this.PIXI, _pixi_sprite); +//# sourceMappingURL=sprite.js.map diff --git a/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js.map b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js.map new file mode 100644 index 0000000..94d05ac --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":["arguments","Point","ObservablePoint","BLEND_MODES","Texture","settings","sign","Bounds","Rectangle","Container"],"mappings":";;;;;;;;;;;IAAA;IACA;AACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;IACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAA,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAA,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA,EAAA,EAAC,EAAE,CAAC;IACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC;AACF;IACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;IAChC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,IAAI,SAAS,EAAE,GAAG,EA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/sprite/dist/browser/sprite.min.js new file mode 100644 index 0000000..01f7c71 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_sprite=function(t,e,i,r,s,n,o){"use strict";var h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},h(t,e)};var a=new s.Point,u=new Uint16Array([0,1,2,0,2,3]),_=function(t){function _(r){var o=t.call(this)||this;return o._anchor=new s.ObservablePoint(o._onAnchorUpdate,o,r?r.defaultAnchor.x:0,r?r.defaultAnchor.y:0),o._texture=null,o._width=0,o._height=0,o._tint=null,o._tintRGB=null,o.tint=16777215,o.blendMode=e.BLEND_MODES.NORMAL,o._cachedTint=16777215,o.uvs=null,o.texture=r||i.Texture.EMPTY,o.vertexData=new Float32Array(8),o.vertexTrimmedData=null,o._transformID=-1,o._textureID=-1,o._transformTrimmedID=-1,o._textureTrimmedID=-1,o.indices=u,o.pluginName="batch",o.isSprite=!0,o._roundPixels=n.settings.ROUND_PIXELS,o}return function(t,e){function i(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(_,t),_.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=o.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=o.sign(this.scale.y)*this._height/this._texture.orig.height)},_.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},_.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,o=e.d,h=e.tx,a=e.ty,u=this.vertexData,_=t.trim,c=t.orig,l=this._anchor,d=0,x=0,p=0,f=0;if(_?(d=(x=_.x-l._x*c.width)+_.width,p=(f=_.y-l._y*c.height)+_.height):(d=(x=-l._x*c.width)+c.width,p=(f=-l._y*c.height)+c.height),u[0]=i*x+s*f+h,u[1]=o*f+r*x+a,u[2]=i*d+s*f+h,u[3]=o*f+r*d+a,u[4]=i*d+s*p+h,u[5]=o*p+r*d+a,u[6]=i*x+s*p+h,u[7]=o*p+r*x+a,this._roundPixels)for(var m=n.settings.RESOLUTION,g=0;g=r&&a.x=s&&a.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||i.Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),_}(r.Container);return t.Sprite=_,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_sprite); +//# sourceMappingURL=sprite.min.js.map diff --git a/live2d/node_modules/@pixi/sprite/dist/browser/sprite.min.js.map b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.min.js.map new file mode 100644 index 0000000..96358ce --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/browser/sprite.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.min.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","tempPoint","Point","indices","Uint16Array","Sprite","_super","texture","_this","this","_anchor","ObservablePoint","_onAnchorUpdate","defaultAnchor","x","y","_texture","_width","_height","_tint","_tintRGB","tint","blendMode","BLEND_MODES","NORMAL","_cachedTint","uvs","Texture","EMPTY","vertexData","Float32Array","vertexTrimmedData","_transformID","_textureID","_transformTrimmedID","_textureTrimmedID","pluginName","isSprite","_roundPixels","settings","ROUND_PIXELS","__","constructor","prototype","create","__extends","_onTextureUpdate","scale","sign","orig","width","height","calculateVertices","transform","_worldID","_updateID","_uvs","uvsFloat32","wt","worldTransform","a","c","tx","ty","trim","anchor","w0","w1","h0","h1","_x","_y","resolution","RESOLUTION","i","length","Math","round","calculateTrimmedVertices","_render","renderer","batch","setObjectRenderer","plugins","render","_calculateBounds","_bounds","addQuad","getLocalBounds","rect","children","_localBounds","Bounds","minX","minY","maxX","maxY","_localBoundsRect","Rectangle","getRectangle","call","containsPoint","point","applyInverse","x1","y1","destroy","options","off","destroyBaseTexture","baseTexture","from","source","defineProperty","get","set","value","abs","s","copyFrom","valid","once","Container"],"mappings":";;;;;;;8EAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,KAClEP,EAAcC,EAAGC,ICT5B,IAAMO,EAAY,IAAIC,EAAAA,MAChBC,EAAU,IAAIC,YAAY,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,IA6BhDC,EAAA,SAAAC,GAuGI,SAAAD,EAAYE,GAAZ,IAAAC,EAEIF,cA4CHG,YA1CGD,EAAKE,QAAU,IAAIC,EAAeA,gBAC9BH,EAAKI,gBACLJ,EACCD,EAAUA,EAAQM,cAAcC,EAAI,EACpCP,EAAUA,EAAQM,cAAcE,EAAI,GAGzCP,EAAKQ,SAAW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/cjs/sprite.js new file mode 100644 index 0000000..edb64df --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.js @@ -0,0 +1,458 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var constants = require('@pixi/constants'); +var core = require('@pixi/core'); +var display = require('@pixi/display'); +var math = require('@pixi/math'); +var settings = require('@pixi/settings'); +var utils = require('@pixi/utils'); + +/*! ***************************************************************************** +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 __()); +} + +var tempPoint = new math.Point(); +var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); +/** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = PIXI.Sprite.from('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * @memberof PIXI + */ +var Sprite = /** @class */ (function (_super) { + __extends(Sprite, _super); + /** @param texture - The texture for this sprite. */ + function Sprite(texture) { + var _this = _super.call(this) || this; + _this._anchor = new math.ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); + _this._texture = null; + _this._width = 0; + _this._height = 0; + _this._tint = null; + _this._tintRGB = null; + _this.tint = 0xFFFFFF; + _this.blendMode = constants.BLEND_MODES.NORMAL; + _this._cachedTint = 0xFFFFFF; + _this.uvs = null; + // call texture setter + _this.texture = texture || core.Texture.EMPTY; + _this.vertexData = new Float32Array(8); + _this.vertexTrimmedData = null; + _this._transformID = -1; + _this._textureID = -1; + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; + // Batchable stuff.. + // TODO could make this a mixin? + _this.indices = indices; + _this.pluginName = 'batch'; + /** + * Used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + _this.isSprite = true; + _this._roundPixels = settings.settings.ROUND_PIXELS; + return _this; + } + /** When the texture is updated, this event will fire to update the scale and frame. */ + Sprite.prototype._onTextureUpdate = function () { + this._textureID = -1; + this._textureTrimmedID = -1; + this._cachedTint = 0xFFFFFF; + // so if _width is 0 then width was not set.. + if (this._width) { + this.scale.x = utils.sign(this.scale.x) * this._width / this._texture.orig.width; + } + if (this._height) { + this.scale.y = utils.sign(this.scale.y) * this._height / this._texture.orig.height; + } + }; + /** Called when the anchor position updates. */ + Sprite.prototype._onAnchorUpdate = function () { + this._transformID = -1; + this._transformTrimmedID = -1; + }; + /** Calculates worldTransform * vertices, store it in vertexData. */ + Sprite.prototype.calculateVertices = function () { + var texture = this._texture; + if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { + return; + } + // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` + if (this._textureID !== texture._updateID) { + this.uvs = this._texture._uvs.uvsFloat32; + } + this._transformID = this.transform._worldID; + this._textureID = texture._updateID; + // set the vertex data + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + var trim = texture.trim; + var orig = texture.orig; + var anchor = this._anchor; + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the extra + // space before transforming the sprite coords. + w1 = trim.x - (anchor._x * orig.width); + w0 = w1 + trim.width; + h1 = trim.y - (anchor._y * orig.height); + h0 = h1 + trim.height; + } + else { + w1 = -anchor._x * orig.width; + w0 = w1 + orig.width; + h1 = -anchor._y * orig.height; + h0 = h1 + orig.height; + } + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + if (this._roundPixels) { + var resolution = settings.settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + }; + /** + * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData. + * + * This is used to ensure that the true width and height of a trimmed texture is respected. + */ + Sprite.prototype.calculateTrimmedVertices = function () { + if (!this.vertexTrimmedData) { + this.vertexTrimmedData = new Float32Array(8); + } + else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { + return; + } + this._transformTrimmedID = this.transform._worldID; + this._textureTrimmedID = this._texture._updateID; + // lets do some special trim code! + var texture = this._texture; + var vertexData = this.vertexTrimmedData; + var orig = texture.orig; + var anchor = this._anchor; + // lets calculate the new untrimmed bounds.. + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var w1 = -anchor._x * orig.width; + var w0 = w1 + orig.width; + var h1 = -anchor._y * orig.height; + var h0 = h1 + orig.height; + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + }; + /** + * + * Renders the object using the WebGL renderer + * @param renderer - The webgl renderer to use. + */ + Sprite.prototype._render = function (renderer) { + this.calculateVertices(); + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + /** Updates the bounds of the sprite. */ + Sprite.prototype._calculateBounds = function () { + var trim = this._texture.trim; + var orig = this._texture.orig; + // First lets check to see if the current texture has a trim.. + if (!trim || (trim.width === orig.width && trim.height === orig.height)) { + // no trim! lets use the usual calculations.. + this.calculateVertices(); + this._bounds.addQuad(this.vertexData); + } + else { + // lets calculate a special trimmed bounds... + this.calculateTrimmedVertices(); + this._bounds.addQuad(this.vertexTrimmedData); + } + }; + /** + * Gets the local bounds of the sprite object. + * @param rect - Optional output rectangle. + * @returns The bounds. + */ + Sprite.prototype.getLocalBounds = function (rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + if (!this._localBounds) { + this._localBounds = new display.Bounds(); + } + this._localBounds.minX = this._texture.orig.width * -this._anchor._x; + this._localBounds.minY = this._texture.orig.height * -this._anchor._y; + this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x); + this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y); + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new math.Rectangle(); + } + rect = this._localBoundsRect; + } + return this._localBounds.getRectangle(rect); + } + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * Tests if a point is inside this sprite + * @param point - the point to test + * @returns The result of the test + */ + Sprite.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, tempPoint); + var width = this._texture.orig.width; + var height = this._texture.orig.height; + var x1 = -width * this.anchor.x; + var y1 = 0; + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + y1 = -height * this.anchor.y; + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + return false; + }; + /** + * Destroys this sprite and optionally its texture and children. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + Sprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this._texture.off('update', this._onTextureUpdate, this); + this._anchor = null; + var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; + if (destroyTexture) { + var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; + this._texture.destroy(!!destroyBaseTexture); + } + this._texture = null; + }; + // some helper functions.. + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns The newly created sprite + */ + Sprite.from = function (source, options) { + var texture = (source instanceof core.Texture) + ? source + : core.Texture.from(source, options); + return new Sprite(texture); + }; + Object.defineProperty(Sprite.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}. + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "width", { + /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + var s = utils.sign(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "height", { + /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + var s = utils.sign(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "anchor", { + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + */ + get: function () { + return this._anchor; + }, + set: function (value) { + this._anchor.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "tint", { + /** + * The tint applied to the sprite. This is a hex value. + * + * A value of 0xFFFFFF will remove any tint effect. + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "texture", { + /** The texture that the sprite is using. */ + get: function () { + return this._texture; + }, + set: function (value) { + if (this._texture === value) { + return; + } + if (this._texture) { + this._texture.off('update', this._onTextureUpdate, this); + } + this._texture = value || core.Texture.EMPTY; + this._cachedTint = 0xFFFFFF; + this._textureID = -1; + this._textureTrimmedID = -1; + if (value) { + // wait for the texture to load + if (value.baseTexture.valid) { + this._onTextureUpdate(); + } + else { + value.once('update', this._onTextureUpdate, this); + } + } + }, + enumerable: false, + configurable: true + }); + return Sprite; +}(display.Container)); + +exports.Sprite = Sprite; +//# sourceMappingURL=sprite.js.map diff --git a/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.js.map b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.js.map new file mode 100644 index 0000000..e7cc9bb --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":["Point","ObservablePoint","BLEND_MODES","Texture","settings","sign","Bounds","Rectangle","Container"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QA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,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACrD,iBAAA;AACJ,aAAA;SACJ;;;AAhCA,KAAA,CAAA,CAAA;IAiCL,OAAC,MAAA,CAAA;AAAD,CAhlBA,CAA4BK,iBAAS,CAglBpC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js new file mode 100644 index 0000000..fa716c4 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/constants"),e=require("@pixi/core"),i=require("@pixi/display"),r=require("@pixi/math"),s=require("@pixi/settings"),n=require("@pixi/utils"),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},o(t,e)};var h=new r.Point,u=new Uint16Array([0,1,2,0,2,3]),a=function(a){function c(i){var n=a.call(this)||this;return n._anchor=new r.ObservablePoint(n._onAnchorUpdate,n,i?i.defaultAnchor.x:0,i?i.defaultAnchor.y:0),n._texture=null,n._width=0,n._height=0,n._tint=null,n._tintRGB=null,n.tint=16777215,n.blendMode=t.BLEND_MODES.NORMAL,n._cachedTint=16777215,n.uvs=null,n.texture=i||e.Texture.EMPTY,n.vertexData=new Float32Array(8),n.vertexTrimmedData=null,n._transformID=-1,n._textureID=-1,n._transformTrimmedID=-1,n._textureTrimmedID=-1,n.indices=u,n.pluginName="batch",n.isSprite=!0,n._roundPixels=s.settings.ROUND_PIXELS,n}return function(t,e){function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(c,a),c.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=n.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=n.sign(this.scale.y)*this._height/this._texture.orig.height)},c.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},c.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,o=e.d,h=e.tx,u=e.ty,a=this.vertexData,c=t.trim,_=t.orig,l=this._anchor,d=0,x=0,p=0,f=0;if(c?(d=(x=c.x-l._x*_.width)+c.width,p=(f=c.y-l._y*_.height)+c.height):(d=(x=-l._x*_.width)+_.width,p=(f=-l._y*_.height)+_.height),a[0]=i*x+n*f+h,a[1]=o*f+r*x+u,a[2]=i*d+n*f+h,a[3]=o*f+r*d+u,a[4]=i*d+n*p+h,a[5]=o*p+r*d+u,a[6]=i*x+n*p+h,a[7]=o*p+r*x+u,this._roundPixels)for(var m=s.settings.RESOLUTION,g=0;g=r&&h.x=s&&h.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||e.Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),c}(i.Container);exports.Sprite=a; +//# sourceMappingURL=sprite.min.js.map diff --git a/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js.map b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js.map new file mode 100644 index 0000000..aa5f4eb --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/cjs/sprite.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.min.js","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","tempPoint","Point","indices","Uint16Array","Sprite","_super","texture","_this","this","_anchor","ObservablePoint","_onAnchorUpdate","defaultAnchor","x","y","_texture","_width","_height","_tint","_tintRGB","tint","blendMode","BLEND_MODES","NORMAL","_cachedTint","uvs","Texture","EMPTY","vertexData","Float32Array","vertexTrimmedData","_transformID","_textureID","_transformTrimmedID","_textureTrimmedID","pluginName","isSprite","_roundPixels","settings","ROUND_PIXELS","__","constructor","prototype","create","__extends","_onTextureUpdate","scale","sign","orig","width","height","calculateVertices","transform","_worldID","_updateID","_uvs","uvsFloat32","wt","worldTransform","a","c","tx","ty","trim","anchor","w0","w1","h0","h1","_x","_y","resolution","RESOLUTION","i","length","Math","round","calculateTrimmedVertices","_render","renderer","batch","setObjectRenderer","plugins","render","_calculateBounds","_bounds","addQuad","getLocalBounds","rect","children","_localBounds","Bounds","minX","minY","maxX","maxY","_localBoundsRect","Rectangle","getRectangle","call","containsPoint","point","applyInverse","x1","y1","destroy","options","off","destroyBaseTexture","baseTexture","from","source","defineProperty","get","set","value","abs","s","copyFrom","valid","once","Container"],"mappings":";;;;;;;qOAgBIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,KAClEP,EAAcC,EAAGC,ICT5B,IAAMO,EAAY,IAAIC,EAAAA,MAChBC,EAAU,IAAIC,YAAY,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,IA6BhDC,EAAA,S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,EAEtBiF,IAGIA,EAAMN,YAAYU,MAElB/G,KAAKqC,mBAILsE,EAAMK,KAAK,SAAUhH,KAAKqC,iBAAkBrC,yCAI3DJ,EAhlBD,CAA4BqH"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs new file mode 100644 index 0000000..13895eb --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{BLEND_MODES as t}from"@pixi/constants";import{Texture as e}from"@pixi/core";import{Bounds as i,Container as r}from"@pixi/display";import{Point as o,Rectangle as n,ObservablePoint as s}from"@pixi/math";import{settings as h}from"@pixi/settings";import{sign as a}from"@pixi/utils";var u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},u(t,e)};var c=new o,_=new Uint16Array([0,1,2,0,2,3]),l=function(r){function o(i){var o=r.call(this)||this;return o._anchor=new s(o._onAnchorUpdate,o,i?i.defaultAnchor.x:0,i?i.defaultAnchor.y:0),o._texture=null,o._width=0,o._height=0,o._tint=null,o._tintRGB=null,o.tint=16777215,o.blendMode=t.NORMAL,o._cachedTint=16777215,o.uvs=null,o.texture=i||e.EMPTY,o.vertexData=new Float32Array(8),o.vertexTrimmedData=null,o._transformID=-1,o._textureID=-1,o._transformTrimmedID=-1,o._textureTrimmedID=-1,o.indices=_,o.pluginName="batch",o.isSprite=!0,o._roundPixels=h.ROUND_PIXELS,o}return function(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(o,r),o.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=a(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=a(this.scale.y)*this._height/this._texture.orig.height)},o.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},o.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,o=e.c,n=e.d,s=e.tx,a=e.ty,u=this.vertexData,c=t.trim,_=t.orig,l=this._anchor,d=0,p=0,x=0,f=0;if(c?(d=(p=c.x-l._x*_.width)+c.width,x=(f=c.y-l._y*_.height)+c.height):(d=(p=-l._x*_.width)+_.width,x=(f=-l._y*_.height)+_.height),u[0]=i*p+o*f+s,u[1]=n*f+r*p+a,u[2]=i*d+o*f+s,u[3]=n*f+r*d+a,u[4]=i*d+o*x+s,u[5]=n*x+r*d+a,u[6]=i*p+o*x+s,u[7]=n*x+r*p+a,this._roundPixels)for(var m=h.RESOLUTION,g=0;g=r&&c.x=o&&c.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||e.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),o}(r);export{l as Sprite}; +//# sourceMappingURL=sprite.min.mjs.map diff --git a/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs.map b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs.map new file mode 100644 index 0000000..240036b --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.min.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.min.mjs","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","tempPoint","Point","indices","Uint16Array","Sprite","_super","texture","_this","this","_anchor","ObservablePoint","_onAnchorUpdate","defaultAnchor","x","y","_texture","_width","_height","_tint","_tintRGB","tint","blendMode","BLEND_MODES","NORMAL","_cachedTint","uvs","Texture","EMPTY","vertexData","Float32Array","vertexTrimmedData","_transformID","_textureID","_transformTrimmedID","_textureTrimmedID","pluginName","isSprite","_roundPixels","settings","ROUND_PIXELS","__","constructor","prototype","create","__extends","_onTextureUpdate","scale","sign","orig","width","height","calculateVertices","transform","_worldID","_updateID","_uvs","uvsFloat32","wt","worldTransform","a","c","tx","ty","trim","anchor","w0","w1","h0","h1","_x","_y","resolution","RESOLUTION","i","length","Math","round","calculateTrimmedVertices","_render","renderer","batch","setObjectRenderer","plugins","render","_calculateBounds","_bounds","addQuad","getLocalBounds","rect","children","_localBounds","Bounds","minX","minY","maxX","maxY","_localBoundsRect","Rectangle","getRectangle","call","containsPoint","point","applyInverse","x1","y1","destroy","options","off","destroyBaseTexture","baseTexture","from","source","defineProperty","get","set","value","abs","s","copyFrom","valid","once","Container"],"mappings":";;;;;;;6RAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,KAClEP,EAAcC,EAAGC,ICT5B,IAAMO,EAAY,IAAIC,EAChBC,EAAU,IAAIC,YAAY,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,IA6BhDC,EAAA,SAAAC,GAuGI,SAAAD,EAAYE,GAAZ,IAAAC,EAEIF,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node_modules/@pixi/sprite/dist/esm/sprite.mjs b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.mjs new file mode 100644 index 0000000..d8981e2 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.mjs @@ -0,0 +1,454 @@ +/*! + * @pixi/sprite - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { BLEND_MODES } from '@pixi/constants'; +import { Texture } from '@pixi/core'; +import { Bounds, Container } from '@pixi/display'; +import { Point, Rectangle, ObservablePoint } from '@pixi/math'; +import { settings } from '@pixi/settings'; +import { sign } from '@pixi/utils'; + +/*! ***************************************************************************** +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 __()); +} + +var tempPoint = new Point(); +var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); +/** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = PIXI.Sprite.from('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * @memberof PIXI + */ +var Sprite = /** @class */ (function (_super) { + __extends(Sprite, _super); + /** @param texture - The texture for this sprite. */ + function Sprite(texture) { + var _this = _super.call(this) || this; + _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); + _this._texture = null; + _this._width = 0; + _this._height = 0; + _this._tint = null; + _this._tintRGB = null; + _this.tint = 0xFFFFFF; + _this.blendMode = BLEND_MODES.NORMAL; + _this._cachedTint = 0xFFFFFF; + _this.uvs = null; + // call texture setter + _this.texture = texture || Texture.EMPTY; + _this.vertexData = new Float32Array(8); + _this.vertexTrimmedData = null; + _this._transformID = -1; + _this._textureID = -1; + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; + // Batchable stuff.. + // TODO could make this a mixin? + _this.indices = indices; + _this.pluginName = 'batch'; + /** + * Used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + _this.isSprite = true; + _this._roundPixels = settings.ROUND_PIXELS; + return _this; + } + /** When the texture is updated, this event will fire to update the scale and frame. */ + Sprite.prototype._onTextureUpdate = function () { + this._textureID = -1; + this._textureTrimmedID = -1; + this._cachedTint = 0xFFFFFF; + // so if _width is 0 then width was not set.. + if (this._width) { + this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width; + } + if (this._height) { + this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height; + } + }; + /** Called when the anchor position updates. */ + Sprite.prototype._onAnchorUpdate = function () { + this._transformID = -1; + this._transformTrimmedID = -1; + }; + /** Calculates worldTransform * vertices, store it in vertexData. */ + Sprite.prototype.calculateVertices = function () { + var texture = this._texture; + if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { + return; + } + // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` + if (this._textureID !== texture._updateID) { + this.uvs = this._texture._uvs.uvsFloat32; + } + this._transformID = this.transform._worldID; + this._textureID = texture._updateID; + // set the vertex data + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + var trim = texture.trim; + var orig = texture.orig; + var anchor = this._anchor; + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the extra + // space before transforming the sprite coords. + w1 = trim.x - (anchor._x * orig.width); + w0 = w1 + trim.width; + h1 = trim.y - (anchor._y * orig.height); + h0 = h1 + trim.height; + } + else { + w1 = -anchor._x * orig.width; + w0 = w1 + orig.width; + h1 = -anchor._y * orig.height; + h0 = h1 + orig.height; + } + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + if (this._roundPixels) { + var resolution = settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + }; + /** + * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData. + * + * This is used to ensure that the true width and height of a trimmed texture is respected. + */ + Sprite.prototype.calculateTrimmedVertices = function () { + if (!this.vertexTrimmedData) { + this.vertexTrimmedData = new Float32Array(8); + } + else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { + return; + } + this._transformTrimmedID = this.transform._worldID; + this._textureTrimmedID = this._texture._updateID; + // lets do some special trim code! + var texture = this._texture; + var vertexData = this.vertexTrimmedData; + var orig = texture.orig; + var anchor = this._anchor; + // lets calculate the new untrimmed bounds.. + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var w1 = -anchor._x * orig.width; + var w0 = w1 + orig.width; + var h1 = -anchor._y * orig.height; + var h0 = h1 + orig.height; + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + }; + /** + * + * Renders the object using the WebGL renderer + * @param renderer - The webgl renderer to use. + */ + Sprite.prototype._render = function (renderer) { + this.calculateVertices(); + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + /** Updates the bounds of the sprite. */ + Sprite.prototype._calculateBounds = function () { + var trim = this._texture.trim; + var orig = this._texture.orig; + // First lets check to see if the current texture has a trim.. + if (!trim || (trim.width === orig.width && trim.height === orig.height)) { + // no trim! lets use the usual calculations.. + this.calculateVertices(); + this._bounds.addQuad(this.vertexData); + } + else { + // lets calculate a special trimmed bounds... + this.calculateTrimmedVertices(); + this._bounds.addQuad(this.vertexTrimmedData); + } + }; + /** + * Gets the local bounds of the sprite object. + * @param rect - Optional output rectangle. + * @returns The bounds. + */ + Sprite.prototype.getLocalBounds = function (rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + this._localBounds.minX = this._texture.orig.width * -this._anchor._x; + this._localBounds.minY = this._texture.orig.height * -this._anchor._y; + this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x); + this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y); + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new Rectangle(); + } + rect = this._localBoundsRect; + } + return this._localBounds.getRectangle(rect); + } + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * Tests if a point is inside this sprite + * @param point - the point to test + * @returns The result of the test + */ + Sprite.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, tempPoint); + var width = this._texture.orig.width; + var height = this._texture.orig.height; + var x1 = -width * this.anchor.x; + var y1 = 0; + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + y1 = -height * this.anchor.y; + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + return false; + }; + /** + * Destroys this sprite and optionally its texture and children. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + Sprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this._texture.off('update', this._onTextureUpdate, this); + this._anchor = null; + var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; + if (destroyTexture) { + var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; + this._texture.destroy(!!destroyBaseTexture); + } + this._texture = null; + }; + // some helper functions.. + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns The newly created sprite + */ + Sprite.from = function (source, options) { + var texture = (source instanceof Texture) + ? source + : Texture.from(source, options); + return new Sprite(texture); + }; + Object.defineProperty(Sprite.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}. + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "width", { + /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + var s = sign(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "height", { + /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */ + get: function () { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + var s = sign(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "anchor", { + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + */ + get: function () { + return this._anchor; + }, + set: function (value) { + this._anchor.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "tint", { + /** + * The tint applied to the sprite. This is a hex value. + * + * A value of 0xFFFFFF will remove any tint effect. + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "texture", { + /** The texture that the sprite is using. */ + get: function () { + return this._texture; + }, + set: function (value) { + if (this._texture === value) { + return; + } + if (this._texture) { + this._texture.off('update', this._onTextureUpdate, this); + } + this._texture = value || Texture.EMPTY; + this._cachedTint = 0xFFFFFF; + this._textureID = -1; + this._textureTrimmedID = -1; + if (value) { + // wait for the texture to load + if (value.baseTexture.valid) { + this._onTextureUpdate(); + } + else { + value.once('update', this._onTextureUpdate, this); + } + } + }, + enumerable: false, + configurable: true + }); + return Sprite; +}(Container)); + +export { Sprite }; +//# sourceMappingURL=sprite.mjs.map diff --git a/live2d/node_modules/@pixi/sprite/dist/esm/sprite.mjs.map b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.mjs.map new file mode 100644 index 0000000..a2aeec4 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/dist/esm/sprite.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"sprite.mjs","sources":["../../../../node_modules/tslib/tslib.es6.js","../../src/Sprite.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Bounds, Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource | Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n *\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n * @param rect - Optional output rectangle.\n * @returns The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n this._localBounds.minX = this._texture.orig.width * -this._anchor._x;\n this._localBounds.minY = this._texture.orig.height * -this._anchor._y;\n this._localBounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._localBounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._localBounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n * @param point - the point to test\n * @returns The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [options.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions | boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @returns The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EA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J;;;AAhCA,KAAA,CAAA,CAAA;IAiCL,OAAC,MAAA,CAAA;AAAD,CAhlBA,CAA4B,SAAS,CAglBpC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/sprite/global.d.ts b/live2d/node_modules/@pixi/sprite/global.d.ts new file mode 100644 index 0000000..016e101 --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/global.d.ts @@ -0,0 +1,8 @@ +declare namespace GlobalMixins +{ + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Sprite + { + + } +} diff --git a/live2d/node_modules/@pixi/sprite/index.d.ts b/live2d/node_modules/@pixi/sprite/index.d.ts new file mode 100644 index 0000000..67eb86e --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/index.d.ts @@ -0,0 +1,228 @@ +/// + +import { BLEND_MODES } from '@pixi/constants'; +import { Container } from '@pixi/display'; +import type { IBaseTextureOptions } from '@pixi/core'; +import type { IDestroyOptions } from '@pixi/display'; +import type { IPointData } from '@pixi/math'; +import { ObservablePoint } from '@pixi/math'; +import { Rectangle } from '@pixi/math'; +import type { Renderer } from '@pixi/core'; +import { Texture } from '@pixi/core'; +import type { TextureSource } from '@pixi/core'; + +export declare interface Sprite extends GlobalMixins.Sprite, Container { +} + +/** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = PIXI.Sprite.from('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * @memberof PIXI + */ +export declare class Sprite extends Container { + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * @default PIXI.BLEND_MODES.NORMAL + */ + blendMode: BLEND_MODES; + indices: Uint16Array; + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods. + * @default 'batch' + */ + pluginName: string; + /** + * The width of the sprite (this is initially set by the texture). + * @protected + */ + _width: number; + /** + * The height of the sprite (this is initially set by the texture) + * @protected + */ + _height: number; + /** + * The texture that the sprite is using. + * @private + */ + _texture: Texture; + _textureID: number; + /** + * Cached tint value so we can tell when the tint is changed. + * Value is used for 2d CanvasRenderer. + * @protected + * @default 0xFFFFFF + */ + _cachedTint: number; + protected _textureTrimmedID: number; + /** + * This is used to store the uvs data of the sprite, assigned at the same time + * as the vertexData in calculateVertices(). + * @member {Float32Array} + */ + protected uvs: Float32Array; + /** + * The anchor point defines the normalized coordinates + * in the texture that map to the position of this + * sprite. + * + * By default, this is `(0,0)` (or `texture.defaultAnchor` + * if you have modified that), which means the position + * `(x,y)` of this `Sprite` will be the top-left corner. + * + * Note: Updating `texture.defaultAnchor` after + * constructing a `Sprite` does _not_ update its anchor. + * + * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html} + * @default `this.texture.defaultAnchor` + */ + protected _anchor: ObservablePoint; + /** + * This is used to store the vertex data of the sprite (basically a quad). + * @member {Float32Array} + */ + protected vertexData: Float32Array; + /** + * This is used to calculate the bounds of the object IF it is a trimmed sprite. + * @member {Float32Array} + */ + private vertexTrimmedData; + /** + * Internal roundPixels field + * @private + */ + private _roundPixels; + private _transformID; + private _transformTrimmedID; + /** + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * @default 0xFFFFFF + */ + private _tint; + /** + * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect. + * @private + * @default 16777215 + */ + _tintRGB: number; + /** @param texture - The texture for this sprite. */ + constructor(texture?: Texture); + /** When the texture is updated, this event will fire to update the scale and frame. */ + protected _onTextureUpdate(): void; + /** Called when the anchor position updates. */ + private _onAnchorUpdate; + /** Calculates worldTransform * vertices, store it in vertexData. */ + calculateVertices(): void; + /** + * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData. + * + * This is used to ensure that the true width and height of a trimmed texture is respected. + */ + calculateTrimmedVertices(): void; + /** + * + * Renders the object using the WebGL renderer + * @param renderer - The webgl renderer to use. + */ + protected _render(renderer: Renderer): void; + /** Updates the bounds of the sprite. */ + protected _calculateBounds(): void; + /** + * Gets the local bounds of the sprite object. + * @param rect - Optional output rectangle. + * @returns The bounds. + */ + getLocalBounds(rect?: Rectangle): Rectangle; + /** + * Tests if a point is inside this sprite + * @param point - the point to test + * @returns The result of the test + */ + containsPoint(point: IPointData): boolean; + /** + * Destroys this sprite and optionally its texture and children. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + destroy(options?: IDestroyOptions | boolean): void; + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. + * @returns The newly created sprite + */ + static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite; + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}. + * @default false + */ + set roundPixels(value: boolean); + get roundPixels(): boolean; + /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */ + get width(): number; + set width(value: number); + /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */ + get height(): number; + set height(value: number); + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + */ + get anchor(): ObservablePoint; + set anchor(value: ObservablePoint); + /** + * The tint applied to the sprite. This is a hex value. + * + * A value of 0xFFFFFF will remove any tint effect. + * @default 0xFFFFFF + */ + get tint(): number; + set tint(value: number); + /** The texture that the sprite is using. */ + get texture(): Texture; + set texture(value: Texture); +} + +export declare type SpriteSource = TextureSource | Texture; + +export { } diff --git a/live2d/node_modules/@pixi/sprite/package.json b/live2d/node_modules/@pixi/sprite/package.json new file mode 100644 index 0000000..106320f --- /dev/null +++ b/live2d/node_modules/@pixi/sprite/package.json @@ -0,0 +1,49 @@ +{ + "name": "@pixi/sprite", + "version": "6.5.10", + "main": "dist/cjs/sprite.js", + "module": "dist/esm/sprite.mjs", + "bundle": "dist/browser/sprite.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/sprite.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/sprite.js" + } + } + }, + "description": "Base object for textured objects rendered to the screen", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/display": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/ticker/LICENSE b/live2d/node_modules/@pixi/ticker/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/README.md b/live2d/node_modules/@pixi/ticker/README.md new file mode 100644 index 0000000..d305ee0 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/README.md @@ -0,0 +1,31 @@ +# @pixi/ticker + +## Installation + +```bash +npm install @pixi/ticker +``` + +## Usage + +Create a Ticker object directly: + +```js +import { Ticker } from '@pixi/ticker'; + +const ticker = new Ticker(); +ticker.start(); +``` + +Use as an Application plugin: + +```js +import { TickerPlugin } from '@pixi/ticker'; +import { Application } from '@pixi/app'; +import { extensions } from '@pixi/core'; + +extensions.add(TickerPlugin); + +const app = new Application(); +app.ticker.start(); +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js new file mode 100644 index 0000000..5846d26 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js @@ -0,0 +1,720 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +var _pixi_ticker = (function (exports, settings, extensions) { + 'use strict'; + + /** + * Target frames per millisecond. + * @static + * @name TARGET_FPMS + * @memberof PIXI.settings + * @type {number} + * @default 0.06 + */ + settings.settings.TARGET_FPMS = 0.06; + + /** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @enum {number} + * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager} + * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} + * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}. + * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering. + * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility. + */ + exports.UPDATE_PRIORITY = void 0; + (function (UPDATE_PRIORITY) { + UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; + UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; + UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; + UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; + UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; + })(exports.UPDATE_PRIORITY || (exports.UPDATE_PRIORITY = {})); + + /** + * Internal class for handling the priority sorting of ticker handlers. + * @private + * @class + * @memberof PIXI + */ + var TickerListener = /** @class */ (function () { + /** + * Constructor + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param priority - The priority for emitting + * @param once - If the handler should fire once + */ + function TickerListener(fn, context, priority, once) { + if (context === void 0) { context = null; } + if (priority === void 0) { priority = 0; } + if (once === void 0) { once = false; } + /** The next item in chain. */ + this.next = null; + /** The previous item in chain. */ + this.previous = null; + /** `true` if this listener has been destroyed already. */ + this._destroyed = false; + this.fn = fn; + this.context = context; + this.priority = priority; + this.once = once; + } + /** + * Simple compare function to figure out if a function and context match. + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @returns `true` if the listener match the arguments + */ + TickerListener.prototype.match = function (fn, context) { + if (context === void 0) { context = null; } + return this.fn === fn && this.context === context; + }; + /** + * Emit by calling the current function. + * @private + * @param deltaTime - time since the last emit. + * @returns Next ticker + */ + TickerListener.prototype.emit = function (deltaTime) { + if (this.fn) { + if (this.context) { + this.fn.call(this.context, deltaTime); + } + else { + this.fn(deltaTime); + } + } + var redirect = this.next; + if (this.once) { + this.destroy(true); + } + // Soft-destroying should remove + // the next reference + if (this._destroyed) { + this.next = null; + } + return redirect; + }; + /** + * Connect to the list. + * @private + * @param previous - Input node, previous listener + */ + TickerListener.prototype.connect = function (previous) { + this.previous = previous; + if (previous.next) { + previous.next.previous = this; + } + this.next = previous.next; + previous.next = this; + }; + /** + * Destroy and don't use after this. + * @private + * @param hard - `true` to remove the `next` reference, this + * is considered a hard destroy. Soft destroy maintains the next reference. + * @returns The listener to redirect while emitting or removing. + */ + TickerListener.prototype.destroy = function (hard) { + if (hard === void 0) { hard = false; } + this._destroyed = true; + this.fn = null; + this.context = null; + // Disconnect, hook up next and previous + if (this.previous) { + this.previous.next = this.next; + } + if (this.next) { + this.next.previous = this.previous; + } + // Redirect to the next item + var redirect = this.next; + // Remove references + this.next = hard ? null : redirect; + this.previous = null; + return redirect; + }; + return TickerListener; + }()); + + /** + * A Ticker class that runs an update loop that other objects listen to. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. + * @class + * @memberof PIXI + */ + var Ticker = /** @class */ (function () { + function Ticker() { + var _this = this; + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.Ticker#start} automatically + * when a listener is added. + */ + this.autoStart = false; + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + */ + this.deltaTime = 1; + /** + * The last time {@link PIXI.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + */ + this.lastTime = -1; + /** + * Factor of current {@link PIXI.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + */ + this.speed = 1; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.Ticker#start} has been called. + * `false` if {@link PIXI.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.Ticker#autoStart} being `true` + * and a listener is added. + */ + this.started = false; + /** Internal current frame request ID */ + this._requestId = null; + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + */ + this._maxElapsedMS = 100; + /** + * Internal value managed by minFPS property setter and getter. + * This is the minimum allowed milliseconds between updates. + */ + this._minElapsedMS = 0; + /** If enabled, deleting is disabled.*/ + this._protected = false; + /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */ + this._lastFrame = -1; + this._head = new TickerListener(null, null, Infinity); + this.deltaMS = 1 / settings.settings.TARGET_FPMS; + this.elapsedMS = 1 / settings.settings.TARGET_FPMS; + this._tick = function (time) { + _this._requestId = null; + if (_this.started) { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._head.next) { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; + } + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * @private + */ + Ticker.prototype._requestIfNeeded = function () { + if (this._requestId === null && this._head.next) { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._lastFrame = this.lastTime; + this._requestId = requestAnimationFrame(this._tick); + } + }; + /** + * Conditionally cancels a pending animation frame. + * @private + */ + Ticker.prototype._cancelIfNeeded = function () { + if (this._requestId !== null) { + cancelAnimationFrame(this._requestId); + this._requestId = null; + } + }; + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * @private + */ + Ticker.prototype._startIfPossible = function () { + if (this.started) { + this._requestIfNeeded(); + } + else if (this.autoStart) { + this.start(); + } + }; + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * @param fn - The listener function to be added for updates + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.add = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority)); + }; + /** + * Add a handler for the tick event which is only execute once. + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.addOnce = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority, true)); + }; + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * @private + * @param listener - Current listener being added. + * @returns This instance of a ticker + */ + Ticker.prototype._addListener = function (listener) { + // For attaching to head + var current = this._head.next; + var previous = this._head; + // Add the first item + if (!current) { + listener.connect(previous); + } + else { + // Go from highest to lowest priority + while (current) { + if (listener.priority > current.priority) { + listener.connect(previous); + break; + } + previous = current; + current = current.next; + } + // Not yet connected + if (!listener.previous) { + listener.connect(previous); + } + } + this._startIfPossible(); + return this; + }; + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * @param fn - The listener function to be removed + * @param context - The listener context to be removed + * @returns This instance of a ticker + */ + Ticker.prototype.remove = function (fn, context) { + var listener = this._head.next; + while (listener) { + // We found a match, lets remove it + // no break to delete all possible matches + // incase a listener was added 2+ times + if (listener.match(fn, context)) { + listener = listener.destroy(); + } + else { + listener = listener.next; + } + } + if (!this._head.next) { + this._cancelIfNeeded(); + } + return this; + }; + Object.defineProperty(Ticker.prototype, "count", { + /** + * The number of listeners on this ticker, calculated by walking through linked list + * @readonly + * @member {number} + */ + get: function () { + if (!this._head) { + return 0; + } + var count = 0; + var current = this._head; + while ((current = current.next)) { + count++; + } + return count; + }, + enumerable: false, + configurable: true + }); + /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */ + Ticker.prototype.start = function () { + if (!this.started) { + this.started = true; + this._requestIfNeeded(); + } + }; + /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */ + Ticker.prototype.stop = function () { + if (this.started) { + this.started = false; + this._cancelIfNeeded(); + } + }; + /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */ + Ticker.prototype.destroy = function () { + if (!this._protected) { + this.stop(); + var listener = this._head.next; + while (listener) { + listener = listener.destroy(true); + } + this._head.destroy(); + this._head = null; + } + }; + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.Ticker#elapsedMS}, + * the current {@link PIXI.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + Ticker.prototype.update = function (currentTime) { + if (currentTime === void 0) { currentTime = performance.now(); } + var elapsedMS; + // If the difference in time is zero or negative, we ignore most of the work done here. + // If there is no valid difference, then should be no reason to let anyone know about it. + // A zero delta, is exactly that, nothing should update. + // + // The difference in time can be negative, and no this does not mean time traveling. + // This can be the result of a race condition between when an animation frame is requested + // on the current JavaScript engine event loop, and when the ticker's start method is invoked + // (which invokes the internal _requestIfNeeded method). If a frame is requested before + // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, + // can receive a time argument that can be less than the lastTime value that was set within + // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. + // + // This check covers this browser engine timing issue, as well as if consumers pass an invalid + // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. + if (currentTime > this.lastTime) { + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) { + elapsedMS = this._maxElapsedMS; + } + elapsedMS *= this.speed; + // If not enough time has passed, exit the function. + // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS + // adjustment to ensure a relatively stable interval. + if (this._minElapsedMS) { + var delta = currentTime - this._lastFrame | 0; + if (delta < this._minElapsedMS) { + return; + } + this._lastFrame = currentTime - (delta % this._minElapsedMS); + } + this.deltaMS = elapsedMS; + this.deltaTime = this.deltaMS * settings.settings.TARGET_FPMS; + // Cache a local reference, in-case ticker is destroyed + // during the emit, we can still check for head.next + var head = this._head; + // Invoke listeners added to internal emitter + var listener = head.next; + while (listener) { + listener = listener.emit(this.deltaTime); + } + if (!head.next) { + this._cancelIfNeeded(); + } + } + else { + this.deltaTime = this.deltaMS = this.elapsedMS = 0; + } + this.lastTime = currentTime; + }; + Object.defineProperty(Ticker.prototype, "FPS", { + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.Ticker#speed}, which is specific + * to scaling {@link PIXI.Ticker#deltaTime}. + * @member {number} + * @readonly + */ + get: function () { + return 1000 / this.elapsedMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "minFPS", { + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.Ticker#update}. + * This value is used to cap {@link PIXI.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * @member {number} + * @default 10 + */ + get: function () { + return 1000 / this._maxElapsedMS; + }, + set: function (fps) { + // Minimum must be below the maxFPS + var minFPS = Math.min(this.maxFPS, fps); + // Must be at least 0, but below 1 / settings.TARGET_FPMS + var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.settings.TARGET_FPMS); + this._maxElapsedMS = 1 / minFPMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "maxFPS", { + /** + * Manages the minimum amount of milliseconds required to + * elapse between invoking {@link PIXI.Ticker#update}. + * This will effect the measured value of {@link PIXI.Ticker#FPS}. + * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. + * Otherwise it will be at least `minFPS` + * @member {number} + * @default 0 + */ + get: function () { + if (this._minElapsedMS) { + return Math.round(1000 / this._minElapsedMS); + } + return 0; + }, + set: function (fps) { + if (fps === 0) { + this._minElapsedMS = 0; + } + else { + // Max must be at least the minFPS + var maxFPS = Math.max(this.minFPS, fps); + this._minElapsedMS = 1 / (maxFPS / 1000); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "shared", { + /** + * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by + * {@link PIXI.VideoResource} to update animation frames / video textures. + * + * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. + * @example + * let ticker = PIXI.Ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.Ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(); + * let stage = new PIXI.Container(); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._shared) { + var shared = Ticker._shared = new Ticker(); + shared.autoStart = true; + shared._protected = true; + } + return Ticker._shared; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "system", { + /** + * The system ticker instance used by {@link PIXI.InteractionManager} and by + * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, + * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._system) { + var system = Ticker._system = new Ticker(); + system.autoStart = true; + system._protected = true; + } + return Ticker._system; + }, + enumerable: false, + configurable: true + }); + return Ticker; + }()); + + /** + * Middleware for for Application Ticker. + * @example + * import {TickerPlugin} from '@pixi/ticker'; + * import {Application} from '@pixi/app'; + * import {extensions} from '@pixi/extensions'; + * extensions.add(TickerPlugin); + * @class + * @memberof PIXI + */ + var TickerPlugin = /** @class */ (function () { + function TickerPlugin() { + } + /** + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options + */ + TickerPlugin.init = function (options) { + var _this = this; + // Set default + options = Object.assign({ + autoStart: true, + sharedTicker: false, + }, options); + // Create ticker setter + Object.defineProperty(this, 'ticker', { + set: function (ticker) { + if (this._ticker) { + this._ticker.remove(this.render, this); + } + this._ticker = ticker; + if (ticker) { + ticker.add(this.render, this, exports.UPDATE_PRIORITY.LOW); + } + }, + get: function () { + return this._ticker; + }, + }); + /** + * Convenience method for stopping the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.stop = function () { + _this._ticker.stop(); + }; + /** + * Convenience method for starting the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.start = function () { + _this._ticker.start(); + }; + /** + * Internal reference to the ticker. + * @type {PIXI.Ticker} + * @name _ticker + * @memberof PIXI.Application# + * @private + */ + this._ticker = null; + /** + * Ticker for doing render updates. + * @type {PIXI.Ticker} + * @name ticker + * @memberof PIXI.Application# + * @default PIXI.Ticker.shared + */ + this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); + // Start the rendering + if (options.autoStart) { + this.start(); + } + }; + /** + * Clean up the ticker, scoped to application. + * @static + * @private + */ + TickerPlugin.destroy = function () { + if (this._ticker) { + var oldTicker = this._ticker; + this.ticker = null; + oldTicker.destroy(); + } + }; + /** @ignore */ + TickerPlugin.extension = extensions.ExtensionType.Application; + return TickerPlugin; + }()); + + exports.Ticker = Ticker; + exports.TickerPlugin = TickerPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI); +Object.assign(this.PIXI, _pixi_ticker); +//# sourceMappingURL=ticker.js.map diff --git a/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js.map b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js.map new file mode 100644 index 0000000..3eba3fb --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ticker.js","sources":["../../src/settings.ts","../../src/const.ts","../../src/TickerListener.ts","../../src/Ticker.ts","../../src/TickerPlugin.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering.\n * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import type { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":["settings","UPDATE_PRIORITY","ExtensionType"],"mappings":";;;;;;;;;;;IAEA;;;;;;;IAOG;AACHA,qBAAQ,CAAC,WAAW,GAAG,IAAI;;ICV3B;;;;;;;;;;;;;;IAcG;AACSC,qCAQX;IARD,CAAA,UAAY,eAAe,EAAA;IAGvB,IAAA,eAAA,CAAA,eAAA,CAAA,aAAA,CAAA,GAAA,EAAA,CAAA,GAAA,aAAgB,CAAA;IAChB,IAAA,eAAA,CAAA,eAAA,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAS,CAAA;IACT,IAAA,eAAA,CAAA,eAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU,CAAA;IACV,IAAA,eAAA,CAAA,eAAA,CAAA,KAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,KAAS,CAAA;IACT,IAAA,eAAA,CAAA,eAAA,CAAA,SAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,SAAa,CAAA;IACjB,CAAC,EARWA,uBAAe,KAAfA,uBAAe,GAQ1B,EAAA,CAAA,CAAA;;ICrBD;;;;;IAKG;IACH,IAAA,cAAA,kBAAA,YAAA;IAkBI;;;;;;;IAOG;IACH,IAAA,SAAA,cAAA,CAAY,EAAqB,EAAE,OAAiB,EAAE,QAAY,EAAE,IAAY,EAAA;IAA7C,Q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d,YAAA;YAEI,IAAI,IAAI,CAAC,OAAO,EAChB;IACI,YAAA,IAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;IAE/B,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;gBACnB,SAAS,CAAC,OAAO,EAAE,CAAC;IACvB,SAAA;SACJ,CAAA;;IAvGM,IAAA,YAAA,CAAA,SAAS,GAAsBC,wBAAa,CAAC,WAAW,CAAC;QAwGpE,OAAC,YAAA,CAAA;IAAA,CA3GD,EA2GC;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/dist/browser/ticker.min.js b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.min.js new file mode 100644 index 0000000..03ec743 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/browser/ticker.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{};var _pixi_ticker=function(t,e,i){"use strict";var s;e.settings.TARGET_FPMS=.06,t.UPDATE_PRIORITY=void 0,(s=t.UPDATE_PRIORITY||(t.UPDATE_PRIORITY={}))[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY";var n=function(){function t(t,e,i,s){void 0===e&&(e=null),void 0===i&&(i=0),void 0===s&&(s=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),r=function(){function i(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new n(null,null,1/0),this.deltaMS=1/e.settings.TARGET_FPMS,this.elapsedMS=1/e.settings.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return i.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},i.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},i.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},i.prototype.add=function(e,i,s){return void 0===s&&(s=t.UPDATE_PRIORITY.NORMAL),this._addListener(new n(e,i,s))},i.prototype.addOnce=function(e,i,s){return void 0===s&&(s=t.UPDATE_PRIORITY.NORMAL),this._addListener(new n(e,i,s,!0))},i.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},i.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(i.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),i.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},i.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},i.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},i.prototype.update=function(t){var i;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((i=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){var s=t-this._lastFrame|0;if(s\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":["UPDATE_PRIORITY","settings","TARGET_FPMS","exports","TickerListener","fn","context","priority","once","this","next","previous","_destroyed","prototype","match","emit","deltaTime","call","redirect","destroy","connect","hard","Ticker","_this","autoStart","lastTime","speed","started","_requestId","_maxElapsedMS","_minElapsedMS","_protected","_lastFrame","_head","Infinity","deltaMS","elapsedMS","_tick","time","update","requestAnimationFrame","_requestIfNeeded","performance","now","_cancelIfNeeded","cancelAnimationFrame","_startIfPossible","start","add","NORMAL","_addListener","addOnce","listener","current","remove","Object","defineProperty","get","count","stop","currentTime","delta","head","set","fps","minFPS","Math","min","maxFPS","minFPMS","max","round","_shared","shared","_system","system","TickerPlugin","init","options","assign","sharedTicker","ticker","_ticker","render","LOW","oldTicker","extension","ExtensionType","Application"],"mappings":";;;;;;;sEAeA,IAAYA,ECLJC,EAAAA,SAACC,YAAc,IDatBC,EAAAH,qBAAA,GARWA,EAAAA,EAAeA,kBAAfA,kBAQX,KALGA,EAAA,YAAA,IAAA,cACAA,EAAAA,EAAA,KAAA,IAAA,OACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,KAAA,IAAA,MACAA,EAAAA,EAAA,SAAA,IAAA,UEdJ,IAAAI,EAAA,WA0BI,SAAAA,EAAYC,EAAuBC,EAAmBC,EAAcC,QAAjC,IAAAF,IAAAA,EAAiB,WAAE,IAAAC,IAAAA,EAAY,QAAE,IAAAC,IAAAA,GAAY,GArBzEC,KAAIC,KAAmB,KAEvBD,KAAQE,SAAmB,KAS1BF,KAAUG,YAAG,EAYjBH,KAAKJ,GAAKA,EACVI,KAAKH,QAAUA,EACfG,KAAKF,SAAWA,EAChBE,KAAKD,KAAOA,EAqGpB,OA3FIJ,EAAAS,UAAAC,MAAA,SAAMT,EAAuBC,GAEzB,YAFyB,IAAAA,IAAAA,EAAmB,MAErCG,KAAKJ,KAAOA,GAAMI,KAAKH,UAAYA,GAS9CF,EAAIS,UAAAE,KAAJ,SAAKC,GAEGP,KAAKJ,KAEDI,KAAKH,QAELG,KAAKJ,GAAGY,KAAKR,KAAKH,QAASU,GAI1BP,KAA6BJ,GAAGW,IAIzC,IAAME,EAAWT,KAAKC,KActB,OAZID,KAAK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vB,OAAOC,eAAe/C,KAAM,SACxB,CACIsD,aAAIkB,GAEIxE,KAAKyE,SAELzE,KAAKyE,QAAQ5B,OAAO7C,KAAK0E,OAAQ1E,MAErCA,KAAKyE,QAAUD,EACXA,GAEAA,EAAOjC,IAAIvC,KAAK0E,OAAQ1E,KAAMT,EAAAA,gBAAgBoF,MAGtD3B,IAAG,WAEC,OAAOhD,KAAKyE,WAUxBzE,KAAKkD,KAAO,WAERpC,EAAK2D,QAAQvB,QASjBlD,KAAKsC,MAAQ,WAETxB,EAAK2D,QAAQnC,SAUjBtC,KAAKyE,QAAU,KASfzE,KAAKwE,OAASH,EAAQE,aAAe1D,EAAOmD,OAAS,IAAInD,EAGrDwD,EAAQtD,WAERf,KAAKsC,SASN6B,EAAAzD,QAAP,WAEI,GAAIV,KAAKyE,QACT,CACI,IAAMG,EAAY5E,KAAKyE,QAEvBzE,KAAKwE,OAAS,KACdI,EAAUlE,YArGXyD,EAAAU,UAA+BC,EAAaA,cAACC,YAwGvDZ"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js new file mode 100644 index 0000000..37196a7 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js @@ -0,0 +1,716 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var settings = require('@pixi/settings'); +var extensions = require('@pixi/extensions'); + +/** + * Target frames per millisecond. + * @static + * @name TARGET_FPMS + * @memberof PIXI.settings + * @type {number} + * @default 0.06 + */ +settings.settings.TARGET_FPMS = 0.06; + +/** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @enum {number} + * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager} + * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} + * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}. + * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering. + * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility. + */ +exports.UPDATE_PRIORITY = void 0; +(function (UPDATE_PRIORITY) { + UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; + UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; + UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; + UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; + UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; +})(exports.UPDATE_PRIORITY || (exports.UPDATE_PRIORITY = {})); + +/** + * Internal class for handling the priority sorting of ticker handlers. + * @private + * @class + * @memberof PIXI + */ +var TickerListener = /** @class */ (function () { + /** + * Constructor + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param priority - The priority for emitting + * @param once - If the handler should fire once + */ + function TickerListener(fn, context, priority, once) { + if (context === void 0) { context = null; } + if (priority === void 0) { priority = 0; } + if (once === void 0) { once = false; } + /** The next item in chain. */ + this.next = null; + /** The previous item in chain. */ + this.previous = null; + /** `true` if this listener has been destroyed already. */ + this._destroyed = false; + this.fn = fn; + this.context = context; + this.priority = priority; + this.once = once; + } + /** + * Simple compare function to figure out if a function and context match. + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @returns `true` if the listener match the arguments + */ + TickerListener.prototype.match = function (fn, context) { + if (context === void 0) { context = null; } + return this.fn === fn && this.context === context; + }; + /** + * Emit by calling the current function. + * @private + * @param deltaTime - time since the last emit. + * @returns Next ticker + */ + TickerListener.prototype.emit = function (deltaTime) { + if (this.fn) { + if (this.context) { + this.fn.call(this.context, deltaTime); + } + else { + this.fn(deltaTime); + } + } + var redirect = this.next; + if (this.once) { + this.destroy(true); + } + // Soft-destroying should remove + // the next reference + if (this._destroyed) { + this.next = null; + } + return redirect; + }; + /** + * Connect to the list. + * @private + * @param previous - Input node, previous listener + */ + TickerListener.prototype.connect = function (previous) { + this.previous = previous; + if (previous.next) { + previous.next.previous = this; + } + this.next = previous.next; + previous.next = this; + }; + /** + * Destroy and don't use after this. + * @private + * @param hard - `true` to remove the `next` reference, this + * is considered a hard destroy. Soft destroy maintains the next reference. + * @returns The listener to redirect while emitting or removing. + */ + TickerListener.prototype.destroy = function (hard) { + if (hard === void 0) { hard = false; } + this._destroyed = true; + this.fn = null; + this.context = null; + // Disconnect, hook up next and previous + if (this.previous) { + this.previous.next = this.next; + } + if (this.next) { + this.next.previous = this.previous; + } + // Redirect to the next item + var redirect = this.next; + // Remove references + this.next = hard ? null : redirect; + this.previous = null; + return redirect; + }; + return TickerListener; +}()); + +/** + * A Ticker class that runs an update loop that other objects listen to. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. + * @class + * @memberof PIXI + */ +var Ticker = /** @class */ (function () { + function Ticker() { + var _this = this; + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.Ticker#start} automatically + * when a listener is added. + */ + this.autoStart = false; + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + */ + this.deltaTime = 1; + /** + * The last time {@link PIXI.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + */ + this.lastTime = -1; + /** + * Factor of current {@link PIXI.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + */ + this.speed = 1; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.Ticker#start} has been called. + * `false` if {@link PIXI.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.Ticker#autoStart} being `true` + * and a listener is added. + */ + this.started = false; + /** Internal current frame request ID */ + this._requestId = null; + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + */ + this._maxElapsedMS = 100; + /** + * Internal value managed by minFPS property setter and getter. + * This is the minimum allowed milliseconds between updates. + */ + this._minElapsedMS = 0; + /** If enabled, deleting is disabled.*/ + this._protected = false; + /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */ + this._lastFrame = -1; + this._head = new TickerListener(null, null, Infinity); + this.deltaMS = 1 / settings.settings.TARGET_FPMS; + this.elapsedMS = 1 / settings.settings.TARGET_FPMS; + this._tick = function (time) { + _this._requestId = null; + if (_this.started) { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._head.next) { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; + } + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * @private + */ + Ticker.prototype._requestIfNeeded = function () { + if (this._requestId === null && this._head.next) { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._lastFrame = this.lastTime; + this._requestId = requestAnimationFrame(this._tick); + } + }; + /** + * Conditionally cancels a pending animation frame. + * @private + */ + Ticker.prototype._cancelIfNeeded = function () { + if (this._requestId !== null) { + cancelAnimationFrame(this._requestId); + this._requestId = null; + } + }; + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * @private + */ + Ticker.prototype._startIfPossible = function () { + if (this.started) { + this._requestIfNeeded(); + } + else if (this.autoStart) { + this.start(); + } + }; + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * @param fn - The listener function to be added for updates + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.add = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority)); + }; + /** + * Add a handler for the tick event which is only execute once. + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.addOnce = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority, true)); + }; + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * @private + * @param listener - Current listener being added. + * @returns This instance of a ticker + */ + Ticker.prototype._addListener = function (listener) { + // For attaching to head + var current = this._head.next; + var previous = this._head; + // Add the first item + if (!current) { + listener.connect(previous); + } + else { + // Go from highest to lowest priority + while (current) { + if (listener.priority > current.priority) { + listener.connect(previous); + break; + } + previous = current; + current = current.next; + } + // Not yet connected + if (!listener.previous) { + listener.connect(previous); + } + } + this._startIfPossible(); + return this; + }; + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * @param fn - The listener function to be removed + * @param context - The listener context to be removed + * @returns This instance of a ticker + */ + Ticker.prototype.remove = function (fn, context) { + var listener = this._head.next; + while (listener) { + // We found a match, lets remove it + // no break to delete all possible matches + // incase a listener was added 2+ times + if (listener.match(fn, context)) { + listener = listener.destroy(); + } + else { + listener = listener.next; + } + } + if (!this._head.next) { + this._cancelIfNeeded(); + } + return this; + }; + Object.defineProperty(Ticker.prototype, "count", { + /** + * The number of listeners on this ticker, calculated by walking through linked list + * @readonly + * @member {number} + */ + get: function () { + if (!this._head) { + return 0; + } + var count = 0; + var current = this._head; + while ((current = current.next)) { + count++; + } + return count; + }, + enumerable: false, + configurable: true + }); + /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */ + Ticker.prototype.start = function () { + if (!this.started) { + this.started = true; + this._requestIfNeeded(); + } + }; + /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */ + Ticker.prototype.stop = function () { + if (this.started) { + this.started = false; + this._cancelIfNeeded(); + } + }; + /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */ + Ticker.prototype.destroy = function () { + if (!this._protected) { + this.stop(); + var listener = this._head.next; + while (listener) { + listener = listener.destroy(true); + } + this._head.destroy(); + this._head = null; + } + }; + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.Ticker#elapsedMS}, + * the current {@link PIXI.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + Ticker.prototype.update = function (currentTime) { + if (currentTime === void 0) { currentTime = performance.now(); } + var elapsedMS; + // If the difference in time is zero or negative, we ignore most of the work done here. + // If there is no valid difference, then should be no reason to let anyone know about it. + // A zero delta, is exactly that, nothing should update. + // + // The difference in time can be negative, and no this does not mean time traveling. + // This can be the result of a race condition between when an animation frame is requested + // on the current JavaScript engine event loop, and when the ticker's start method is invoked + // (which invokes the internal _requestIfNeeded method). If a frame is requested before + // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, + // can receive a time argument that can be less than the lastTime value that was set within + // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. + // + // This check covers this browser engine timing issue, as well as if consumers pass an invalid + // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. + if (currentTime > this.lastTime) { + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) { + elapsedMS = this._maxElapsedMS; + } + elapsedMS *= this.speed; + // If not enough time has passed, exit the function. + // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS + // adjustment to ensure a relatively stable interval. + if (this._minElapsedMS) { + var delta = currentTime - this._lastFrame | 0; + if (delta < this._minElapsedMS) { + return; + } + this._lastFrame = currentTime - (delta % this._minElapsedMS); + } + this.deltaMS = elapsedMS; + this.deltaTime = this.deltaMS * settings.settings.TARGET_FPMS; + // Cache a local reference, in-case ticker is destroyed + // during the emit, we can still check for head.next + var head = this._head; + // Invoke listeners added to internal emitter + var listener = head.next; + while (listener) { + listener = listener.emit(this.deltaTime); + } + if (!head.next) { + this._cancelIfNeeded(); + } + } + else { + this.deltaTime = this.deltaMS = this.elapsedMS = 0; + } + this.lastTime = currentTime; + }; + Object.defineProperty(Ticker.prototype, "FPS", { + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.Ticker#speed}, which is specific + * to scaling {@link PIXI.Ticker#deltaTime}. + * @member {number} + * @readonly + */ + get: function () { + return 1000 / this.elapsedMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "minFPS", { + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.Ticker#update}. + * This value is used to cap {@link PIXI.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * @member {number} + * @default 10 + */ + get: function () { + return 1000 / this._maxElapsedMS; + }, + set: function (fps) { + // Minimum must be below the maxFPS + var minFPS = Math.min(this.maxFPS, fps); + // Must be at least 0, but below 1 / settings.TARGET_FPMS + var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.settings.TARGET_FPMS); + this._maxElapsedMS = 1 / minFPMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "maxFPS", { + /** + * Manages the minimum amount of milliseconds required to + * elapse between invoking {@link PIXI.Ticker#update}. + * This will effect the measured value of {@link PIXI.Ticker#FPS}. + * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. + * Otherwise it will be at least `minFPS` + * @member {number} + * @default 0 + */ + get: function () { + if (this._minElapsedMS) { + return Math.round(1000 / this._minElapsedMS); + } + return 0; + }, + set: function (fps) { + if (fps === 0) { + this._minElapsedMS = 0; + } + else { + // Max must be at least the minFPS + var maxFPS = Math.max(this.minFPS, fps); + this._minElapsedMS = 1 / (maxFPS / 1000); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "shared", { + /** + * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by + * {@link PIXI.VideoResource} to update animation frames / video textures. + * + * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. + * @example + * let ticker = PIXI.Ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.Ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(); + * let stage = new PIXI.Container(); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._shared) { + var shared = Ticker._shared = new Ticker(); + shared.autoStart = true; + shared._protected = true; + } + return Ticker._shared; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "system", { + /** + * The system ticker instance used by {@link PIXI.InteractionManager} and by + * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, + * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._system) { + var system = Ticker._system = new Ticker(); + system.autoStart = true; + system._protected = true; + } + return Ticker._system; + }, + enumerable: false, + configurable: true + }); + return Ticker; +}()); + +/** + * Middleware for for Application Ticker. + * @example + * import {TickerPlugin} from '@pixi/ticker'; + * import {Application} from '@pixi/app'; + * import {extensions} from '@pixi/extensions'; + * extensions.add(TickerPlugin); + * @class + * @memberof PIXI + */ +var TickerPlugin = /** @class */ (function () { + function TickerPlugin() { + } + /** + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options + */ + TickerPlugin.init = function (options) { + var _this = this; + // Set default + options = Object.assign({ + autoStart: true, + sharedTicker: false, + }, options); + // Create ticker setter + Object.defineProperty(this, 'ticker', { + set: function (ticker) { + if (this._ticker) { + this._ticker.remove(this.render, this); + } + this._ticker = ticker; + if (ticker) { + ticker.add(this.render, this, exports.UPDATE_PRIORITY.LOW); + } + }, + get: function () { + return this._ticker; + }, + }); + /** + * Convenience method for stopping the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.stop = function () { + _this._ticker.stop(); + }; + /** + * Convenience method for starting the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.start = function () { + _this._ticker.start(); + }; + /** + * Internal reference to the ticker. + * @type {PIXI.Ticker} + * @name _ticker + * @memberof PIXI.Application# + * @private + */ + this._ticker = null; + /** + * Ticker for doing render updates. + * @type {PIXI.Ticker} + * @name ticker + * @memberof PIXI.Application# + * @default PIXI.Ticker.shared + */ + this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); + // Start the rendering + if (options.autoStart) { + this.start(); + } + }; + /** + * Clean up the ticker, scoped to application. + * @static + * @private + */ + TickerPlugin.destroy = function () { + if (this._ticker) { + var oldTicker = this._ticker; + this.ticker = null; + oldTicker.destroy(); + } + }; + /** @ignore */ + TickerPlugin.extension = extensions.ExtensionType.Application; + return TickerPlugin; +}()); + +exports.Ticker = Ticker; +exports.TickerPlugin = TickerPlugin; +//# sourceMappingURL=ticker.js.map diff --git a/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js.map b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js.map new file mode 100644 index 0000000..a02193f --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ticker.js","sources":["../../src/settings.ts","../../src/const.ts","../../src/TickerListener.ts","../../src/Ticker.ts","../../src/TickerPlugin.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering.\n * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import type { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":["settings","UPDATE_PRIORITY","ExtensionType"],"mappings":";;;;;;;;;;;;;;AAEA;;;;;;;AAOG;AACHA,iBAAQ,CAAC,WAAW,GAAG,IAAI;;ACV3B;;;;;;;;;;;;;;AAcG;AACSC,iCAQX;AARD,CAAA,UAAY,eAAe,EAAA;AAGvB,IAAA,eAAA,CAAA,eAAA,CAAA,aAAA,CAAA,GAAA,EAAA,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ACH,IAAI,CAAC,IAAI,GAAG,YAAA;AAER,YAAA,KAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,SAAC,CAAC;AAEF;;;;;AAKG;QACH,IAAI,CAAC,KAAK,GAAG,YAAA;AAET,YAAA,KAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AACzB,SAAC,CAAC;AAEF;;;;;;AAMG;AACH,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AAEpB;;;;;;AAMG;AACH,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;;QAGlE,IAAI,OAAO,CAAC,SAAS,EACrB;YACI,IAAI,CAAC,KAAK,EAAE,CAAC;AAChB,SAAA;KACJ,CAAA;AAED;;;;AAIG;AACI,IAAA,YAAA,CAAA,OAAO,GAAd,YAAA;QAEI,IAAI,IAAI,CAAC,OAAO,EAChB;AACI,YAAA,IAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;AAE/B,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,SAAS,CAAC,OAAO,EAAE,CAAC;AACvB,SAAA;KACJ,CAAA;;AAvGM,IAAA,YAAA,CAAA,SAAS,GAAsBC,wBAAa,CAAC,WAAW,CAAC;IAwGpE,OAAC,YAAA,CAAA;AAAA,CA3GD,EA2GC;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.min.js b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.min.js new file mode 100644 index 0000000..b6b7e9c --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/cjs/ticker.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@pixi/settings"),i=require("@pixi/extensions");e.settings.TARGET_FPMS=.06,exports.UPDATE_PRIORITY=void 0,(t=exports.UPDATE_PRIORITY||(exports.UPDATE_PRIORITY={}))[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY";var s=function(){function t(t,e,i,s){void 0===e&&(e=null),void 0===i&&(i=0),void 0===s&&(s=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),n=function(){function t(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new s(null,null,1/0),this.deltaMS=1/e.settings.TARGET_FPMS,this.elapsedMS=1/e.settings.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return t.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},t.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},t.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},t.prototype.add=function(t,e,i){return void 0===i&&(i=exports.UPDATE_PRIORITY.NORMAL),this._addListener(new s(t,e,i))},t.prototype.addOnce=function(t,e,i){return void 0===i&&(i=exports.UPDATE_PRIORITY.NORMAL),this._addListener(new s(t,e,i,!0))},t.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},t.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(t){var i;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((i=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){var s=t-this._lastFrame|0;if(s\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":["UPDATE_PRIORITY","settings","TARGET_FPMS","TickerListener","fn","context","priority","once","this","next","previous","_destroyed","prototype","match","emit","deltaTime","call","redirect","destroy","connect","hard","Ticker","_this","autoStart","lastTime","speed","started","_requestId","_maxElapsedMS","_minElapsedMS","_protected","_lastFrame","_head","Infinity","deltaMS","elapsedMS","_tick","time","update","requestAnimationFrame","_requestIfNeeded","performance","now","_cancelIfNeeded","cancelAnimationFrame","_startIfPossible","start","add","NORMAL","_addListener","addOnce","listener","current","remove","Object","defineProperty","get","count","stop","currentTime","delta","head","set","fps","minFPS","Math","min","maxFPS","minFPMS","max","round","_shared","shared","_system","system","TickerPlugin","init","options","assign","sharedTicker","ticker","_ticker","render","LOW","oldTicker","extension","ExtensionType","Application"],"mappings":";;;;;;;wEAeYA,4DCLZC,EAAQA,SAACC,YAAc,IDKXF,QAQXA,qBAAA,GARWA,EAAAA,QAAeA,kBAAfA,wBAQX,KALGA,EAAA,YAAA,IAAA,cACAA,EAAAA,EAAA,KAAA,IAAA,OACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,KAAA,IAAA,MACAA,EAAAA,EAAA,SAAA,IAAA,UEdJ,IAAAG,EAAA,WA0BI,SAAAA,EAAYC,E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i/ticker/dist/esm/ticker.min.mjs b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.min.mjs new file mode 100644 index 0000000..f861ea7 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{settings as t}from"@pixi/settings";import{ExtensionType as e}from"@pixi/extensions";var i;t.TARGET_FPMS=.06,function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"}(i||(i={}));var s=function(){function t(t,e,i,s){void 0===e&&(e=null),void 0===i&&(i=0),void 0===s&&(s=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=i,this.once=s}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),n=function(){function e(){var e=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new s(null,null,1/0),this.deltaMS=1/t.TARGET_FPMS,this.elapsedMS=1/t.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&null===e._requestId&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(t,e,n){return void 0===n&&(n=i.NORMAL),this._addListener(new s(t,e,n))},e.prototype.addOnce=function(t,e,n){return void 0===n&&(n=i.NORMAL),this._addListener(new s(t,e,n,!0))},e.prototype._addListener=function(t){var e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this},e.prototype.remove=function(t,e){for(var i=this._head.next;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(e.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(e){var i;if(void 0===e&&(e=performance.now()),e>this.lastTime){if((i=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){var s=e-this._lastFrame|0;if(s\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":["UPDATE_PRIORITY","settings","TARGET_FPMS","TickerListener","fn","context","priority","once","this","next","previous","_destroyed","prototype","match","emit","deltaTime","call","redirect","destroy","connect","hard","Ticker","_this","autoStart","lastTime","speed","started","_requestId","_maxElapsedMS","_minElapsedMS","_protected","_lastFrame","_head","Infinity","deltaMS","elapsedMS","_tick","time","update","requestAnimationFrame","_requestIfNeeded","performance","now","_cancelIfNeeded","cancelAnimationFrame","_startIfPossible","start","add","NORMAL","_addListener","addOnce","listener","current","remove","Object","defineProperty","get","count","stop","currentTime","delta","head","set","fps","minFPS","Math","min","maxFPS","minFPMS","max","round","_shared","shared","_system","system","TickerPlugin","init","options","assign","sharedTicker","ticker","_ticker","render","LOW","oldTicker","extension","ExtensionType","Application"],"mappings":";;;;;;;2FAeA,IAAYA,ECLZC,EAASC,YAAc,IDKvB,SAAYF,GAGRA,EAAAA,EAAA,YAAA,IAAA,cACAA,EAAA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,KAAKyE,QAEvBzE,KAAKwE,OAAS,KACdI,EAAUlE,YArGXyD,EAAAU,UAA+BC,EAAcC,YAwGvDZ"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs new file mode 100644 index 0000000..d25338c --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs @@ -0,0 +1,711 @@ +/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { settings } from '@pixi/settings'; +import { ExtensionType } from '@pixi/extensions'; + +/** + * Target frames per millisecond. + * @static + * @name TARGET_FPMS + * @memberof PIXI.settings + * @type {number} + * @default 0.06 + */ +settings.TARGET_FPMS = 0.06; + +/** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @enum {number} + * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager} + * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} + * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}. + * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering. + * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility. + */ +var UPDATE_PRIORITY; +(function (UPDATE_PRIORITY) { + UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; + UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; + UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; + UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; + UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; +})(UPDATE_PRIORITY || (UPDATE_PRIORITY = {})); + +/** + * Internal class for handling the priority sorting of ticker handlers. + * @private + * @class + * @memberof PIXI + */ +var TickerListener = /** @class */ (function () { + /** + * Constructor + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param priority - The priority for emitting + * @param once - If the handler should fire once + */ + function TickerListener(fn, context, priority, once) { + if (context === void 0) { context = null; } + if (priority === void 0) { priority = 0; } + if (once === void 0) { once = false; } + /** The next item in chain. */ + this.next = null; + /** The previous item in chain. */ + this.previous = null; + /** `true` if this listener has been destroyed already. */ + this._destroyed = false; + this.fn = fn; + this.context = context; + this.priority = priority; + this.once = once; + } + /** + * Simple compare function to figure out if a function and context match. + * @private + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @returns `true` if the listener match the arguments + */ + TickerListener.prototype.match = function (fn, context) { + if (context === void 0) { context = null; } + return this.fn === fn && this.context === context; + }; + /** + * Emit by calling the current function. + * @private + * @param deltaTime - time since the last emit. + * @returns Next ticker + */ + TickerListener.prototype.emit = function (deltaTime) { + if (this.fn) { + if (this.context) { + this.fn.call(this.context, deltaTime); + } + else { + this.fn(deltaTime); + } + } + var redirect = this.next; + if (this.once) { + this.destroy(true); + } + // Soft-destroying should remove + // the next reference + if (this._destroyed) { + this.next = null; + } + return redirect; + }; + /** + * Connect to the list. + * @private + * @param previous - Input node, previous listener + */ + TickerListener.prototype.connect = function (previous) { + this.previous = previous; + if (previous.next) { + previous.next.previous = this; + } + this.next = previous.next; + previous.next = this; + }; + /** + * Destroy and don't use after this. + * @private + * @param hard - `true` to remove the `next` reference, this + * is considered a hard destroy. Soft destroy maintains the next reference. + * @returns The listener to redirect while emitting or removing. + */ + TickerListener.prototype.destroy = function (hard) { + if (hard === void 0) { hard = false; } + this._destroyed = true; + this.fn = null; + this.context = null; + // Disconnect, hook up next and previous + if (this.previous) { + this.previous.next = this.next; + } + if (this.next) { + this.next.previous = this.previous; + } + // Redirect to the next item + var redirect = this.next; + // Remove references + this.next = hard ? null : redirect; + this.previous = null; + return redirect; + }; + return TickerListener; +}()); + +/** + * A Ticker class that runs an update loop that other objects listen to. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. + * @class + * @memberof PIXI + */ +var Ticker = /** @class */ (function () { + function Ticker() { + var _this = this; + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.Ticker#start} automatically + * when a listener is added. + */ + this.autoStart = false; + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + */ + this.deltaTime = 1; + /** + * The last time {@link PIXI.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + */ + this.lastTime = -1; + /** + * Factor of current {@link PIXI.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + */ + this.speed = 1; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.Ticker#start} has been called. + * `false` if {@link PIXI.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.Ticker#autoStart} being `true` + * and a listener is added. + */ + this.started = false; + /** Internal current frame request ID */ + this._requestId = null; + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + */ + this._maxElapsedMS = 100; + /** + * Internal value managed by minFPS property setter and getter. + * This is the minimum allowed milliseconds between updates. + */ + this._minElapsedMS = 0; + /** If enabled, deleting is disabled.*/ + this._protected = false; + /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */ + this._lastFrame = -1; + this._head = new TickerListener(null, null, Infinity); + this.deltaMS = 1 / settings.TARGET_FPMS; + this.elapsedMS = 1 / settings.TARGET_FPMS; + this._tick = function (time) { + _this._requestId = null; + if (_this.started) { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._head.next) { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; + } + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * @private + */ + Ticker.prototype._requestIfNeeded = function () { + if (this._requestId === null && this._head.next) { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._lastFrame = this.lastTime; + this._requestId = requestAnimationFrame(this._tick); + } + }; + /** + * Conditionally cancels a pending animation frame. + * @private + */ + Ticker.prototype._cancelIfNeeded = function () { + if (this._requestId !== null) { + cancelAnimationFrame(this._requestId); + this._requestId = null; + } + }; + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * @private + */ + Ticker.prototype._startIfPossible = function () { + if (this.started) { + this._requestIfNeeded(); + } + else if (this.autoStart) { + this.start(); + } + }; + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * @param fn - The listener function to be added for updates + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.add = function (fn, context, priority) { + if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority)); + }; + /** + * Add a handler for the tick event which is only execute once. + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + Ticker.prototype.addOnce = function (fn, context, priority) { + if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority, true)); + }; + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * @private + * @param listener - Current listener being added. + * @returns This instance of a ticker + */ + Ticker.prototype._addListener = function (listener) { + // For attaching to head + var current = this._head.next; + var previous = this._head; + // Add the first item + if (!current) { + listener.connect(previous); + } + else { + // Go from highest to lowest priority + while (current) { + if (listener.priority > current.priority) { + listener.connect(previous); + break; + } + previous = current; + current = current.next; + } + // Not yet connected + if (!listener.previous) { + listener.connect(previous); + } + } + this._startIfPossible(); + return this; + }; + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * @param fn - The listener function to be removed + * @param context - The listener context to be removed + * @returns This instance of a ticker + */ + Ticker.prototype.remove = function (fn, context) { + var listener = this._head.next; + while (listener) { + // We found a match, lets remove it + // no break to delete all possible matches + // incase a listener was added 2+ times + if (listener.match(fn, context)) { + listener = listener.destroy(); + } + else { + listener = listener.next; + } + } + if (!this._head.next) { + this._cancelIfNeeded(); + } + return this; + }; + Object.defineProperty(Ticker.prototype, "count", { + /** + * The number of listeners on this ticker, calculated by walking through linked list + * @readonly + * @member {number} + */ + get: function () { + if (!this._head) { + return 0; + } + var count = 0; + var current = this._head; + while ((current = current.next)) { + count++; + } + return count; + }, + enumerable: false, + configurable: true + }); + /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */ + Ticker.prototype.start = function () { + if (!this.started) { + this.started = true; + this._requestIfNeeded(); + } + }; + /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */ + Ticker.prototype.stop = function () { + if (this.started) { + this.started = false; + this._cancelIfNeeded(); + } + }; + /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */ + Ticker.prototype.destroy = function () { + if (!this._protected) { + this.stop(); + var listener = this._head.next; + while (listener) { + listener = listener.destroy(true); + } + this._head.destroy(); + this._head = null; + } + }; + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.Ticker#elapsedMS}, + * the current {@link PIXI.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + Ticker.prototype.update = function (currentTime) { + if (currentTime === void 0) { currentTime = performance.now(); } + var elapsedMS; + // If the difference in time is zero or negative, we ignore most of the work done here. + // If there is no valid difference, then should be no reason to let anyone know about it. + // A zero delta, is exactly that, nothing should update. + // + // The difference in time can be negative, and no this does not mean time traveling. + // This can be the result of a race condition between when an animation frame is requested + // on the current JavaScript engine event loop, and when the ticker's start method is invoked + // (which invokes the internal _requestIfNeeded method). If a frame is requested before + // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, + // can receive a time argument that can be less than the lastTime value that was set within + // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. + // + // This check covers this browser engine timing issue, as well as if consumers pass an invalid + // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. + if (currentTime > this.lastTime) { + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) { + elapsedMS = this._maxElapsedMS; + } + elapsedMS *= this.speed; + // If not enough time has passed, exit the function. + // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS + // adjustment to ensure a relatively stable interval. + if (this._minElapsedMS) { + var delta = currentTime - this._lastFrame | 0; + if (delta < this._minElapsedMS) { + return; + } + this._lastFrame = currentTime - (delta % this._minElapsedMS); + } + this.deltaMS = elapsedMS; + this.deltaTime = this.deltaMS * settings.TARGET_FPMS; + // Cache a local reference, in-case ticker is destroyed + // during the emit, we can still check for head.next + var head = this._head; + // Invoke listeners added to internal emitter + var listener = head.next; + while (listener) { + listener = listener.emit(this.deltaTime); + } + if (!head.next) { + this._cancelIfNeeded(); + } + } + else { + this.deltaTime = this.deltaMS = this.elapsedMS = 0; + } + this.lastTime = currentTime; + }; + Object.defineProperty(Ticker.prototype, "FPS", { + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.Ticker#speed}, which is specific + * to scaling {@link PIXI.Ticker#deltaTime}. + * @member {number} + * @readonly + */ + get: function () { + return 1000 / this.elapsedMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "minFPS", { + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.Ticker#update}. + * This value is used to cap {@link PIXI.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * @member {number} + * @default 10 + */ + get: function () { + return 1000 / this._maxElapsedMS; + }, + set: function (fps) { + // Minimum must be below the maxFPS + var minFPS = Math.min(this.maxFPS, fps); + // Must be at least 0, but below 1 / settings.TARGET_FPMS + var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS); + this._maxElapsedMS = 1 / minFPMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "maxFPS", { + /** + * Manages the minimum amount of milliseconds required to + * elapse between invoking {@link PIXI.Ticker#update}. + * This will effect the measured value of {@link PIXI.Ticker#FPS}. + * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. + * Otherwise it will be at least `minFPS` + * @member {number} + * @default 0 + */ + get: function () { + if (this._minElapsedMS) { + return Math.round(1000 / this._minElapsedMS); + } + return 0; + }, + set: function (fps) { + if (fps === 0) { + this._minElapsedMS = 0; + } + else { + // Max must be at least the minFPS + var maxFPS = Math.max(this.minFPS, fps); + this._minElapsedMS = 1 / (maxFPS / 1000); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "shared", { + /** + * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by + * {@link PIXI.VideoResource} to update animation frames / video textures. + * + * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. + * @example + * let ticker = PIXI.Ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.Ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(); + * let stage = new PIXI.Container(); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._shared) { + var shared = Ticker._shared = new Ticker(); + shared.autoStart = true; + shared._protected = true; + } + return Ticker._shared; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "system", { + /** + * The system ticker instance used by {@link PIXI.InteractionManager} and by + * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, + * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._system) { + var system = Ticker._system = new Ticker(); + system.autoStart = true; + system._protected = true; + } + return Ticker._system; + }, + enumerable: false, + configurable: true + }); + return Ticker; +}()); + +/** + * Middleware for for Application Ticker. + * @example + * import {TickerPlugin} from '@pixi/ticker'; + * import {Application} from '@pixi/app'; + * import {extensions} from '@pixi/extensions'; + * extensions.add(TickerPlugin); + * @class + * @memberof PIXI + */ +var TickerPlugin = /** @class */ (function () { + function TickerPlugin() { + } + /** + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options + */ + TickerPlugin.init = function (options) { + var _this = this; + // Set default + options = Object.assign({ + autoStart: true, + sharedTicker: false, + }, options); + // Create ticker setter + Object.defineProperty(this, 'ticker', { + set: function (ticker) { + if (this._ticker) { + this._ticker.remove(this.render, this); + } + this._ticker = ticker; + if (ticker) { + ticker.add(this.render, this, UPDATE_PRIORITY.LOW); + } + }, + get: function () { + return this._ticker; + }, + }); + /** + * Convenience method for stopping the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.stop = function () { + _this._ticker.stop(); + }; + /** + * Convenience method for starting the render. + * @method + * @memberof PIXI.Application + * @instance + */ + this.start = function () { + _this._ticker.start(); + }; + /** + * Internal reference to the ticker. + * @type {PIXI.Ticker} + * @name _ticker + * @memberof PIXI.Application# + * @private + */ + this._ticker = null; + /** + * Ticker for doing render updates. + * @type {PIXI.Ticker} + * @name ticker + * @memberof PIXI.Application# + * @default PIXI.Ticker.shared + */ + this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); + // Start the rendering + if (options.autoStart) { + this.start(); + } + }; + /** + * Clean up the ticker, scoped to application. + * @static + * @private + */ + TickerPlugin.destroy = function () { + if (this._ticker) { + var oldTicker = this._ticker; + this.ticker = null; + oldTicker.destroy(); + } + }; + /** @ignore */ + TickerPlugin.extension = ExtensionType.Application; + return TickerPlugin; +}()); + +export { Ticker, TickerPlugin, UPDATE_PRIORITY }; +//# sourceMappingURL=ticker.mjs.map diff --git a/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs.map b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs.map new file mode 100644 index 0000000..e62c5cb --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/dist/esm/ticker.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"ticker.mjs","sources":["../../src/settings.ts","../../src/const.ts","../../src/TickerListener.ts","../../src/Ticker.ts","../../src/TickerPlugin.ts"],"sourcesContent":["import { settings } from '@pixi/settings';\n\n/**\n * Target frames per millisecond.\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\nexport { settings };\n","/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering.\n * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nexport enum UPDATE_PRIORITY\n// eslint-disable-next-line @typescript-eslint/indent\n{\n INTERACTION = 50,\n HIGH = 25,\n NORMAL = 0,\n LOW = -25,\n UTILITY = -50,\n}\n","import type { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @returns `true` if the listener match the arguments\n */\n match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\n\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @returns Next ticker\n */\n emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\n\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @returns The listener to redirect while emitting or removing.\n */\n destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n * @class\n * @memberof PIXI\n */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n public autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n public lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n public speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the minimum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\n // Invoke listeners now\n this.update(time);\n // Listener side effects may have modified ticker state.\n if (this.started && this._requestId === null && this._head.next)\n {\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n };\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n * @private\n */\n private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n }\n\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n }\n\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n * @private\n */\n private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\n\n /**\n * Add a handler for the tick event which is only execute once.\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\n\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\n\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context))\n {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\n }\n\n /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */\n destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\n }\n\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS)\n {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n * @member {number}\n * @readonly\n */\n get FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n * @member {number}\n * @default 10\n */\n get minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n * @member {number}\n * @default 0\n */\n get maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n * @member {PIXI.Ticker}\n * @static\n */\n static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * @member {PIXI.Ticker}\n * @static\n */\n static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import type { ExtensionMetadata } from '@pixi/extensions';\nimport { ExtensionType } from '@pixi/extensions';\nimport { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * import {extensions} from '@pixi/extensions';\n * extensions.add(TickerPlugin);\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n /** @ignore */\n static extension: ExtensionMetadata = ExtensionType.Application;\n\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAEA;;;;;;;AAOG;AACH,QAAQ,CAAC,WAAW,GAAG,IAAI;;ACV3B;;;;;;;;;;;;;;AAcG;AACH,IAAY,gBAQX;AARD,CAAA,UAAY,eAAe,EAAA;AAGvB,IAAA,eAAA,CAAA,eAAA,CAAA,aAAA,CAAA,GAAA,EAAA,CAAA,GAAA,aAAgB,CAAA;AAChB,IAAA,eAAA,CAAA,eAAA,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAS,CAAA;AACT,IAAA,eAAA,CAAA,eAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU,CAAA;AACV,IAAA,eAAA,CAAA,eAAA,CAAA,KAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,KAAS,CAAA;AACT,IAAA,eAAA,CAAA,eAAA,CAAA,SAAA,CAAA,GAAA,CAAA,EAAA,CAAA,GAAA,SAAa,CAAA;AACjB,CAAC,EARW,eAAe,KAAf,eAAe,GAQ1B,EAAA,CAAA,CAAA;;ACrBD;;;;;AAKG;AACH,IAAA,cAAA,kBAAA,YAAA;AAkBI;;;;;;;AAOG;AACH,IAAA,SAAA,cAAA,CAAY,EAAqB,EAAE,OAAiB,EAAE,QAAY,EAAE,IAAY,EAAA;AAA7C,QAAA,IAAA,OAAA,KAAA,KAAA,CAAA,EAAA,EAAA,OAA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AE/B,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,SAAS,CAAC,OAAO,EAAE,CAAC;AACvB,SAAA;KACJ,CAAA;;AAvGM,IAAA,YAAA,CAAA,SAAS,GAAsB,aAAa,CAAC,WAAW,CAAC;IAwGpE,OAAC,YAAA,CAAA;AAAA,CA3GD,EA2GC;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/ticker/global.d.ts b/live2d/node_modules/@pixi/ticker/global.d.ts new file mode 100644 index 0000000..f858dbd --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/global.d.ts @@ -0,0 +1,15 @@ +declare namespace GlobalMixins +{ + interface Application + { + ticker: import('@pixi/ticker').Ticker; + stop(): void; + start(): void; + } + + interface IApplicationOptions + { + autoStart?: boolean; + sharedTicker?: boolean; + } +} diff --git a/live2d/node_modules/@pixi/ticker/index.d.ts b/live2d/node_modules/@pixi/ticker/index.d.ts new file mode 100644 index 0000000..2c574f7 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/index.d.ts @@ -0,0 +1,329 @@ +/// + +import type { ExtensionMetadata } from '@pixi/extensions'; + +/** + * A Ticker class that runs an update loop that other objects listen to. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. + * @class + * @memberof PIXI + */ +export declare class Ticker { + /** The private shared ticker instance */ + private static _shared; + /** The private system ticker instance */ + private static _system; + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.Ticker#start} automatically + * when a listener is added. + */ + autoStart: boolean; + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + */ + deltaTime: number; + /** + * Scaler time elapsed in milliseconds from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * Defaults to target frame time + * @default 16.66 + */ + deltaMS: number; + /** + * Time elapsed in milliseconds from last frame to this frame. + * Opposed to what the scalar {@link PIXI.Ticker#deltaTime} + * is based, this value is neither capped nor scaled. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * Defaults to target frame time + * @default 16.66 + */ + elapsedMS: number; + /** + * The last time {@link PIXI.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + */ + lastTime: number; + /** + * Factor of current {@link PIXI.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + */ + speed: number; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.Ticker#start} has been called. + * `false` if {@link PIXI.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.Ticker#autoStart} being `true` + * and a listener is added. + */ + started: boolean; + /** The first listener. All new listeners added are chained on this. */ + private _head; + /** Internal current frame request ID */ + private _requestId; + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + */ + private _maxElapsedMS; + /** + * Internal value managed by minFPS property setter and getter. + * This is the minimum allowed milliseconds between updates. + */ + private _minElapsedMS; + /** If enabled, deleting is disabled.*/ + private _protected; + /** The last time keyframe was executed. Maintains a relatively fixed interval with the previous value. */ + private _lastFrame; + /** + * Internal tick method bound to ticker instance. + * This is because in early 2015, Function.bind + * is still 60% slower in high performance scenarios. + * Also separating frame requests from update method + * so listeners may be called at any time and with + * any animation API, just invoke ticker.update(time). + * @param time - Time since last tick. + */ + private _tick; + constructor(); + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * @private + */ + private _requestIfNeeded; + /** + * Conditionally cancels a pending animation frame. + * @private + */ + private _cancelIfNeeded; + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * @private + */ + private _startIfPossible; + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * @param fn - The listener function to be added for updates + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + add(fn: TickerCallback, context?: T, priority?: UPDATE_PRIORITY): this; + /** + * Add a handler for the tick event which is only execute once. + * @param fn - The listener function to be added for one update + * @param context - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns This instance of a ticker + */ + addOnce(fn: TickerCallback, context?: T, priority?: UPDATE_PRIORITY): this; + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * @private + * @param listener - Current listener being added. + * @returns This instance of a ticker + */ + private _addListener; + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * @param fn - The listener function to be removed + * @param context - The listener context to be removed + * @returns This instance of a ticker + */ + remove(fn: TickerCallback, context?: T): this; + /** + * The number of listeners on this ticker, calculated by walking through linked list + * @readonly + * @member {number} + */ + get count(): number; + /** Starts the ticker. If the ticker has listeners a new animation frame is requested at this point. */ + start(): void; + /** Stops the ticker. If the ticker has requested an animation frame it is canceled at this point. */ + stop(): void; + /** Destroy the ticker and don't use after this. Calling this method removes all references to internal events. */ + destroy(): void; + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.Ticker#elapsedMS}, + * the current {@link PIXI.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + update(currentTime?: number): void; + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.Ticker#speed}, which is specific + * to scaling {@link PIXI.Ticker#deltaTime}. + * @member {number} + * @readonly + */ + get FPS(): number; + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.Ticker#update}. + * This value is used to cap {@link PIXI.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * @member {number} + * @default 10 + */ + get minFPS(): number; + set minFPS(fps: number); + /** + * Manages the minimum amount of milliseconds required to + * elapse between invoking {@link PIXI.Ticker#update}. + * This will effect the measured value of {@link PIXI.Ticker#FPS}. + * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. + * Otherwise it will be at least `minFPS` + * @member {number} + * @default 0 + */ + get maxFPS(): number; + set maxFPS(fps: number); + /** + * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by + * {@link PIXI.VideoResource} to update animation frames / video textures. + * + * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. + * @example + * let ticker = PIXI.Ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.Ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(); + * let stage = new PIXI.Container(); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * @member {PIXI.Ticker} + * @static + */ + static get shared(): Ticker; + /** + * The system ticker instance used by {@link PIXI.InteractionManager} and by + * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, + * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * @member {PIXI.Ticker} + * @static + */ + static get system(): Ticker; +} + +export declare type TickerCallback = (this: T, dt: number) => any; + +/** + * Middleware for for Application Ticker. + * @example + * import {TickerPlugin} from '@pixi/ticker'; + * import {Application} from '@pixi/app'; + * import {extensions} from '@pixi/extensions'; + * extensions.add(TickerPlugin); + * @class + * @memberof PIXI + */ +export declare class TickerPlugin { + /** @ignore */ + static extension: ExtensionMetadata; + static start: () => void; + static stop: () => void; + static _ticker: Ticker; + static ticker: Ticker; + /** + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options + */ + static init(options?: GlobalMixins.IApplicationOptions): void; + /** + * Clean up the ticker, scoped to application. + * @static + * @private + */ + static destroy(): void; +} + +/** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @enum {number} + * @property {number} [INTERACTION=50] Highest priority, used for {@link PIXI.InteractionManager} + * @property {number} [HIGH=25] High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} + * @property {number} [NORMAL=0] Default priority for ticker events, see {@link PIXI.Ticker#add}. + * @property {number} [LOW=-25] Low priority used for {@link PIXI.Application} rendering. + * @property {number} [UTILITY=-50] Lowest priority used for {@link PIXI.BasePrepare} utility. + */ +export declare enum UPDATE_PRIORITY { + INTERACTION = 50, + HIGH = 25, + NORMAL = 0, + LOW = -25, + UTILITY = -50 +} + +export { } diff --git a/live2d/node_modules/@pixi/ticker/package.json b/live2d/node_modules/@pixi/ticker/package.json new file mode 100644 index 0000000..9c02600 --- /dev/null +++ b/live2d/node_modules/@pixi/ticker/package.json @@ -0,0 +1,45 @@ +{ + "name": "@pixi/ticker", + "version": "6.5.10", + "main": "dist/cjs/ticker.js", + "module": "dist/esm/ticker.mjs", + "bundle": "dist/browser/ticker.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/ticker.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/ticker.js" + } + } + }, + "description": "Tickers are control the timings within PixiJS", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "peerDependencies": { + "@pixi/extensions": "6.5.10", + "@pixi/settings": "6.5.10" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@pixi/utils/LICENSE b/live2d/node_modules/@pixi/utils/LICENSE new file mode 100644 index 0000000..148e3eb --- /dev/null +++ b/live2d/node_modules/@pixi/utils/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2013-2018 Mathew Groves, Chad Engler + +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. \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/README.md b/live2d/node_modules/@pixi/utils/README.md new file mode 100644 index 0000000..fdfb2dc --- /dev/null +++ b/live2d/node_modules/@pixi/utils/README.md @@ -0,0 +1,13 @@ +# @pixi/utils + +## Installation + +```bash +npm install @pixi/utils +``` + +## Usage + +```js +import * as utils from '@pixi/utils'; +``` \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/browser/utils.js b/live2d/node_modules/@pixi/utils/dist/browser/utils.js new file mode 100644 index 0000000..f14f4f7 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/browser/utils.js @@ -0,0 +1,4259 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI = this.PIXI || {}; +this.PIXI.utils = this.PIXI.utils || {}; +var _pixi_utils = (function (exports, settings, constants) { + 'use strict'; + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function createCommonjsModule(fn, basedir, module) { + return module = { + path: basedir, + exports: {}, + require: function (path, base) { + return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); + } + }, fn(module, module.exports), module.exports; + } + + function getDefaultExportFromNamespaceIfPresent (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n; + } + + function getDefaultExportFromNamespaceIfNotNamed (n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n; + } + + function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var a = Object.defineProperty({}, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; + } + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); + } + + var eventemitter3 = createCommonjsModule(function (module) { + 'use strict'; + + 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 arguments$1 = arguments; + + 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$1[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$1[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. + // + if ('undefined' !== 'object') { + module.exports = EventEmitter; + } + }); + + 'use strict'; + + var earcut_1 = earcut; + var _default = earcut; + + function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode || outerNode.next === outerNode.prev) { return triangles; } + + var minX, minY, maxX, maxY, x, y, invSize; + + if (hasHoles) { outerNode = eliminateHoles(data, holeIndices, outerNode, dim); } + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) { minX = x; } + if (y < minY) { minY = y; } + if (x > maxX) { maxX = x; } + if (y > maxY) { maxY = y; } + } + + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 32767 / invSize : 0; + } + + earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); + + return triangles; + } + + // create a circular doubly linked list from polygon points in the specified winding order + function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) { last = insertNode(i, data[i], data[i + 1], last); } + } else { + for (i = end - dim; i >= start; i -= dim) { last = insertNode(i, data[i], data[i + 1], last); } + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; + } + + // eliminate colinear or duplicate points + function filterPoints(start, end) { + if (!start) { return start; } + if (!end) { end = start; } + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) { break; } + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; + } + + // main ear slicing loop which triangulates a polygon (given as a linked list) + function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) { return; } + + // interlink polygon nodes in z-order + if (!pass && invSize) { indexCurve(ear, minX, minY, invSize); } + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim | 0); + triangles.push(ear.i / dim | 0); + triangles.push(next.i / dim | 0); + + removeNode(ear); + + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(filterPoints(ear), triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } + + break; + } + } + } + + // check whether a polygon node forms a valid ear with adjacent nodes + function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + var p = c.next; + while (p !== a) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && + area(p.prev, p, p.next) >= 0) { return false; } + p = p.next; + } + + return true; + } + + function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear + + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + // z-order range for the current triangle bbox; + var minZ = zOrder(x0, y0, minX, minY, invSize), + maxZ = zOrder(x1, y1, minX, minY, invSize); + + var p = ear.prevZ, + n = ear.nextZ; + + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) { return false; } + p = p.prevZ; + + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) { return false; } + n = n.nextZ; + } + + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) { return false; } + p = p.prevZ; + } + + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) { return false; } + n = n.nextZ; + } + + return true; + } + + // go through all polygon nodes and cure small local self-intersections + function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim | 0); + triangles.push(p.i / dim | 0); + triangles.push(b.i / dim | 0); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return filterPoints(p); + } + + // try splitting polygon into two and triangulate them independently + function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize, 0); + earcutLinked(c, triangles, dim, minX, minY, invSize, 0); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); + } + + // link every hole into the outer loop, producing a single-ring polygon without holes + function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) { list.steiner = true; } + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + outerNode = eliminateHole(queue[i], outerNode); + } + + return outerNode; + } + + function compareX(a, b) { + return a.x - b.x; + } + + // find a bridge between vertices that connects hole with an outer ring and and link it + function eliminateHole(hole, outerNode) { + var bridge = findHoleBridge(hole, outerNode); + if (!bridge) { + return outerNode; + } + + var bridgeReverse = splitPolygon(bridge, hole); + + // filter collinear points around the cuts + filterPoints(bridgeReverse, bridgeReverse.next); + return filterPoints(bridge, bridge.next); + } + + // David Eberly's algorithm for finding a bridge between hole and outer polygon + function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + m = p.x < p.next.x ? p : p.next; + if (x === hx) { return m; } // hole touches outer segment; pick leftmost endpoint + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) { return null; } + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m; + + do { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if (locallyInside(p, hole) && + (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } while (p !== stop); + + return m; + } + + // whether sector in vertex m contains sector in vertex p in the same coordinates + function sectorContainsSector(m, p) { + return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; + } + + // interlink polygon nodes in z-order + function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === 0) { p.z = zOrder(p.x, p.y, minX, minY, invSize); } + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); + } + + // Simon Tatham's linked list merge sort algorithm + // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html + function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) { break; } + } + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) { tail.nextZ = e; } + else { list = e; } + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; + } + + // z-order of a point given coords and inverse of the longer side of data bbox + function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = (x - minX) * invSize | 0; + y = (y - minY) * invSize | 0; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); + } + + // find the leftmost node of a polygon ring + function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) { leftmost = p; } + p = p.next; + } while (p !== start); + + return leftmost; + } + + // check if a point lies within a convex triangle + function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && + (ax - px) * (by - py) >= (bx - px) * (ay - py) && + (bx - px) * (cy - py) >= (cx - px) * (by - py); + } + + // check if a diagonal between two polygon nodes is valid (lies in polygon interior) + function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges + (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible + (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case + } + + // signed area of a triangle + function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); + } + + // check if two points are equal + function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; + } + + // check if two segments intersect + function intersects(p1, q1, p2, q2) { + var o1 = sign$1(area(p1, q1, p2)); + var o2 = sign$1(area(p1, q1, q2)); + var o3 = sign$1(area(p2, q2, p1)); + var o4 = sign$1(area(p2, q2, q1)); + + if (o1 !== o2 && o3 !== o4) { return true; } // general case + + if (o1 === 0 && onSegment(p1, p2, q1)) { return true; } // p1, q1 and p2 are collinear and p2 lies on p1q1 + if (o2 === 0 && onSegment(p1, q2, q1)) { return true; } // p1, q1 and q2 are collinear and q2 lies on p1q1 + if (o3 === 0 && onSegment(p2, p1, q2)) { return true; } // p2, q2 and p1 are collinear and p1 lies on p2q2 + if (o4 === 0 && onSegment(p2, q1, q2)) { return true; } // p2, q2 and q1 are collinear and q1 lies on p2q2 + + return false; + } + + // for collinear points p, q, r, check if point q lies on segment pr + function onSegment(p, q, r) { + return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); + } + + function sign$1(num) { + return num > 0 ? 1 : num < 0 ? -1 : 0; + } + + // check if a polygon diagonal intersects any polygon segments + function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) { return true; } + p = p.next; + } while (p !== a); + + return false; + } + + // check if a polygon diagonal is locally inside the polygon + function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; + } + + // check if the middle point of a polygon diagonal is inside the polygon + function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + { inside = !inside; } + p = p.next; + } while (p !== a); + + return inside; + } + + // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; + // if one belongs to the outer ring and another to a hole, it merges it into a single ring + function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; + } + + // create a node and optionally link it with previous one (in a circular doubly linked list) + function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; + } + + function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) { p.prevZ.nextZ = p.nextZ; } + if (p.nextZ) { p.nextZ.prevZ = p.prevZ; } + } + + function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = 0; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; + } + + // return a percentage difference between the polygon area and its triangulation area; + // used to verify correctness of triangulation + earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); + }; + + function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; + } + + // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts + earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) { result.vertices.push(data[i][j][d]); } + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; + }; + earcut_1.default = _default; + + var punycode = createCommonjsModule(function (module, exports) { + /*! https://mths.be/punycode v1.3.2 by @mathias */ + ;(function(root) { + + /** Detect free variables */ + var freeExports = 'object' == 'object' && exports && + !exports.nodeType && exports; + var freeModule = 'object' == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * http://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof undefined == 'function' && + typeof undefined.amd == 'object' && + undefined.amd + ) { + undefined('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { // in Rhino or a web browser + root.punycode = punycode; + } + + }(commonjsGlobal)); + }); + + 'use strict'; + + var util = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } + }; + + // Copyright Joyent, Inc. and other Node 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. + + 'use strict'; + + // If obj.hasOwnProperty has been overridden, then calling + // obj.hasOwnProperty(prop) will break. + // See: https://github.com/joyent/node/issues/1707 + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + var decode = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (Array.isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; + }; + + // Copyright Joyent, Inc. and other Node 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. + + 'use strict'; + + var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } + }; + + var encode = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return Object.keys(obj).map(function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (Array.isArray(obj[k])) { + return obj[k].map(function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) { return ''; } + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); + }; + + var querystring = createCommonjsModule(function (module, exports) { + 'use strict'; + + exports.decode = exports.parse = decode; + exports.encode = exports.stringify = encode; + }); + + // Copyright Joyent, Inc. and other Node 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. + + 'use strict'; + + + + + var parse = urlParse; + var resolve = urlResolve; + var resolveObject = urlResolveObject; + var format = urlFormat; + + var Url_1 = Url; + + function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; + } + + // Reference: RFC 3986, RFC 1808, RFC 2396 + + // define these here so at least they only have to be + // compiled once on the first module load. + var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }; + + function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) { return url; } + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; + } + + Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + { hostEnd = hec; } + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + { hostEnd = hec; } + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + { hostEnd = rest.length; } + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) { continue; } + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + { continue; } + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) { this.pathname = rest; } + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; + }; + + // format a parsed object into a url string + function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) { obj = urlParse(obj); } + if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); } + return obj.format(); + } + + Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; } + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; } + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; } + if (search && search.charAt(0) !== '?') { search = '?' + search; } + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; + }; + + function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); + } + + Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); + }; + + function urlResolveObject(source, relative) { + if (!source) { return relative; } + return urlParse(source, false, true).resolveObject(relative); + } + + Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + { result[rkey] = relative[rkey]; } + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())){ ; } + if (!relative.host) { relative.host = ''; } + if (!relative.hostname) { relative.hostname = ''; } + if (relPath[0] !== '') { relPath.unshift(''); } + if (relPath.length < 2) { relPath.unshift(''); } + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') { srcPath[0] = result.host; } + else { srcPath.unshift(result.host); } + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') { relPath[0] = relative.host; } + else { relPath.unshift(relative.host); } + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) { srcPath = []; } + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + }; + + Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) { this.hostname = host; } + }; + + var url$1 = { + parse: parse, + resolve: resolve, + resolveObject: resolveObject, + format: format, + Url: Url_1 + }; + + /** + * This file contains redeclared types for Node `url` and `querystring` modules. These modules + * don't provide their own typings but instead are a part of the full Node typings. The purpose of + * this file is to redeclare the required types to avoid having the whole Node types as a + * dependency. + */ + var url = { + parse: parse, + format: format, + resolve: resolve, + }; + + function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError("Path must be a string. Received " + JSON.stringify(path)); + } + } + function removeUrlParams(url) { + var re = url.split('?')[0]; + return re.split('#')[0]; + } + function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string + } + function replaceAll(str, find, replace) { + return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); + } + // Resolves . and .. elements in a path with directory names + function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) { + code = path.charCodeAt(i); + } + else if (code === 47) { + break; + } + else { + code = 47; + } + if (code === 47) { + if (lastSlash === i - 1 || dots === 1) { + // NOOP + } + else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 + || lastSegmentLength !== 2 + || res.charCodeAt(res.length - 1) !== 46 + || res.charCodeAt(res.length - 2) !== 46) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } + else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } + else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) { + res += '/..'; + } + else { + res = '..'; + } + lastSegmentLength = 2; + } + } + else { + if (res.length > 0) { + res += "/" + path.slice(lastSlash + 1, i); + } + else { + res = path.slice(lastSlash + 1, i); + } + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } + else if (code === 46 && dots !== -1) { + ++dots; + } + else { + dots = -1; + } + } + return res; + } + var path = { + /** + * Converts a path to posix format. + * @param path - The path to convert to posix + */ + toPosix: function (path) { return replaceAll(path, '\\', '/'); }, + /** + * Checks if the path is a URL + * @param path - The path to check + */ + isUrl: function (path) { return (/^https?:/).test(this.toPosix(path)); }, + /** + * Checks if the path is a data URL + * @param path - The path to check + */ + isDataUrl: function (path) { + // eslint-disable-next-line max-len + return (/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i) + .test(path); + }, + /** + * Checks if the path has a protocol e.g. http:// + * This will return true for windows file paths + * @param path - The path to check + */ + hasProtocol: function (path) { return (/^[^/:]+:\//).test(this.toPosix(path)); }, + /** + * Returns the protocol of the path e.g. http://, C:/, file:/// + * @param path - The path to get the protocol from + */ + getProtocol: function (path) { + assertPath(path); + path = this.toPosix(path); + var protocol = ''; + var isFile = (/^file:\/\/\//).exec(path); + var isHttp = (/^[^/:]+:\/\//).exec(path); + var isWindows = (/^[^/:]+:\//).exec(path); + if (isFile || isHttp || isWindows) { + var arr = (isFile === null || isFile === void 0 ? void 0 : isFile[0]) || (isHttp === null || isHttp === void 0 ? void 0 : isHttp[0]) || (isWindows === null || isWindows === void 0 ? void 0 : isWindows[0]); + protocol = arr; + path = path.slice(arr.length); + } + return protocol; + }, + /** + * Converts URL to an absolute path. + * When loading from a Web Worker, we must use absolute paths. + * If the URL is already absolute we return it as is + * If it's not, we convert it + * @param url - The URL to test + * @param customBaseUrl - The base URL to use + * @param customRootUrl - The root URL to use + */ + toAbsolute: function (url, customBaseUrl, customRootUrl) { + if (this.isDataUrl(url)) + { return url; } + var baseUrl = removeUrlParams(this.toPosix(customBaseUrl !== null && customBaseUrl !== void 0 ? customBaseUrl : settings.settings.ADAPTER.getBaseUrl())); + var rootUrl = removeUrlParams(this.toPosix(customRootUrl !== null && customRootUrl !== void 0 ? customRootUrl : this.rootname(baseUrl))); + assertPath(url); + url = this.toPosix(url); + // root relative url + if (url.startsWith('/')) { + return path.join(rootUrl, url.slice(1)); + } + var absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url); + return absolutePath; + }, + /** + * Normalizes the given path, resolving '..' and '.' segments + * @param path - The path to normalize + */ + normalize: function (path) { + path = this.toPosix(path); + assertPath(path); + if (path.length === 0) + { return '.'; } + var protocol = ''; + var isAbsolute = path.startsWith('/'); + if (this.hasProtocol(path)) { + protocol = this.rootname(path); + path = path.slice(protocol.length); + } + var trailingSeparator = path.endsWith('/'); + // Normalize the path + path = normalizeStringPosix(path, false); + if (path.length > 0 && trailingSeparator) + { path += '/'; } + if (isAbsolute) + { return "/" + path; } + return protocol + path; + }, + /** + * Determines if path is an absolute path. + * Absolute paths can be urls, data urls, or paths on disk + * @param path - The path to test + */ + isAbsolute: function (path) { + assertPath(path); + path = this.toPosix(path); + if (this.hasProtocol(path)) + { return true; } + return path.startsWith('/'); + }, + /** + * Joins all given path segments together using the platform-specific separator as a delimiter, + * then normalizes the resulting path + * @param segments - The segments of the path to join + */ + join: function () { + var arguments$1 = arguments; + + var _a; + var segments = []; + for (var _i = 0; _i < arguments.length; _i++) { + segments[_i] = arguments$1[_i]; + } + if (segments.length === 0) { + return '.'; + } + var joined; + for (var i = 0; i < segments.length; ++i) { + var arg = segments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + { joined = arg; } + else { + var prevArg = (_a = segments[i - 1]) !== null && _a !== void 0 ? _a : ''; + if (this.extname(prevArg)) { + joined += "/../" + arg; + } + else { + joined += "/" + arg; + } + } + } + } + if (joined === undefined) { + return '.'; + } + return this.normalize(joined); + }, + /** + * Returns the directory name of a path + * @param path - The path to parse + */ + dirname: function (path) { + assertPath(path); + if (path.length === 0) + { return '.'; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var hasRoot = code === 47; + var end = -1; + var matchedSlash = true; + var proto = this.getProtocol(path); + var origpath = path; + path = path.slice(proto.length); + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47) { + if (!matchedSlash) { + end = i; + break; + } + } + else { + // We saw the first non-path separator + matchedSlash = false; + } + } + // if end is -1 and its a url then we need to add the path back + // eslint-disable-next-line no-nested-ternary + if (end === -1) + { return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto; } + if (hasRoot && end === 1) + { return '//'; } + return proto + path.slice(0, end); + }, + /** + * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/ + * @param path - The path to parse + */ + rootname: function (path) { + assertPath(path); + path = this.toPosix(path); + var root = ''; + if (path.startsWith('/')) + { root = '/'; } + else { + root = this.getProtocol(path); + } + if (this.isUrl(path)) { + // need to find the first path separator + var index = path.indexOf('/', root.length); + if (index !== -1) { + root = path.slice(0, index); + } + else + { root = path; } + if (!root.endsWith('/')) + { root += '/'; } + } + return root; + }, + /** + * Returns the last portion of a path + * @param path - The path to test + * @param ext - Optional extension to remove + */ + basename: function (path, ext) { + assertPath(path); + if (ext) + { assertPath(ext); } + path = this.toPosix(path); + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) + { return ''; } + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } + else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) + { end = firstNonSlashEnd; } + else if (end === -1) + { end = path.length; } + return path.slice(start, end); + } + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + if (end === -1) + { return ''; } + return path.slice(start, end); + }, + /** + * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last + * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than + * the first character of the basename of path, an empty string is returned. + * @param path - The path to parse + */ + extname: function (path) { + assertPath(path); + path = this.toPosix(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, + /** + * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties. + * @param path - The path to parse + */ + parse: function (path) { + assertPath(path); + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) + { return ret; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var isAbsolute = this.isAbsolute(path); + var start; + var protocol = ''; + ret.root = this.rootname(path); + if (isAbsolute || this.hasProtocol(path)) { + start = 1; + } + else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) + { ret.base = ret.name = path.slice(1, end); } + else + { ret.base = ret.name = path.slice(startPart, end); } + } + } + else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } + else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } + ret.dir = this.dirname(path); + if (protocol) + { ret.dir = protocol + ret.dir; } + return ret; + }, + sep: '/', + delimiter: ':' + }; + + /** + * The prefix that denotes a URL is for a retina asset. + * @static + * @name RETINA_PREFIX + * @memberof PIXI.settings + * @type {RegExp} + * @default /@([0-9\.]+)x/ + * @example `@2x` + */ + settings.settings.RETINA_PREFIX = /@([0-9\.]+)x/; + /** + * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. + * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when + * using WebGL. + * + * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible. + * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the + * browser. + * + * If your application requires high performance rendering, you may wish to set this to false. + * We recommend one of two options if you decide to set this flag to false: + * + * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is + * not supported. + * + * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS + * renderer, and show an error message to the user if the function returns false, explaining that their device & browser + * combination does not support high performance WebGL. + * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails. + * @static + * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + settings.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false; + + var saidHello = false; + var VERSION = '6.5.10'; + /** + * Skips the hello message of renderers that are created after this is run. + * @function skipHello + * @memberof PIXI.utils + */ + function skipHello() { + saidHello = true; + } + /** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever make you a jerk face. + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ + function sayHello(type) { + var _a; + if (saidHello) { + return; + } + if (settings.settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1) { + var args = [ + "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", + 'background: #ff66a5; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff66a5; background: #030307; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'background: #ffc3dc; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;' ]; + (_a = globalThis.console).log.apply(_a, args); + } + else if (globalThis.console) { + globalThis.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); + } + saidHello = true; + } + + var supported; + /** + * Helper for checking for WebGL support. + * @memberof PIXI.utils + * @function isWebGLSupported + * @returns {boolean} Is WebGL supported. + */ + function isWebGLSupported() { + if (typeof supported === 'undefined') { + supported = (function supported() { + var contextOptions = { + stencil: true, + failIfMajorPerformanceCaveat: settings.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, + }; + try { + if (!settings.settings.ADAPTER.getWebGLRenderingContext()) { + return false; + } + var canvas = settings.settings.ADAPTER.createCanvas(); + var gl = (canvas.getContext('webgl', contextOptions) + || canvas.getContext('experimental-webgl', contextOptions)); + var success = !!(gl && gl.getContextAttributes().stencil); + if (gl) { + var loseContext = gl.getExtension('WEBGL_lose_context'); + if (loseContext) { + loseContext.loseContext(); + } + } + gl = null; + return success; + } + catch (e) { + return false; + } + })(); + } + return supported; + } + + var aliceblue = "#f0f8ff"; + var antiquewhite = "#faebd7"; + var aqua = "#00ffff"; + var aquamarine = "#7fffd4"; + var azure = "#f0ffff"; + var beige = "#f5f5dc"; + var bisque = "#ffe4c4"; + var black = "#000000"; + var blanchedalmond = "#ffebcd"; + var blue = "#0000ff"; + var blueviolet = "#8a2be2"; + var brown = "#a52a2a"; + var burlywood = "#deb887"; + var cadetblue = "#5f9ea0"; + var chartreuse = "#7fff00"; + var chocolate = "#d2691e"; + var coral = "#ff7f50"; + var cornflowerblue = "#6495ed"; + var cornsilk = "#fff8dc"; + var crimson = "#dc143c"; + var cyan = "#00ffff"; + var darkblue = "#00008b"; + var darkcyan = "#008b8b"; + var darkgoldenrod = "#b8860b"; + var darkgray = "#a9a9a9"; + var darkgreen = "#006400"; + var darkgrey = "#a9a9a9"; + var darkkhaki = "#bdb76b"; + var darkmagenta = "#8b008b"; + var darkolivegreen = "#556b2f"; + var darkorange = "#ff8c00"; + var darkorchid = "#9932cc"; + var darkred = "#8b0000"; + var darksalmon = "#e9967a"; + var darkseagreen = "#8fbc8f"; + var darkslateblue = "#483d8b"; + var darkslategray = "#2f4f4f"; + var darkslategrey = "#2f4f4f"; + var darkturquoise = "#00ced1"; + var darkviolet = "#9400d3"; + var deeppink = "#ff1493"; + var deepskyblue = "#00bfff"; + var dimgray = "#696969"; + var dimgrey = "#696969"; + var dodgerblue = "#1e90ff"; + var firebrick = "#b22222"; + var floralwhite = "#fffaf0"; + var forestgreen = "#228b22"; + var fuchsia = "#ff00ff"; + var gainsboro = "#dcdcdc"; + var ghostwhite = "#f8f8ff"; + var goldenrod = "#daa520"; + var gold = "#ffd700"; + var gray = "#808080"; + var green = "#008000"; + var greenyellow = "#adff2f"; + var grey = "#808080"; + var honeydew = "#f0fff0"; + var hotpink = "#ff69b4"; + var indianred = "#cd5c5c"; + var indigo = "#4b0082"; + var ivory = "#fffff0"; + var khaki = "#f0e68c"; + var lavenderblush = "#fff0f5"; + var lavender = "#e6e6fa"; + var lawngreen = "#7cfc00"; + var lemonchiffon = "#fffacd"; + var lightblue = "#add8e6"; + var lightcoral = "#f08080"; + var lightcyan = "#e0ffff"; + var lightgoldenrodyellow = "#fafad2"; + var lightgray = "#d3d3d3"; + var lightgreen = "#90ee90"; + var lightgrey = "#d3d3d3"; + var lightpink = "#ffb6c1"; + var lightsalmon = "#ffa07a"; + var lightseagreen = "#20b2aa"; + var lightskyblue = "#87cefa"; + var lightslategray = "#778899"; + var lightslategrey = "#778899"; + var lightsteelblue = "#b0c4de"; + var lightyellow = "#ffffe0"; + var lime = "#00ff00"; + var limegreen = "#32cd32"; + var linen = "#faf0e6"; + var magenta = "#ff00ff"; + var maroon = "#800000"; + var mediumaquamarine = "#66cdaa"; + var mediumblue = "#0000cd"; + var mediumorchid = "#ba55d3"; + var mediumpurple = "#9370db"; + var mediumseagreen = "#3cb371"; + var mediumslateblue = "#7b68ee"; + var mediumspringgreen = "#00fa9a"; + var mediumturquoise = "#48d1cc"; + var mediumvioletred = "#c71585"; + var midnightblue = "#191970"; + var mintcream = "#f5fffa"; + var mistyrose = "#ffe4e1"; + var moccasin = "#ffe4b5"; + var navajowhite = "#ffdead"; + var navy = "#000080"; + var oldlace = "#fdf5e6"; + var olive = "#808000"; + var olivedrab = "#6b8e23"; + var orange = "#ffa500"; + var orangered = "#ff4500"; + var orchid = "#da70d6"; + var palegoldenrod = "#eee8aa"; + var palegreen = "#98fb98"; + var paleturquoise = "#afeeee"; + var palevioletred = "#db7093"; + var papayawhip = "#ffefd5"; + var peachpuff = "#ffdab9"; + var peru = "#cd853f"; + var pink = "#ffc0cb"; + var plum = "#dda0dd"; + var powderblue = "#b0e0e6"; + var purple = "#800080"; + var rebeccapurple = "#663399"; + var red = "#ff0000"; + var rosybrown = "#bc8f8f"; + var royalblue = "#4169e1"; + var saddlebrown = "#8b4513"; + var salmon = "#fa8072"; + var sandybrown = "#f4a460"; + var seagreen = "#2e8b57"; + var seashell = "#fff5ee"; + var sienna = "#a0522d"; + var silver = "#c0c0c0"; + var skyblue = "#87ceeb"; + var slateblue = "#6a5acd"; + var slategray = "#708090"; + var slategrey = "#708090"; + var snow = "#fffafa"; + var springgreen = "#00ff7f"; + var steelblue = "#4682b4"; + var tan = "#d2b48c"; + var teal = "#008080"; + var thistle = "#d8bfd8"; + var tomato = "#ff6347"; + var turquoise = "#40e0d0"; + var violet = "#ee82ee"; + var wheat = "#f5deb3"; + var white = "#ffffff"; + var whitesmoke = "#f5f5f5"; + var yellow = "#ffff00"; + var yellowgreen = "#9acd32"; + var cssColorNames = { + aliceblue: aliceblue, + antiquewhite: antiquewhite, + aqua: aqua, + aquamarine: aquamarine, + azure: azure, + beige: beige, + bisque: bisque, + black: black, + blanchedalmond: blanchedalmond, + blue: blue, + blueviolet: blueviolet, + brown: brown, + burlywood: burlywood, + cadetblue: cadetblue, + chartreuse: chartreuse, + chocolate: chocolate, + coral: coral, + cornflowerblue: cornflowerblue, + cornsilk: cornsilk, + crimson: crimson, + cyan: cyan, + darkblue: darkblue, + darkcyan: darkcyan, + darkgoldenrod: darkgoldenrod, + darkgray: darkgray, + darkgreen: darkgreen, + darkgrey: darkgrey, + darkkhaki: darkkhaki, + darkmagenta: darkmagenta, + darkolivegreen: darkolivegreen, + darkorange: darkorange, + darkorchid: darkorchid, + darkred: darkred, + darksalmon: darksalmon, + darkseagreen: darkseagreen, + darkslateblue: darkslateblue, + darkslategray: darkslategray, + darkslategrey: darkslategrey, + darkturquoise: darkturquoise, + darkviolet: darkviolet, + deeppink: deeppink, + deepskyblue: deepskyblue, + dimgray: dimgray, + dimgrey: dimgrey, + dodgerblue: dodgerblue, + firebrick: firebrick, + floralwhite: floralwhite, + forestgreen: forestgreen, + fuchsia: fuchsia, + gainsboro: gainsboro, + ghostwhite: ghostwhite, + goldenrod: goldenrod, + gold: gold, + gray: gray, + green: green, + greenyellow: greenyellow, + grey: grey, + honeydew: honeydew, + hotpink: hotpink, + indianred: indianred, + indigo: indigo, + ivory: ivory, + khaki: khaki, + lavenderblush: lavenderblush, + lavender: lavender, + lawngreen: lawngreen, + lemonchiffon: lemonchiffon, + lightblue: lightblue, + lightcoral: lightcoral, + lightcyan: lightcyan, + lightgoldenrodyellow: lightgoldenrodyellow, + lightgray: lightgray, + lightgreen: lightgreen, + lightgrey: lightgrey, + lightpink: lightpink, + lightsalmon: lightsalmon, + lightseagreen: lightseagreen, + lightskyblue: lightskyblue, + lightslategray: lightslategray, + lightslategrey: lightslategrey, + lightsteelblue: lightsteelblue, + lightyellow: lightyellow, + lime: lime, + limegreen: limegreen, + linen: linen, + magenta: magenta, + maroon: maroon, + mediumaquamarine: mediumaquamarine, + mediumblue: mediumblue, + mediumorchid: mediumorchid, + mediumpurple: mediumpurple, + mediumseagreen: mediumseagreen, + mediumslateblue: mediumslateblue, + mediumspringgreen: mediumspringgreen, + mediumturquoise: mediumturquoise, + mediumvioletred: mediumvioletred, + midnightblue: midnightblue, + mintcream: mintcream, + mistyrose: mistyrose, + moccasin: moccasin, + navajowhite: navajowhite, + navy: navy, + oldlace: oldlace, + olive: olive, + olivedrab: olivedrab, + orange: orange, + orangered: orangered, + orchid: orchid, + palegoldenrod: palegoldenrod, + palegreen: palegreen, + paleturquoise: paleturquoise, + palevioletred: palevioletred, + papayawhip: papayawhip, + peachpuff: peachpuff, + peru: peru, + pink: pink, + plum: plum, + powderblue: powderblue, + purple: purple, + rebeccapurple: rebeccapurple, + red: red, + rosybrown: rosybrown, + royalblue: royalblue, + saddlebrown: saddlebrown, + salmon: salmon, + sandybrown: sandybrown, + seagreen: seagreen, + seashell: seashell, + sienna: sienna, + silver: silver, + skyblue: skyblue, + slateblue: slateblue, + slategray: slategray, + slategrey: slategrey, + snow: snow, + springgreen: springgreen, + steelblue: steelblue, + tan: tan, + teal: teal, + thistle: thistle, + tomato: tomato, + turquoise: turquoise, + violet: violet, + wheat: wheat, + white: white, + whitesmoke: whitesmoke, + yellow: yellow, + yellowgreen: yellowgreen + }; + + /** + * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). + * @example + * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The hexadecimal number to convert + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one + * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats. + */ + function hex2rgb(hex, out) { + if (out === void 0) { out = []; } + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + return out; + } + /** + * Converts a hexadecimal color number to a string. + * @example + * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex (e.g., `0xffffff`) + * @returns {string} The string color (e.g., `"#ffffff"`). + */ + function hex2string(hex) { + var hexString = hex.toString(16); + hexString = '000000'.substring(0, 6 - hexString.length) + hexString; + return "#" + hexString; + } + /** + * Converts a string to a hexadecimal color number. + * It can handle: + * hex strings starting with #: "#ffffff" + * hex strings starting with 0x: "0xffffff" + * hex strings without prefix: "ffffff" + * css colors: "black" + * @example + * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function string2hex + * @param {string} string - The string color (e.g., `"#ffffff"`) + * @returns {number} Number in hexadecimal. + */ + function string2hex(string) { + if (typeof string === 'string') { + string = cssColorNames[string.toLowerCase()] || string; + if (string[0] === '#') { + string = string.slice(1); + } + } + return parseInt(string, 16); + } + /** + * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. + * @example + * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. + * @returns {number} Number in hexadecimal. + */ + function rgb2hex(rgb) { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); + } + + /** + * Corrects PixiJS blend, takes premultiplied alpha into account + * @memberof PIXI.utils + * @function mapPremultipliedBlendModes + * @private + * @returns {Array} Mapped modes. + */ + function mapPremultipliedBlendModes() { + var pm = []; + var npm = []; + for (var i = 0; i < 32; i++) { + pm[i] = i; + npm[i] = i; + } + pm[constants.BLEND_MODES.NORMAL_NPM] = constants.BLEND_MODES.NORMAL; + pm[constants.BLEND_MODES.ADD_NPM] = constants.BLEND_MODES.ADD; + pm[constants.BLEND_MODES.SCREEN_NPM] = constants.BLEND_MODES.SCREEN; + npm[constants.BLEND_MODES.NORMAL] = constants.BLEND_MODES.NORMAL_NPM; + npm[constants.BLEND_MODES.ADD] = constants.BLEND_MODES.ADD_NPM; + npm[constants.BLEND_MODES.SCREEN] = constants.BLEND_MODES.SCREEN_NPM; + var array = []; + array.push(npm); + array.push(pm); + return array; + } + /** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @constant premultiplyBlendMode + * @type {Array} + */ + var premultiplyBlendMode = mapPremultipliedBlendModes(); + /** + * changes blendMode according to texture format + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied + * @returns {number} true blend mode for this texture + */ + function correctBlendMode(blendMode, premultiplied) { + return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; + } + /** + * combines rgb and alpha to out array + * @memberof PIXI.utils + * @function premultiplyRgba + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyRgba(rgb, alpha, out, premultiply) { + out = out || new Float32Array(4); + if (premultiply || premultiply === undefined) { + out[0] = rgb[0] * alpha; + out[1] = rgb[1] * alpha; + out[2] = rgb[2] * alpha; + } + else { + out[0] = rgb[0]; + out[1] = rgb[1]; + out[2] = rgb[2]; + } + out[3] = alpha; + return out; + } + /** + * premultiplies tint + * @memberof PIXI.utils + * @function premultiplyTint + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ + function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { + return (alpha * 255 << 24) + tint; + } + if (alpha === 0.0) { + return 0; + } + var R = ((tint >> 16) & 0xFF); + var G = ((tint >> 8) & 0xFF); + var B = (tint & 0xFF); + R = ((R * alpha) + 0.5) | 0; + G = ((G * alpha) + 0.5) | 0; + B = ((B * alpha) + 0.5) | 0; + return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; + } + /** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * @memberof PIXI.utils + * @function premultiplyTintToRgba + * @param {number} tint - input tint + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyTintToRgba(tint, alpha, out, premultiply) { + out = out || new Float32Array(4); + out[0] = ((tint >> 16) & 0xFF) / 255.0; + out[1] = ((tint >> 8) & 0xFF) / 255.0; + out[2] = (tint & 0xFF) / 255.0; + if (premultiply || premultiply === undefined) { + out[0] *= alpha; + out[1] *= alpha; + out[2] *= alpha; + } + out[3] = alpha; + return out; + } + + /** + * Generic Mask Stack data structure + * @memberof PIXI.utils + * @function createIndicesForQuads + * @param {number} size - Number of quads + * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` + * @returns {Uint16Array|Uint32Array} - Resulting index buffer + */ + function createIndicesForQuads(size, outBuffer) { + if (outBuffer === void 0) { outBuffer = null; } + // the total number of indices in our array, there are 6 points per quad. + var totalIndices = size * 6; + outBuffer = outBuffer || new Uint16Array(totalIndices); + if (outBuffer.length !== totalIndices) { + throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); + } + // fill the indices with the quads to draw + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { + outBuffer[i + 0] = j + 0; + outBuffer[i + 1] = j + 1; + outBuffer[i + 2] = j + 2; + outBuffer[i + 3] = j + 0; + outBuffer[i + 4] = j + 2; + outBuffer[i + 5] = j + 3; + } + return outBuffer; + } + + function getBufferType(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; + } + + /* eslint-disable object-shorthand */ + var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; + function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + /* + @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way + or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? + */ + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); + } + + // Taken from the bit-twiddle package + /** + * Rounds to next power of two. + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} - next rounded power of two + */ + function nextPow2(v) { + v += v === 0 ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; + } + /** + * Checks if a number is a power of two. + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {boolean} `true` if value is power of two + */ + function isPow2(v) { + return !(v & (v - 1)) && (!!v); + } + /** + * Computes ceil of log base 2 + * @function log2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} logarithm base 2 + */ + function log2(v) { + var r = (v > 0xFFFF ? 1 : 0) << 4; + v >>>= r; + var shift = (v > 0xFF ? 1 : 0) << 3; + v >>>= shift; + r |= shift; + shift = (v > 0xF ? 1 : 0) << 2; + v >>>= shift; + r |= shift; + shift = (v > 0x3 ? 1 : 0) << 1; + v >>>= shift; + r |= shift; + return r | (v >> 1); + } + + /** + * Remove items from a javascript array without generating garbage + * @function removeItems + * @memberof PIXI.utils + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove + */ + function removeItems(arr, startIdx, removeCount) { + var length = arr.length; + var i; + if (startIdx >= length || removeCount === 0) { + return; + } + removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); + var len = length - removeCount; + for (i = startIdx; i < len; ++i) { + arr[i] = arr[i + removeCount]; + } + arr.length = len; + } + + /** + * Returns sign of number + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ + function sign(n) { + if (n === 0) + { return 0; } + return n < 0 ? -1 : 1; + } + + var nextUid = 0; + /** + * Gets the next unique identifier + * @memberof PIXI.utils + * @function uid + * @returns {number} The next unique identifier to use. + */ + function uid() { + return ++nextUid; + } + + // A map of warning messages already fired + var warnings = {}; + /** + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. + * @memberof PIXI.utils + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. + */ + function deprecation(version, message, ignoreDepth) { + if (ignoreDepth === void 0) { ignoreDepth = 3; } + // Ignore duplicat + if (warnings[message]) { + return; + } + /* eslint-disable no-console */ + var stack = new Error().stack; + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + } + else { + // chop off the stack trace which includes PixiJS internal calls + stack = stack.split('\n').splice(ignoreDepth).join('\n'); + if (console.groupCollapsed) { + console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + console.warn(stack); + } + } + /* eslint-enable no-console */ + warnings[message] = true; + } + + /** + * @todo Describe property usage + * @static + * @name ProgramCache + * @memberof PIXI.utils + * @type {object} + */ + var ProgramCache = {}; + /** + * @todo Describe property usage + * @static + * @name TextureCache + * @memberof PIXI.utils + * @type {object} + */ + var TextureCache = Object.create(null); + /** + * @todo Describe property usage + * @static + * @name BaseTextureCache + * @memberof PIXI.utils + * @type {object} + */ + var BaseTextureCache = Object.create(null); + /** + * Destroys all texture in the cache + * @memberof PIXI.utils + * @function destroyTextureCache + */ + function destroyTextureCache() { + var key; + for (key in TextureCache) { + TextureCache[key].destroy(); + } + for (key in BaseTextureCache) { + BaseTextureCache[key].destroy(); + } + } + /** + * Removes all textures from cache, but does not destroy them + * @memberof PIXI.utils + * @function clearTextureCache + */ + function clearTextureCache() { + var key; + for (key in TextureCache) { + delete TextureCache[key]; + } + for (key in BaseTextureCache) { + delete BaseTextureCache[key]; + } + } + + /** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * @class + * @memberof PIXI.utils + */ + var CanvasRenderTarget = /** @class */ (function () { + /** + * @param width - the width for the newly created canvas + * @param height - the height for the newly created canvas + * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + this.canvas = settings.settings.ADAPTER.createCanvas(); + this.context = this.canvas.getContext('2d'); + this.resolution = resolution || settings.settings.RESOLUTION; + this.resize(width, height); + } + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * @private + */ + CanvasRenderTarget.prototype.clear = function () { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + /** + * Resizes the canvas to the specified width and height. + * @param desiredWidth - the desired width of the canvas + * @param desiredHeight - the desired height of the canvas + */ + CanvasRenderTarget.prototype.resize = function (desiredWidth, desiredHeight) { + this.canvas.width = Math.round(desiredWidth * this.resolution); + this.canvas.height = Math.round(desiredHeight * this.resolution); + }; + /** Destroys this canvas. */ + CanvasRenderTarget.prototype.destroy = function () { + this.context = null; + this.canvas = null; + }; + Object.defineProperty(CanvasRenderTarget.prototype, "width", { + /** + * The width of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.width; + }, + set: function (val) { + this.canvas.width = Math.round(val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CanvasRenderTarget.prototype, "height", { + /** + * The height of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.height; + }, + set: function (val) { + this.canvas.height = Math.round(val); + }, + enumerable: false, + configurable: true + }); + return CanvasRenderTarget; + }()); + + /** + * Trim transparent borders from a canvas + * @memberof PIXI.utils + * @function trimCanvas + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ + function trimCanvas(canvas) { + // https://gist.github.com/remy/784508 + var width = canvas.width; + var height = canvas.height; + var context = canvas.getContext('2d', { + willReadFrequently: true, + }); + var imageData = context.getImageData(0, 0, width, height); + var pixels = imageData.data; + var len = pixels.length; + var bound = { + top: null, + left: null, + right: null, + bottom: null, + }; + var data = null; + var i; + var x; + var y; + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { + x = (i / 4) % width; + y = ~~((i / 4) / width); + if (bound.top === null) { + bound.top = y; + } + if (bound.left === null) { + bound.left = x; + } + else if (x < bound.left) { + bound.left = x; + } + if (bound.right === null) { + bound.right = x + 1; + } + else if (bound.right < x) { + bound.right = x + 1; + } + if (bound.bottom === null) { + bound.bottom = y; + } + else if (bound.bottom < y) { + bound.bottom = y; + } + } + } + if (bound.top !== null) { + width = bound.right - bound.left; + height = bound.bottom - bound.top + 1; + data = context.getImageData(bound.left, bound.top, width, height); + } + return { + height: height, + width: width, + data: data, + }; + } + + /** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * @static + * @constant {RegExp|string} DATA_URI + * @memberof PIXI + * @example data:image/png;base64 + */ + var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; + + /** + * @memberof PIXI.utils + * @interface DecomposedDataUri + */ + /** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ + /** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ + /** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ + /** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ + /** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data + */ + /** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined + */ + function decomposeDataUri(dataUri) { + var dataUriMatch = DATA_URI.exec(dataUri); + if (dataUriMatch) { + return { + mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, + subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, + charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, + encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, + data: dataUriMatch[5], + }; + } + return undefined; + } + + var tempAnchor; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @returns {string} The crossOrigin value to use (or empty string for none). + */ + function determineCrossOrigin(url$1, loc) { + if (loc === void 0) { loc = globalThis.location; } + // data: and javascript: urls are considered same-origin + if (url$1.indexOf('data:') === 0) { + return ''; + } + // default is window.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url$1; + var parsedUrl = url.parse(tempAnchor.href); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + // if cross origin + if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; + } + + /** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @returns {number} resolution / device pixel ratio of an asset + */ + function getResolutionOfUrl(url, defaultValue) { + var resolution = settings.settings.RETINA_PREFIX.exec(url); + if (resolution) { + return parseFloat(resolution[1]); + } + return defaultValue !== undefined ? defaultValue : 1; + } + + /** + * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" + * @namespace PIXI.utils + */ + + Object.defineProperty(exports, 'isMobile', { + enumerable: true, + get: function () { return settings.isMobile; } + }); + exports.BaseTextureCache = BaseTextureCache; + exports.CanvasRenderTarget = CanvasRenderTarget; + exports.DATA_URI = DATA_URI; + exports.EventEmitter = eventemitter3; + exports.ProgramCache = ProgramCache; + exports.TextureCache = TextureCache; + exports.clearTextureCache = clearTextureCache; + exports.correctBlendMode = correctBlendMode; + exports.createIndicesForQuads = createIndicesForQuads; + exports.decomposeDataUri = decomposeDataUri; + exports.deprecation = deprecation; + exports.destroyTextureCache = destroyTextureCache; + exports.determineCrossOrigin = determineCrossOrigin; + exports.earcut = earcut_1; + exports.getBufferType = getBufferType; + exports.getResolutionOfUrl = getResolutionOfUrl; + exports.hex2rgb = hex2rgb; + exports.hex2string = hex2string; + exports.interleaveTypedArrays = interleaveTypedArrays; + exports.isPow2 = isPow2; + exports.isWebGLSupported = isWebGLSupported; + exports.log2 = log2; + exports.nextPow2 = nextPow2; + exports.path = path; + exports.premultiplyBlendMode = premultiplyBlendMode; + exports.premultiplyRgba = premultiplyRgba; + exports.premultiplyTint = premultiplyTint; + exports.premultiplyTintToRgba = premultiplyTintToRgba; + exports.removeItems = removeItems; + exports.rgb2hex = rgb2hex; + exports.sayHello = sayHello; + exports.sign = sign; + exports.skipHello = skipHello; + exports.string2hex = string2hex; + exports.trimCanvas = trimCanvas; + exports.uid = uid; + exports.url = url; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}, PIXI, PIXI); +Object.assign(this.PIXI.utils, _pixi_utils); +//# sourceMappingURL=utils.js.map diff --git a/live2d/node_modules/@pixi/utils/dist/browser/utils.js.map b/live2d/node_modules/@pixi/utils/dist/browser/utils.js.map new file mode 100644 index 0000000..1a2eb5d --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/browser/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sources":["../../../../node_modules/eventemitter3/index.js","../../../../node_modules/earcut/src/earcut.js","../../../../node_modules/url/node_modules/punycode/punycode.js","../../../../node_modules/url/util.js","../../../../node_modules/querystring/decode.js","../../../../node_modules/querystring/encode.js","../../../../node_modules/querystring/index.js","../../../../node_modules/url/url.js","../../src/url.ts","../../src/path.ts","../../src/settings.ts","../../src/browser/hello.ts","../../src/browser/isWebGLSupported.ts","../../src/color/hex.ts","../../src/color/premultiply.ts","../../src/data/createIndicesForQuads.ts","../../src/data/getBufferType.ts","../../src/data/interleaveTypedArrays.ts","../../src/data/pow2.ts","../../src/data/removeItems.ts","../../src/data/sign.ts","../../src/data/uid.ts","../../src/logging/deprecation.ts","../../src/media/caches.ts","../../src/media/CanvasRenderTarget.ts","../../src/media/trimCanvas.ts","../../src/const.ts","../../src/network/decomposeDataUri.ts","../../src/network/determineCrossOrigin.ts","../../src/network/getResolutionOfUrl.ts","../../src/index.ts"],"sourcesContent":["'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { parse as _parse, format as _format, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n","import { settings } from '@pixi/settings';\n\nfunction assertPath(path: string)\n{\n if (typeof path !== 'string')\n {\n throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);\n }\n}\n\nfunction removeUrlParams(url: string): string\n{\n const re = url.split('?')[0];\n\n return re.split('#')[0];\n}\n\nfunction escapeRegExp(string: string)\n{\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str: string, find: string, replace: string)\n{\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean)\n{\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code: number;\n\n for (let i = 0; i <= path.length; ++i)\n {\n if (i < path.length)\n {\n code = path.charCodeAt(i);\n }\n else if (code === 47)\n {\n break;\n }\n else\n {\n code = 47;\n }\n if (code === 47)\n {\n if (lastSlash === i - 1 || dots === 1)\n {\n // NOOP\n }\n else if (lastSlash !== i - 1 && dots === 2)\n {\n if (\n res.length < 2\n || lastSegmentLength !== 2\n || res.charCodeAt(res.length - 1) !== 46\n || res.charCodeAt(res.length - 2) !== 46\n )\n {\n if (res.length > 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","/**\n * Generalized convenience utilities for PIXI.\n * @example\n * // Extend PIXI's internal Event Emitter.\n * class MyEmitter extends PIXI.utils.EventEmitter {\n * constructor() {\n * super();\n * console.log(\"Emitter created!\");\n * }\n * }\n *\n * // Get info on current device\n * console.log(PIXI.utils.isMobile);\n *\n * // Convert hex color to string\n * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: \"#ff00ff\"\n * @namespace PIXI.utils\n */\n\n/**\n * A simple JS library that detects mobile devices.\n * @see {@link https://github.com/kaimallea/isMobile}\n * @memberof PIXI.utils\n * @name isMobile\n * @member {object}\n * @property {boolean} any - `true` if current platform is tablet or phone device\n * @property {boolean} tablet - `true` if current platform large-screen tablet device\n * @property {boolean} phone - `true` if current platform small-screen phone device\n * @property {object} apple -\n * @property {boolean} apple.device - `true` if any Apple device\n * @property {boolean} apple.tablet - `true` if any Apple iPad\n * @property {boolean} apple.phone - `true` if any Apple iPhone\n * @property {boolean} apple.ipod - `true` if any iPod\n * @property {object} android -\n * @property {boolean} android.device - `true` if any Android device\n * @property {boolean} android.tablet - `true` if any Android tablet\n * @property {boolean} android.phone - `true` if any Android phone\n * @property {object} amazon -\n * @property {boolean} amazon.device - `true` if any Silk device\n * @property {boolean} amazon.tablet - `true` if any Silk tablet\n * @property {boolean} amazon.phone - `true` if any Silk phone\n * @property {object} windows -\n * @property {boolean} windows.device - `true` if any Windows device\n * @property {boolean} windows.tablet - `true` if any Windows tablet\n * @property {boolean} windows.phone - `true` if any Windows phone\n */\nexport { isMobile } from '@pixi/settings';\n\nimport EventEmitter from 'eventemitter3';\n\n/**\n * A high performance event emitter\n * @see {@link https://github.com/primus/eventemitter3}\n * @memberof PIXI.utils\n * @class EventEmitter\n */\nexport { EventEmitter };\n\n/**\n * A polygon triangulation library\n * @see {@link https://github.com/mapbox/earcut}\n * @memberof PIXI.utils\n * @method earcut\n * @param {number[]} vertices - A flat array of vertex coordinates\n * @param {number[]} [holes] - An array of hole indices\n * @param {number} [dimensions=2] - The number of coordinates per vertex in the input array\n * @returns {number[]} Triangulated polygon\n */\nexport { default as earcut } from 'earcut';\n\n/**\n * Node.js compatible URL utilities.\n * @see https://www.npmjs.com/package/url\n * @memberof PIXI.utils\n * @name url\n * @member {object}\n */\nexport * from './url';\n/**\n * Browser and Node.js compatible path utilities.\n * All paths that are passed in will become normalized to have posix separators.\n * @memberof PIXI.utils\n * @name path\n * @member {object}\n */\nexport * from './path';\n\nimport './settings';\n\nexport * from './browser/hello';\nexport * from './browser/isWebGLSupported';\nexport * from './color/hex';\nexport * from './color/premultiply';\nexport * from './data/createIndicesForQuads';\nexport * from './data/getBufferType';\nexport * from './data/interleaveTypedArrays';\nexport * from './data/pow2';\nexport * from './data/removeItems';\nexport * from './data/sign';\nexport * from './data/uid';\nexport * from './logging/deprecation';\nexport * from './media/caches';\nexport * from './media/CanvasRenderTarget';\nexport * from './media/trimCanvas';\nexport * from './network/decomposeDataUri';\nexport * from './network/determineCrossOrigin';\nexport * from './network/getResolutionOfUrl';\nexport * from './const';\nexport * from './types';\n"],"names":["arguments","sign","global","define","this","require$$0","require$$1","_parse","_format","_resolve","settings","BLEND_MODES","url","_url"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA,YAAY,CAAC;AACb;CACA,IAAI,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc;CACzC,IAAI,MAAM,GAAG,GAAG,CAAC;AACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,SAAS,MAAM,GAAG,EAAE;AACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,IAAI,MAAM,CAAC,MAAM,EAAE;CACnB,EAAE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC;CACA;CACA;CACA;CACA;CACA,EAAE,IAAI,CAAC,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,EAAA,MAAM,GAAG,KAAK,CAAC,EAAA;CAC9C,CAAC;AACD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,SAAS,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC/B,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;CACf,EAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;CACzB,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,KAAK,CAAC;CAC5B,CAAC;AACD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,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AAS,GAAGC,GAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAE9C,IAAM,QAAQ,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;;CAGvF,IAAA,IAAI,SAAS,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,EAC3F;CACI,QAAA,OAAO,WAAW,CAAC;CACtB,KAAA;CAED,IAAA,OAAO,EAAE,CAAC;CACd;;CC3CA;;;;;;;;CAQG;CACa,SAAA,kBAAkB,CAAC,GAAW,EAAE,YAAqB,EAAA;KAEjE,IAAM,UAAU,GAAGH,iBAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CAEpD,IAAA,IAAI,UAAU,EACd;CACI,QAAA,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CACpC,KAAA;KAED,OAAO,YAAY,KAAK,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC;CACzD;;CCrBA;;;;;;;;;;;;;;;;;CAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/browser/utils.min.js b/live2d/node_modules/@pixi/utils/dist/browser/utils.min.js new file mode 100644 index 0000000..57b41b1 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/browser/utils.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +this.PIXI=this.PIXI||{},this.PIXI.utils=this.PIXI.utils||{};var _pixi_utils=function(e,t,n){"use strict";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var i=o((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new o(r,i||e,a),h=n?n+t:t;return e._events[h]?e._events[h].fn?e._events[h]=[e._events[h],s]:e._events[h].push(s):(e._events[h]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}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 e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o80*n){r=i=e[0],o=a=e[1];for(var y=n;yi&&(i=s),h>a&&(a=h);l=0!==(l=Math.max(i-r,a-o))?32767/l:0}return u(d,v,n,r,o,l,0),v}function f(e,t,n,r,o){var i,a;if(o===j(e,t,n,r)>0)for(i=t;i=t;i-=r)a=D(i,e[i],e[i+1],a);return a&&C(a,a.next)&&(M(a),a=a.next),a}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!C(r,r.next)&&0!==E(r.prev,r,r.next))r=r.next;else{if(M(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function u(e,t,n,r,o,i,a){if(e){!a&&i&&function(e,t,n,r){var o=e;do{0===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,a,s,h,f=1;do{for(n=e,e=null,i=null,a=0;n;){for(a++,r=n,s=0,t=0;t0||h>0&&r;)0!==s&&(0===h||!r||n.z<=r.z)?(o=n,n=n.nextZ,s--):(o=r,r=r.nextZ,h--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,f*=2}while(a>1)}(o)}(e,r,o,i);for(var s,h,f=e;e.prev!==e.next;)if(s=e.prev,h=e.next,i?p(e,r,o,i):c(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(h.i/n|0),M(e),e=h.next,f=h.next;else if((e=h)===f){a?1===a?u(e=d(l(e),t,n),t,n,r,o,i,2):2===a&&v(e,t,n,r,o,i):u(l(e),t,n,r,o,i,1);break}}}function c(e){var t=e.prev,n=e,r=e.next;if(E(t,n,r)>=0)return!1;for(var o=t.x,i=n.x,a=r.x,s=t.y,h=n.y,f=r.y,l=oi?o>a?o:a:i>a?i:a,p=s>h?s>f?s:f:h>f?h:f,d=r.next;d!==t;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&w(o,s,i,h,a,f,d.x,d.y)&&E(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function p(e,t,n,r){var o=e.prev,i=e,a=e.next;if(E(o,i,a)>=0)return!1;for(var s=o.x,h=i.x,f=a.x,l=o.y,u=i.y,c=a.y,p=sh?s>f?s:f:h>f?h:f,g=l>u?l>c?l:c:u>c?u:c,x=m(p,d,t,n,r),y=m(v,g,t,n,r),b=e.prevZ,A=e.nextZ;b&&b.z>=x&&A&&A.z<=y;){if(b.x>=p&&b.x<=v&&b.y>=d&&b.y<=g&&b!==o&&b!==a&&w(s,l,h,u,f,c,b.x,b.y)&&E(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,A.x>=p&&A.x<=v&&A.y>=d&&A.y<=g&&A!==o&&A!==a&&w(s,l,h,u,f,c,A.x,A.y)&&E(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;b&&b.z>=x;){if(b.x>=p&&b.x<=v&&b.y>=d&&b.y<=g&&b!==o&&b!==a&&w(s,l,h,u,f,c,b.x,b.y)&&E(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;A&&A.z<=y;){if(A.x>=p&&A.x<=v&&A.y>=d&&A.y<=g&&A!==o&&A!==a&&w(s,l,h,u,f,c,A.x,A.y)&&E(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function d(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!C(o,i)&&_(o,r,r.next,i)&&k(o,i)&&k(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),M(r),M(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function v(e,t,n,r,o,i){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&A(a,s)){var h=I(a,s);return a=l(a,a.next),h=l(h,h.next),u(a,t,n,r,o,i,0),void u(h,t,n,r,o,i,0)}s=s.next}a=a.next}while(a!==e)}function g(e,t){return e.x-t.x}function x(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=o&&s>a&&(a=s,n=r.x=r.x&&r.x>=l&&o!==r.x&&w(in.x||r.x===n.x&&y(n,r)))&&(n=r,c=h)),r=r.next}while(r!==f);return n}(e,t);if(!n)return t;var r=I(n,e);return l(r,r.next),l(n,n.next)}function y(e,t){return E(e.prev,e,t.prev)<0&&E(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function b(e){var t=e,n=e;do{(t.x=(e-a)*(i-s)&&(e-a)*(r-s)>=(n-a)*(t-s)&&(n-a)*(i-s)>=(o-a)*(r-s)}function A(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&_(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(k(e,t)&&k(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(E(e.prev,e,t.prev)||E(e,t.prev,t))||C(e,t)&&E(e.prev,e,e.next)>0&&E(t.prev,t,t.next)>0)}function E(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function C(e,t){return e.x===t.x&&e.y===t.y}function _(e,t,n,r){var o=P(E(e,t,n)),i=P(E(e,t,r)),a=P(E(n,r,e)),s=P(E(n,r,t));return o!==i&&a!==s||(!(0!==o||!O(e,n,t))||(!(0!==i||!O(e,r,t))||(!(0!==a||!O(n,e,r))||!(0!==s||!O(n,t,r)))))}function O(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function P(e){return e>0?1:e<0?-1:0}function k(e,t){return E(e.prev,e,e.next)<0?E(e,t,e.next)>=0&&E(e,e.prev,t)>=0:E(e,t,e.prev)<0||E(e,e.next,t)<0}function I(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function D(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function M(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function j(e,t,n,r){for(var o=0,i=t,a=n-r;i0&&(r+=e[o-1].length,n.holes.push(r))}return n},a.default=s;var T=o((function(e,t){!function(n){var o=t&&!t.nodeType&&t,i=e&&!e.nodeType&&e,a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self!==a||(n=a);var s,h,f=2147483647,l=36,u=/^xn--/,c=/[^\x20-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=Math.floor,g=String.fromCharCode;function x(e){throw RangeError(d[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function m(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(p,".")).split("."),t).join(".")}function b(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=g(e)})).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function E(e,t,n){var r=0;for(e=n?v(e/700):e>>1,e+=v(e/t);e>455;r+=l)e=v(e/35);return v(r+36*e/(e+38))}function C(e){var t,n,r,o,i,a,s,h,u,c,p,d=[],g=e.length,y=0,m=128,b=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&x("not-basic"),d.push(e.charCodeAt(r));for(o=n>0?n+1:0;o=g&&x("invalid-input"),((h=(p=e.charCodeAt(o++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:l)>=l||h>v((f-y)/a))&&x("overflow"),y+=h*a,!(h<(u=s<=b?1:s>=b+26?26:s-b));s+=l)a>v(f/(c=l-u))&&x("overflow"),a*=c;b=E(y-i,t=d.length+1,0==i),v(y/t)>f-m&&x("overflow"),m+=v(y/t),y%=t,d.splice(y++,0,m)}return w(d)}function _(e){var t,n,r,o,i,a,s,h,u,c,p,d,y,m,w,C=[];for(d=(e=b(e)).length,t=128,n=0,i=72,a=0;a=t&&pv((f-n)/(y=r+1))&&x("overflow"),n+=(s-t)*y,t=s,a=0;af&&x("overflow"),p==t){for(h=n,u=l;!(h<(c=u<=i?1:u>=i+26?26:u-i));u+=l)w=h-c,m=l-c,C.push(g(A(c+w%m,0))),h=v(w/m);C.push(g(A(h,0))),i=E(n,y,r==o),n=0,++r}++n,++t}return C.join("")}if(s={version:"1.3.2",ucs2:{decode:b,encode:w},decode:C,encode:_,toASCII:function(e){return m(e,(function(e){return c.test(e)?"xn--"+_(e):e}))},toUnicode:function(e){return m(e,(function(e){return u.test(e)?C(e.slice(4).toLowerCase()):e}))}},o&&i)if(e.exports==o)i.exports=s;else for(h in s)s.hasOwnProperty(h)&&(o[h]=s[h]);else n.punycode=s}(r)})),L=function(e){return"string"==typeof e},N=function(e){return"object"==typeof e&&null!==e},S=function(e){return null===e},U=function(e){return null==e};function q(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Z=function(e,t,n,r){t=t||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var i=/\+/g;e=e.split(t);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var h=0;h=0?(f=p.substr(0,d),l=p.substr(d+1)):(f=p,l=""),u=decodeURIComponent(f),c=decodeURIComponent(l),q(o,u)?Array.isArray(o[u])?o[u].push(c):o[u]=[o[u],c]:o[u]=c}return o},F=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},z=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(r){var o=encodeURIComponent(F(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return o+encodeURIComponent(F(e))})).join(t):o+encodeURIComponent(F(e[r]))})).join(t):r?encodeURIComponent(F(r))+n+encodeURIComponent(F(e)):""},B=o((function(e,t){t.decode=t.parse=Z,t.encode=t.stringify=z})),W=ae,$=function(e,t){return ae(e,!1,!0).resolve(t)},X=function(e){L(e)&&(e=ae(e));if(!(e instanceof J))return J.prototype.format.call(e);return e.format()};function J(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var H=/^([a-z0-9.+-]+:)/i,G=/:[0-9]*$/,Y=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,K=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),V=["'"].concat(K),Q=["%","/","?",";","#"].concat(V),ee=["/","?","#"],te=/^[+a-z0-9A-Z_-]{0,63}$/,ne=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,re={javascript:!0,"javascript:":!0},oe={javascript:!0,"javascript:":!0},ie={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ae(e,t,n){if(e&&N(e)&&e instanceof J)return e;var r=new J;return r.parse(e,t,n),r}J.prototype.parse=function(e,t,n){if(!L(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=-1!==r&&r127?b+="x":b+=m[w];if(!b.match(te)){var E=x.slice(0,d),C=x.slice(d+1),_=m.match(ne);_&&(E.push(_[1]),C.unshift(_[2])),C.length&&(a="/"+C.join(".")+a),this.hostname=E.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=T.toASCII(this.hostname));var O=this.port?":"+this.port:"",P=this.hostname||"";this.host=P+O,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!re[f])for(d=0,y=V.length;d0)&&n.host.split("@"))&&(n.auth=_.shift(),n.host=n.hostname=_.shift());return n.search=e.search,n.query=e.query,S(n.pathname)&&S(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!m.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var w=m.slice(-1)[0],A=(n.host||e.host||m.length>1)&&("."===w||".."===w)||""===w,E=0,C=m.length;C>=0;C--)"."===(w=m[C])?m.splice(C,1):".."===w?(m.splice(C,1),E++):E&&(m.splice(C,1),E--);if(!x&&!y)for(;E--;E)m.unshift("..");!x||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),A&&"/"!==m.join("/").substr(-1)&&m.push("");var _,O=""===m[0]||m[0]&&"/"===m[0].charAt(0);b&&(n.hostname=n.host=O?"":m.length?m.shift():"",(_=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=_.shift(),n.host=n.hostname=_.shift()));return(x=x||n.host&&m.length)&&!O&&m.unshift(""),m.length?n.pathname=m.join("/"):(n.pathname=null,n.path=null),S(n.pathname)&&S(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},J.prototype.parseHost=function(){var e=this.host,t=G.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var se={parse:W,format:X,resolve:$};function he(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function fe(e){return e.split("?")[0].split("#")[0]}var le={toPosix:function(e){return t="\\",n="/",e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),n);var t,n},isUrl:function(e){return/^https?:/.test(this.toPosix(e))},isDataUrl:function(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},hasProtocol:function(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol:function(e){he(e),e=this.toPosix(e);var t="",n=/^file:\/\/\//.exec(e),r=/^[^/:]+:\/\//.exec(e),o=/^[^/:]+:\//.exec(e);if(n||r||o){var i=(null==n?void 0:n[0])||(null==r?void 0:r[0])||(null==o?void 0:o[0]);t=i,e=e.slice(i.length)}return t},toAbsolute:function(e,n,r){if(this.isDataUrl(e))return e;var o=fe(this.toPosix(null!=n?n:t.settings.ADAPTER.getBaseUrl())),i=fe(this.toPosix(null!=r?r:this.rootname(o)));return he(e),(e=this.toPosix(e)).startsWith("/")?le.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(o,e)},normalize:function(e){if(he(e=this.toPosix(e)),0===e.length)return".";var t="",n=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));var r=e.endsWith("/");return(e=function(e,t){for(var n,r="",o=0,i=-1,a=0,s=0;s<=e.length;++s){if(s2){var h=r.lastIndexOf("/");if(h!==r.length-1){-1===h?(r="",o=0):o=(r=r.slice(0,h)).length-1-r.lastIndexOf("/"),i=s,a=0;continue}}else if(2===r.length||1===r.length){r="",o=0,i=s,a=0;continue}t&&(r.length>0?r+="/..":r="..",o=2)}else r.length>0?r+="/"+e.slice(i+1,s):r=e.slice(i+1,s),o=s-i-1;i=s,a=0}else 46===n&&-1!==a?++a:a=-1}return r}(e,!1)).length>0&&r&&(e+="/"),n?"/"+e:t+e},isAbsolute:function(e){return he(e),e=this.toPosix(e),!!this.hasProtocol(e)||e.startsWith("/")},join:function(){for(var e,t,n=arguments,r=[],o=0;o0)if(void 0===t)t=a;else{var s=null!==(e=r[i-1])&&void 0!==e?e:"";this.extname(s)?t+="/../"+a:t+="/"+a}}return void 0===t?".":this.normalize(t)},dirname:function(e){if(he(e),0===e.length)return".";for(var t=(e=this.toPosix(e)).charCodeAt(0),n=47===t,r=-1,o=!0,i=this.getProtocol(e),a=e,s=(e=e.slice(i.length)).length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!o){r=s;break}}else o=!1;return-1===r?n?"/":this.isUrl(a)?i+e:i:n&&1===r?"//":i+e.slice(0,r)},rootname:function(e){he(e);var t="";if(t=(e=this.toPosix(e)).startsWith("/")?"/":this.getProtocol(e),this.isUrl(e)){var n=e.indexOf("/",t.length);(t=-1!==n?e.slice(0,n):e).endsWith("/")||(t+="/")}return t},basename:function(e,t){he(e),t&&he(t),e=this.toPosix(e);var n,r=0,o=-1,i=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,s=-1;for(n=e.length-1;n>=0;--n){var h=e.charCodeAt(n);if(47===h){if(!i){r=n+1;break}}else-1===s&&(i=!1,s=n+1),a>=0&&(h===t.charCodeAt(a)?-1==--a&&(o=n):(a=-1,o=s))}return r===o?o=s:-1===o&&(o=e.length),e.slice(r,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!i){r=n+1;break}}else-1===o&&(i=!1,o=n+1);return-1===o?"":e.slice(r,o)},extname:function(e){he(e);for(var t=-1,n=0,r=-1,o=!0,i=0,a=(e=this.toPosix(e)).length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===r&&(o=!1,r=a+1),46===s?-1===t?t=a:1!==i&&(i=1):-1!==t&&(i=-1);else if(!o){n=a+1;break}}return-1===t||-1===r||0===i||1===i&&t===r-1&&t===n+1?"":e.slice(t,r)},parse:function(e){he(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,r=(e=this.toPosix(e)).charCodeAt(0),o=this.isAbsolute(e);t.root=this.rootname(e),n=o||this.hasProtocol(e)?1:0;for(var i=-1,a=0,s=-1,h=!0,f=e.length-1,l=0;f>=n;--f)if(47!==(r=e.charCodeAt(f)))-1===s&&(h=!1,s=f+1),46===r?-1===i?i=f:1!==l&&(l=1):-1!==i&&(l=-1);else if(!h){a=f+1;break}return-1===i||-1===s||0===l||1===l&&i===s-1&&i===a+1?-1!==s&&(t.base=t.name=0===a&&o?e.slice(1,s):e.slice(a,s)):(0===a&&o?(t.name=e.slice(1,i),t.base=e.slice(1,s)):(t.name=e.slice(a,i),t.base=e.slice(a,s)),t.ext=e.slice(i,s)),t.dir=this.dirname(e),t},sep:"/",delimiter:":"};t.settings.RETINA_PREFIX=/@([0-9\.]+)x/,t.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ue,ce=!1;var pe={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};var de=function(){for(var e=[],t=[],r=0;r<32;r++)e[r]=r,t[r]=r;e[n.BLEND_MODES.NORMAL_NPM]=n.BLEND_MODES.NORMAL,e[n.BLEND_MODES.ADD_NPM]=n.BLEND_MODES.ADD,e[n.BLEND_MODES.SCREEN_NPM]=n.BLEND_MODES.SCREEN,t[n.BLEND_MODES.NORMAL]=n.BLEND_MODES.NORMAL_NPM,t[n.BLEND_MODES.ADD]=n.BLEND_MODES.ADD_NPM,t[n.BLEND_MODES.SCREEN]=n.BLEND_MODES.SCREEN_NPM;var o=[];return o.push(t),o.push(e),o}();function ve(e){if(4===e.BYTES_PER_ELEMENT)return e instanceof Float32Array?"Float32Array":e instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===e.BYTES_PER_ELEMENT){if(e instanceof Uint16Array)return"Uint16Array"}else if(1===e.BYTES_PER_ELEMENT&&e instanceof Uint8Array)return"Uint8Array";return null}var ge={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var xe=0;var ye={};var me=Object.create(null),be=Object.create(null);var we=function(){function e(e,n,r){this.canvas=t.settings.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=r||t.settings.RESOLUTION,this.resize(e,n)}return e.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},e.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},e.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),e}();var Ae,Ee=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;return Object.defineProperty(e,"isMobile",{enumerable:!0,get:function(){return t.isMobile}}),e.BaseTextureCache=be,e.CanvasRenderTarget=we,e.DATA_URI=Ee,e.EventEmitter=i,e.ProgramCache={},e.TextureCache=me,e.clearTextureCache=function(){var e;for(e in me)delete me[e];for(e in be)delete be[e]},e.correctBlendMode=function(e,t){return de[t?1:0][e]},e.createIndicesForQuads=function(e,t){void 0===t&&(t=null);var n=6*e;if((t=t||new Uint16Array(n)).length!==n)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+n);for(var r=0,o=0;r>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t},e.hex2string=function(e){var t=e.toString(16);return"#"+(t="000000".substring(0,6-t.length)+t)},e.interleaveTypedArrays=function(e,t){for(var n=0,r=0,o={},i=0;i65535?1:0)<<4,n=((e>>>=t)>255?1:0)<<3;return t|=n,t|=n=((e>>>=n)>15?1:0)<<2,(t|=n=((e>>>=n)>3?1:0)<<1)|(e>>>=n)>>1},e.nextPow2=function(e){return e+=0===e?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},e.path=le,e.premultiplyBlendMode=de,e.premultiplyRgba=function(e,t,n,r){return n=n||new Float32Array(4),r||void 0===r?(n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t):(n[0]=e[0],n[1]=e[1],n[2]=e[2]),n[3]=t,n},e.premultiplyTint=function(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var n=e>>16&255,r=e>>8&255,o=255&e;return(255*t<<24)+((n=n*t+.5|0)<<16)+((r=r*t+.5|0)<<8)+(o=o*t+.5|0)},e.premultiplyTintToRgba=function(e,t,n,r){return(n=n||new Float32Array(4))[0]=(e>>16&255)/255,n[1]=(e>>8&255)/255,n[2]=(255&e)/255,(r||void 0===r)&&(n[0]*=t,n[1]*=t,n[2]*=t),n[3]=t,n},e.removeItems=function(e,t,n){var r,o=e.length;if(!(t>=o||0===n)){var i=o-(n=t+n>o?o-t:n);for(r=t;r-1){var r=["\n %c %c %c PixiJS 6.5.10 - ✰ "+e+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(n=globalThis.console).log.apply(n,r)}else globalThis.console&&globalThis.console.log("PixiJS 6.5.10 - "+e+" - http://www.pixijs.com/");ce=!0}},e.sign=function(e){return 0===e?0:e<0?-1:1},e.skipHello=function(){ce=!0},e.string2hex=function(e){return"string"==typeof e&&"#"===(e=pe[e.toLowerCase()]||e)[0]&&(e=e.slice(1)),parseInt(e,16)},e.trimCanvas=function(e){var t,n,r,o=e.width,i=e.height,a=e.getContext("2d",{willReadFrequently:!0}),s=a.getImageData(0,0,o,i).data,h=s.length,f={top:null,left:null,right:null,bottom:null},l=null;for(t=0;t 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! https://mths.be/punycode v1.3.2 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n continue;\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n result[rkey] = relative[rkey];\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n","/**\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { parse as _parse, format as _format, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n","import { settings } from '@pixi/settings';\n\nfunction assertPath(path: string)\n{\n if (typeof path !== 'string')\n {\n throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);\n }\n}\n\nfunction removeUrlParams(url: string): string\n{\n const re = url.split('?')[0];\n\n return re.split('#')[0];\n}\n\nfunction escapeRegExp(string: string)\n{\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str: string, find: string, replace: string)\n{\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean)\n{\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code: number;\n\n for (let i = 0; i <= path.length; ++i)\n {\n if (i < path.length)\n {\n code = path.charCodeAt(i);\n }\n else if (code === 47)\n {\n break;\n }\n else\n {\n code = 47;\n }\n if (code === 47)\n {\n if (lastSlash === i - 1 || dots === 1)\n {\n // NOOP\n }\n else if (lastSlash !== i - 1 && dots === 2)\n {\n if (\n res.length < 2\n || lastSegmentLength !== 2\n || res.charCodeAt(res.length - 1) !== 46\n || res.charCodeAt(res.length - 2) !== 46\n )\n {\n if (res.length > 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n"],"names":["has","Object","prototype","hasOwnProperty","prefix","Events","EE","fn","context","once","this","addListener","emitter","event","TypeError","listener","evt","_events","push","_eventsCount","clearEvent","EventEmitter","create","__proto__","eventNames","events","name","names","call","slice","getOwnPropertySymbols","concat","listeners","handlers","i","l","length","ee","Array","listenerCount","emit","a1","a2","a3","a4","a5","args","len","arguments","removeListener","undefined","apply","j","on","removeAllListeners","off","prefixed","module","exports","earcut_1","earcut","_default","data","holeIndices","dim","minX","minY","maxX","maxY","x","y","invSize","hasHoles","outerLen","outerNode","linkedList","triangles","next","prev","list","queue","steiner","getLeftmost","sort","compareX","eliminateHole","eliminateHoles","Math","max","earcutLinked","start","end","clockwise","last","signedArea","insertNode","equals","removeNode","filterPoints","again","p","area","ear","pass","z","zOrder","prevZ","nextZ","q","e","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","stop","isEarHashed","isEar","cureLocalIntersections","splitEarcut","a","b","c","ax","bx","cx","ay","by","cy","x0","y0","x1","y1","pointInTriangle","minZ","maxZ","n","intersects","locallyInside","isValidDiagonal","splitPolygon","hole","bridge","m","hx","hy","qx","Infinity","tan","mx","my","tanMin","abs","sectorContainsSector","findHoleBridge","bridgeReverse","leftmost","px","py","intersectsPolygon","inside","middleInside","r","p1","p2","q1","q2","o1","sign","o2","o3","o4","onSegment","min","num","Node","b2","an","bp","sum","deviation","polygonArea","trianglesArea","flatten","result","vertices","holes","dimensions","holeIndex","d","root","freeExports","nodeType","freeModule","freeGlobal","global","window","self","punycode","key","maxInt","base","regexPunycode","regexNonASCII","regexSeparators","errors","overflow","floor","stringFromCharCode","String","fromCharCode","error","type","RangeError","map","array","mapDomain","string","parts","split","replace","join","ucs2decode","value","extra","output","counter","charCodeAt","ucs2encode","digitToBasic","digit","flag","adapt","delta","numPoints","firstTime","k","baseMinusTMin","decode","input","out","basic","index","oldi","w","t","baseMinusT","codePoint","inputLength","bias","lastIndexOf","splice","encode","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","version","ucs2","toASCII","test","toUnicode","toLowerCase","util","arg","obj","prop","qs","sep","eq","options","regexp","maxKeys","kstr","vstr","v","idx","indexOf","substr","decodeURIComponent","isArray","stringifyPrimitive","isFinite","keys","ks","encodeURIComponent","parse","require$$0","stringify","require$$1","urlParse","resolve","source","relative","format","Url","protocol","slashes","auth","host","port","hostname","hash","search","query","pathname","path","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","javascript","hostlessProtocol","slashedProtocol","http","https","ftp","gopher","file","url","parseQueryString","slashesDenoteHost","u","queryIndex","splitter","uSplit","rest","trim","simplePath","exec","querystring","proto","lowerProto","match","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","part","newpart","validParts","notHost","bit","unshift","h","ae","esc","escape","qm","s","charAt","resolveObject","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","shift","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","pop","authInHost","hasTrailingSlash","up","isAbsolute","_parse","_format","_resolve","assertPath","JSON","removeUrlParams","toPosix","find","RegExp","isUrl","isDataUrl","hasProtocol","getProtocol","isFile","isHttp","isWindows","arr","toAbsolute","customBaseUrl","customRootUrl","baseUrl","settings","ADAPTER","getBaseUrl","rootUrl","rootname","startsWith","normalize","trailingSeparator","endsWith","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","lastSlashIndex","normalizeStringPosix","joined","segments","_i","prevArg","_a","extname","dirname","hasRoot","matchedSlash","origpath","basename","ext","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","dir","delimiter","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","premultiplyBlendMode","pm","npm","BLEND_MODES","NORMAL_NPM","NORMAL","ADD_NPM","ADD","SCREEN_NPM","SCREEN","mapPremultipliedBlendModes","getBufferType","BYTES_PER_ELEMENT","Float32Array","Uint32Array","Uint16Array","Uint8Array","Int32Array","nextUid","warnings","TextureCache","BaseTextureCache","CanvasRenderTarget","width","height","resolution","canvas","createCanvas","getContext","RESOLUTION","resize","clear","setTransform","clearRect","desiredWidth","desiredHeight","round","destroy","defineProperty","get","set","val","tempAnchor","DATA_URI","blendMode","premultiplied","size","outBuffer","totalIndices","Error","dataUri","dataUriMatch","mediaType","subType","charset","encoding","message","ignoreDepth","stack","console","warn","groupCollapsed","groupEnd","loc","globalThis","location","document","createElement","parsedUrl","_url","samePort","defaultValue","parseFloat","hex","hexString","toString","substring","arrays","sizes","outSize","stride","views","buffer","ArrayBuffer","littleOffset","contextOptions","stencil","failIfMajorPerformanceCaveat","getWebGLRenderingContext","gl","success","getContextAttributes","loseContext","getExtension","rgb","alpha","premultiply","tint","R","G","B","startIdx","removeCount","getNavigator","userAgent","log","cssColorNames","parseInt","willReadFrequently","pixels","getImageData","bound","top","left","right","bottom"],"mappings":";;;;;;;+eAEA,IAAIA,EAAMC,OAAOC,UAAUC,eACvBC,EAAS,IASb,SAASC,KA4BT,SAASC,EAAGC,EAAIC,EAASC,GACvBC,KAAKH,GAAKA,EACVG,KAAKF,QAAUA,EACfE,KAAKD,KAAOA,IAAQ,EActB,SAASE,EAAYC,EAASC,EAAON,EAAIC,E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yCV,SAAqBlO,GAYvB,MAVsB,iBAAXA,GAIW,OAFlBA,EAAU6U,GAA0C7U,EAAO8C,gBAAkB9C,GAElE,KAEPA,EAASA,EAAO9L,MAAM,IAIvB4gB,SAAS9U,EAAQ,kBIlDtB,SAAqB6P,GAIvB,IAiBItb,EACAmC,EACAC,EAnBA+Y,EAAQG,EAAOH,MACfC,EAASE,EAAOF,OAEd9c,EAAUgd,EAAOE,WAAW,KAAM,CACpCgF,oBAAoB,IAGlBC,EADYniB,EAAQoiB,aAAa,EAAG,EAAGvF,EAAOC,GAC3BxZ,KACnBf,EAAM4f,EAAOvgB,OAEbygB,EAAe,CACjBC,IAAK,KACLC,KAAM,KACNC,MAAO,KACPC,OAAQ,MAERnf,EAAO,KAKX,IAAK5B,EAAI,EAAGA,EAAIa,EAAKb,GAAK,EAEA,IAAlBygB,EAAOzgB,EAAI,KAEXmC,EAAKnC,EAAI,EAAKmb,EACd/Y,KAAQpC,EAAI,EAAKmb,GAEC,OAAdwF,EAAMC,MAEND,EAAMC,IAAMxe,IAGG,OAAfue,EAAME,MAID1e,EAAIwe,EAAME,QAFfF,EAAME,KAAO1e,IAOG,OAAhBwe,EAAMG,OAIDH,EAAMG,MAAQ3e,KAFnBwe,EAAMG,MAAQ3e,EAAI,IAOD,OAAjBwe,EAAMI,QAIDJ,EAAMI,OAAS3e,KAFpBue,EAAMI,OAAS3e,IAgB3B,OAPkB,OAAdue,EAAMC,MAENzF,EAAQwF,EAAMG,MAAQH,EAAME,KAC5BzF,EAASuF,EAAMI,OAASJ,EAAMC,IAAM,EACpChf,EAAOtD,EAAQoiB,aAAaC,EAAME,KAAMF,EAAMC,IAAKzF,EAAOC,IAGvD,CACHA,OAAMA,EACND,MAAKA,EACLvZ,KAAIA,qBbjFR,QAASkZ"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/cjs/utils.js b/live2d/node_modules/@pixi/utils/dist/cjs/utils.js new file mode 100644 index 0000000..1bbc96f --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/cjs/utils.js @@ -0,0 +1,1734 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var settings = require('@pixi/settings'); +var eventemitter3 = require('eventemitter3'); +var earcut = require('earcut'); +var url$1 = require('url'); +var constants = require('@pixi/constants'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var eventemitter3__default = /*#__PURE__*/_interopDefaultLegacy(eventemitter3); +var earcut__default = /*#__PURE__*/_interopDefaultLegacy(earcut); + +/** + * This file contains redeclared types for Node `url` and `querystring` modules. These modules + * don't provide their own typings but instead are a part of the full Node typings. The purpose of + * this file is to redeclare the required types to avoid having the whole Node types as a + * dependency. + */ +var url = { + parse: url$1.parse, + format: url$1.format, + resolve: url$1.resolve, +}; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError("Path must be a string. Received " + JSON.stringify(path)); + } +} +function removeUrlParams(url) { + var re = url.split('?')[0]; + return re.split('#')[0]; +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} +function replaceAll(str, find, replace) { + return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); +} +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) { + code = path.charCodeAt(i); + } + else if (code === 47) { + break; + } + else { + code = 47; + } + if (code === 47) { + if (lastSlash === i - 1 || dots === 1) ; + else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 + || lastSegmentLength !== 2 + || res.charCodeAt(res.length - 1) !== 46 + || res.charCodeAt(res.length - 2) !== 46) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } + else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } + else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) { + res += '/..'; + } + else { + res = '..'; + } + lastSegmentLength = 2; + } + } + else { + if (res.length > 0) { + res += "/" + path.slice(lastSlash + 1, i); + } + else { + res = path.slice(lastSlash + 1, i); + } + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } + else if (code === 46 && dots !== -1) { + ++dots; + } + else { + dots = -1; + } + } + return res; +} +var path = { + /** + * Converts a path to posix format. + * @param path - The path to convert to posix + */ + toPosix: function (path) { return replaceAll(path, '\\', '/'); }, + /** + * Checks if the path is a URL + * @param path - The path to check + */ + isUrl: function (path) { return (/^https?:/).test(this.toPosix(path)); }, + /** + * Checks if the path is a data URL + * @param path - The path to check + */ + isDataUrl: function (path) { + // eslint-disable-next-line max-len + return (/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i) + .test(path); + }, + /** + * Checks if the path has a protocol e.g. http:// + * This will return true for windows file paths + * @param path - The path to check + */ + hasProtocol: function (path) { return (/^[^/:]+:\//).test(this.toPosix(path)); }, + /** + * Returns the protocol of the path e.g. http://, C:/, file:/// + * @param path - The path to get the protocol from + */ + getProtocol: function (path) { + assertPath(path); + path = this.toPosix(path); + var protocol = ''; + var isFile = (/^file:\/\/\//).exec(path); + var isHttp = (/^[^/:]+:\/\//).exec(path); + var isWindows = (/^[^/:]+:\//).exec(path); + if (isFile || isHttp || isWindows) { + var arr = (isFile === null || isFile === void 0 ? void 0 : isFile[0]) || (isHttp === null || isHttp === void 0 ? void 0 : isHttp[0]) || (isWindows === null || isWindows === void 0 ? void 0 : isWindows[0]); + protocol = arr; + path = path.slice(arr.length); + } + return protocol; + }, + /** + * Converts URL to an absolute path. + * When loading from a Web Worker, we must use absolute paths. + * If the URL is already absolute we return it as is + * If it's not, we convert it + * @param url - The URL to test + * @param customBaseUrl - The base URL to use + * @param customRootUrl - The root URL to use + */ + toAbsolute: function (url, customBaseUrl, customRootUrl) { + if (this.isDataUrl(url)) + { return url; } + var baseUrl = removeUrlParams(this.toPosix(customBaseUrl !== null && customBaseUrl !== void 0 ? customBaseUrl : settings.settings.ADAPTER.getBaseUrl())); + var rootUrl = removeUrlParams(this.toPosix(customRootUrl !== null && customRootUrl !== void 0 ? customRootUrl : this.rootname(baseUrl))); + assertPath(url); + url = this.toPosix(url); + // root relative url + if (url.startsWith('/')) { + return path.join(rootUrl, url.slice(1)); + } + var absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url); + return absolutePath; + }, + /** + * Normalizes the given path, resolving '..' and '.' segments + * @param path - The path to normalize + */ + normalize: function (path) { + path = this.toPosix(path); + assertPath(path); + if (path.length === 0) + { return '.'; } + var protocol = ''; + var isAbsolute = path.startsWith('/'); + if (this.hasProtocol(path)) { + protocol = this.rootname(path); + path = path.slice(protocol.length); + } + var trailingSeparator = path.endsWith('/'); + // Normalize the path + path = normalizeStringPosix(path, false); + if (path.length > 0 && trailingSeparator) + { path += '/'; } + if (isAbsolute) + { return "/" + path; } + return protocol + path; + }, + /** + * Determines if path is an absolute path. + * Absolute paths can be urls, data urls, or paths on disk + * @param path - The path to test + */ + isAbsolute: function (path) { + assertPath(path); + path = this.toPosix(path); + if (this.hasProtocol(path)) + { return true; } + return path.startsWith('/'); + }, + /** + * Joins all given path segments together using the platform-specific separator as a delimiter, + * then normalizes the resulting path + * @param segments - The segments of the path to join + */ + join: function () { + var arguments$1 = arguments; + + var _a; + var segments = []; + for (var _i = 0; _i < arguments.length; _i++) { + segments[_i] = arguments$1[_i]; + } + if (segments.length === 0) { + return '.'; + } + var joined; + for (var i = 0; i < segments.length; ++i) { + var arg = segments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + { joined = arg; } + else { + var prevArg = (_a = segments[i - 1]) !== null && _a !== void 0 ? _a : ''; + if (this.extname(prevArg)) { + joined += "/../" + arg; + } + else { + joined += "/" + arg; + } + } + } + } + if (joined === undefined) { + return '.'; + } + return this.normalize(joined); + }, + /** + * Returns the directory name of a path + * @param path - The path to parse + */ + dirname: function (path) { + assertPath(path); + if (path.length === 0) + { return '.'; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var hasRoot = code === 47; + var end = -1; + var matchedSlash = true; + var proto = this.getProtocol(path); + var origpath = path; + path = path.slice(proto.length); + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47) { + if (!matchedSlash) { + end = i; + break; + } + } + else { + // We saw the first non-path separator + matchedSlash = false; + } + } + // if end is -1 and its a url then we need to add the path back + // eslint-disable-next-line no-nested-ternary + if (end === -1) + { return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto; } + if (hasRoot && end === 1) + { return '//'; } + return proto + path.slice(0, end); + }, + /** + * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/ + * @param path - The path to parse + */ + rootname: function (path) { + assertPath(path); + path = this.toPosix(path); + var root = ''; + if (path.startsWith('/')) + { root = '/'; } + else { + root = this.getProtocol(path); + } + if (this.isUrl(path)) { + // need to find the first path separator + var index = path.indexOf('/', root.length); + if (index !== -1) { + root = path.slice(0, index); + } + else + { root = path; } + if (!root.endsWith('/')) + { root += '/'; } + } + return root; + }, + /** + * Returns the last portion of a path + * @param path - The path to test + * @param ext - Optional extension to remove + */ + basename: function (path, ext) { + assertPath(path); + if (ext) + { assertPath(ext); } + path = this.toPosix(path); + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) + { return ''; } + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } + else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) + { end = firstNonSlashEnd; } + else if (end === -1) + { end = path.length; } + return path.slice(start, end); + } + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + if (end === -1) + { return ''; } + return path.slice(start, end); + }, + /** + * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last + * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than + * the first character of the basename of path, an empty string is returned. + * @param path - The path to parse + */ + extname: function (path) { + assertPath(path); + path = this.toPosix(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, + /** + * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties. + * @param path - The path to parse + */ + parse: function (path) { + assertPath(path); + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) + { return ret; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var isAbsolute = this.isAbsolute(path); + var start; + ret.root = this.rootname(path); + if (isAbsolute || this.hasProtocol(path)) { + start = 1; + } + else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) + { ret.base = ret.name = path.slice(1, end); } + else + { ret.base = ret.name = path.slice(startPart, end); } + } + } + else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } + else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } + ret.dir = this.dirname(path); + return ret; + }, + sep: '/', + delimiter: ':' +}; + +/** + * The prefix that denotes a URL is for a retina asset. + * @static + * @name RETINA_PREFIX + * @memberof PIXI.settings + * @type {RegExp} + * @default /@([0-9\.]+)x/ + * @example `@2x` + */ +settings.settings.RETINA_PREFIX = /@([0-9\.]+)x/; +/** + * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. + * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when + * using WebGL. + * + * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible. + * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the + * browser. + * + * If your application requires high performance rendering, you may wish to set this to false. + * We recommend one of two options if you decide to set this flag to false: + * + * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is + * not supported. + * + * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS + * renderer, and show an error message to the user if the function returns false, explaining that their device & browser + * combination does not support high performance WebGL. + * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails. + * @static + * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false; + +var saidHello = false; +var VERSION = '6.5.10'; +/** + * Skips the hello message of renderers that are created after this is run. + * @function skipHello + * @memberof PIXI.utils + */ +function skipHello() { + saidHello = true; +} +/** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever make you a jerk face. + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ +function sayHello(type) { + var _a; + if (saidHello) { + return; + } + if (settings.settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1) { + var args = [ + "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", + 'background: #ff66a5; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff66a5; background: #030307; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'background: #ffc3dc; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;' ]; + (_a = globalThis.console).log.apply(_a, args); + } + else if (globalThis.console) { + globalThis.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); + } + saidHello = true; +} + +var supported; +/** + * Helper for checking for WebGL support. + * @memberof PIXI.utils + * @function isWebGLSupported + * @returns {boolean} Is WebGL supported. + */ +function isWebGLSupported() { + if (typeof supported === 'undefined') { + supported = (function supported() { + var contextOptions = { + stencil: true, + failIfMajorPerformanceCaveat: settings.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, + }; + try { + if (!settings.settings.ADAPTER.getWebGLRenderingContext()) { + return false; + } + var canvas = settings.settings.ADAPTER.createCanvas(); + var gl = (canvas.getContext('webgl', contextOptions) + || canvas.getContext('experimental-webgl', contextOptions)); + var success = !!(gl && gl.getContextAttributes().stencil); + if (gl) { + var loseContext = gl.getExtension('WEBGL_lose_context'); + if (loseContext) { + loseContext.loseContext(); + } + } + gl = null; + return success; + } + catch (e) { + return false; + } + })(); + } + return supported; +} + +var aliceblue = "#f0f8ff"; +var antiquewhite = "#faebd7"; +var aqua = "#00ffff"; +var aquamarine = "#7fffd4"; +var azure = "#f0ffff"; +var beige = "#f5f5dc"; +var bisque = "#ffe4c4"; +var black = "#000000"; +var blanchedalmond = "#ffebcd"; +var blue = "#0000ff"; +var blueviolet = "#8a2be2"; +var brown = "#a52a2a"; +var burlywood = "#deb887"; +var cadetblue = "#5f9ea0"; +var chartreuse = "#7fff00"; +var chocolate = "#d2691e"; +var coral = "#ff7f50"; +var cornflowerblue = "#6495ed"; +var cornsilk = "#fff8dc"; +var crimson = "#dc143c"; +var cyan = "#00ffff"; +var darkblue = "#00008b"; +var darkcyan = "#008b8b"; +var darkgoldenrod = "#b8860b"; +var darkgray = "#a9a9a9"; +var darkgreen = "#006400"; +var darkgrey = "#a9a9a9"; +var darkkhaki = "#bdb76b"; +var darkmagenta = "#8b008b"; +var darkolivegreen = "#556b2f"; +var darkorange = "#ff8c00"; +var darkorchid = "#9932cc"; +var darkred = "#8b0000"; +var darksalmon = "#e9967a"; +var darkseagreen = "#8fbc8f"; +var darkslateblue = "#483d8b"; +var darkslategray = "#2f4f4f"; +var darkslategrey = "#2f4f4f"; +var darkturquoise = "#00ced1"; +var darkviolet = "#9400d3"; +var deeppink = "#ff1493"; +var deepskyblue = "#00bfff"; +var dimgray = "#696969"; +var dimgrey = "#696969"; +var dodgerblue = "#1e90ff"; +var firebrick = "#b22222"; +var floralwhite = "#fffaf0"; +var forestgreen = "#228b22"; +var fuchsia = "#ff00ff"; +var gainsboro = "#dcdcdc"; +var ghostwhite = "#f8f8ff"; +var goldenrod = "#daa520"; +var gold = "#ffd700"; +var gray = "#808080"; +var green = "#008000"; +var greenyellow = "#adff2f"; +var grey = "#808080"; +var honeydew = "#f0fff0"; +var hotpink = "#ff69b4"; +var indianred = "#cd5c5c"; +var indigo = "#4b0082"; +var ivory = "#fffff0"; +var khaki = "#f0e68c"; +var lavenderblush = "#fff0f5"; +var lavender = "#e6e6fa"; +var lawngreen = "#7cfc00"; +var lemonchiffon = "#fffacd"; +var lightblue = "#add8e6"; +var lightcoral = "#f08080"; +var lightcyan = "#e0ffff"; +var lightgoldenrodyellow = "#fafad2"; +var lightgray = "#d3d3d3"; +var lightgreen = "#90ee90"; +var lightgrey = "#d3d3d3"; +var lightpink = "#ffb6c1"; +var lightsalmon = "#ffa07a"; +var lightseagreen = "#20b2aa"; +var lightskyblue = "#87cefa"; +var lightslategray = "#778899"; +var lightslategrey = "#778899"; +var lightsteelblue = "#b0c4de"; +var lightyellow = "#ffffe0"; +var lime = "#00ff00"; +var limegreen = "#32cd32"; +var linen = "#faf0e6"; +var magenta = "#ff00ff"; +var maroon = "#800000"; +var mediumaquamarine = "#66cdaa"; +var mediumblue = "#0000cd"; +var mediumorchid = "#ba55d3"; +var mediumpurple = "#9370db"; +var mediumseagreen = "#3cb371"; +var mediumslateblue = "#7b68ee"; +var mediumspringgreen = "#00fa9a"; +var mediumturquoise = "#48d1cc"; +var mediumvioletred = "#c71585"; +var midnightblue = "#191970"; +var mintcream = "#f5fffa"; +var mistyrose = "#ffe4e1"; +var moccasin = "#ffe4b5"; +var navajowhite = "#ffdead"; +var navy = "#000080"; +var oldlace = "#fdf5e6"; +var olive = "#808000"; +var olivedrab = "#6b8e23"; +var orange = "#ffa500"; +var orangered = "#ff4500"; +var orchid = "#da70d6"; +var palegoldenrod = "#eee8aa"; +var palegreen = "#98fb98"; +var paleturquoise = "#afeeee"; +var palevioletred = "#db7093"; +var papayawhip = "#ffefd5"; +var peachpuff = "#ffdab9"; +var peru = "#cd853f"; +var pink = "#ffc0cb"; +var plum = "#dda0dd"; +var powderblue = "#b0e0e6"; +var purple = "#800080"; +var rebeccapurple = "#663399"; +var red = "#ff0000"; +var rosybrown = "#bc8f8f"; +var royalblue = "#4169e1"; +var saddlebrown = "#8b4513"; +var salmon = "#fa8072"; +var sandybrown = "#f4a460"; +var seagreen = "#2e8b57"; +var seashell = "#fff5ee"; +var sienna = "#a0522d"; +var silver = "#c0c0c0"; +var skyblue = "#87ceeb"; +var slateblue = "#6a5acd"; +var slategray = "#708090"; +var slategrey = "#708090"; +var snow = "#fffafa"; +var springgreen = "#00ff7f"; +var steelblue = "#4682b4"; +var tan = "#d2b48c"; +var teal = "#008080"; +var thistle = "#d8bfd8"; +var tomato = "#ff6347"; +var turquoise = "#40e0d0"; +var violet = "#ee82ee"; +var wheat = "#f5deb3"; +var white = "#ffffff"; +var whitesmoke = "#f5f5f5"; +var yellow = "#ffff00"; +var yellowgreen = "#9acd32"; +var cssColorNames = { + aliceblue: aliceblue, + antiquewhite: antiquewhite, + aqua: aqua, + aquamarine: aquamarine, + azure: azure, + beige: beige, + bisque: bisque, + black: black, + blanchedalmond: blanchedalmond, + blue: blue, + blueviolet: blueviolet, + brown: brown, + burlywood: burlywood, + cadetblue: cadetblue, + chartreuse: chartreuse, + chocolate: chocolate, + coral: coral, + cornflowerblue: cornflowerblue, + cornsilk: cornsilk, + crimson: crimson, + cyan: cyan, + darkblue: darkblue, + darkcyan: darkcyan, + darkgoldenrod: darkgoldenrod, + darkgray: darkgray, + darkgreen: darkgreen, + darkgrey: darkgrey, + darkkhaki: darkkhaki, + darkmagenta: darkmagenta, + darkolivegreen: darkolivegreen, + darkorange: darkorange, + darkorchid: darkorchid, + darkred: darkred, + darksalmon: darksalmon, + darkseagreen: darkseagreen, + darkslateblue: darkslateblue, + darkslategray: darkslategray, + darkslategrey: darkslategrey, + darkturquoise: darkturquoise, + darkviolet: darkviolet, + deeppink: deeppink, + deepskyblue: deepskyblue, + dimgray: dimgray, + dimgrey: dimgrey, + dodgerblue: dodgerblue, + firebrick: firebrick, + floralwhite: floralwhite, + forestgreen: forestgreen, + fuchsia: fuchsia, + gainsboro: gainsboro, + ghostwhite: ghostwhite, + goldenrod: goldenrod, + gold: gold, + gray: gray, + green: green, + greenyellow: greenyellow, + grey: grey, + honeydew: honeydew, + hotpink: hotpink, + indianred: indianred, + indigo: indigo, + ivory: ivory, + khaki: khaki, + lavenderblush: lavenderblush, + lavender: lavender, + lawngreen: lawngreen, + lemonchiffon: lemonchiffon, + lightblue: lightblue, + lightcoral: lightcoral, + lightcyan: lightcyan, + lightgoldenrodyellow: lightgoldenrodyellow, + lightgray: lightgray, + lightgreen: lightgreen, + lightgrey: lightgrey, + lightpink: lightpink, + lightsalmon: lightsalmon, + lightseagreen: lightseagreen, + lightskyblue: lightskyblue, + lightslategray: lightslategray, + lightslategrey: lightslategrey, + lightsteelblue: lightsteelblue, + lightyellow: lightyellow, + lime: lime, + limegreen: limegreen, + linen: linen, + magenta: magenta, + maroon: maroon, + mediumaquamarine: mediumaquamarine, + mediumblue: mediumblue, + mediumorchid: mediumorchid, + mediumpurple: mediumpurple, + mediumseagreen: mediumseagreen, + mediumslateblue: mediumslateblue, + mediumspringgreen: mediumspringgreen, + mediumturquoise: mediumturquoise, + mediumvioletred: mediumvioletred, + midnightblue: midnightblue, + mintcream: mintcream, + mistyrose: mistyrose, + moccasin: moccasin, + navajowhite: navajowhite, + navy: navy, + oldlace: oldlace, + olive: olive, + olivedrab: olivedrab, + orange: orange, + orangered: orangered, + orchid: orchid, + palegoldenrod: palegoldenrod, + palegreen: palegreen, + paleturquoise: paleturquoise, + palevioletred: palevioletred, + papayawhip: papayawhip, + peachpuff: peachpuff, + peru: peru, + pink: pink, + plum: plum, + powderblue: powderblue, + purple: purple, + rebeccapurple: rebeccapurple, + red: red, + rosybrown: rosybrown, + royalblue: royalblue, + saddlebrown: saddlebrown, + salmon: salmon, + sandybrown: sandybrown, + seagreen: seagreen, + seashell: seashell, + sienna: sienna, + silver: silver, + skyblue: skyblue, + slateblue: slateblue, + slategray: slategray, + slategrey: slategrey, + snow: snow, + springgreen: springgreen, + steelblue: steelblue, + tan: tan, + teal: teal, + thistle: thistle, + tomato: tomato, + turquoise: turquoise, + violet: violet, + wheat: wheat, + white: white, + whitesmoke: whitesmoke, + yellow: yellow, + yellowgreen: yellowgreen +}; + +/** + * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). + * @example + * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The hexadecimal number to convert + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one + * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats. + */ +function hex2rgb(hex, out) { + if (out === void 0) { out = []; } + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + return out; +} +/** + * Converts a hexadecimal color number to a string. + * @example + * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex (e.g., `0xffffff`) + * @returns {string} The string color (e.g., `"#ffffff"`). + */ +function hex2string(hex) { + var hexString = hex.toString(16); + hexString = '000000'.substring(0, 6 - hexString.length) + hexString; + return "#" + hexString; +} +/** + * Converts a string to a hexadecimal color number. + * It can handle: + * hex strings starting with #: "#ffffff" + * hex strings starting with 0x: "0xffffff" + * hex strings without prefix: "ffffff" + * css colors: "black" + * @example + * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function string2hex + * @param {string} string - The string color (e.g., `"#ffffff"`) + * @returns {number} Number in hexadecimal. + */ +function string2hex(string) { + if (typeof string === 'string') { + string = cssColorNames[string.toLowerCase()] || string; + if (string[0] === '#') { + string = string.slice(1); + } + } + return parseInt(string, 16); +} +/** + * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. + * @example + * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. + * @returns {number} Number in hexadecimal. + */ +function rgb2hex(rgb) { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); +} + +/** + * Corrects PixiJS blend, takes premultiplied alpha into account + * @memberof PIXI.utils + * @function mapPremultipliedBlendModes + * @private + * @returns {Array} Mapped modes. + */ +function mapPremultipliedBlendModes() { + var pm = []; + var npm = []; + for (var i = 0; i < 32; i++) { + pm[i] = i; + npm[i] = i; + } + pm[constants.BLEND_MODES.NORMAL_NPM] = constants.BLEND_MODES.NORMAL; + pm[constants.BLEND_MODES.ADD_NPM] = constants.BLEND_MODES.ADD; + pm[constants.BLEND_MODES.SCREEN_NPM] = constants.BLEND_MODES.SCREEN; + npm[constants.BLEND_MODES.NORMAL] = constants.BLEND_MODES.NORMAL_NPM; + npm[constants.BLEND_MODES.ADD] = constants.BLEND_MODES.ADD_NPM; + npm[constants.BLEND_MODES.SCREEN] = constants.BLEND_MODES.SCREEN_NPM; + var array = []; + array.push(npm); + array.push(pm); + return array; +} +/** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @constant premultiplyBlendMode + * @type {Array} + */ +var premultiplyBlendMode = mapPremultipliedBlendModes(); +/** + * changes blendMode according to texture format + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied + * @returns {number} true blend mode for this texture + */ +function correctBlendMode(blendMode, premultiplied) { + return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; +} +/** + * combines rgb and alpha to out array + * @memberof PIXI.utils + * @function premultiplyRgba + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +function premultiplyRgba(rgb, alpha, out, premultiply) { + out = out || new Float32Array(4); + if (premultiply || premultiply === undefined) { + out[0] = rgb[0] * alpha; + out[1] = rgb[1] * alpha; + out[2] = rgb[2] * alpha; + } + else { + out[0] = rgb[0]; + out[1] = rgb[1]; + out[2] = rgb[2]; + } + out[3] = alpha; + return out; +} +/** + * premultiplies tint + * @memberof PIXI.utils + * @function premultiplyTint + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ +function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { + return (alpha * 255 << 24) + tint; + } + if (alpha === 0.0) { + return 0; + } + var R = ((tint >> 16) & 0xFF); + var G = ((tint >> 8) & 0xFF); + var B = (tint & 0xFF); + R = ((R * alpha) + 0.5) | 0; + G = ((G * alpha) + 0.5) | 0; + B = ((B * alpha) + 0.5) | 0; + return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; +} +/** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * @memberof PIXI.utils + * @function premultiplyTintToRgba + * @param {number} tint - input tint + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +function premultiplyTintToRgba(tint, alpha, out, premultiply) { + out = out || new Float32Array(4); + out[0] = ((tint >> 16) & 0xFF) / 255.0; + out[1] = ((tint >> 8) & 0xFF) / 255.0; + out[2] = (tint & 0xFF) / 255.0; + if (premultiply || premultiply === undefined) { + out[0] *= alpha; + out[1] *= alpha; + out[2] *= alpha; + } + out[3] = alpha; + return out; +} + +/** + * Generic Mask Stack data structure + * @memberof PIXI.utils + * @function createIndicesForQuads + * @param {number} size - Number of quads + * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` + * @returns {Uint16Array|Uint32Array} - Resulting index buffer + */ +function createIndicesForQuads(size, outBuffer) { + if (outBuffer === void 0) { outBuffer = null; } + // the total number of indices in our array, there are 6 points per quad. + var totalIndices = size * 6; + outBuffer = outBuffer || new Uint16Array(totalIndices); + if (outBuffer.length !== totalIndices) { + throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); + } + // fill the indices with the quads to draw + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { + outBuffer[i + 0] = j + 0; + outBuffer[i + 1] = j + 1; + outBuffer[i + 2] = j + 2; + outBuffer[i + 3] = j + 0; + outBuffer[i + 4] = j + 2; + outBuffer[i + 5] = j + 3; + } + return outBuffer; +} + +function getBufferType(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; +} + +/* eslint-disable object-shorthand */ +var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; +function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + /* + @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way + or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? + */ + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); +} + +// Taken from the bit-twiddle package +/** + * Rounds to next power of two. + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} - next rounded power of two + */ +function nextPow2(v) { + v += v === 0 ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; +} +/** + * Checks if a number is a power of two. + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {boolean} `true` if value is power of two + */ +function isPow2(v) { + return !(v & (v - 1)) && (!!v); +} +/** + * Computes ceil of log base 2 + * @function log2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} logarithm base 2 + */ +function log2(v) { + var r = (v > 0xFFFF ? 1 : 0) << 4; + v >>>= r; + var shift = (v > 0xFF ? 1 : 0) << 3; + v >>>= shift; + r |= shift; + shift = (v > 0xF ? 1 : 0) << 2; + v >>>= shift; + r |= shift; + shift = (v > 0x3 ? 1 : 0) << 1; + v >>>= shift; + r |= shift; + return r | (v >> 1); +} + +/** + * Remove items from a javascript array without generating garbage + * @function removeItems + * @memberof PIXI.utils + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove + */ +function removeItems(arr, startIdx, removeCount) { + var length = arr.length; + var i; + if (startIdx >= length || removeCount === 0) { + return; + } + removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); + var len = length - removeCount; + for (i = startIdx; i < len; ++i) { + arr[i] = arr[i + removeCount]; + } + arr.length = len; +} + +/** + * Returns sign of number + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ +function sign(n) { + if (n === 0) + { return 0; } + return n < 0 ? -1 : 1; +} + +var nextUid = 0; +/** + * Gets the next unique identifier + * @memberof PIXI.utils + * @function uid + * @returns {number} The next unique identifier to use. + */ +function uid() { + return ++nextUid; +} + +// A map of warning messages already fired +var warnings = {}; +/** + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. + * @memberof PIXI.utils + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. + */ +function deprecation(version, message, ignoreDepth) { + if (ignoreDepth === void 0) { ignoreDepth = 3; } + // Ignore duplicat + if (warnings[message]) { + return; + } + /* eslint-disable no-console */ + var stack = new Error().stack; + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + } + else { + // chop off the stack trace which includes PixiJS internal calls + stack = stack.split('\n').splice(ignoreDepth).join('\n'); + if (console.groupCollapsed) { + console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + console.warn(stack); + } + } + /* eslint-enable no-console */ + warnings[message] = true; +} + +/** + * @todo Describe property usage + * @static + * @name ProgramCache + * @memberof PIXI.utils + * @type {object} + */ +var ProgramCache = {}; +/** + * @todo Describe property usage + * @static + * @name TextureCache + * @memberof PIXI.utils + * @type {object} + */ +var TextureCache = Object.create(null); +/** + * @todo Describe property usage + * @static + * @name BaseTextureCache + * @memberof PIXI.utils + * @type {object} + */ +var BaseTextureCache = Object.create(null); +/** + * Destroys all texture in the cache + * @memberof PIXI.utils + * @function destroyTextureCache + */ +function destroyTextureCache() { + var key; + for (key in TextureCache) { + TextureCache[key].destroy(); + } + for (key in BaseTextureCache) { + BaseTextureCache[key].destroy(); + } +} +/** + * Removes all textures from cache, but does not destroy them + * @memberof PIXI.utils + * @function clearTextureCache + */ +function clearTextureCache() { + var key; + for (key in TextureCache) { + delete TextureCache[key]; + } + for (key in BaseTextureCache) { + delete BaseTextureCache[key]; + } +} + +/** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * @class + * @memberof PIXI.utils + */ +var CanvasRenderTarget = /** @class */ (function () { + /** + * @param width - the width for the newly created canvas + * @param height - the height for the newly created canvas + * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + this.canvas = settings.settings.ADAPTER.createCanvas(); + this.context = this.canvas.getContext('2d'); + this.resolution = resolution || settings.settings.RESOLUTION; + this.resize(width, height); + } + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * @private + */ + CanvasRenderTarget.prototype.clear = function () { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + /** + * Resizes the canvas to the specified width and height. + * @param desiredWidth - the desired width of the canvas + * @param desiredHeight - the desired height of the canvas + */ + CanvasRenderTarget.prototype.resize = function (desiredWidth, desiredHeight) { + this.canvas.width = Math.round(desiredWidth * this.resolution); + this.canvas.height = Math.round(desiredHeight * this.resolution); + }; + /** Destroys this canvas. */ + CanvasRenderTarget.prototype.destroy = function () { + this.context = null; + this.canvas = null; + }; + Object.defineProperty(CanvasRenderTarget.prototype, "width", { + /** + * The width of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.width; + }, + set: function (val) { + this.canvas.width = Math.round(val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CanvasRenderTarget.prototype, "height", { + /** + * The height of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.height; + }, + set: function (val) { + this.canvas.height = Math.round(val); + }, + enumerable: false, + configurable: true + }); + return CanvasRenderTarget; +}()); + +/** + * Trim transparent borders from a canvas + * @memberof PIXI.utils + * @function trimCanvas + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ +function trimCanvas(canvas) { + // https://gist.github.com/remy/784508 + var width = canvas.width; + var height = canvas.height; + var context = canvas.getContext('2d', { + willReadFrequently: true, + }); + var imageData = context.getImageData(0, 0, width, height); + var pixels = imageData.data; + var len = pixels.length; + var bound = { + top: null, + left: null, + right: null, + bottom: null, + }; + var data = null; + var i; + var x; + var y; + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { + x = (i / 4) % width; + y = ~~((i / 4) / width); + if (bound.top === null) { + bound.top = y; + } + if (bound.left === null) { + bound.left = x; + } + else if (x < bound.left) { + bound.left = x; + } + if (bound.right === null) { + bound.right = x + 1; + } + else if (bound.right < x) { + bound.right = x + 1; + } + if (bound.bottom === null) { + bound.bottom = y; + } + else if (bound.bottom < y) { + bound.bottom = y; + } + } + } + if (bound.top !== null) { + width = bound.right - bound.left; + height = bound.bottom - bound.top + 1; + data = context.getImageData(bound.left, bound.top, width, height); + } + return { + height: height, + width: width, + data: data, + }; +} + +/** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * @static + * @constant {RegExp|string} DATA_URI + * @memberof PIXI + * @example data:image/png;base64 + */ +var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; + +/** + * @memberof PIXI.utils + * @interface DecomposedDataUri + */ +/** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ +/** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ +/** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ +/** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ +/** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data + */ +/** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined + */ +function decomposeDataUri(dataUri) { + var dataUriMatch = DATA_URI.exec(dataUri); + if (dataUriMatch) { + return { + mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, + subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, + charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, + encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, + data: dataUriMatch[5], + }; + } + return undefined; +} + +var tempAnchor; +/** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @returns {string} The crossOrigin value to use (or empty string for none). + */ +function determineCrossOrigin(url$1, loc) { + if (loc === void 0) { loc = globalThis.location; } + // data: and javascript: urls are considered same-origin + if (url$1.indexOf('data:') === 0) { + return ''; + } + // default is window.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url$1; + var parsedUrl = url.parse(tempAnchor.href); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + // if cross origin + if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; +} + +/** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @returns {number} resolution / device pixel ratio of an asset + */ +function getResolutionOfUrl(url, defaultValue) { + var resolution = settings.settings.RETINA_PREFIX.exec(url); + if (resolution) { + return parseFloat(resolution[1]); + } + return defaultValue !== undefined ? defaultValue : 1; +} + +Object.defineProperty(exports, 'isMobile', { + enumerable: true, + get: function () { return settings.isMobile; } +}); +Object.defineProperty(exports, 'EventEmitter', { + enumerable: true, + get: function () { return eventemitter3__default["default"]; } +}); +Object.defineProperty(exports, 'earcut', { + enumerable: true, + get: function () { return earcut__default["default"]; } +}); +exports.BaseTextureCache = BaseTextureCache; +exports.CanvasRenderTarget = CanvasRenderTarget; +exports.DATA_URI = DATA_URI; +exports.ProgramCache = ProgramCache; +exports.TextureCache = TextureCache; +exports.clearTextureCache = clearTextureCache; +exports.correctBlendMode = correctBlendMode; +exports.createIndicesForQuads = createIndicesForQuads; +exports.decomposeDataUri = decomposeDataUri; +exports.deprecation = deprecation; +exports.destroyTextureCache = destroyTextureCache; +exports.determineCrossOrigin = determineCrossOrigin; +exports.getBufferType = getBufferType; +exports.getResolutionOfUrl = getResolutionOfUrl; +exports.hex2rgb = hex2rgb; +exports.hex2string = hex2string; +exports.interleaveTypedArrays = interleaveTypedArrays; +exports.isPow2 = isPow2; +exports.isWebGLSupported = isWebGLSupported; +exports.log2 = log2; +exports.nextPow2 = nextPow2; +exports.path = path; +exports.premultiplyBlendMode = premultiplyBlendMode; +exports.premultiplyRgba = premultiplyRgba; +exports.premultiplyTint = premultiplyTint; +exports.premultiplyTintToRgba = premultiplyTintToRgba; +exports.removeItems = removeItems; +exports.rgb2hex = rgb2hex; +exports.sayHello = sayHello; +exports.sign = sign; +exports.skipHello = skipHello; +exports.string2hex = string2hex; +exports.trimCanvas = trimCanvas; +exports.uid = uid; +exports.url = url; +//# sourceMappingURL=utils.js.map diff --git a/live2d/node_modules/@pixi/utils/dist/cjs/utils.js.map b/live2d/node_modules/@pixi/utils/dist/cjs/utils.js.map new file mode 100644 index 0000000..375c79a --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/cjs/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sources":["../../src/url.ts","../../src/path.ts","../../src/settings.ts","../../src/browser/hello.ts","../../src/browser/isWebGLSupported.ts","../../src/color/hex.ts","../../src/color/premultiply.ts","../../src/data/createIndicesForQuads.ts","../../src/data/getBufferType.ts","../../src/data/interleaveTypedArrays.ts","../../src/data/pow2.ts","../../src/data/removeItems.ts","../../src/data/sign.ts","../../src/data/uid.ts","../../src/logging/deprecation.ts","../../src/media/caches.ts","../../src/media/CanvasRenderTarget.ts","../../src/media/trimCanvas.ts","../../src/const.ts","../../src/network/decomposeDataUri.ts","../../src/network/determineCrossOrigin.ts","../../src/network/getResolutionOfUrl.ts"],"sourcesContent":["/**\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { parse as _parse, format as _format, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n","import { settings } from '@pixi/settings';\n\nfunction assertPath(path: string)\n{\n if (typeof path !== 'string')\n {\n throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);\n }\n}\n\nfunction removeUrlParams(url: string): string\n{\n const re = url.split('?')[0];\n\n return re.split('#')[0];\n}\n\nfunction escapeRegExp(string: string)\n{\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str: string, find: string, replace: string)\n{\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean)\n{\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code: number;\n\n for (let i = 0; i <= path.length; ++i)\n {\n if (i < path.length)\n {\n code = path.charCodeAt(i);\n }\n else if (code === 47)\n {\n break;\n }\n else\n {\n code = 47;\n }\n if (code === 47)\n {\n if (lastSlash === i - 1 || dots === 1)\n {\n // NOOP\n }\n else if (lastSlash !== i - 1 && dots === 2)\n {\n if (\n res.length < 2\n || lastSegmentLength !== 2\n || res.charCodeAt(res.length - 1) !== 46\n || res.charCodeAt(res.length - 2) !== 46\n )\n {\n if (res.length > 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n"],"names":["_parse","_format","_resolve","settings","arguments","BLEND_MODES","url","_url"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AA4EI,IAAM,GAAG,GAAG;AACf,IAAA,KAAK,EAAEA,WAAuB;AAC9B,IAAA,MAAM,EAAEC,YAAyB;AACjC,IAAA,OAAO,EAAEC,aAA2B;;;AClFxC,SAAS,UAAU,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/cjs/utils.min.js b/live2d/node_modules/@pixi/utils/dist/cjs/utils.min.js new file mode 100644 index 0000000..28fb47f --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/cjs/utils.min.js @@ -0,0 +1,9 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@pixi/settings"),t=require("eventemitter3"),r=require("earcut"),n=require("url"),o=require("@pixi/constants");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(t),f=i(r),l={parse:n.parse,format:n.format,resolve:n.resolve};function s(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function c(e){return e.split("?")[0].split("#")[0]}var u={toPosix:function(e){return t="\\",r="/",e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r);var t,r},isUrl:function(e){return/^https?:/.test(this.toPosix(e))},isDataUrl:function(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},hasProtocol:function(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol:function(e){s(e),e=this.toPosix(e);var t="",r=/^file:\/\/\//.exec(e),n=/^[^/:]+:\/\//.exec(e),o=/^[^/:]+:\//.exec(e);if(r||n||o){var i=(null==r?void 0:r[0])||(null==n?void 0:n[0])||(null==o?void 0:o[0]);t=i,e=e.slice(i.length)}return t},toAbsolute:function(t,r,n){if(this.isDataUrl(t))return t;var o=c(this.toPosix(null!=r?r:e.settings.ADAPTER.getBaseUrl())),i=c(this.toPosix(null!=n?n:this.rootname(o)));return s(t),(t=this.toPosix(t)).startsWith("/")?u.join(i,t.slice(1)):this.isAbsolute(t)?t:this.join(o,t)},normalize:function(e){if(s(e=this.toPosix(e)),0===e.length)return".";var t="",r=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));var n=e.endsWith("/");return(e=function(e,t){for(var r,n="",o=0,i=-1,a=0,f=0;f<=e.length;++f){if(f2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=f,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=f,a=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,f):n=e.slice(i+1,f),o=f-i-1;i=f,a=0}else 46===r&&-1!==a?++a:a=-1}return n}(e,!1)).length>0&&n&&(e+="/"),r?"/"+e:t+e},isAbsolute:function(e){return s(e),e=this.toPosix(e),!!this.hasProtocol(e)||e.startsWith("/")},join:function(){for(var e,t,r=arguments,n=[],o=0;o0)if(void 0===t)t=a;else{var f=null!==(e=n[i-1])&&void 0!==e?e:"";this.extname(f)?t+="/../"+a:t+="/"+a}}return void 0===t?".":this.normalize(t)},dirname:function(e){if(s(e),0===e.length)return".";for(var t=(e=this.toPosix(e)).charCodeAt(0),r=47===t,n=-1,o=!0,i=this.getProtocol(e),a=e,f=(e=e.slice(i.length)).length-1;f>=1;--f)if(47===(t=e.charCodeAt(f))){if(!o){n=f;break}}else o=!1;return-1===n?r?"/":this.isUrl(a)?i+e:i:r&&1===n?"//":i+e.slice(0,n)},rootname:function(e){s(e);var t="";if(t=(e=this.toPosix(e)).startsWith("/")?"/":this.getProtocol(e),this.isUrl(e)){var r=e.indexOf("/",t.length);(t=-1!==r?e.slice(0,r):e).endsWith("/")||(t+="/")}return t},basename:function(e,t){s(e),t&&s(t),e=this.toPosix(e);var r,n=0,o=-1,i=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,f=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(47===l){if(!i){n=r+1;break}}else-1===f&&(i=!1,f=r+1),a>=0&&(l===t.charCodeAt(a)?-1==--a&&(o=r):(a=-1,o=f))}return n===o?o=f:-1===o&&(o=e.length),e.slice(n,o)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!i){n=r+1;break}}else-1===o&&(i=!1,o=r+1);return-1===o?"":e.slice(n,o)},extname:function(e){s(e);for(var t=-1,r=0,n=-1,o=!0,i=0,a=(e=this.toPosix(e)).length-1;a>=0;--a){var f=e.charCodeAt(a);if(47!==f)-1===n&&(o=!1,n=a+1),46===f?-1===t?t=a:1!==i&&(i=1):-1!==t&&(i=-1);else if(!o){r=a+1;break}}return-1===t||-1===n||0===i||1===i&&t===n-1&&t===r+1?"":e.slice(t,n)},parse:function(e){s(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=(e=this.toPosix(e)).charCodeAt(0),o=this.isAbsolute(e);t.root=this.rootname(e),r=o||this.hasProtocol(e)?1:0;for(var i=-1,a=0,f=-1,l=!0,c=e.length-1,u=0;c>=r;--c)if(47!==(n=e.charCodeAt(c)))-1===f&&(l=!1,f=c+1),46===n?-1===i?i=c:1!==u&&(u=1):-1!==i&&(u=-1);else if(!l){a=c+1;break}return-1===i||-1===f||0===u||1===u&&i===f-1&&i===a+1?-1!==f&&(t.base=t.name=0===a&&o?e.slice(1,f):e.slice(a,f)):(0===a&&o?(t.name=e.slice(1,i),t.base=e.slice(1,f)):(t.name=e.slice(a,i),t.base=e.slice(a,f)),t.ext=e.slice(i,f)),t.dir=this.dirname(e),t},sep:"/",delimiter:":"};e.settings.RETINA_PREFIX=/@([0-9\.]+)x/,e.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var d,h=!1;var g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};var p=function(){for(var e=[],t=[],r=0;r<32;r++)e[r]=r,t[r]=r;e[o.BLEND_MODES.NORMAL_NPM]=o.BLEND_MODES.NORMAL,e[o.BLEND_MODES.ADD_NPM]=o.BLEND_MODES.ADD,e[o.BLEND_MODES.SCREEN_NPM]=o.BLEND_MODES.SCREEN,t[o.BLEND_MODES.NORMAL]=o.BLEND_MODES.NORMAL_NPM,t[o.BLEND_MODES.ADD]=o.BLEND_MODES.ADD_NPM,t[o.BLEND_MODES.SCREEN]=o.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(t),n.push(e),n}();function b(e){if(4===e.BYTES_PER_ELEMENT)return e instanceof Float32Array?"Float32Array":e instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===e.BYTES_PER_ELEMENT){if(e instanceof Uint16Array)return"Uint16Array"}else if(1===e.BYTES_PER_ELEMENT&&e instanceof Uint8Array)return"Uint8Array";return null}var v={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var x=0;var m={};var y=Object.create(null),E=Object.create(null);var A=function(){function t(t,r,n){this.canvas=e.settings.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=n||e.settings.RESOLUTION,this.resize(t,r)}return t.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},t.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},t.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(t.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),t}();var w,P=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;Object.defineProperty(exports,"isMobile",{enumerable:!0,get:function(){return e.isMobile}}),Object.defineProperty(exports,"EventEmitter",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(exports,"earcut",{enumerable:!0,get:function(){return f.default}}),exports.BaseTextureCache=E,exports.CanvasRenderTarget=A,exports.DATA_URI=P,exports.ProgramCache={},exports.TextureCache=y,exports.clearTextureCache=function(){var e;for(e in y)delete y[e];for(e in E)delete E[e]},exports.correctBlendMode=function(e,t){return p[t?1:0][e]},exports.createIndicesForQuads=function(e,t){void 0===t&&(t=null);var r=6*e;if((t=t||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+r);for(var n=0,o=0;n>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t},exports.hex2string=function(e){var t=e.toString(16);return"#"+(t="000000".substring(0,6-t.length)+t)},exports.interleaveTypedArrays=function(e,t){for(var r=0,n=0,o={},i=0;i65535?1:0)<<4,r=((e>>>=t)>255?1:0)<<3;return t|=r,t|=r=((e>>>=r)>15?1:0)<<2,(t|=r=((e>>>=r)>3?1:0)<<1)|(e>>>=r)>>1},exports.nextPow2=function(e){return e+=0===e?1:0,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},exports.path=u,exports.premultiplyBlendMode=p,exports.premultiplyRgba=function(e,t,r,n){return r=r||new Float32Array(4),n||void 0===n?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=t,r},exports.premultiplyTint=function(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,n=e>>8&255,o=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((n=n*t+.5|0)<<8)+(o=o*t+.5|0)},exports.premultiplyTintToRgba=function(e,t,r,n){return(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(n||void 0===n)&&(r[0]*=t,r[1]*=t,r[2]*=t),r[3]=t,r},exports.removeItems=function(e,t,r){var n,o=e.length;if(!(t>=o||0===r)){var i=o-(r=t+r>o?o-t:r);for(n=t;n-1){var n=["\n %c %c %c PixiJS 6.5.10 - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(r=globalThis.console).log.apply(r,n)}else globalThis.console&&globalThis.console.log("PixiJS 6.5.10 - "+t+" - http://www.pixijs.com/");h=!0}},exports.sign=function(e){return 0===e?0:e<0?-1:1},exports.skipHello=function(){h=!0},exports.string2hex=function(e){return"string"==typeof e&&"#"===(e=g[e.toLowerCase()]||e)[0]&&(e=e.slice(1)),parseInt(e,16)},exports.trimCanvas=function(e){var t,r,n,o=e.width,i=e.height,a=e.getContext("2d",{willReadFrequently:!0}),f=a.getImageData(0,0,o,i).data,l=f.length,s={top:null,left:null,right:null,bottom:null},c=null;for(t=0;t 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n"],"names":["url","parse","_parse","format","_format","resolve","_resolve","assertPath","path","TypeError","JSON","stringify","removeUrlParams","split","toPosix","find","replace","RegExp","isUrl","test","this","isDataUrl","hasProtocol","getProtocol","protocol","isFile","exec","isHttp","isWindows","arr","slice","length","toAbsolute","customBaseUrl","customRootUrl","baseUrl","settings","ADAPTER","getBaseUrl","rootUrl","rootname","startsWith","join","isAbsolute","normalize","trailingSeparator","endsWith","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","i","charCodeAt","lastSlashIndex","lastIndexOf","normalizeStringPosix","joined","segments","_i","arguments","arg","undefined","prevArg","_a","extname","dirname","hasRoot","end","matchedSlash","proto","origpath","root","index","indexOf","basename","ext","start","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","dir","base","name","sep","delimiter","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","premultiplyBlendMode","pm","npm","BLEND_MODES","NORMAL_NPM","NORMAL","ADD_NPM","ADD","SCREEN_NPM","SCREEN","array","push","mapPremultipliedBlendModes","getBufferType","BYTES_PER_ELEMENT","Float32Array","Uint32Array","Uint16Array","Uint8Array","map","Int32Array","nextUid","warnings","TextureCache","Object","create","BaseTextureCache","CanvasRenderTarget","width","height","resolution","canvas","createCanvas","context","getContext","RESOLUTION","resize","prototype","clear","setTransform","clearRect","desiredWidth","desiredHeight","Math","round","destroy","defineProperty","get","set","val","tempAnchor","DATA_URI","key","blendMode","premultiplied","size","outBuffer","totalIndices","Error","j","dataUri","dataUriMatch","mediaType","toLowerCase","subType","charset","encoding","data","version","message","ignoreDepth","stack","console","warn","splice","groupCollapsed","groupEnd","loc","globalThis","location","document","createElement","href","parsedUrl","_url","samePort","port","hostname","defaultValue","parseFloat","hex","out","hexString","toString","substring","arrays","sizes","outSize","stride","views","buffer","ArrayBuffer","littleOffset","type","v","contextOptions","stencil","failIfMajorPerformanceCaveat","getWebGLRenderingContext","gl","success","getContextAttributes","loseContext","getExtension","e","r","shift","rgb","alpha","premultiply","tint","R","G","B","startIdx","removeCount","len","getNavigator","userAgent","args","log","apply","n","string","cssColorNames","parseInt","x","y","willReadFrequently","pixels","getImageData","bound","top","left","right","bottom"],"mappings":";;;;;;;2RAiFaA,EAAM,CACfC,MAAOC,EAAuBD,MAC9BE,OAAQC,EAAyBD,OACjCE,QAASC,EAA2BD,SClFxC,SAASE,EAAWC,GAEhB,GAAoB,iBAATA,EAEP,MAA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ME,KAAOP,IAOG,OAAhBK,EAAMG,OAIDH,EAAMG,MAAQR,KAFnBK,EAAMG,MAAQR,EAAI,IAOD,OAAjBK,EAAMI,QAIDJ,EAAMI,OAASR,KAFpBI,EAAMI,OAASR,IAgB3B,OAPkB,OAAdI,EAAMC,MAENlH,EAAQiH,EAAMG,MAAQH,EAAME,KAC5BlH,EAASgH,EAAMI,OAASJ,EAAMC,IAAM,EACpC3E,EAAOlC,EAAQ2G,aAAaC,EAAME,KAAMF,EAAMC,IAAKlH,EAAOC,IAGvD,CACHA,OAAMA,EACND,MAAKA,EACLuC,KAAIA,2BbjFR,QAAS9C"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/esm/utils.min.mjs b/live2d/node_modules/@pixi/utils/dist/esm/utils.min.mjs new file mode 100644 index 0000000..e568ac2 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/esm/utils.min.mjs @@ -0,0 +1,9 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import{settings as e}from"@pixi/settings";export{isMobile}from"@pixi/settings";export{default as EventEmitter}from"eventemitter3";export{default as earcut}from"earcut";import{parse as t,format as r,resolve as n}from"url";import{BLEND_MODES as a}from"@pixi/constants";var i={parse:t,format:r,resolve:n};function o(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function f(e){return e.split("?")[0].split("#")[0]}var l={toPosix:function(e){return t="\\",r="/",e.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r);var t,r},isUrl:function(e){return/^https?:/.test(this.toPosix(e))},isDataUrl:function(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},hasProtocol:function(e){return/^[^/:]+:\//.test(this.toPosix(e))},getProtocol:function(e){o(e),e=this.toPosix(e);var t="",r=/^file:\/\/\//.exec(e),n=/^[^/:]+:\/\//.exec(e),a=/^[^/:]+:\//.exec(e);if(r||n||a){var i=(null==r?void 0:r[0])||(null==n?void 0:n[0])||(null==a?void 0:a[0]);t=i,e=e.slice(i.length)}return t},toAbsolute:function(t,r,n){if(this.isDataUrl(t))return t;var a=f(this.toPosix(null!=r?r:e.ADAPTER.getBaseUrl())),i=f(this.toPosix(null!=n?n:this.rootname(a)));return o(t),(t=this.toPosix(t)).startsWith("/")?l.join(i,t.slice(1)):this.isAbsolute(t)?t:this.join(a,t)},normalize:function(e){if(o(e=this.toPosix(e)),0===e.length)return".";var t="",r=e.startsWith("/");this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));var n=e.endsWith("/");return(e=function(e,t){for(var r,n="",a=0,i=-1,o=0,f=0;f<=e.length;++f){if(f2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",a=0):a=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),i=f,o=0;continue}}else if(2===n.length||1===n.length){n="",a=0,i=f,o=0;continue}t&&(n.length>0?n+="/..":n="..",a=2)}else n.length>0?n+="/"+e.slice(i+1,f):n=e.slice(i+1,f),a=f-i-1;i=f,o=0}else 46===r&&-1!==o?++o:o=-1}return n}(e,!1)).length>0&&n&&(e+="/"),r?"/"+e:t+e},isAbsolute:function(e){return o(e),e=this.toPosix(e),!!this.hasProtocol(e)||e.startsWith("/")},join:function(){for(var e,t,r=arguments,n=[],a=0;a0)if(void 0===t)t=f;else{var l=null!==(e=n[i-1])&&void 0!==e?e:"";this.extname(l)?t+="/../"+f:t+="/"+f}}return void 0===t?".":this.normalize(t)},dirname:function(e){if(o(e),0===e.length)return".";for(var t=(e=this.toPosix(e)).charCodeAt(0),r=47===t,n=-1,a=!0,i=this.getProtocol(e),f=e,l=(e=e.slice(i.length)).length-1;l>=1;--l)if(47===(t=e.charCodeAt(l))){if(!a){n=l;break}}else a=!1;return-1===n?r?"/":this.isUrl(f)?i+e:i:r&&1===n?"//":i+e.slice(0,n)},rootname:function(e){o(e);var t="";if(t=(e=this.toPosix(e)).startsWith("/")?"/":this.getProtocol(e),this.isUrl(e)){var r=e.indexOf("/",t.length);(t=-1!==r?e.slice(0,r):e).endsWith("/")||(t+="/")}return t},basename:function(e,t){o(e),t&&o(t),e=this.toPosix(e);var r,n=0,a=-1,i=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var f=t.length-1,l=-1;for(r=e.length-1;r>=0;--r){var s=e.charCodeAt(r);if(47===s){if(!i){n=r+1;break}}else-1===l&&(i=!1,l=r+1),f>=0&&(s===t.charCodeAt(f)?-1==--f&&(a=r):(f=-1,a=l))}return n===a?a=l:-1===a&&(a=e.length),e.slice(n,a)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!i){n=r+1;break}}else-1===a&&(i=!1,a=r+1);return-1===a?"":e.slice(n,a)},extname:function(e){o(e);for(var t=-1,r=0,n=-1,a=!0,i=0,f=(e=this.toPosix(e)).length-1;f>=0;--f){var l=e.charCodeAt(f);if(47!==l)-1===n&&(a=!1,n=f+1),46===l?-1===t?t=f:1!==i&&(i=1):-1!==t&&(i=-1);else if(!a){r=f+1;break}}return-1===t||-1===n||0===i||1===i&&t===n-1&&t===r+1?"":e.slice(t,n)},parse:function(e){o(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=(e=this.toPosix(e)).charCodeAt(0),a=this.isAbsolute(e);t.root=this.rootname(e),r=a||this.hasProtocol(e)?1:0;for(var i=-1,f=0,l=-1,s=!0,c=e.length-1,d=0;c>=r;--c)if(47!==(n=e.charCodeAt(c)))-1===l&&(s=!1,l=c+1),46===n?-1===i?i=c:1!==d&&(d=1):-1!==i&&(d=-1);else if(!s){f=c+1;break}return-1===i||-1===l||0===d||1===d&&i===l-1&&i===f+1?-1!==l&&(t.base=t.name=0===f&&a?e.slice(1,l):e.slice(f,l)):(0===f&&a?(t.name=e.slice(1,i),t.base=e.slice(1,l)):(t.name=e.slice(f,i),t.base=e.slice(f,l)),t.ext=e.slice(i,l)),t.dir=this.dirname(e),t},sep:"/",delimiter:":"};e.RETINA_PREFIX=/@([0-9\.]+)x/,e.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var s,c=!1;function d(){c=!0}function u(t){var r;if(!c){if(e.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var n=["\n %c %c %c PixiJS 6.5.10 - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(r=globalThis.console).log.apply(r,n)}else globalThis.console&&globalThis.console.log("PixiJS 6.5.10 - "+t+" - http://www.pixijs.com/");c=!0}}function h(){return void 0===s&&(s=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:e.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!e.ADAPTER.getWebGLRenderingContext())return!1;var r=e.ADAPTER.createCanvas(),n=r.getContext("webgl",t)||r.getContext("experimental-webgl",t),a=!(!n||!n.getContextAttributes().stencil);if(n){var i=n.getExtension("WEBGL_lose_context");i&&i.loseContext()}return n=null,a}catch(e){return!1}}()),s}var g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function b(e,t){return void 0===t&&(t=[]),t[0]=(e>>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function p(e){var t=e.toString(16);return"#"+(t="000000".substring(0,6-t.length)+t)}function v(e){return"string"==typeof e&&"#"===(e=g[e.toLowerCase()]||e)[0]&&(e=e.slice(1)),parseInt(e,16)}function m(e){return(255*e[0]<<16)+(255*e[1]<<8)+(255*e[2]|0)}var y=function(){for(var e=[],t=[],r=0;r<32;r++)e[r]=r,t[r]=r;e[a.NORMAL_NPM]=a.NORMAL,e[a.ADD_NPM]=a.ADD,e[a.SCREEN_NPM]=a.SCREEN,t[a.NORMAL]=a.NORMAL_NPM,t[a.ADD]=a.ADD_NPM,t[a.SCREEN]=a.SCREEN_NPM;var n=[];return n.push(t),n.push(e),n}();function A(e,t){return y[t?1:0][e]}function x(e,t,r,n){return r=r||new Float32Array(4),n||void 0===n?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=t,r}function w(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,n=e>>8&255,a=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((n=n*t+.5|0)<<8)+(a=a*t+.5|0)}function k(e,t,r,n){return(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(n||void 0===n)&&(r[0]*=t,r[1]*=t,r[2]*=t),r[3]=t,r}function E(e,t){void 0===t&&(t=null);var r=6*e;if((t=t||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+r);for(var n=0,a=0;n>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function T(e){return!(e&e-1||!e)}function N(e){var t=(e>65535?1:0)<<4,r=((e>>>=t)>255?1:0)<<3;return t|=r,t|=r=((e>>>=r)>15?1:0)<<2,(t|=r=((e>>>=r)>3?1:0)<<1)|(e>>>=r)>>1}function D(e,t,r){var n,a=e.length;if(!(t>=a||0===r)){var i=a-(r=t+r>a?a-t:r);for(n=t;n 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n"],"names":["url","parse","_parse","format","_format","resolve","_resolve","assertPath","path","TypeError","JSON","stringify","removeUrlParams","split","toPosix","find","replace","RegExp","isUrl","test","this","isDataUrl","hasProtocol","getProtocol","protocol","isFile","exec","isHttp","isWindows","arr","slice","length","toAbsolute","customBaseUrl","customRootUrl","baseUrl","settings","ADAPTER","getBaseUrl","rootUrl","rootname","startsWith","join","isAbsolute","normalize","trailingSeparator","endsWith","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","i","charCodeAt","lastSlashIndex","lastIndexOf","normalizeStringPosix","joined","segments","_i","arguments","arg","undefined","prevArg","_a","extname","dirname","hasRoot","end","matchedSlash","proto","origpath","root","index","indexOf","basename","ext","start","extIdx","firstNonSlashEnd","startDot","startPart","preDotState","ret","dir","base","name","sep","delimiter","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","skipHello","sayHello","type","getNavigator","userAgent","toLowerCase","args","globalThis","console","log","apply","isWebGLSupported","contextOptions","stencil","failIfMajorPerformanceCaveat","getWebGLRenderingContext","canvas","createCanvas","gl","getContext","success","getContextAttributes","loseContext","getExtension","e","hex2rgb","hex","out","hex2string","hexString","toString","substring","string2hex","string","cssColorNames","parseInt","rgb2hex","rgb","premultiplyBlendMode","pm","npm","BLEND_MODES","NORMAL_NPM","NORMAL","ADD_NPM","ADD","SCREEN_NPM","SCREEN","array","push","mapPremultipliedBlendModes","correctBlendMode","blendMode","premultiplied","premultiplyRgba","alpha","premultiply","Float32Array","premultiplyTint","tint","R","G","B","premultiplyTintToRgba","createIndicesForQuads","size","outBuffer","totalIndices","Uint16Array","Error","j","getBufferType","BYTES_PER_ELEMENT","Uint32Array","Uint8Array","map","Int32Array","interleaveTypedArrays","arrays","sizes","outSize","stride","views","buffer","ArrayBuffer","littleOffset","nextPow2","v","isPow2","log2","r","shift","removeItems","startIdx","removeCount","len","sign","n","nextUid","uid","warnings","deprecation","version","message","ignoreDepth","stack","warn","splice","groupCollapsed","groupEnd","ProgramCache","TextureCache","Object","create","BaseTextureCache","destroyTextureCache","key","destroy","clearTextureCache","CanvasRenderTarget","width","height","resolution","context","RESOLUTION","resize","prototype","clear","setTransform","clearRect","desiredWidth","desiredHeight","Math","round","defineProperty","get","set","val","trimCanvas","x","y","willReadFrequently","pixels","getImageData","data","bound","top","left","right","bottom","tempAnchor","DATA_URI","decomposeDataUri","dataUri","dataUriMatch","mediaType","subType","charset","encoding","determineCrossOrigin","loc","location","document","createElement","href","parsedUrl","_url","samePort","port","hostname","getResolutionOfUrl","defaultValue","parseFloat"],"mappings":";;;;;;;2QAiFO,IAAMA,EAAM,CACfC,MAAOC,EACPC,OAAQC,EACRC,QAASC,GClFb,SAASC,EAAWC,GAEhB,GAAoB,iBAATA,EAEP,MAAM,IAAIC,UAAU,mCAAmCC,KAAKC,UAAUH,IAI9E,SAASI,EAAgBZ,GAIrB,OAFWA,EAAIa,MAAM,KAAK,GAEhBA,MAAM,KAAK,GA0IlB,IAAML,EAAa,CAKtBM,QAAA,SAAQN,GAAgB,OAvIKO,EAuImB,KAvILC,EAuIW,IAAZR,EArI/BQ,QAAQ,IAAIC,OAAoBF,EAL7BC,QAAQ,sBAAuB,QAKK,KAAMA,GAF5D,IAAiCD,EAAcC,GA4I3CE,MAAA,SAAMV,GAAgB,MAAO,WAAaW,KAAKC,KAAKN,QAAQN,KAK5Da,UAAA,SAAUb,GAGN,MAAO,yIACFW,KAAKX,IAOdc,YAAA,SAAYd,GAAgB,MAAO,aAAeW,KAAKC,KAAKN,QAAQN,KAKpEe,YAAA,SAAYf,GAERD,EAAWC,GACXA,EAAOY,KAAKN,QAAQN,GAEpB,IAAIgB,EAAW,GAETC,EAAS,eAAiBC,KAAKlB,GAC/BmB,EAAS,eAAiBD,KAAKlB,GAC/BoB,EAAY,aAAeF,KAAKlB,GAEtC,GAA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AKA,EACLwB,KAAIA,GCnFC,ICNTM,EDMSC,EAAW,+EE6ClB,SAAUC,EAAiBC,GAE7B,IAAMC,EAAeH,EAAS3N,KAAK6N,GAEnC,GAAIC,EAEA,MAAO,CACHC,UAAWD,EAAa,GAAKA,EAAa,GAAGrJ,mBAAgBpC,EAC7D2L,QAASF,EAAa,GAAKA,EAAa,GAAGrJ,mBAAgBpC,EAC3D4L,QAASH,EAAa,GAAKA,EAAa,GAAGrJ,mBAAgBpC,EAC3D6L,SAAUJ,EAAa,GAAKA,EAAa,GAAGrJ,mBAAgBpC,EAC5D+K,KAAMU,EAAa,IDlDf,SAAAK,EAAqB7P,EAAa8P,GAG9C,QAH8C,IAAAA,IAAAA,EAAgBzJ,WAAW0J,UAG5C,IAAzB/P,EAAI2E,QAAQ,SAEZ,MAAO,GAIXmL,EAAMA,GAAOzJ,WAAW0J,SAEnBX,IAEDA,EAAaY,SAASC,cAAc,MAMxCb,EAAWc,KAAOlQ,EAClB,IAAMmQ,EAAYC,EAAKnQ,MAAMmP,EAAWc,MAElCG,GAAaF,EAAUG,MAAqB,KAAbR,EAAIQ,MAAiBH,EAAUG,OAASR,EAAIQ,KAGjF,OAAIH,EAAUI,WAAaT,EAAIS,UAAaF,GAAYF,EAAU3O,WAAasO,EAAItO,SAK5E,GAHI,YE9BC,SAAAgP,EAAmBxQ,EAAayQ,GAE5C,IAAMjD,EAAapL,EAASsD,cAAchE,KAAK1B,GAE/C,OAAIwN,EAEOkD,WAAWlD,EAAW,SAGTzJ,IAAjB0M,EAA6BA,EAAe"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs b/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs new file mode 100644 index 0000000..381707a --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs @@ -0,0 +1,1680 @@ +/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +import { settings } from '@pixi/settings'; +export { isMobile } from '@pixi/settings'; +export { default as EventEmitter } from 'eventemitter3'; +export { default as earcut } from 'earcut'; +import { parse, format, resolve } from 'url'; +import { BLEND_MODES } from '@pixi/constants'; + +/** + * This file contains redeclared types for Node `url` and `querystring` modules. These modules + * don't provide their own typings but instead are a part of the full Node typings. The purpose of + * this file is to redeclare the required types to avoid having the whole Node types as a + * dependency. + */ +var url = { + parse: parse, + format: format, + resolve: resolve, +}; + +function assertPath(path) { + if (typeof path !== 'string') { + throw new TypeError("Path must be a string. Received " + JSON.stringify(path)); + } +} +function removeUrlParams(url) { + var re = url.split('?')[0]; + return re.split('#')[0]; +} +function escapeRegExp(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} +function replaceAll(str, find, replace) { + return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); +} +// Resolves . and .. elements in a path with directory names +function normalizeStringPosix(path, allowAboveRoot) { + var res = ''; + var lastSegmentLength = 0; + var lastSlash = -1; + var dots = 0; + var code; + for (var i = 0; i <= path.length; ++i) { + if (i < path.length) { + code = path.charCodeAt(i); + } + else if (code === 47) { + break; + } + else { + code = 47; + } + if (code === 47) { + if (lastSlash === i - 1 || dots === 1) ; + else if (lastSlash !== i - 1 && dots === 2) { + if (res.length < 2 + || lastSegmentLength !== 2 + || res.charCodeAt(res.length - 1) !== 46 + || res.charCodeAt(res.length - 2) !== 46) { + if (res.length > 2) { + var lastSlashIndex = res.lastIndexOf('/'); + if (lastSlashIndex !== res.length - 1) { + if (lastSlashIndex === -1) { + res = ''; + lastSegmentLength = 0; + } + else { + res = res.slice(0, lastSlashIndex); + lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); + } + lastSlash = i; + dots = 0; + continue; + } + } + else if (res.length === 2 || res.length === 1) { + res = ''; + lastSegmentLength = 0; + lastSlash = i; + dots = 0; + continue; + } + } + if (allowAboveRoot) { + if (res.length > 0) { + res += '/..'; + } + else { + res = '..'; + } + lastSegmentLength = 2; + } + } + else { + if (res.length > 0) { + res += "/" + path.slice(lastSlash + 1, i); + } + else { + res = path.slice(lastSlash + 1, i); + } + lastSegmentLength = i - lastSlash - 1; + } + lastSlash = i; + dots = 0; + } + else if (code === 46 && dots !== -1) { + ++dots; + } + else { + dots = -1; + } + } + return res; +} +var path = { + /** + * Converts a path to posix format. + * @param path - The path to convert to posix + */ + toPosix: function (path) { return replaceAll(path, '\\', '/'); }, + /** + * Checks if the path is a URL + * @param path - The path to check + */ + isUrl: function (path) { return (/^https?:/).test(this.toPosix(path)); }, + /** + * Checks if the path is a data URL + * @param path - The path to check + */ + isDataUrl: function (path) { + // eslint-disable-next-line max-len + return (/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i) + .test(path); + }, + /** + * Checks if the path has a protocol e.g. http:// + * This will return true for windows file paths + * @param path - The path to check + */ + hasProtocol: function (path) { return (/^[^/:]+:\//).test(this.toPosix(path)); }, + /** + * Returns the protocol of the path e.g. http://, C:/, file:/// + * @param path - The path to get the protocol from + */ + getProtocol: function (path) { + assertPath(path); + path = this.toPosix(path); + var protocol = ''; + var isFile = (/^file:\/\/\//).exec(path); + var isHttp = (/^[^/:]+:\/\//).exec(path); + var isWindows = (/^[^/:]+:\//).exec(path); + if (isFile || isHttp || isWindows) { + var arr = (isFile === null || isFile === void 0 ? void 0 : isFile[0]) || (isHttp === null || isHttp === void 0 ? void 0 : isHttp[0]) || (isWindows === null || isWindows === void 0 ? void 0 : isWindows[0]); + protocol = arr; + path = path.slice(arr.length); + } + return protocol; + }, + /** + * Converts URL to an absolute path. + * When loading from a Web Worker, we must use absolute paths. + * If the URL is already absolute we return it as is + * If it's not, we convert it + * @param url - The URL to test + * @param customBaseUrl - The base URL to use + * @param customRootUrl - The root URL to use + */ + toAbsolute: function (url, customBaseUrl, customRootUrl) { + if (this.isDataUrl(url)) + { return url; } + var baseUrl = removeUrlParams(this.toPosix(customBaseUrl !== null && customBaseUrl !== void 0 ? customBaseUrl : settings.ADAPTER.getBaseUrl())); + var rootUrl = removeUrlParams(this.toPosix(customRootUrl !== null && customRootUrl !== void 0 ? customRootUrl : this.rootname(baseUrl))); + assertPath(url); + url = this.toPosix(url); + // root relative url + if (url.startsWith('/')) { + return path.join(rootUrl, url.slice(1)); + } + var absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url); + return absolutePath; + }, + /** + * Normalizes the given path, resolving '..' and '.' segments + * @param path - The path to normalize + */ + normalize: function (path) { + path = this.toPosix(path); + assertPath(path); + if (path.length === 0) + { return '.'; } + var protocol = ''; + var isAbsolute = path.startsWith('/'); + if (this.hasProtocol(path)) { + protocol = this.rootname(path); + path = path.slice(protocol.length); + } + var trailingSeparator = path.endsWith('/'); + // Normalize the path + path = normalizeStringPosix(path, false); + if (path.length > 0 && trailingSeparator) + { path += '/'; } + if (isAbsolute) + { return "/" + path; } + return protocol + path; + }, + /** + * Determines if path is an absolute path. + * Absolute paths can be urls, data urls, or paths on disk + * @param path - The path to test + */ + isAbsolute: function (path) { + assertPath(path); + path = this.toPosix(path); + if (this.hasProtocol(path)) + { return true; } + return path.startsWith('/'); + }, + /** + * Joins all given path segments together using the platform-specific separator as a delimiter, + * then normalizes the resulting path + * @param segments - The segments of the path to join + */ + join: function () { + var arguments$1 = arguments; + + var _a; + var segments = []; + for (var _i = 0; _i < arguments.length; _i++) { + segments[_i] = arguments$1[_i]; + } + if (segments.length === 0) { + return '.'; + } + var joined; + for (var i = 0; i < segments.length; ++i) { + var arg = segments[i]; + assertPath(arg); + if (arg.length > 0) { + if (joined === undefined) + { joined = arg; } + else { + var prevArg = (_a = segments[i - 1]) !== null && _a !== void 0 ? _a : ''; + if (this.extname(prevArg)) { + joined += "/../" + arg; + } + else { + joined += "/" + arg; + } + } + } + } + if (joined === undefined) { + return '.'; + } + return this.normalize(joined); + }, + /** + * Returns the directory name of a path + * @param path - The path to parse + */ + dirname: function (path) { + assertPath(path); + if (path.length === 0) + { return '.'; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var hasRoot = code === 47; + var end = -1; + var matchedSlash = true; + var proto = this.getProtocol(path); + var origpath = path; + path = path.slice(proto.length); + for (var i = path.length - 1; i >= 1; --i) { + code = path.charCodeAt(i); + if (code === 47) { + if (!matchedSlash) { + end = i; + break; + } + } + else { + // We saw the first non-path separator + matchedSlash = false; + } + } + // if end is -1 and its a url then we need to add the path back + // eslint-disable-next-line no-nested-ternary + if (end === -1) + { return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto; } + if (hasRoot && end === 1) + { return '//'; } + return proto + path.slice(0, end); + }, + /** + * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/ + * @param path - The path to parse + */ + rootname: function (path) { + assertPath(path); + path = this.toPosix(path); + var root = ''; + if (path.startsWith('/')) + { root = '/'; } + else { + root = this.getProtocol(path); + } + if (this.isUrl(path)) { + // need to find the first path separator + var index = path.indexOf('/', root.length); + if (index !== -1) { + root = path.slice(0, index); + } + else + { root = path; } + if (!root.endsWith('/')) + { root += '/'; } + } + return root; + }, + /** + * Returns the last portion of a path + * @param path - The path to test + * @param ext - Optional extension to remove + */ + basename: function (path, ext) { + assertPath(path); + if (ext) + { assertPath(ext); } + path = this.toPosix(path); + var start = 0; + var end = -1; + var matchedSlash = true; + var i; + if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { + if (ext.length === path.length && ext === path) + { return ''; } + var extIdx = ext.length - 1; + var firstNonSlashEnd = -1; + for (i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else { + if (firstNonSlashEnd === -1) { + // We saw the first non-path separator, remember this index in case + // we need it if the extension ends up not matching + matchedSlash = false; + firstNonSlashEnd = i + 1; + } + if (extIdx >= 0) { + // Try to match the explicit extension + if (code === ext.charCodeAt(extIdx)) { + if (--extIdx === -1) { + // We matched the extension, so mark this as the end of our path + // component + end = i; + } + } + else { + // Extension does not match, so our result is the entire path + // component + extIdx = -1; + end = firstNonSlashEnd; + } + } + } + } + if (start === end) + { end = firstNonSlashEnd; } + else if (end === -1) + { end = path.length; } + return path.slice(start, end); + } + for (i = path.length - 1; i >= 0; --i) { + if (path.charCodeAt(i) === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + start = i + 1; + break; + } + } + else if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // path component + matchedSlash = false; + end = i + 1; + } + } + if (end === -1) + { return ''; } + return path.slice(start, end); + }, + /** + * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last + * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than + * the first character of the basename of path, an empty string is returned. + * @param path - The path to parse + */ + extname: function (path) { + assertPath(path); + path = this.toPosix(path); + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + for (var i = path.length - 1; i >= 0; --i) { + var code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + return ''; + } + return path.slice(startDot, end); + }, + /** + * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties. + * @param path - The path to parse + */ + parse: function (path) { + assertPath(path); + var ret = { root: '', dir: '', base: '', ext: '', name: '' }; + if (path.length === 0) + { return ret; } + path = this.toPosix(path); + var code = path.charCodeAt(0); + var isAbsolute = this.isAbsolute(path); + var start; + ret.root = this.rootname(path); + if (isAbsolute || this.hasProtocol(path)) { + start = 1; + } + else { + start = 0; + } + var startDot = -1; + var startPart = 0; + var end = -1; + var matchedSlash = true; + var i = path.length - 1; + // Track the state of characters (if any) we see before our first dot and + // after any path separator we find + var preDotState = 0; + // Get non-dir info + for (; i >= start; --i) { + code = path.charCodeAt(i); + if (code === 47) { + // If we reached a path separator that was not part of a set of path + // separators at the end of the string, stop now + if (!matchedSlash) { + startPart = i + 1; + break; + } + continue; + } + if (end === -1) { + // We saw the first non-path separator, mark this as the end of our + // extension + matchedSlash = false; + end = i + 1; + } + if (code === 46) { + // If this is our first dot, mark it as the start of our extension + if (startDot === -1) + { startDot = i; } + else if (preDotState !== 1) + { preDotState = 1; } + } + else if (startDot !== -1) { + // We saw a non-dot and non-path separator before our dot, so we should + // have a good chance at having a non-empty extension + preDotState = -1; + } + } + if (startDot === -1 || end === -1 + // We saw a non-dot character immediately before the dot + || preDotState === 0 + // The (right-most) trimmed path component is exactly '..' + // eslint-disable-next-line no-mixed-operators + || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { + if (end !== -1) { + if (startPart === 0 && isAbsolute) + { ret.base = ret.name = path.slice(1, end); } + else + { ret.base = ret.name = path.slice(startPart, end); } + } + } + else { + if (startPart === 0 && isAbsolute) { + ret.name = path.slice(1, startDot); + ret.base = path.slice(1, end); + } + else { + ret.name = path.slice(startPart, startDot); + ret.base = path.slice(startPart, end); + } + ret.ext = path.slice(startDot, end); + } + ret.dir = this.dirname(path); + return ret; + }, + sep: '/', + delimiter: ':' +}; + +/** + * The prefix that denotes a URL is for a retina asset. + * @static + * @name RETINA_PREFIX + * @memberof PIXI.settings + * @type {RegExp} + * @default /@([0-9\.]+)x/ + * @example `@2x` + */ +settings.RETINA_PREFIX = /@([0-9\.]+)x/; +/** + * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. + * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when + * using WebGL. + * + * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible. + * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the + * browser. + * + * If your application requires high performance rendering, you may wish to set this to false. + * We recommend one of two options if you decide to set this flag to false: + * + * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is + * not supported. + * + * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS + * renderer, and show an error message to the user if the function returns false, explaining that their device & browser + * combination does not support high performance WebGL. + * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails. + * @static + * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ +settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false; + +var saidHello = false; +var VERSION = '6.5.10'; +/** + * Skips the hello message of renderers that are created after this is run. + * @function skipHello + * @memberof PIXI.utils + */ +function skipHello() { + saidHello = true; +} +/** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever make you a jerk face. + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ +function sayHello(type) { + var _a; + if (saidHello) { + return; + } + if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1) { + var args = [ + "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", + 'background: #ff66a5; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff66a5; background: #030307; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'background: #ffc3dc; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;' ]; + (_a = globalThis.console).log.apply(_a, args); + } + else if (globalThis.console) { + globalThis.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); + } + saidHello = true; +} + +var supported; +/** + * Helper for checking for WebGL support. + * @memberof PIXI.utils + * @function isWebGLSupported + * @returns {boolean} Is WebGL supported. + */ +function isWebGLSupported() { + if (typeof supported === 'undefined') { + supported = (function supported() { + var contextOptions = { + stencil: true, + failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, + }; + try { + if (!settings.ADAPTER.getWebGLRenderingContext()) { + return false; + } + var canvas = settings.ADAPTER.createCanvas(); + var gl = (canvas.getContext('webgl', contextOptions) + || canvas.getContext('experimental-webgl', contextOptions)); + var success = !!(gl && gl.getContextAttributes().stencil); + if (gl) { + var loseContext = gl.getExtension('WEBGL_lose_context'); + if (loseContext) { + loseContext.loseContext(); + } + } + gl = null; + return success; + } + catch (e) { + return false; + } + })(); + } + return supported; +} + +var aliceblue = "#f0f8ff"; +var antiquewhite = "#faebd7"; +var aqua = "#00ffff"; +var aquamarine = "#7fffd4"; +var azure = "#f0ffff"; +var beige = "#f5f5dc"; +var bisque = "#ffe4c4"; +var black = "#000000"; +var blanchedalmond = "#ffebcd"; +var blue = "#0000ff"; +var blueviolet = "#8a2be2"; +var brown = "#a52a2a"; +var burlywood = "#deb887"; +var cadetblue = "#5f9ea0"; +var chartreuse = "#7fff00"; +var chocolate = "#d2691e"; +var coral = "#ff7f50"; +var cornflowerblue = "#6495ed"; +var cornsilk = "#fff8dc"; +var crimson = "#dc143c"; +var cyan = "#00ffff"; +var darkblue = "#00008b"; +var darkcyan = "#008b8b"; +var darkgoldenrod = "#b8860b"; +var darkgray = "#a9a9a9"; +var darkgreen = "#006400"; +var darkgrey = "#a9a9a9"; +var darkkhaki = "#bdb76b"; +var darkmagenta = "#8b008b"; +var darkolivegreen = "#556b2f"; +var darkorange = "#ff8c00"; +var darkorchid = "#9932cc"; +var darkred = "#8b0000"; +var darksalmon = "#e9967a"; +var darkseagreen = "#8fbc8f"; +var darkslateblue = "#483d8b"; +var darkslategray = "#2f4f4f"; +var darkslategrey = "#2f4f4f"; +var darkturquoise = "#00ced1"; +var darkviolet = "#9400d3"; +var deeppink = "#ff1493"; +var deepskyblue = "#00bfff"; +var dimgray = "#696969"; +var dimgrey = "#696969"; +var dodgerblue = "#1e90ff"; +var firebrick = "#b22222"; +var floralwhite = "#fffaf0"; +var forestgreen = "#228b22"; +var fuchsia = "#ff00ff"; +var gainsboro = "#dcdcdc"; +var ghostwhite = "#f8f8ff"; +var goldenrod = "#daa520"; +var gold = "#ffd700"; +var gray = "#808080"; +var green = "#008000"; +var greenyellow = "#adff2f"; +var grey = "#808080"; +var honeydew = "#f0fff0"; +var hotpink = "#ff69b4"; +var indianred = "#cd5c5c"; +var indigo = "#4b0082"; +var ivory = "#fffff0"; +var khaki = "#f0e68c"; +var lavenderblush = "#fff0f5"; +var lavender = "#e6e6fa"; +var lawngreen = "#7cfc00"; +var lemonchiffon = "#fffacd"; +var lightblue = "#add8e6"; +var lightcoral = "#f08080"; +var lightcyan = "#e0ffff"; +var lightgoldenrodyellow = "#fafad2"; +var lightgray = "#d3d3d3"; +var lightgreen = "#90ee90"; +var lightgrey = "#d3d3d3"; +var lightpink = "#ffb6c1"; +var lightsalmon = "#ffa07a"; +var lightseagreen = "#20b2aa"; +var lightskyblue = "#87cefa"; +var lightslategray = "#778899"; +var lightslategrey = "#778899"; +var lightsteelblue = "#b0c4de"; +var lightyellow = "#ffffe0"; +var lime = "#00ff00"; +var limegreen = "#32cd32"; +var linen = "#faf0e6"; +var magenta = "#ff00ff"; +var maroon = "#800000"; +var mediumaquamarine = "#66cdaa"; +var mediumblue = "#0000cd"; +var mediumorchid = "#ba55d3"; +var mediumpurple = "#9370db"; +var mediumseagreen = "#3cb371"; +var mediumslateblue = "#7b68ee"; +var mediumspringgreen = "#00fa9a"; +var mediumturquoise = "#48d1cc"; +var mediumvioletred = "#c71585"; +var midnightblue = "#191970"; +var mintcream = "#f5fffa"; +var mistyrose = "#ffe4e1"; +var moccasin = "#ffe4b5"; +var navajowhite = "#ffdead"; +var navy = "#000080"; +var oldlace = "#fdf5e6"; +var olive = "#808000"; +var olivedrab = "#6b8e23"; +var orange = "#ffa500"; +var orangered = "#ff4500"; +var orchid = "#da70d6"; +var palegoldenrod = "#eee8aa"; +var palegreen = "#98fb98"; +var paleturquoise = "#afeeee"; +var palevioletred = "#db7093"; +var papayawhip = "#ffefd5"; +var peachpuff = "#ffdab9"; +var peru = "#cd853f"; +var pink = "#ffc0cb"; +var plum = "#dda0dd"; +var powderblue = "#b0e0e6"; +var purple = "#800080"; +var rebeccapurple = "#663399"; +var red = "#ff0000"; +var rosybrown = "#bc8f8f"; +var royalblue = "#4169e1"; +var saddlebrown = "#8b4513"; +var salmon = "#fa8072"; +var sandybrown = "#f4a460"; +var seagreen = "#2e8b57"; +var seashell = "#fff5ee"; +var sienna = "#a0522d"; +var silver = "#c0c0c0"; +var skyblue = "#87ceeb"; +var slateblue = "#6a5acd"; +var slategray = "#708090"; +var slategrey = "#708090"; +var snow = "#fffafa"; +var springgreen = "#00ff7f"; +var steelblue = "#4682b4"; +var tan = "#d2b48c"; +var teal = "#008080"; +var thistle = "#d8bfd8"; +var tomato = "#ff6347"; +var turquoise = "#40e0d0"; +var violet = "#ee82ee"; +var wheat = "#f5deb3"; +var white = "#ffffff"; +var whitesmoke = "#f5f5f5"; +var yellow = "#ffff00"; +var yellowgreen = "#9acd32"; +var cssColorNames = { + aliceblue: aliceblue, + antiquewhite: antiquewhite, + aqua: aqua, + aquamarine: aquamarine, + azure: azure, + beige: beige, + bisque: bisque, + black: black, + blanchedalmond: blanchedalmond, + blue: blue, + blueviolet: blueviolet, + brown: brown, + burlywood: burlywood, + cadetblue: cadetblue, + chartreuse: chartreuse, + chocolate: chocolate, + coral: coral, + cornflowerblue: cornflowerblue, + cornsilk: cornsilk, + crimson: crimson, + cyan: cyan, + darkblue: darkblue, + darkcyan: darkcyan, + darkgoldenrod: darkgoldenrod, + darkgray: darkgray, + darkgreen: darkgreen, + darkgrey: darkgrey, + darkkhaki: darkkhaki, + darkmagenta: darkmagenta, + darkolivegreen: darkolivegreen, + darkorange: darkorange, + darkorchid: darkorchid, + darkred: darkred, + darksalmon: darksalmon, + darkseagreen: darkseagreen, + darkslateblue: darkslateblue, + darkslategray: darkslategray, + darkslategrey: darkslategrey, + darkturquoise: darkturquoise, + darkviolet: darkviolet, + deeppink: deeppink, + deepskyblue: deepskyblue, + dimgray: dimgray, + dimgrey: dimgrey, + dodgerblue: dodgerblue, + firebrick: firebrick, + floralwhite: floralwhite, + forestgreen: forestgreen, + fuchsia: fuchsia, + gainsboro: gainsboro, + ghostwhite: ghostwhite, + goldenrod: goldenrod, + gold: gold, + gray: gray, + green: green, + greenyellow: greenyellow, + grey: grey, + honeydew: honeydew, + hotpink: hotpink, + indianred: indianred, + indigo: indigo, + ivory: ivory, + khaki: khaki, + lavenderblush: lavenderblush, + lavender: lavender, + lawngreen: lawngreen, + lemonchiffon: lemonchiffon, + lightblue: lightblue, + lightcoral: lightcoral, + lightcyan: lightcyan, + lightgoldenrodyellow: lightgoldenrodyellow, + lightgray: lightgray, + lightgreen: lightgreen, + lightgrey: lightgrey, + lightpink: lightpink, + lightsalmon: lightsalmon, + lightseagreen: lightseagreen, + lightskyblue: lightskyblue, + lightslategray: lightslategray, + lightslategrey: lightslategrey, + lightsteelblue: lightsteelblue, + lightyellow: lightyellow, + lime: lime, + limegreen: limegreen, + linen: linen, + magenta: magenta, + maroon: maroon, + mediumaquamarine: mediumaquamarine, + mediumblue: mediumblue, + mediumorchid: mediumorchid, + mediumpurple: mediumpurple, + mediumseagreen: mediumseagreen, + mediumslateblue: mediumslateblue, + mediumspringgreen: mediumspringgreen, + mediumturquoise: mediumturquoise, + mediumvioletred: mediumvioletred, + midnightblue: midnightblue, + mintcream: mintcream, + mistyrose: mistyrose, + moccasin: moccasin, + navajowhite: navajowhite, + navy: navy, + oldlace: oldlace, + olive: olive, + olivedrab: olivedrab, + orange: orange, + orangered: orangered, + orchid: orchid, + palegoldenrod: palegoldenrod, + palegreen: palegreen, + paleturquoise: paleturquoise, + palevioletred: palevioletred, + papayawhip: papayawhip, + peachpuff: peachpuff, + peru: peru, + pink: pink, + plum: plum, + powderblue: powderblue, + purple: purple, + rebeccapurple: rebeccapurple, + red: red, + rosybrown: rosybrown, + royalblue: royalblue, + saddlebrown: saddlebrown, + salmon: salmon, + sandybrown: sandybrown, + seagreen: seagreen, + seashell: seashell, + sienna: sienna, + silver: silver, + skyblue: skyblue, + slateblue: slateblue, + slategray: slategray, + slategrey: slategrey, + snow: snow, + springgreen: springgreen, + steelblue: steelblue, + tan: tan, + teal: teal, + thistle: thistle, + tomato: tomato, + turquoise: turquoise, + violet: violet, + wheat: wheat, + white: white, + whitesmoke: whitesmoke, + yellow: yellow, + yellowgreen: yellowgreen +}; + +/** + * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). + * @example + * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The hexadecimal number to convert + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one + * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats. + */ +function hex2rgb(hex, out) { + if (out === void 0) { out = []; } + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + return out; +} +/** + * Converts a hexadecimal color number to a string. + * @example + * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex (e.g., `0xffffff`) + * @returns {string} The string color (e.g., `"#ffffff"`). + */ +function hex2string(hex) { + var hexString = hex.toString(16); + hexString = '000000'.substring(0, 6 - hexString.length) + hexString; + return "#" + hexString; +} +/** + * Converts a string to a hexadecimal color number. + * It can handle: + * hex strings starting with #: "#ffffff" + * hex strings starting with 0x: "0xffffff" + * hex strings without prefix: "ffffff" + * css colors: "black" + * @example + * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function string2hex + * @param {string} string - The string color (e.g., `"#ffffff"`) + * @returns {number} Number in hexadecimal. + */ +function string2hex(string) { + if (typeof string === 'string') { + string = cssColorNames[string.toLowerCase()] || string; + if (string[0] === '#') { + string = string.slice(1); + } + } + return parseInt(string, 16); +} +/** + * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. + * @example + * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. + * @returns {number} Number in hexadecimal. + */ +function rgb2hex(rgb) { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); +} + +/** + * Corrects PixiJS blend, takes premultiplied alpha into account + * @memberof PIXI.utils + * @function mapPremultipliedBlendModes + * @private + * @returns {Array} Mapped modes. + */ +function mapPremultipliedBlendModes() { + var pm = []; + var npm = []; + for (var i = 0; i < 32; i++) { + pm[i] = i; + npm[i] = i; + } + pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL; + pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD; + pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN; + npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM; + npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM; + npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM; + var array = []; + array.push(npm); + array.push(pm); + return array; +} +/** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @constant premultiplyBlendMode + * @type {Array} + */ +var premultiplyBlendMode = mapPremultipliedBlendModes(); +/** + * changes blendMode according to texture format + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied + * @returns {number} true blend mode for this texture + */ +function correctBlendMode(blendMode, premultiplied) { + return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; +} +/** + * combines rgb and alpha to out array + * @memberof PIXI.utils + * @function premultiplyRgba + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +function premultiplyRgba(rgb, alpha, out, premultiply) { + out = out || new Float32Array(4); + if (premultiply || premultiply === undefined) { + out[0] = rgb[0] * alpha; + out[1] = rgb[1] * alpha; + out[2] = rgb[2] * alpha; + } + else { + out[0] = rgb[0]; + out[1] = rgb[1]; + out[2] = rgb[2]; + } + out[3] = alpha; + return out; +} +/** + * premultiplies tint + * @memberof PIXI.utils + * @function premultiplyTint + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ +function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { + return (alpha * 255 << 24) + tint; + } + if (alpha === 0.0) { + return 0; + } + var R = ((tint >> 16) & 0xFF); + var G = ((tint >> 8) & 0xFF); + var B = (tint & 0xFF); + R = ((R * alpha) + 0.5) | 0; + G = ((G * alpha) + 0.5) | 0; + B = ((B * alpha) + 0.5) | 0; + return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; +} +/** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * @memberof PIXI.utils + * @function premultiplyTintToRgba + * @param {number} tint - input tint + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +function premultiplyTintToRgba(tint, alpha, out, premultiply) { + out = out || new Float32Array(4); + out[0] = ((tint >> 16) & 0xFF) / 255.0; + out[1] = ((tint >> 8) & 0xFF) / 255.0; + out[2] = (tint & 0xFF) / 255.0; + if (premultiply || premultiply === undefined) { + out[0] *= alpha; + out[1] *= alpha; + out[2] *= alpha; + } + out[3] = alpha; + return out; +} + +/** + * Generic Mask Stack data structure + * @memberof PIXI.utils + * @function createIndicesForQuads + * @param {number} size - Number of quads + * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` + * @returns {Uint16Array|Uint32Array} - Resulting index buffer + */ +function createIndicesForQuads(size, outBuffer) { + if (outBuffer === void 0) { outBuffer = null; } + // the total number of indices in our array, there are 6 points per quad. + var totalIndices = size * 6; + outBuffer = outBuffer || new Uint16Array(totalIndices); + if (outBuffer.length !== totalIndices) { + throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); + } + // fill the indices with the quads to draw + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { + outBuffer[i + 0] = j + 0; + outBuffer[i + 1] = j + 1; + outBuffer[i + 2] = j + 2; + outBuffer[i + 3] = j + 0; + outBuffer[i + 4] = j + 2; + outBuffer[i + 5] = j + 3; + } + return outBuffer; +} + +function getBufferType(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; +} + +/* eslint-disable object-shorthand */ +var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; +function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + /* + @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way + or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? + */ + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); +} + +// Taken from the bit-twiddle package +/** + * Rounds to next power of two. + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} - next rounded power of two + */ +function nextPow2(v) { + v += v === 0 ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; +} +/** + * Checks if a number is a power of two. + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {boolean} `true` if value is power of two + */ +function isPow2(v) { + return !(v & (v - 1)) && (!!v); +} +/** + * Computes ceil of log base 2 + * @function log2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} logarithm base 2 + */ +function log2(v) { + var r = (v > 0xFFFF ? 1 : 0) << 4; + v >>>= r; + var shift = (v > 0xFF ? 1 : 0) << 3; + v >>>= shift; + r |= shift; + shift = (v > 0xF ? 1 : 0) << 2; + v >>>= shift; + r |= shift; + shift = (v > 0x3 ? 1 : 0) << 1; + v >>>= shift; + r |= shift; + return r | (v >> 1); +} + +/** + * Remove items from a javascript array without generating garbage + * @function removeItems + * @memberof PIXI.utils + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove + */ +function removeItems(arr, startIdx, removeCount) { + var length = arr.length; + var i; + if (startIdx >= length || removeCount === 0) { + return; + } + removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); + var len = length - removeCount; + for (i = startIdx; i < len; ++i) { + arr[i] = arr[i + removeCount]; + } + arr.length = len; +} + +/** + * Returns sign of number + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ +function sign(n) { + if (n === 0) + { return 0; } + return n < 0 ? -1 : 1; +} + +var nextUid = 0; +/** + * Gets the next unique identifier + * @memberof PIXI.utils + * @function uid + * @returns {number} The next unique identifier to use. + */ +function uid() { + return ++nextUid; +} + +// A map of warning messages already fired +var warnings = {}; +/** + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. + * @memberof PIXI.utils + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. + */ +function deprecation(version, message, ignoreDepth) { + if (ignoreDepth === void 0) { ignoreDepth = 3; } + // Ignore duplicat + if (warnings[message]) { + return; + } + /* eslint-disable no-console */ + var stack = new Error().stack; + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + } + else { + // chop off the stack trace which includes PixiJS internal calls + stack = stack.split('\n').splice(ignoreDepth).join('\n'); + if (console.groupCollapsed) { + console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + console.warn(stack); + } + } + /* eslint-enable no-console */ + warnings[message] = true; +} + +/** + * @todo Describe property usage + * @static + * @name ProgramCache + * @memberof PIXI.utils + * @type {object} + */ +var ProgramCache = {}; +/** + * @todo Describe property usage + * @static + * @name TextureCache + * @memberof PIXI.utils + * @type {object} + */ +var TextureCache = Object.create(null); +/** + * @todo Describe property usage + * @static + * @name BaseTextureCache + * @memberof PIXI.utils + * @type {object} + */ +var BaseTextureCache = Object.create(null); +/** + * Destroys all texture in the cache + * @memberof PIXI.utils + * @function destroyTextureCache + */ +function destroyTextureCache() { + var key; + for (key in TextureCache) { + TextureCache[key].destroy(); + } + for (key in BaseTextureCache) { + BaseTextureCache[key].destroy(); + } +} +/** + * Removes all textures from cache, but does not destroy them + * @memberof PIXI.utils + * @function clearTextureCache + */ +function clearTextureCache() { + var key; + for (key in TextureCache) { + delete TextureCache[key]; + } + for (key in BaseTextureCache) { + delete BaseTextureCache[key]; + } +} + +/** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * @class + * @memberof PIXI.utils + */ +var CanvasRenderTarget = /** @class */ (function () { + /** + * @param width - the width for the newly created canvas + * @param height - the height for the newly created canvas + * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + this.canvas = settings.ADAPTER.createCanvas(); + this.context = this.canvas.getContext('2d'); + this.resolution = resolution || settings.RESOLUTION; + this.resize(width, height); + } + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * @private + */ + CanvasRenderTarget.prototype.clear = function () { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + /** + * Resizes the canvas to the specified width and height. + * @param desiredWidth - the desired width of the canvas + * @param desiredHeight - the desired height of the canvas + */ + CanvasRenderTarget.prototype.resize = function (desiredWidth, desiredHeight) { + this.canvas.width = Math.round(desiredWidth * this.resolution); + this.canvas.height = Math.round(desiredHeight * this.resolution); + }; + /** Destroys this canvas. */ + CanvasRenderTarget.prototype.destroy = function () { + this.context = null; + this.canvas = null; + }; + Object.defineProperty(CanvasRenderTarget.prototype, "width", { + /** + * The width of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.width; + }, + set: function (val) { + this.canvas.width = Math.round(val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CanvasRenderTarget.prototype, "height", { + /** + * The height of the canvas buffer in pixels. + * @member {number} + */ + get: function () { + return this.canvas.height; + }, + set: function (val) { + this.canvas.height = Math.round(val); + }, + enumerable: false, + configurable: true + }); + return CanvasRenderTarget; +}()); + +/** + * Trim transparent borders from a canvas + * @memberof PIXI.utils + * @function trimCanvas + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ +function trimCanvas(canvas) { + // https://gist.github.com/remy/784508 + var width = canvas.width; + var height = canvas.height; + var context = canvas.getContext('2d', { + willReadFrequently: true, + }); + var imageData = context.getImageData(0, 0, width, height); + var pixels = imageData.data; + var len = pixels.length; + var bound = { + top: null, + left: null, + right: null, + bottom: null, + }; + var data = null; + var i; + var x; + var y; + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { + x = (i / 4) % width; + y = ~~((i / 4) / width); + if (bound.top === null) { + bound.top = y; + } + if (bound.left === null) { + bound.left = x; + } + else if (x < bound.left) { + bound.left = x; + } + if (bound.right === null) { + bound.right = x + 1; + } + else if (bound.right < x) { + bound.right = x + 1; + } + if (bound.bottom === null) { + bound.bottom = y; + } + else if (bound.bottom < y) { + bound.bottom = y; + } + } + } + if (bound.top !== null) { + width = bound.right - bound.left; + height = bound.bottom - bound.top + 1; + data = context.getImageData(bound.left, bound.top, width, height); + } + return { + height: height, + width: width, + data: data, + }; +} + +/** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * @static + * @constant {RegExp|string} DATA_URI + * @memberof PIXI + * @example data:image/png;base64 + */ +var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; + +/** + * @memberof PIXI.utils + * @interface DecomposedDataUri + */ +/** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ +/** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ +/** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ +/** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ +/** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data + */ +/** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined + */ +function decomposeDataUri(dataUri) { + var dataUriMatch = DATA_URI.exec(dataUri); + if (dataUriMatch) { + return { + mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, + subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, + charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, + encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, + data: dataUriMatch[5], + }; + } + return undefined; +} + +var tempAnchor; +/** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @returns {string} The crossOrigin value to use (or empty string for none). + */ +function determineCrossOrigin(url$1, loc) { + if (loc === void 0) { loc = globalThis.location; } + // data: and javascript: urls are considered same-origin + if (url$1.indexOf('data:') === 0) { + return ''; + } + // default is window.location + loc = loc || globalThis.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url$1; + var parsedUrl = url.parse(tempAnchor.href); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + // if cross origin + if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; +} + +/** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @returns {number} resolution / device pixel ratio of an asset + */ +function getResolutionOfUrl(url, defaultValue) { + var resolution = settings.RETINA_PREFIX.exec(url); + if (resolution) { + return parseFloat(resolution[1]); + } + return defaultValue !== undefined ? defaultValue : 1; +} + +export { BaseTextureCache, CanvasRenderTarget, DATA_URI, ProgramCache, TextureCache, clearTextureCache, correctBlendMode, createIndicesForQuads, decomposeDataUri, deprecation, destroyTextureCache, determineCrossOrigin, getBufferType, getResolutionOfUrl, hex2rgb, hex2string, interleaveTypedArrays, isPow2, isWebGLSupported, log2, nextPow2, path, premultiplyBlendMode, premultiplyRgba, premultiplyTint, premultiplyTintToRgba, removeItems, rgb2hex, sayHello, sign, skipHello, string2hex, trimCanvas, uid, url }; +//# sourceMappingURL=utils.mjs.map diff --git a/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs.map b/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs.map new file mode 100644 index 0000000..87e5f96 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/dist/esm/utils.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.mjs","sources":["../../src/url.ts","../../src/path.ts","../../src/settings.ts","../../src/browser/hello.ts","../../src/browser/isWebGLSupported.ts","../../src/color/hex.ts","../../src/color/premultiply.ts","../../src/data/createIndicesForQuads.ts","../../src/data/getBufferType.ts","../../src/data/interleaveTypedArrays.ts","../../src/data/pow2.ts","../../src/data/removeItems.ts","../../src/data/sign.ts","../../src/data/uid.ts","../../src/logging/deprecation.ts","../../src/media/caches.ts","../../src/media/CanvasRenderTarget.ts","../../src/media/trimCanvas.ts","../../src/const.ts","../../src/network/decomposeDataUri.ts","../../src/network/determineCrossOrigin.ts","../../src/network/getResolutionOfUrl.ts"],"sourcesContent":["/**\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\n\nimport { parse as _parse, format as _format, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery\n{\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput\n{\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon\n{\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon\n{\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon\n{\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url\n{\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url\n{\n query: string | null;\n}\n\ninterface URLFormatOptions\n{\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n","import { settings } from '@pixi/settings';\n\nfunction assertPath(path: string)\n{\n if (typeof path !== 'string')\n {\n throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);\n }\n}\n\nfunction removeUrlParams(url: string): string\n{\n const re = url.split('?')[0];\n\n return re.split('#')[0];\n}\n\nfunction escapeRegExp(string: string)\n{\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nfunction replaceAll(str: string, find: string, replace: string)\n{\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean)\n{\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let code: number;\n\n for (let i = 0; i <= path.length; ++i)\n {\n if (i < path.length)\n {\n code = path.charCodeAt(i);\n }\n else if (code === 47)\n {\n break;\n }\n else\n {\n code = 47;\n }\n if (code === 47)\n {\n if (lastSlash === i - 1 || dots === 1)\n {\n // NOOP\n }\n else if (lastSlash !== i - 1 && dots === 2)\n {\n if (\n res.length < 2\n || lastSegmentLength !== 2\n || res.charCodeAt(res.length - 1) !== 46\n || res.charCodeAt(res.length - 2) !== 46\n )\n {\n if (res.length > 2)\n {\n const lastSlashIndex = res.lastIndexOf('/');\n\n if (lastSlashIndex !== res.length - 1)\n {\n if (lastSlashIndex === -1)\n {\n res = '';\n lastSegmentLength = 0;\n }\n else\n {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1)\n {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot)\n {\n if (res.length > 0)\n { res += '/..'; }\n else\n { res = '..'; }\n lastSegmentLength = 2;\n }\n }\n else\n {\n if (res.length > 0)\n {\n res += `/${path.slice(lastSlash + 1, i)}`;\n }\n else\n {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === 46 && dots !== -1)\n {\n ++dots;\n }\n else\n {\n dots = -1;\n }\n }\n\n return res;\n}\n\nexport interface Path\n{\n toPosix: (path: string) => string;\n toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string;\n isUrl: (path: string) => boolean;\n isDataUrl: (path: string) => boolean;\n hasProtocol: (path: string) => boolean;\n getProtocol: (path: string) => string;\n normalize: (path: string) => string;\n join: (...paths: string[]) => string;\n isAbsolute: (path: string) => boolean;\n dirname: (path: string) => string;\n rootname: (path: string) => string;\n basename: (path: string, ext?: string) => string;\n extname: (path: string) => string;\n parse: (path: string) => { root?: string, dir?: string, base?: string, ext?: string, name?: string };\n sep: string,\n delimiter: string\n}\n\nexport const path: Path = {\n /**\n * Converts a path to posix format.\n * @param path - The path to convert to posix\n */\n toPosix(path: string) { return replaceAll(path, '\\\\', '/'); },\n /**\n * Checks if the path is a URL\n * @param path - The path to check\n */\n isUrl(path: string) { return (/^https?:/).test(this.toPosix(path)); },\n /**\n * Checks if the path is a data URL\n * @param path - The path to check\n */\n isDataUrl(path: string)\n {\n // eslint-disable-next-line max-len\n return (/^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s<>]*?)$/i)\n .test(path);\n },\n /**\n * Checks if the path has a protocol e.g. http://\n * This will return true for windows file paths\n * @param path - The path to check\n */\n hasProtocol(path: string) { return (/^[^/:]+:\\//).test(this.toPosix(path)); },\n /**\n * Returns the protocol of the path e.g. http://, C:/, file:///\n * @param path - The path to get the protocol from\n */\n getProtocol(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let protocol = '';\n\n const isFile = (/^file:\\/\\/\\//).exec(path);\n const isHttp = (/^[^/:]+:\\/\\//).exec(path);\n const isWindows = (/^[^/:]+:\\//).exec(path);\n\n if (isFile || isHttp || isWindows)\n {\n const arr = isFile?.[0] || isHttp?.[0] || isWindows?.[0];\n\n protocol = arr;\n path = path.slice(arr.length);\n }\n\n return protocol;\n },\n\n /**\n * Converts URL to an absolute path.\n * When loading from a Web Worker, we must use absolute paths.\n * If the URL is already absolute we return it as is\n * If it's not, we convert it\n * @param url - The URL to test\n * @param customBaseUrl - The base URL to use\n * @param customRootUrl - The root URL to use\n */\n toAbsolute(url: string, customBaseUrl?: string, customRootUrl?: string)\n {\n if (this.isDataUrl(url)) return url;\n\n const baseUrl = removeUrlParams(this.toPosix(customBaseUrl ?? settings.ADAPTER.getBaseUrl()));\n const rootUrl = removeUrlParams(this.toPosix(customRootUrl ?? this.rootname(baseUrl)));\n\n assertPath(url);\n url = this.toPosix(url);\n\n // root relative url\n if (url.startsWith('/'))\n {\n return path.join(rootUrl, url.slice(1));\n }\n\n const absolutePath = this.isAbsolute(url) ? url : this.join(baseUrl, url);\n\n return absolutePath;\n },\n\n /**\n * Normalizes the given path, resolving '..' and '.' segments\n * @param path - The path to normalize\n */\n normalize(path: string)\n {\n path = this.toPosix(path);\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n let protocol = '';\n const isAbsolute = path.startsWith('/');\n\n if (this.hasProtocol(path))\n {\n protocol = this.rootname(path);\n path = path.slice(protocol.length);\n }\n\n const trailingSeparator = path.endsWith('/');\n\n // Normalize the path\n path = normalizeStringPosix(path, false);\n\n if (path.length > 0 && trailingSeparator) path += '/';\n if (isAbsolute) return `/${path}`;\n\n return protocol + path;\n },\n\n /**\n * Determines if path is an absolute path.\n * Absolute paths can be urls, data urls, or paths on disk\n * @param path - The path to test\n */\n isAbsolute(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n if (this.hasProtocol(path)) return true;\n\n return path.startsWith('/');\n },\n\n /**\n * Joins all given path segments together using the platform-specific separator as a delimiter,\n * then normalizes the resulting path\n * @param segments - The segments of the path to join\n */\n join(...segments: string[])\n {\n if (segments.length === 0)\n { return '.'; }\n let joined;\n\n for (let i = 0; i < segments.length; ++i)\n {\n const arg = segments[i];\n\n assertPath(arg);\n if (arg.length > 0)\n {\n if (joined === undefined) joined = arg;\n else\n {\n const prevArg = segments[i - 1] ?? '';\n\n if (this.extname(prevArg))\n {\n joined += `/../${arg}`;\n }\n else\n {\n joined += `/${arg}`;\n }\n }\n }\n }\n if (joined === undefined) { return '.'; }\n\n return this.normalize(joined);\n },\n\n /**\n * Returns the directory name of a path\n * @param path - The path to parse\n */\n dirname(path: string)\n {\n assertPath(path);\n if (path.length === 0) return '.';\n path = this.toPosix(path);\n let code = path.charCodeAt(0);\n const hasRoot = code === 47;\n let end = -1;\n let matchedSlash = true;\n\n const proto = this.getProtocol(path);\n const origpath = path;\n\n path = path.slice(proto.length);\n\n for (let i = path.length - 1; i >= 1; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n if (!matchedSlash)\n {\n end = i;\n break;\n }\n }\n else\n {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n // if end is -1 and its a url then we need to add the path back\n // eslint-disable-next-line no-nested-ternary\n if (end === -1) return hasRoot ? '/' : this.isUrl(origpath) ? proto + path : proto;\n if (hasRoot && end === 1) return '//';\n\n return proto + path.slice(0, end);\n },\n\n /**\n * Returns the root of the path e.g. /, C:/, file:///, http://domain.com/\n * @param path - The path to parse\n */\n rootname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let root = '';\n\n if (path.startsWith('/')) root = '/';\n else\n {\n root = this.getProtocol(path);\n }\n\n if (this.isUrl(path))\n {\n // need to find the first path separator\n const index = path.indexOf('/', root.length);\n\n if (index !== -1)\n {\n root = path.slice(0, index);\n }\n else root = path;\n\n if (!root.endsWith('/')) root += '/';\n }\n\n return root;\n },\n\n /**\n * Returns the last portion of a path\n * @param path - The path to test\n * @param ext - Optional extension to remove\n */\n basename(path: string, ext?: string)\n {\n assertPath(path);\n if (ext) assertPath(ext);\n\n path = this.toPosix(path);\n\n let start = 0;\n let end = -1;\n let matchedSlash = true;\n let i: number;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length)\n {\n if (ext.length === path.length && ext === path) return '';\n let extIdx = ext.length - 1;\n let firstNonSlashEnd = -1;\n\n for (i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else\n {\n if (firstNonSlashEnd === -1)\n {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0)\n {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx))\n {\n if (--extIdx === -1)\n {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n }\n else\n {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd; else if (end === -1) end = path.length;\n\n return path.slice(start, end);\n }\n for (i = path.length - 1; i >= 0; --i)\n {\n if (path.charCodeAt(i) === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n start = i + 1;\n break;\n }\n }\n else if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n\n return path.slice(start, end);\n },\n\n /**\n * Returns the extension of the path, from the last occurrence of the . (period) character to end of string in the last\n * portion of the path. If there is no . in the last portion of the path, or if there are no . characters other than\n * the first character of the basename of path, an empty string is returned.\n * @param path - The path to parse\n */\n extname(path: string)\n {\n assertPath(path);\n path = this.toPosix(path);\n\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n for (let i = path.length - 1; i >= 0; --i)\n {\n const code = path.charCodeAt(i);\n\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n return '';\n }\n\n return path.slice(startDot, end);\n },\n\n /**\n * Parses a path into an object containing the 'root', `dir`, `base`, `ext`, and `name` properties.\n * @param path - The path to parse\n */\n parse(path: string)\n {\n assertPath(path);\n\n const ret = { root: '', dir: '', base: '', ext: '', name: '' };\n\n if (path.length === 0) return ret;\n path = this.toPosix(path);\n\n let code = path.charCodeAt(0);\n const isAbsolute = this.isAbsolute(path);\n let start: number;\n const protocol = '';\n\n ret.root = this.rootname(path);\n\n if (isAbsolute || this.hasProtocol(path))\n {\n start = 1;\n }\n else\n {\n start = 0;\n }\n let startDot = -1;\n let startPart = 0;\n let end = -1;\n let matchedSlash = true;\n let i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n let preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i)\n {\n code = path.charCodeAt(i);\n if (code === 47)\n {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash)\n {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1)\n {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46)\n {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;\n else if (preDotState !== 1) preDotState = 1;\n }\n else if (startDot !== -1)\n {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (\n startDot === -1 || end === -1\n // We saw a non-dot character immediately before the dot\n || preDotState === 0\n // The (right-most) trimmed path component is exactly '..'\n // eslint-disable-next-line no-mixed-operators\n || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1\n )\n {\n if (end !== -1)\n {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);\n else ret.base = ret.name = path.slice(startPart, end);\n }\n }\n else\n {\n if (startPart === 0 && isAbsolute)\n {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n }\n else\n {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n ret.dir = this.dirname(path);\n if (protocol) ret.dir = protocol + ret.dir;\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':'\n} as Path;\n","import { settings } from '@pixi/settings';\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nexport { settings };\n","import { settings } from '@pixi/settings';\n\nlet saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\n\\n`,\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n ];\n\n globalThis.console.log(...args);\n }\n else if (globalThis.console)\n {\n globalThis.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean | undefined;\n\n/**\n * Helper for checking for WebGL support.\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @returns {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!settings.ADAPTER.getWebGLRenderingContext())\n {\n return false;\n }\n\n const canvas = settings.ADAPTER.createCanvas();\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { default as cssColorNames } from 'css-color-names';\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\n\n/**\n * Converts a hexadecimal color number to a string.\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @returns {string} The string color (e.g., `\"#ffffff\"`).\n */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substring(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @returns {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.slice(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @returns {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @returns {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\n\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @constant premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array | number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\n/**\n * premultiplies tint\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array | Uint32Array = null): Uint16Array | Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(\n array: ITypedArray\n): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\n/**\n * Rounds to next power of two.\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} - next rounded power of two\n */\nexport function nextPow2(v: number): number\n{\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n\n return v + 1;\n}\n\n/**\n * Checks if a number is a power of two.\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {boolean} `true` if value is power of two\n */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\n\n/**\n * Computes ceil of log base 2\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @returns {number} logarithm base 2\n */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\n}\n","/**\n * Remove items from a javascript array without generating garbage\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1 | 0 | 1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\n/**\n * Gets the next unique identifier\n * @memberof PIXI.utils\n * @function uid\n * @returns {number} The next unique identifier to use.\n */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n * @class\n * @memberof PIXI.utils\n */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = settings.ADAPTER.createCanvas();\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n * @private\n */\n clear(): void\n {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n\n /**\n * Resizes the canvas to the specified width and height.\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","interface Inset\n{\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d', {\n willReadFrequently: true,\n } as CanvasRenderingContext2DSettings);\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri\n{\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement | undefined;\n\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @returns {string} The crossOrigin value to use (or empty string for none).\n */\nexport function determineCrossOrigin(url: string, loc: Location = globalThis.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || globalThis.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\n\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { settings } from '../settings';\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @returns {number} resolution / device pixel ratio of an asset\n */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n"],"names":["_parse","_format","_resolve","argu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U,EACd;AACI,QAAA,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,KAAA;IAED,OAAO,YAAY,KAAK,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC;AACzD;;;;"} \ No newline at end of file diff --git a/live2d/node_modules/@pixi/utils/index.d.ts b/live2d/node_modules/@pixi/utils/index.d.ts new file mode 100644 index 0000000..a698b47 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/index.d.ts @@ -0,0 +1,522 @@ +import type { BaseTexture } from '@pixi/core'; +import { default as earcut_2 } from 'earcut'; +import EventEmitter from 'eventemitter3'; +import { isMobile } from '@pixi/settings'; +import type { ITypedArray } from '@pixi/core'; +import type { Program } from '@pixi/core'; +import type { Texture } from '@pixi/core'; + +export declare type ArrayFixed = [T, ...Array] & { + length: L; +}; + +/** + * @todo Describe property usage + * @static + * @name BaseTextureCache + * @memberof PIXI.utils + * @type {object} + */ +export declare const BaseTextureCache: { + [key: string]: BaseTexture; +}; + +/** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * @class + * @memberof PIXI.utils + */ +export declare class CanvasRenderTarget { + /** The Canvas object that belongs to this CanvasRenderTarget. */ + canvas: HTMLCanvasElement; + /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */ + context: CanvasRenderingContext2D; + /** + * The resolution / device pixel ratio of the canvas + * @default 1 + */ + resolution: number; + /** + * @param width - the width for the newly created canvas + * @param height - the height for the newly created canvas + * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas + */ + constructor(width: number, height: number, resolution?: number); + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * @private + */ + clear(): void; + /** + * Resizes the canvas to the specified width and height. + * @param desiredWidth - the desired width of the canvas + * @param desiredHeight - the desired height of the canvas + */ + resize(desiredWidth: number, desiredHeight: number): void; + /** Destroys this canvas. */ + destroy(): void; + /** + * The width of the canvas buffer in pixels. + * @member {number} + */ + get width(): number; + set width(val: number); + /** + * The height of the canvas buffer in pixels. + * @member {number} + */ + get height(): number; + set height(val: number); +} + +/** + * Removes all textures from cache, but does not destroy them + * @memberof PIXI.utils + * @function clearTextureCache + */ +export declare function clearTextureCache(): void; + +/** + * changes blendMode according to texture format + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied + * @returns {number} true blend mode for this texture + */ +export declare function correctBlendMode(blendMode: number, premultiplied: boolean): number; + +/** + * Generic Mask Stack data structure + * @memberof PIXI.utils + * @function createIndicesForQuads + * @param {number} size - Number of quads + * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` + * @returns {Uint16Array|Uint32Array} - Resulting index buffer + */ +export declare function createIndicesForQuads(size: number, outBuffer?: Uint16Array | Uint32Array): Uint16Array | Uint32Array; + +/** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * @static + * @constant {RegExp|string} DATA_URI + * @memberof PIXI + * @example data:image/png;base64 + */ +export declare const DATA_URI: RegExp; + +/** + * @memberof PIXI.utils + * @interface DecomposedDataUri + */ +/** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ +/** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ +/** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ +/** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ +/** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data + */ +/** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @returns {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined + */ +export declare function decomposeDataUri(dataUri: string): DecomposedDataUri; + +export declare interface DecomposedDataUri { + mediaType: string; + subType: string; + charset: string; + encoding: string; + data: string; +} + +/** + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. + * @memberof PIXI.utils + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. + */ +export declare function deprecation(version: string, message: string, ignoreDepth?: number): void; + +/** + * Destroys all texture in the cache + * @memberof PIXI.utils + * @function destroyTextureCache + */ +export declare function destroyTextureCache(): void; + +/** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @returns {string} The crossOrigin value to use (or empty string for none). + */ +export declare function determineCrossOrigin(url: string, loc?: Location): string; + +export declare type Dict = { + [key: string]: T; +}; + +export { earcut_2 as earcut } + +export { EventEmitter } + +declare type FormatFunction = { + (URL: URL, options?: URLFormatOptions): string; + (urlObject: UrlObject | string): string; +}; + +export declare function getBufferType(array: ITypedArray): 'Float32Array' | 'Uint32Array' | 'Int32Array' | 'Uint16Array' | 'Uint8Array' | null; + +/** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @returns {number} resolution / device pixel ratio of an asset + */ +export declare function getResolutionOfUrl(url: string, defaultValue?: number): number; + +/** + * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). + * @example + * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The hexadecimal number to convert + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one + * @returns {number[]} An array representing the [R, G, B] of the color where all values are floats. + */ +export declare function hex2rgb(hex: number, out?: Array | Float32Array): Array | Float32Array; + +/** + * Converts a hexadecimal color number to a string. + * @example + * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex (e.g., `0xffffff`) + * @returns {string} The string color (e.g., `"#ffffff"`). + */ +export declare function hex2string(hex: number): string; + +export declare function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array; + +export { isMobile } + +/** + * Checks if a number is a power of two. + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {boolean} `true` if value is power of two + */ +export declare function isPow2(v: number): boolean; + +/** + * Helper for checking for WebGL support. + * @memberof PIXI.utils + * @function isWebGLSupported + * @returns {boolean} Is WebGL supported. + */ +export declare function isWebGLSupported(): boolean; + +/** + * Computes ceil of log base 2 + * @function log2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} logarithm base 2 + */ +export declare function log2(v: number): number; + +/** + * Rounds to next power of two. + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @returns {number} - next rounded power of two + */ +export declare function nextPow2(v: number): number; + +declare type PackedArray = Float32Array | Uint32Array | Int32Array | Uint8Array; + +/** + * This file contains redeclared types for Node `url` and `querystring` modules. These modules + * don't provide their own typings but instead are a part of the full Node typings. The purpose of + * this file is to redeclare the required types to avoid having the whole Node types as a + * dependency. + */ +declare interface ParsedUrlQuery { + [key: string]: string | string[]; +} + +declare interface ParsedUrlQueryInput { + [key: string]: unknown; +} + +declare type ParseFunction = { + (urlStr: string): UrlWithStringQuery; + (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery; + (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; + (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; +}; + +export declare interface Path { + toPosix: (path: string) => string; + toAbsolute: (url: string, baseUrl?: string, rootUrl?: string) => string; + isUrl: (path: string) => boolean; + isDataUrl: (path: string) => boolean; + hasProtocol: (path: string) => boolean; + getProtocol: (path: string) => string; + normalize: (path: string) => string; + join: (...paths: string[]) => string; + isAbsolute: (path: string) => boolean; + dirname: (path: string) => string; + rootname: (path: string) => string; + basename: (path: string, ext?: string) => string; + extname: (path: string) => string; + parse: (path: string) => { + root?: string; + dir?: string; + base?: string; + ext?: string; + name?: string; + }; + sep: string; + delimiter: string; +} + +export declare const path: Path; + +/** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @constant premultiplyBlendMode + * @type {Array} + */ +export declare const premultiplyBlendMode: number[][]; + +/** + * combines rgb and alpha to out array + * @memberof PIXI.utils + * @function premultiplyRgba + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +export declare function premultiplyRgba(rgb: Float32Array | number[], alpha: number, out?: Float32Array, premultiply?: boolean): Float32Array; + +/** + * premultiplies tint + * @memberof PIXI.utils + * @function premultiplyTint + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ +export declare function premultiplyTint(tint: number, alpha: number): number; + +/** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * @memberof PIXI.utils + * @function premultiplyTintToRgba + * @param {number} tint - input tint + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ +export declare function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array; + +/** + * @todo Describe property usage + * @static + * @name ProgramCache + * @memberof PIXI.utils + * @type {object} + */ +export declare const ProgramCache: { + [key: string]: Program; +}; + +/** + * Remove items from a javascript array without generating garbage + * @function removeItems + * @memberof PIXI.utils + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove + */ +export declare function removeItems(arr: any[], startIdx: number, removeCount: number): void; + +declare type ResolveFunction = { + (from: string, to: string): string; +}; + +/** + * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. + * @example + * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. + * @returns {number} Number in hexadecimal. + */ +export declare function rgb2hex(rgb: number[] | Float32Array): number; + +/** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever make you a jerk face. + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ +export declare function sayHello(type: string): void; + +/** + * Returns sign of number + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ +export declare function sign(n: number): -1 | 0 | 1; + +/** + * Skips the hello message of renderers that are created after this is run. + * @function skipHello + * @memberof PIXI.utils + */ +export declare function skipHello(): void; + +/** + * Converts a string to a hexadecimal color number. + * It can handle: + * hex strings starting with #: "#ffffff" + * hex strings starting with 0x: "0xffffff" + * hex strings without prefix: "ffffff" + * css colors: "black" + * @example + * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff, which is 16777215 as an integer + * @memberof PIXI.utils + * @function string2hex + * @param {string} string - The string color (e.g., `"#ffffff"`) + * @returns {number} Number in hexadecimal. + */ +export declare function string2hex(string: string): number; + +/** + * @todo Describe property usage + * @static + * @name TextureCache + * @memberof PIXI.utils + * @type {object} + */ +export declare const TextureCache: { + [key: string]: Texture; +}; + +/** + * Trim transparent borders from a canvas + * @memberof PIXI.utils + * @function trimCanvas + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ +export declare function trimCanvas(canvas: HTMLCanvasElement): { + width: number; + height: number; + data?: ImageData; +}; + +/** + * Gets the next unique identifier + * @memberof PIXI.utils + * @function uid + * @returns {number} The next unique identifier to use. + */ +export declare function uid(): number; + +declare interface Url extends UrlObjectCommon { + port?: string; + query?: string | null | ParsedUrlQuery; +} + +export declare const url: { + parse: ParseFunction; + format: FormatFunction; + resolve: ResolveFunction; +}; + +declare interface URLFormatOptions { + auth?: boolean; + fragment?: boolean; + search?: boolean; + unicode?: boolean; +} + +declare interface UrlObject extends UrlObjectCommon { + port?: string | number; + query?: string | null | ParsedUrlQueryInput; +} + +declare interface UrlObjectCommon { + auth?: string; + hash?: string; + host?: string; + hostname?: string; + href?: string; + path?: string; + pathname?: string; + protocol?: string; + search?: string; + slashes?: boolean; +} + +declare interface UrlWithParsedQuery extends Url { + query: ParsedUrlQuery; +} + +declare interface UrlWithStringQuery extends Url { + query: string | null; +} + +export { } diff --git a/live2d/node_modules/@pixi/utils/package.json b/live2d/node_modules/@pixi/utils/package.json new file mode 100644 index 0000000..8456a14 --- /dev/null +++ b/live2d/node_modules/@pixi/utils/package.json @@ -0,0 +1,55 @@ +{ + "name": "@pixi/utils", + "version": "6.5.10", + "main": "dist/cjs/utils.js", + "module": "dist/esm/utils.mjs", + "bundle": "dist/browser/utils.js", + "types": "index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./dist/esm/utils.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./dist/cjs/utils.js" + } + } + }, + "namespace": "PIXI.utils", + "description": "Collection of utilities used by PixiJS", + "author": "Mat Groves", + "contributors": [ + "Matt Karl " + ], + "homepage": "http://pixijs.com/", + "bugs": "https://github.com/pixijs/pixi.js/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/pixijs/pixi.js.git" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "lib", + "dist", + "*.d.ts" + ], + "dependencies": { + "@types/earcut": "^2.1.0", + "earcut": "^2.2.4", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/settings": "6.5.10" + }, + "devDependencies": { + "css-color-names": "^1.0.1" + }, + "gitHead": "8cdbf55064b7adc05f65c51e177f1c22f7329f0f" +} diff --git a/live2d/node_modules/@types/earcut/LICENSE b/live2d/node_modules/@types/earcut/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/live2d/node_modules/@types/earcut/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + 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 diff --git a/live2d/node_modules/@types/earcut/README.md b/live2d/node_modules/@types/earcut/README.md new file mode 100644 index 0000000..48b5c95 --- /dev/null +++ b/live2d/node_modules/@types/earcut/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/earcut` + +# Summary +This package contains type definitions for earcut (https://github.com/mapbox/earcut#readme). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/earcut. + +### Additional Details + * Last updated: Mon, 06 Nov 2023 22:41:05 GMT + * Dependencies: none + +# Credits +These definitions were written by [Adrian Leonhard](https://github.com/NaridaL). diff --git a/live2d/node_modules/@types/earcut/index.d.ts b/live2d/node_modules/@types/earcut/index.d.ts new file mode 100644 index 0000000..e46e719 --- /dev/null +++ b/live2d/node_modules/@types/earcut/index.d.ts @@ -0,0 +1,48 @@ +interface EarcutStatic { + /** + * Triangulate an outline. + * + * @param vertices A flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...]. + * @param holes An array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11). + * @param dimensions The number of coordinates per vertice in the input array (2 by default). + * @return A flat array with each group of three numbers indexing a triangle in the `vertices` array. + * @example earcut([10,0, 0,50, 60,60, 70,10]); // returns [1,0,3, 3,2,1] + * @example with a hole: earcut([0,0, 100,0, 100,100, 0,100, 20,20, 80,20, 80,80, 20,80], [4]); // [3,0,4, 5,4,0, 3,4,7, 5,0,1, 2,3,7, 6,5,1, 2,7,6, 6,1,2] + * @example with 3d coords: earcut([10,0,1, 0,50,2, 60,60,3, 70,10,4], null, 3); // [1,0,3, 3,2,1] + */ + (vertices: ArrayLike, holes?: ArrayLike, dimensions?: number): number[]; + + /** + * Transforms multi-dimensional array (e.g. GeoJSON Polygon) into the format expected by earcut. + * @example Transforming GeoJSON data. + * const data = earcut.flatten(geojson.geometry.coordinates); + * const triangles = earcut(data.vertices, data.holes, data.dimensions); + * @example Transforming simple triangle with hole: + * const data = earcut.flatten([[[0, 0], [100, 0], [0, 100]], [[10, 10], [0, 10], [10, 0]]]); + * const triangles = earcut(data.vertices, data.holes, data.dimensions); + * @param data Arrays of rings, with the first being the outline and the rest holes. A ring is an array points, each point being an array of numbers. + */ + flatten(data: ArrayLike>>): { vertices: number[]; holes: number[]; dimensions: number }; + + /** + * Returns the relative difference between the total area of triangles and the area of the input polygon. 0 means the triangulation is fully correct. + * @param vertices same as earcut + * @param holes same as earcut + * @param dimensions same as earcut + * @param triangles see return value of earcut + * @example + * const triangles = earcut(vertices, holes, dimensions); + * const deviation = earcut.deviation(vertices, holes, dimensions, triangles); + */ + deviation( + vertices: ArrayLike, + holes: ArrayLike | undefined, + dimensions: number, + triangles: ArrayLike, + ): number; + + default: EarcutStatic; +} +declare const exports: EarcutStatic; +export = exports; +export as namespace earcut; diff --git a/live2d/node_modules/@types/earcut/package.json b/live2d/node_modules/@types/earcut/package.json new file mode 100644 index 0000000..2eec4c1 --- /dev/null +++ b/live2d/node_modules/@types/earcut/package.json @@ -0,0 +1,25 @@ +{ + "name": "@types/earcut", + "version": "2.1.4", + "description": "TypeScript definitions for earcut", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/earcut", + "license": "MIT", + "contributors": [ + { + "name": "Adrian Leonhard", + "githubUsername": "NaridaL", + "url": "https://github.com/NaridaL" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/earcut" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "f18d2ca8b1c48564f6a04700333034eedffa8ee069836cdd3fa2e3652e78a5f7", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/live2d/node_modules/@types/offscreencanvas/LICENSE b/live2d/node_modules/@types/offscreencanvas/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/live2d/node_modules/@types/offscreencanvas/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + 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 diff --git a/live2d/node_modules/@types/offscreencanvas/README.md b/live2d/node_modules/@types/offscreencanvas/README.md new file mode 100644 index 0000000..7c94b29 --- /dev/null +++ b/live2d/node_modules/@types/offscreencanvas/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/offscreencanvas` + +# Summary +This package contains type definitions for offscreencanvas (https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/offscreencanvas. + +### Additional Details + * Last updated: Tue, 07 Nov 2023 09:09:39 GMT + * Dependencies: none + +# Credits +These definitions were written by [Klaus Reimer](https://github.com/kayahr), [Oleg Varaksin](https://github.com/ova2), and [Sean T.McBeth](https://github.com/capnmidnight). diff --git a/live2d/node_modules/@types/offscreencanvas/index.d.ts b/live2d/node_modules/@types/offscreencanvas/index.d.ts new file mode 100644 index 0000000..8816788 --- /dev/null +++ b/live2d/node_modules/@types/offscreencanvas/index.d.ts @@ -0,0 +1,208 @@ +// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen +interface HTMLCanvasElement { + transferControlToOffscreen(): OffscreenCanvas; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d +interface OffscreenCanvasRenderingContext2D + extends + CanvasState, + CanvasTransform, + CanvasCompositing, + CanvasImageSmoothing, + CanvasFillStrokeStyles, + CanvasShadowStyles, + CanvasFilters, + CanvasRect, + CanvasDrawPath, + CanvasText, + CanvasDrawImage, + CanvasImageData, + CanvasPathDrawingStyles, + CanvasTextDrawingStyles, + CanvasPath +{ + readonly canvas: OffscreenCanvas; +} + +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new(): OffscreenCanvasRenderingContext2D; +}; + +// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +// Possible contextId values are defined by the enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2" } +// See also description: https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas/getContext +interface OffscreenCanvas extends EventTarget { + width: number; + height: number; + + getContext( + contextId: "2d", + contextAttributes?: CanvasRenderingContext2DSettings, + ): OffscreenCanvasRenderingContext2D | null; + + getContext( + contextId: "bitmaprenderer", + contextAttributes?: WebGLContextAttributes, + ): ImageBitmapRenderingContext | null; + + getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + + getContext(contextId: "webgl2", contextAttributes?: WebGLContextAttributes): WebGL2RenderingContext | null; + + convertToBlob(options?: { type?: string | undefined; quality?: number | undefined }): Promise; + + transferToImageBitmap(): ImageBitmap; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage +interface CanvasDrawImage { + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; + + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + + drawImage( + image: CanvasImageSource | OffscreenCanvas, + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number, + ): void; +} + +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; +declare function createImageBitmap( + image: ImageBitmapSource | OffscreenCanvas, + sx: number, + sy: number, + sw: number, + sh: number, +): Promise; + +// OffscreenCanvas should be a part of Transferable => extend all postMessage methods +interface Worker { + postMessage(message: any, transfer?: Array): void; +} + +interface DedicatedWorkerGlobalScope { + postMessage(message: any, transfer?: Array): void; +} + +interface ServiceWorker { + postMessage(message: any, transfer?: Array): void; +} + +interface MessagePort { + postMessage(message: any, transfer?: Array): void; +} + +interface Window { + postMessage(message: any, targetOrigin: string, transfer?: Array): void; +} + +declare function postMessage( + message: any, + targetOrigin: string, + transfer?: Array, +): void; + +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new(width: number, height: number): OffscreenCanvas; +}; + +interface WebGL2RenderingContextBase { + texImage3D( + target: GLenum, + level: GLint, + internalformat: GLint, + width: GLsizei, + height: GLsizei, + depth: GLsizei, + border: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; + texSubImage3D( + target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + zoffset: GLint, + width: GLsizei, + height: GLsizei, + depth: GLsizei, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; +} + +interface WebGL2RenderingContextOverloads { + texImage2D( + target: GLenum, + level: GLint, + internalformat: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; + texImage2D( + target: GLenum, + level: GLint, + internalformat: GLint, + width: GLsizei, + height: GLsizei, + border: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; + texSubImage2D( + target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; + texSubImage2D( + target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + width: GLsizei, + height: GLsizei, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; +} + +interface WebGLRenderingContextOverloads { + texImage2D( + target: GLenum, + level: GLint, + internalformat: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; + texSubImage2D( + target: GLenum, + level: GLint, + xoffset: GLint, + yoffset: GLint, + format: GLenum, + type: GLenum, + source: TexImageSource | OffscreenCanvas, + ): void; +} diff --git a/live2d/node_modules/@types/offscreencanvas/package.json b/live2d/node_modules/@types/offscreencanvas/package.json new file mode 100644 index 0000000..07f6312 --- /dev/null +++ b/live2d/node_modules/@types/offscreencanvas/package.json @@ -0,0 +1,36 @@ +{ + "name": "@types/offscreencanvas", + "version": "2019.7.3", + "description": "TypeScript definitions for offscreencanvas", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/offscreencanvas", + "license": "MIT", + "contributors": [ + { + "name": "Klaus Reimer", + "githubUsername": "kayahr", + "url": "https://github.com/kayahr" + }, + { + "name": "Oleg Varaksin", + "githubUsername": "ova2", + "url": "https://github.com/ova2" + }, + { + "name": "Sean T.McBeth", + "githubUsername": "capnmidnight", + "url": "https://github.com/capnmidnight" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/offscreencanvas" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "3bb9d8e21546b767b05750c5b57b2612423128a6c4619c93ff2e2cbe93279baf", + "typeScriptVersion": "4.5", + "nonNpm": true +} \ No newline at end of file diff --git a/live2d/node_modules/array-union/index.js b/live2d/node_modules/array-union/index.js new file mode 100644 index 0000000..e33f38a --- /dev/null +++ b/live2d/node_modules/array-union/index.js @@ -0,0 +1,6 @@ +'use strict'; +var arrayUniq = require('array-uniq'); + +module.exports = function () { + return arrayUniq([].concat.apply([], arguments)); +}; diff --git a/live2d/node_modules/array-union/license b/live2d/node_modules/array-union/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/array-union/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/array-union/package.json b/live2d/node_modules/array-union/package.json new file mode 100644 index 0000000..367c844 --- /dev/null +++ b/live2d/node_modules/array-union/package.json @@ -0,0 +1,40 @@ +{ + "name": "array-union", + "version": "1.0.2", + "description": "Create an array of unique values, in order, from the input arrays", + "license": "MIT", + "repository": "sindresorhus/array-union", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "arr", + "set", + "uniq", + "unique", + "duplicate", + "remove", + "union", + "combine", + "merge" + ], + "dependencies": { + "array-uniq": "^1.0.1" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/live2d/node_modules/array-union/readme.md b/live2d/node_modules/array-union/readme.md new file mode 100644 index 0000000..ea472dd --- /dev/null +++ b/live2d/node_modules/array-union/readme.md @@ -0,0 +1,28 @@ +# array-union [![Build Status](https://travis-ci.org/sindresorhus/array-union.svg?branch=master)](https://travis-ci.org/sindresorhus/array-union) + +> Create an array of unique values, in order, from the input arrays + + +## Install + +``` +$ npm install --save array-union +``` + + +## Usage + +```js +const arrayUnion = require('array-union'); + +arrayUnion([1, 1, 2, 3], [2, 3]); +//=> [1, 2, 3] + +arrayUnion(['foo', 'foo', 'bar'], ['foo']); +//=> ['foo', 'bar'] +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/array-uniq/index.js b/live2d/node_modules/array-uniq/index.js new file mode 100644 index 0000000..edd09f8 --- /dev/null +++ b/live2d/node_modules/array-uniq/index.js @@ -0,0 +1,62 @@ +'use strict'; + +// there's 3 implementations written in increasing order of efficiency + +// 1 - no Set type is defined +function uniqNoSet(arr) { + var ret = []; + + for (var i = 0; i < arr.length; i++) { + if (ret.indexOf(arr[i]) === -1) { + ret.push(arr[i]); + } + } + + return ret; +} + +// 2 - a simple Set type is defined +function uniqSet(arr) { + var seen = new Set(); + return arr.filter(function (el) { + if (!seen.has(el)) { + seen.add(el); + return true; + } + + return false; + }); +} + +// 3 - a standard Set type is defined and it has a forEach method +function uniqSetWithForEach(arr) { + var ret = []; + + (new Set(arr)).forEach(function (el) { + ret.push(el); + }); + + return ret; +} + +// V8 currently has a broken implementation +// https://github.com/joyent/node/issues/8449 +function doesForEachActuallyWork() { + var ret = false; + + (new Set([true])).forEach(function (el) { + ret = el; + }); + + return ret === true; +} + +if ('Set' in global) { + if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) { + module.exports = uniqSetWithForEach; + } else { + module.exports = uniqSet; + } +} else { + module.exports = uniqNoSet; +} diff --git a/live2d/node_modules/array-uniq/license b/live2d/node_modules/array-uniq/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/array-uniq/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/array-uniq/package.json b/live2d/node_modules/array-uniq/package.json new file mode 100644 index 0000000..106a3a9 --- /dev/null +++ b/live2d/node_modules/array-uniq/package.json @@ -0,0 +1,37 @@ +{ + "name": "array-uniq", + "version": "1.0.3", + "description": "Create an array without duplicates", + "license": "MIT", + "repository": "sindresorhus/array-uniq", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "arr", + "set", + "uniq", + "unique", + "es6", + "duplicate", + "remove" + ], + "devDependencies": { + "ava": "*", + "es6-set": "^0.1.0", + "require-uncached": "^1.0.2", + "xo": "*" + } +} diff --git a/live2d/node_modules/array-uniq/readme.md b/live2d/node_modules/array-uniq/readme.md new file mode 100644 index 0000000..f0bd98c --- /dev/null +++ b/live2d/node_modules/array-uniq/readme.md @@ -0,0 +1,30 @@ +# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq) + +> Create an array without duplicates + +It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays). + + +## Install + +``` +$ npm install --save array-uniq +``` + + +## Usage + +```js +const arrayUniq = require('array-uniq'); + +arrayUniq([1, 1, 2, 3, 3]); +//=> [1, 2, 3] + +arrayUniq(['foo', 'foo', 'bar', 'foo']); +//=> ['foo', 'bar'] +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/async/CHANGELOG.md b/live2d/node_modules/async/CHANGELOG.md new file mode 100644 index 0000000..ec6b871 --- /dev/null +++ b/live2d/node_modules/async/CHANGELOG.md @@ -0,0 +1,278 @@ +# v2.6.4 +- Fix potential prototype pollution exploit (#1828) + +# v2.6.3 +- Updated lodash to squelch a security warning (#1675) + +# v2.6.2 +- Updated lodash to squelch a security warning (#1620) + +# v2.6.1 +- Updated lodash to prevent `npm audit` warnings. (#1532, #1533) +- Made `async-es` more optimized for webpack users (#1517) +- Fixed a stack overflow with large collections and a synchronous iterator (#1514) +- Various small fixes/chores (#1505, #1511, #1527, #1530) + +# v2.6.0 +- Added missing aliases for many methods. Previously, you could not (e.g.) `require('async/find')` or use `async.anyLimit`. (#1483) +- Improved `queue` performance. (#1448, #1454) +- Add missing sourcemap (#1452, #1453) +- Various doc updates (#1448, #1471, #1483) + +# v2.5.0 +- Added `concatLimit`, the `Limit` equivalent of [`concat`](https://caolan.github.io/async/docs.html#concat) ([#1426](https://github.com/caolan/async/issues/1426), [#1430](https://github.com/caolan/async/pull/1430)) +- `concat` improvements: it now preserves order, handles falsy values and the `iteratee` callback takes a variable number of arguments ([#1437](https://github.com/caolan/async/issues/1437), [#1436](https://github.com/caolan/async/pull/1436)) +- Fixed an issue in `queue` where there was a size discrepancy between `workersList().length` and `running()` ([#1428](https://github.com/caolan/async/issues/1428), [#1429](https://github.com/caolan/async/pull/1429)) +- Various doc fixes ([#1422](https://github.com/caolan/async/issues/1422), [#1424](https://github.com/caolan/async/pull/1424)) + +# v2.4.1 +- Fixed a bug preventing functions wrapped with `timeout()` from being re-used. ([#1418](https://github.com/caolan/async/issues/1418), [#1419](https://github.com/caolan/async/issues/1419)) + +# v2.4.0 +- Added `tryEach`, for running async functions in parallel, where you only expect one to succeed. ([#1365](https://github.com/caolan/async/issues/1365), [#687](https://github.com/caolan/async/issues/687)) +- Improved performance, most notably in `parallel` and `waterfall` ([#1395](https://github.com/caolan/async/issues/1395)) +- Added `queue.remove()`, for removing items in a `queue` ([#1397](https://github.com/caolan/async/issues/1397), [#1391](https://github.com/caolan/async/issues/1391)) +- Fixed using `eval`, preventing Async from running in pages with Content Security Policy ([#1404](https://github.com/caolan/async/issues/1404), [#1403](https://github.com/caolan/async/issues/1403)) +- Fixed errors thrown in an `asyncify`ed function's callback being caught by the underlying Promise ([#1408](https://github.com/caolan/async/issues/1408)) +- Fixed timing of `queue.empty()` ([#1367](https://github.com/caolan/async/issues/1367)) +- Various doc fixes ([#1314](https://github.com/caolan/async/issues/1314), [#1394](https://github.com/caolan/async/issues/1394), [#1412](https://github.com/caolan/async/issues/1412)) + +# v2.3.0 +- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will only work if `async` functions are supported natively in your environment, transpiled implementations can't be detected. ([#1386](https://github.com/caolan/async/issues/1386), [#1390](https://github.com/caolan/async/issues/1390)) +- Small doc fix ([#1392](https://github.com/caolan/async/issues/1392)) + +# v2.2.0 +- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) ([#1364](https://github.com/caolan/async/issues/1364)) +- Fixed `transform` bug when `callback` was not passed ([#1381](https://github.com/caolan/async/issues/1381)) +- Added note about `reflect` to `parallel` docs ([#1385](https://github.com/caolan/async/issues/1385)) + +# v2.1.5 +- Fix `auto` bug when function names collided with Array.prototype ([#1358](https://github.com/caolan/async/issues/1358)) +- Improve some error messages ([#1349](https://github.com/caolan/async/issues/1349)) +- Avoid stack overflow case in queue +- Fixed an issue in `some`, `every` and `find` where processing would continue after the result was determined. +- Cleanup implementations of `some`, `every` and `find` + +# v2.1.3 +- Make bundle size smaller +- Create optimized hotpath for `filter` in array case. + +# v2.1.2 +- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs ([#1293](https://github.com/caolan/async/issues/1293)). + +# v2.1.0 + +- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error ([#1256](https://github.com/caolan/async/issues/1256), [#1261](https://github.com/caolan/async/issues/1261)) +- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` ([#1253](https://github.com/caolan/async/issues/1253)) +- Added alias documentation to doc site ([#1251](https://github.com/caolan/async/issues/1251), [#1254](https://github.com/caolan/async/issues/1254)) +- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed ([#1289](https://github.com/caolan/async/issues/1289), [#1300](https://github.com/caolan/async/issues/1300)) +- Various minor doc fixes ([#1263](https://github.com/caolan/async/issues/1263), [#1264](https://github.com/caolan/async/issues/1264), [#1271](https://github.com/caolan/async/issues/1271), [#1278](https://github.com/caolan/async/issues/1278), [#1280](https://github.com/caolan/async/issues/1280), [#1282](https://github.com/caolan/async/issues/1282), [#1302](https://github.com/caolan/async/issues/1302)) + +# v2.0.1 + +- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc ([#1245](https://github.com/caolan/async/issues/1245), [#1246](https://github.com/caolan/async/issues/1246), [#1247](https://github.com/caolan/async/issues/1247)). + +# v2.0.0 + +Lots of changes here! + +First and foremost, we have a slick new [site for docs](https://caolan.github.io/async/). Special thanks to [**@hargasinski**](https://github.com/hargasinski) for his work converting our old docs to `jsdoc` format and implementing the new website. Also huge ups to [**@ivanseidel**](https://github.com/ivanseidel) for designing our new logo. It was a long process for both of these tasks, but I think these changes turned out extraordinary well. + +The biggest feature is modularization. You can now `require("async/series")` to only require the `series` function. Every Async library function is available this way. You still can `require("async")` to require the entire library, like you could do before. + +We also provide Async as a collection of ES2015 modules. You can now `import {each} from 'async-es'` or `import waterfall from 'async-es/waterfall'`. If you are using only a few Async functions, and are using a ES bundler such as Rollup, this can significantly lower your build size. + +Major thanks to [**@Kikobeats**](github.com/Kikobeats), [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for doing the majority of the modularization work, as well as [**@jdalton**](github.com/jdalton) and [**@Rich-Harris**](github.com/Rich-Harris) for advisory work on the general modularization strategy. + +Another one of the general themes of the 2.0 release is standardization of what an "async" function is. We are now more strictly following the node-style continuation passing style. That is, an async function is a function that: + +1. Takes a variable number of arguments +2. The last argument is always a callback +3. The callback can accept any number of arguments +4. The first argument passed to the callback will be treated as an error result, if the argument is truthy +5. Any number of result arguments can be passed after the "error" argument +6. The callback is called once and exactly once, either on the same tick or later tick of the JavaScript event loop. + +There were several cases where Async accepted some functions that did not strictly have these properties, most notably `auto`, `every`, `some`, `filter`, `reject` and `detect`. + +Another theme is performance. We have eliminated internal deferrals in all cases where they make sense. For example, in `waterfall` and `auto`, there was a `setImmediate` between each task -- these deferrals have been removed. A `setImmediate` call can add up to 1ms of delay. This might not seem like a lot, but it can add up if you are using many Async functions in the course of processing a HTTP request, for example. Nearly all asynchronous functions that do I/O already have some sort of deferral built in, so the extra deferral is unnecessary. The trade-off of this change is removing our built-in stack-overflow defense. Many synchronous callback calls in series can quickly overflow the JS call stack. If you do have a function that is sometimes synchronous (calling its callback on the same tick), and are running into stack overflows, wrap it with `async.ensureAsync()`. + +Another big performance win has been re-implementing `queue`, `cargo`, and `priorityQueue` with [doubly linked lists](https://en.wikipedia.org/wiki/Doubly_linked_list) instead of arrays. This has lead to queues being an order of [magnitude faster on large sets of tasks](https://github.com/caolan/async/pull/1205). + +## New Features + +- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) +- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) +- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. ([#568](https://github.com/caolan/async/issues/568), [#1038](https://github.com/caolan/async/issues/1038)) +- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. ([#579](https://github.com/caolan/async/issues/579), [#839](https://github.com/caolan/async/issues/839), [#1074](https://github.com/caolan/async/issues/1074)) +- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) +- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. ([#1007](https://github.com/caolan/async/issues/1007), [#1027](https://github.com/caolan/async/issues/1027)) +- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. ([#942](https://github.com/caolan/async/issues/942), [#1012](https://github.com/caolan/async/issues/1012), [#1095](https://github.com/caolan/async/issues/1095)) +- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. ([#1016](https://github.com/caolan/async/issues/1016), [#1052](https://github.com/caolan/async/issues/1052)) +- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. ([#940](https://github.com/caolan/async/issues/940), [#1053](https://github.com/caolan/async/issues/1053)) +- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) ([#1140](https://github.com/caolan/async/issues/1140)). +- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. ([#608](https://github.com/caolan/async/issues/608), [#1055](https://github.com/caolan/async/issues/1055), [#1099](https://github.com/caolan/async/issues/1099), [#1100](https://github.com/caolan/async/issues/1100)) +- You can now limit the concurrency of `auto` tasks. ([#635](https://github.com/caolan/async/issues/635), [#637](https://github.com/caolan/async/issues/637)) +- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. ([#1058](https://github.com/caolan/async/issues/1058)) +- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. ([#1161](https://github.com/caolan/async/issues/1161)) +- `retry` will now pass all of the arguments the task function was resolved with to the callback ([#1231](https://github.com/caolan/async/issues/1231)). +- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. ([#868](https://github.com/caolan/async/issues/868), [#1030](https://github.com/caolan/async/issues/1030), [#1033](https://github.com/caolan/async/issues/1033), [#1034](https://github.com/caolan/async/issues/1034)) +- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. ([#1170](https://github.com/caolan/async/issues/1170)) +- `applyEach` and `applyEachSeries` now pass results to the final callback. ([#1088](https://github.com/caolan/async/issues/1088)) + +## Breaking changes + +- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. ([#814](https://github.com/caolan/async/issues/814), [#815](https://github.com/caolan/async/issues/815), [#1048](https://github.com/caolan/async/issues/1048), [#1050](https://github.com/caolan/async/issues/1050)) +- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) ([#1036](https://github.com/caolan/async/issues/1036), [#1042](https://github.com/caolan/async/issues/1042)) +- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. ([#696](https://github.com/caolan/async/issues/696), [#704](https://github.com/caolan/async/issues/704), [#1049](https://github.com/caolan/async/issues/1049), [#1050](https://github.com/caolan/async/issues/1050)) +- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) +- `filter`, `reject`, `some`, `every`, `detect` and their families like `{METHOD}Series` and `{METHOD}Limit` now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. ([#118](https://github.com/caolan/async/issues/118), [#774](https://github.com/caolan/async/issues/774), [#1028](https://github.com/caolan/async/issues/1028), [#1041](https://github.com/caolan/async/issues/1041)) +- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. ([#778](https://github.com/caolan/async/issues/778), [#847](https://github.com/caolan/async/issues/847)) +- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. ([#1054](https://github.com/caolan/async/issues/1054), [#1058](https://github.com/caolan/async/issues/1058)) +- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function ([#1217](https://github.com/caolan/async/issues/1217), [#1224](https://github.com/caolan/async/issues/1224)) +- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs ([#1205](https://github.com/caolan/async/issues/1205)). +- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. ([#724](https://github.com/caolan/async/issues/724), [#1078](https://github.com/caolan/async/issues/1078)) +- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays ([#1237](https://github.com/caolan/async/issues/1237)) +- Dropped support for Component, Jam, SPM, and Volo ([#1175](https://github.com/caolan/async/issues/1175), #[#176](https://github.com/caolan/async/issues/176)) + +## Bug Fixes + +- Improved handling of no dependency cases in `auto` & `autoInject` ([#1147](https://github.com/caolan/async/issues/1147)). +- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice ([#1197](https://github.com/caolan/async/issues/1197)). +- Fixed several documented optional callbacks not actually being optional ([#1223](https://github.com/caolan/async/issues/1223)). + +## Other + +- Added `someSeries` and `everySeries` for symmetry, as well as a complete set of `any`/`anyLimit`/`anySeries` and `all`/`/allLmit`/`allSeries` aliases. +- Added `find` as an alias for `detect. (as well as `findLimit` and `findSeries`). +- Various doc fixes ([#1005](https://github.com/caolan/async/issues/1005), [#1008](https://github.com/caolan/async/issues/1008), [#1010](https://github.com/caolan/async/issues/1010), [#1015](https://github.com/caolan/async/issues/1015), [#1021](https://github.com/caolan/async/issues/1021), [#1037](https://github.com/caolan/async/issues/1037), [#1039](https://github.com/caolan/async/issues/1039), [#1051](https://github.com/caolan/async/issues/1051), [#1102](https://github.com/caolan/async/issues/1102), [#1107](https://github.com/caolan/async/issues/1107), [#1121](https://github.com/caolan/async/issues/1121), [#1123](https://github.com/caolan/async/issues/1123), [#1129](https://github.com/caolan/async/issues/1129), [#1135](https://github.com/caolan/async/issues/1135), [#1138](https://github.com/caolan/async/issues/1138), [#1141](https://github.com/caolan/async/issues/1141), [#1153](https://github.com/caolan/async/issues/1153), [#1216](https://github.com/caolan/async/issues/1216), [#1217](https://github.com/caolan/async/issues/1217), [#1232](https://github.com/caolan/async/issues/1232), [#1233](https://github.com/caolan/async/issues/1233), [#1236](https://github.com/caolan/async/issues/1236), [#1238](https://github.com/caolan/async/issues/1238)) + +Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for taking the lead on version 2 of async. + +------------------------------------------ + +# v1.5.2 +- Allow using `"constructor"` as an argument in `memoize` ([#998](https://github.com/caolan/async/issues/998)) +- Give a better error messsage when `auto` dependency checking fails ([#994](https://github.com/caolan/async/issues/994)) +- Various doc updates ([#936](https://github.com/caolan/async/issues/936), [#956](https://github.com/caolan/async/issues/956), [#979](https://github.com/caolan/async/issues/979), [#1002](https://github.com/caolan/async/issues/1002)) + +# v1.5.1 +- Fix issue with `pause` in `queue` with concurrency enabled ([#946](https://github.com/caolan/async/issues/946)) +- `while` and `until` now pass the final result to callback ([#963](https://github.com/caolan/async/issues/963)) +- `auto` will properly handle concurrency when there is no callback ([#966](https://github.com/caolan/async/issues/966)) +- `auto` will no. properly stop execution when an error occurs ([#988](https://github.com/caolan/async/issues/988), [#993](https://github.com/caolan/async/issues/993)) +- Various doc fixes ([#971](https://github.com/caolan/async/issues/971), [#980](https://github.com/caolan/async/issues/980)) + +# v1.5.0 + +- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) ([#892](https://github.com/caolan/async/issues/892)) +- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. ([#873](https://github.com/caolan/async/issues/873)) +- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks ([#637](https://github.com/caolan/async/issues/637)) +- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. ([#891](https://github.com/caolan/async/issues/891)) +- Various code simplifications ([#896](https://github.com/caolan/async/issues/896), [#904](https://github.com/caolan/async/issues/904)) +- Various doc fixes :scroll: ([#890](https://github.com/caolan/async/issues/890), [#894](https://github.com/caolan/async/issues/894), [#903](https://github.com/caolan/async/issues/903), [#905](https://github.com/caolan/async/issues/905), [#912](https://github.com/caolan/async/issues/912)) + +# v1.4.2 + +- Ensure coverage files don't get published on npm ([#879](https://github.com/caolan/async/issues/879)) + +# v1.4.1 + +- Add in overlooked `detectLimit` method ([#866](https://github.com/caolan/async/issues/866)) +- Removed unnecessary files from npm releases ([#861](https://github.com/caolan/async/issues/861)) +- Removed usage of a reserved word to prevent :boom: in older environments ([#870](https://github.com/caolan/async/issues/870)) + +# v1.4.0 + +- `asyncify` now supports promises ([#840](https://github.com/caolan/async/issues/840)) +- Added `Limit` versions of `filter` and `reject` ([#836](https://github.com/caolan/async/issues/836)) +- Add `Limit` versions of `detect`, `some` and `every` ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) +- `some`, `every` and `detect` now short circuit early ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) +- Improve detection of the global object ([#804](https://github.com/caolan/async/issues/804)), enabling use in WebWorkers +- `whilst` now called with arguments from iterator ([#823](https://github.com/caolan/async/issues/823)) +- `during` now gets called with arguments from iterator ([#824](https://github.com/caolan/async/issues/824)) +- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0)) + + +# v1.3.0 + +New Features: +- Added `constant` +- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. ([#671](https://github.com/caolan/async/issues/671), [#806](https://github.com/caolan/async/issues/806)) +- Added `during` and `doDuring`, which are like `whilst` with an async truth test. ([#800](https://github.com/caolan/async/issues/800)) +- `retry` now accepts an `interval` parameter to specify a delay between retries. ([#793](https://github.com/caolan/async/issues/793)) +- `async` should work better in Web Workers due to better `root` detection ([#804](https://github.com/caolan/async/issues/804)) +- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` ([#642](https://github.com/caolan/async/issues/642)) +- Various internal updates ([#786](https://github.com/caolan/async/issues/786), [#801](https://github.com/caolan/async/issues/801), [#802](https://github.com/caolan/async/issues/802), [#803](https://github.com/caolan/async/issues/803)) +- Various doc fixes ([#790](https://github.com/caolan/async/issues/790), [#794](https://github.com/caolan/async/issues/794)) + +Bug Fixes: +- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. ([#740](https://github.com/caolan/async/issues/740), [#744](https://github.com/caolan/async/issues/744), [#783](https://github.com/caolan/async/issues/783)) + + +# v1.2.1 + +Bug Fix: + +- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) + + +# v1.2.0 + +New Features: + +- Added `timesLimit` ([#743](https://github.com/caolan/async/issues/743)) +- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. ([#747](https://github.com/caolan/async/issues/747), [#772](https://github.com/caolan/async/issues/772)) + +Bug Fixes: + +- Fixed a regression in `each` and family with empty arrays that have additional properties. ([#775](https://github.com/caolan/async/issues/775), [#777](https://github.com/caolan/async/issues/777)) + + +# v1.1.1 + +Bug Fix: + +- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) + + +# v1.1.0 + +New Features: + +- `cargo` now supports all of the same methods and event callbacks as `queue`. +- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. ([#769](https://github.com/caolan/async/issues/769)) +- Optimized `map`, `eachOf`, and `waterfall` families of functions +- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array ([#667](https://github.com/caolan/async/issues/667)). +- The callback is now optional for the composed results of `compose` and `seq`. ([#618](https://github.com/caolan/async/issues/618)) +- Reduced file size by 4kb, (minified version by 1kb) +- Added code coverage through `nyc` and `coveralls` ([#768](https://github.com/caolan/async/issues/768)) + +Bug Fixes: + +- `forever` will no longer stack overflow with a synchronous iterator ([#622](https://github.com/caolan/async/issues/622)) +- `eachLimit` and other limit functions will stop iterating once an error occurs ([#754](https://github.com/caolan/async/issues/754)) +- Always pass `null` in callbacks when there is no error ([#439](https://github.com/caolan/async/issues/439)) +- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue ([#668](https://github.com/caolan/async/issues/668)) +- `each` and family will properly handle an empty array ([#578](https://github.com/caolan/async/issues/578)) +- `eachSeries` and family will finish if the underlying array is modified during execution ([#557](https://github.com/caolan/async/issues/557)) +- `queue` will throw if a non-function is passed to `q.push()` ([#593](https://github.com/caolan/async/issues/593)) +- Doc fixes ([#629](https://github.com/caolan/async/issues/629), [#766](https://github.com/caolan/async/issues/766)) + + +# v1.0.0 + +No known breaking changes, we are simply complying with semver from here on out. + +Changes: + +- Start using a changelog! +- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) ([#168](https://github.com/caolan/async/issues/168) [#704](https://github.com/caolan/async/issues/704) [#321](https://github.com/caolan/async/issues/321)) +- Detect deadlocks in `auto` ([#663](https://github.com/caolan/async/issues/663)) +- Better support for require.js ([#527](https://github.com/caolan/async/issues/527)) +- Throw if queue created with concurrency `0` ([#714](https://github.com/caolan/async/issues/714)) +- Fix unneeded iteration in `queue.resume()` ([#758](https://github.com/caolan/async/issues/758)) +- Guard against timer mocking overriding `setImmediate` ([#609](https://github.com/caolan/async/issues/609) [#611](https://github.com/caolan/async/issues/611)) +- Miscellaneous doc fixes ([#542](https://github.com/caolan/async/issues/542) [#596](https://github.com/caolan/async/issues/596) [#615](https://github.com/caolan/async/issues/615) [#628](https://github.com/caolan/async/issues/628) [#631](https://github.com/caolan/async/issues/631) [#690](https://github.com/caolan/async/issues/690) [#729](https://github.com/caolan/async/issues/729)) +- Use single noop function internally ([#546](https://github.com/caolan/async/issues/546)) +- Optimize internal `_each`, `_map` and `_keys` functions. diff --git a/live2d/node_modules/async/LICENSE b/live2d/node_modules/async/LICENSE new file mode 100644 index 0000000..b18aed6 --- /dev/null +++ b/live2d/node_modules/async/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010-2018 Caolan McMahon + +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. diff --git a/live2d/node_modules/async/README.md b/live2d/node_modules/async/README.md new file mode 100644 index 0000000..49cf950 --- /dev/null +++ b/live2d/node_modules/async/README.md @@ -0,0 +1,56 @@ +![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg) + +[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) +[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async) +[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) +[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![libhive - Open source examples](https://www.libhive.com/providers/npm/packages/async/examples/badge.svg)](https://www.libhive.com/providers/npm/packages/async) +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async) + + +Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm install --save async`, it can also be used directly in the browser. + +This version of the package is optimized for the Node.js environment. If you use Async with webpack, install [`async-es`](https://www.npmjs.com/package/async-es) instead. + +For Documentation, visit + +*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)* + + +```javascript +// for use with Node-style callbacks... +var async = require("async"); + +var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; +var configs = {}; + +async.forEachOf(obj, (value, key, callback) => { + fs.readFile(__dirname + value, "utf8", (err, data) => { + if (err) return callback(err); + try { + configs[key] = JSON.parse(data); + } catch (e) { + return callback(e); + } + callback(); + }); +}, err => { + if (err) console.error(err.message); + // configs is now a map of JSON data + doSomethingWith(configs); +}); +``` + +```javascript +var async = require("async"); + +// ...or ES2017 async functions +async.mapLimit(urls, 5, async function(url) { + const response = await fetch(url) + return response.body +}, (err, results) => { + if (err) throw err + // results is now an array of the response bodies + console.log(results) +}) +``` diff --git a/live2d/node_modules/async/all.js b/live2d/node_modules/async/all.js new file mode 100644 index 0000000..d0565b0 --- /dev/null +++ b/live2d/node_modules/async/all.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _notId = require('./internal/notId'); + +var _notId2 = _interopRequireDefault(_notId); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns `true` if every element in `coll` satisfies an async test. If any + * iteratee call returns `false`, the main `callback` is immediately called. + * + * @name every + * @static + * @memberOf module:Collections + * @method + * @alias all + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + * @example + * + * async.every(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then every file exists + * }); + */ +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/allLimit.js b/live2d/node_modules/async/allLimit.js new file mode 100644 index 0000000..a1a759a --- /dev/null +++ b/live2d/node_modules/async/allLimit.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _notId = require('./internal/notId'); + +var _notId2 = _interopRequireDefault(_notId); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. + * + * @name everyLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/allSeries.js b/live2d/node_modules/async/allSeries.js new file mode 100644 index 0000000..23bfebb --- /dev/null +++ b/live2d/node_modules/async/allSeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _everyLimit = require('./everyLimit'); + +var _everyLimit2 = _interopRequireDefault(_everyLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. + * + * @name everySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in series. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +exports.default = (0, _doLimit2.default)(_everyLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/any.js b/live2d/node_modules/async/any.js new file mode 100644 index 0000000..a8e70f7 --- /dev/null +++ b/live2d/node_modules/async/any.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns `true` if at least one element in the `coll` satisfies an async test. + * If any iteratee call returns `true`, the main `callback` is immediately + * called. + * + * @name some + * @static + * @memberOf module:Collections + * @method + * @alias any + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + * @example + * + * async.some(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then at least one of the files exists + * }); + */ +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(Boolean, _identity2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/anyLimit.js b/live2d/node_modules/async/anyLimit.js new file mode 100644 index 0000000..24ca3f4 --- /dev/null +++ b/live2d/node_modules/async/anyLimit.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. + * + * @name someLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anyLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(Boolean, _identity2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/anySeries.js b/live2d/node_modules/async/anySeries.js new file mode 100644 index 0000000..dc24ed2 --- /dev/null +++ b/live2d/node_modules/async/anySeries.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _someLimit = require('./someLimit'); + +var _someLimit2 = _interopRequireDefault(_someLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. + * + * @name someSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anySeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in series. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +exports.default = (0, _doLimit2.default)(_someLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/apply.js b/live2d/node_modules/async/apply.js new file mode 100644 index 0000000..f590fa5 --- /dev/null +++ b/live2d/node_modules/async/apply.js @@ -0,0 +1,68 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + return function () /*callArgs*/{ + var callArgs = (0, _slice2.default)(arguments); + return fn.apply(null, args.concat(callArgs)); + }; +}; + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +; + +/** + * Creates a continuation function with some arguments already applied. + * + * Useful as a shorthand when combined with other control flow functions. Any + * arguments passed to the returned function are added to the arguments + * originally passed to apply. + * + * @name apply + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {Function} fn - The function you want to eventually apply all + * arguments to. Invokes with (arguments...). + * @param {...*} arguments... - Any number of arguments to automatically apply + * when the continuation is called. + * @returns {Function} the partially-applied function + * @example + * + * // using apply + * async.parallel([ + * async.apply(fs.writeFile, 'testfile1', 'test1'), + * async.apply(fs.writeFile, 'testfile2', 'test2') + * ]); + * + * + * // the same process without using apply + * async.parallel([ + * function(callback) { + * fs.writeFile('testfile1', 'test1', callback); + * }, + * function(callback) { + * fs.writeFile('testfile2', 'test2', callback); + * } + * ]); + * + * // It's possible to pass any number of additional arguments when calling the + * // continuation: + * + * node> var fn = async.apply(sys.puts, 'one'); + * node> fn('two', 'three'); + * one + * two + * three + */ +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/applyEach.js b/live2d/node_modules/async/applyEach.js new file mode 100644 index 0000000..06c0845 --- /dev/null +++ b/live2d/node_modules/async/applyEach.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _applyEach = require('./internal/applyEach'); + +var _applyEach2 = _interopRequireDefault(_applyEach); + +var _map = require('./map'); + +var _map2 = _interopRequireDefault(_map); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Applies the provided arguments to each function in the array, calling + * `callback` after all functions have completed. If you only provide the first + * argument, `fns`, then it will return a function which lets you pass in the + * arguments as if it were a single function call. If more arguments are + * provided, `callback` is required while `args` is still optional. + * + * @name applyEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s + * to all call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument, `fns`, is provided, it will + * return a function which lets you pass in the arguments as if it were a single + * function call. The signature is `(..args, callback)`. If invoked with any + * arguments, `callback` is required. + * @example + * + * async.applyEach([enableSearch, updateSchema], 'bucket', callback); + * + * // partial application example: + * async.each( + * buckets, + * async.applyEach([enableSearch, updateSchema]), + * callback + * ); + */ +exports.default = (0, _applyEach2.default)(_map2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/applyEachSeries.js b/live2d/node_modules/async/applyEachSeries.js new file mode 100644 index 0000000..ad80280 --- /dev/null +++ b/live2d/node_modules/async/applyEachSeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _applyEach = require('./internal/applyEach'); + +var _applyEach2 = _interopRequireDefault(_applyEach); + +var _mapSeries = require('./mapSeries'); + +var _mapSeries2 = _interopRequireDefault(_mapSeries); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. + * + * @name applyEachSeries + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.applyEach]{@link module:ControlFlow.applyEach} + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all + * call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument is provided, it will return + * a function which lets you pass in the arguments as if it were a single + * function call. + */ +exports.default = (0, _applyEach2.default)(_mapSeries2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/asyncify.js b/live2d/node_modules/async/asyncify.js new file mode 100644 index 0000000..5e3fc91 --- /dev/null +++ b/live2d/node_modules/async/asyncify.js @@ -0,0 +1,110 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = asyncify; + +var _isObject = require('lodash/isObject'); + +var _isObject2 = _interopRequireDefault(_isObject); + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Take a sync function and make it async, passing its return value to a + * callback. This is useful for plugging sync functions into a waterfall, + * series, or other async functions. Any arguments passed to the generated + * function will be passed to the wrapped function (except for the final + * callback argument). Errors thrown will be passed to the callback. + * + * If the function passed to `asyncify` returns a Promise, that promises's + * resolved/rejected state will be used to call the callback, rather than simply + * the synchronous return value. + * + * This also means you can asyncify ES2017 `async` functions. + * + * @name asyncify + * @static + * @memberOf module:Utils + * @method + * @alias wrapSync + * @category Util + * @param {Function} func - The synchronous function, or Promise-returning + * function to convert to an {@link AsyncFunction}. + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be + * invoked with `(args..., callback)`. + * @example + * + * // passing a regular synchronous function + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(JSON.parse), + * function (data, next) { + * // data is the result of parsing the text. + * // If there was a parsing error, it would have been caught. + * } + * ], callback); + * + * // passing a function returning a promise + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(function (contents) { + * return db.model.create(contents); + * }), + * function (model, next) { + * // `model` is the instantiated model object. + * // If there was an error, this function would be skipped. + * } + * ], callback); + * + * // es2017 example, though `asyncify` is not needed if your JS environment + * // supports async functions out of the box + * var q = async.queue(async.asyncify(async function(file) { + * var intermediateStep = await processFile(file); + * return await somePromise(intermediateStep) + * })); + * + * q.push(files); + */ +function asyncify(func) { + return (0, _initialParams2.default)(function (args, callback) { + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if ((0, _isObject2.default)(result) && typeof result.then === 'function') { + result.then(function (value) { + invokeCallback(callback, null, value); + }, function (err) { + invokeCallback(callback, err.message ? err : new Error(err)); + }); + } else { + callback(null, result); + } + }); +} + +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (e) { + (0, _setImmediate2.default)(rethrow, e); + } +} + +function rethrow(error) { + throw error; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/auto.js b/live2d/node_modules/async/auto.js new file mode 100644 index 0000000..26c1d56 --- /dev/null +++ b/live2d/node_modules/async/auto.js @@ -0,0 +1,289 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (tasks, concurrency, callback) { + if (typeof concurrency === 'function') { + // concurrency is optional, shift the args. + callback = concurrency; + concurrency = null; + } + callback = (0, _once2.default)(callback || _noop2.default); + var keys = (0, _keys2.default)(tasks); + var numTasks = keys.length; + if (!numTasks) { + return callback(null); + } + if (!concurrency) { + concurrency = numTasks; + } + + var results = {}; + var runningTasks = 0; + var hasError = false; + + var listeners = Object.create(null); + + var readyTasks = []; + + // for cycle detection: + var readyToCheck = []; // tasks that have been identified as reachable + // without the possibility of returning to an ancestor task + var uncheckedDependencies = {}; + + (0, _baseForOwn2.default)(tasks, function (task, key) { + if (!(0, _isArray2.default)(task)) { + // no dependencies + enqueueTask(key, [task]); + readyToCheck.push(key); + return; + } + + var dependencies = task.slice(0, task.length - 1); + var remainingDependencies = dependencies.length; + if (remainingDependencies === 0) { + enqueueTask(key, task); + readyToCheck.push(key); + return; + } + uncheckedDependencies[key] = remainingDependencies; + + (0, _arrayEach2.default)(dependencies, function (dependencyName) { + if (!tasks[dependencyName]) { + throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', ')); + } + addListener(dependencyName, function () { + remainingDependencies--; + if (remainingDependencies === 0) { + enqueueTask(key, task); + } + }); + }); + }); + + checkForDeadlocks(); + processQueue(); + + function enqueueTask(key, task) { + readyTasks.push(function () { + runTask(key, task); + }); + } + + function processQueue() { + if (readyTasks.length === 0 && runningTasks === 0) { + return callback(null, results); + } + while (readyTasks.length && runningTasks < concurrency) { + var run = readyTasks.shift(); + run(); + } + } + + function addListener(taskName, fn) { + var taskListeners = listeners[taskName]; + if (!taskListeners) { + taskListeners = listeners[taskName] = []; + } + + taskListeners.push(fn); + } + + function taskComplete(taskName) { + var taskListeners = listeners[taskName] || []; + (0, _arrayEach2.default)(taskListeners, function (fn) { + fn(); + }); + processQueue(); + } + + function runTask(key, task) { + if (hasError) return; + + var taskCallback = (0, _onlyOnce2.default)(function (err, result) { + runningTasks--; + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); + } + if (err) { + var safeResults = {}; + (0, _baseForOwn2.default)(results, function (val, rkey) { + safeResults[rkey] = val; + }); + safeResults[key] = result; + hasError = true; + listeners = Object.create(null); + + callback(err, safeResults); + } else { + results[key] = result; + taskComplete(key); + } + }); + + runningTasks++; + var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]); + if (task.length > 1) { + taskFn(results, taskCallback); + } else { + taskFn(taskCallback); + } + } + + function checkForDeadlocks() { + // Kahn's algorithm + // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm + // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html + var currentTask; + var counter = 0; + while (readyToCheck.length) { + currentTask = readyToCheck.pop(); + counter++; + (0, _arrayEach2.default)(getDependents(currentTask), function (dependent) { + if (--uncheckedDependencies[dependent] === 0) { + readyToCheck.push(dependent); + } + }); + } + + if (counter !== numTasks) { + throw new Error('async.auto cannot execute tasks due to a recursive dependency'); + } + } + + function getDependents(taskName) { + var result = []; + (0, _baseForOwn2.default)(tasks, function (task, key) { + if ((0, _isArray2.default)(task) && (0, _baseIndexOf2.default)(task, taskName, 0) >= 0) { + result.push(key); + } + }); + return result; + } +}; + +var _arrayEach = require('lodash/_arrayEach'); + +var _arrayEach2 = _interopRequireDefault(_arrayEach); + +var _baseForOwn = require('lodash/_baseForOwn'); + +var _baseForOwn2 = _interopRequireDefault(_baseForOwn); + +var _baseIndexOf = require('lodash/_baseIndexOf'); + +var _baseIndexOf2 = _interopRequireDefault(_baseIndexOf); + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _keys = require('lodash/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; + +/** + * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on + * their requirements. Each function can optionally depend on other functions + * being completed first, and each function is run as soon as its requirements + * are satisfied. + * + * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence + * will stop. Further tasks will not execute (so any other functions depending + * on it will not run), and the main `callback` is immediately called with the + * error. + * + * {@link AsyncFunction}s also receive an object containing the results of functions which + * have completed so far as the first argument, if they have dependencies. If a + * task function has no dependencies, it will only be passed a callback. + * + * @name auto + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Object} tasks - An object. Each of its properties is either a + * function or an array of requirements, with the {@link AsyncFunction} itself the last item + * in the array. The object's key of a property serves as the name of the task + * defined by that property, i.e. can be used when specifying requirements for + * other tasks. The function receives one or two arguments: + * * a `results` object, containing the results of the previously executed + * functions, only passed if the task has any dependencies, + * * a `callback(err, result)` function, which must be called when finished, + * passing an `error` (which can be `null`) and the result of the function's + * execution. + * @param {number} [concurrency=Infinity] - An optional `integer` for + * determining the maximum number of tasks that can be run in parallel. By + * default, as many as possible. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback. Results are always returned; however, if an + * error occurs, no further `tasks` will be performed, and the results object + * will only contain partial results. Invoked with (err, results). + * @returns undefined + * @example + * + * async.auto({ + * // this function will just be passed a callback + * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), + * showData: ['readData', function(results, cb) { + * // results.readData is the file's contents + * // ... + * }] + * }, callback); + * + * async.auto({ + * get_data: function(callback) { + * console.log('in get_data'); + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * console.log('in make_folder'); + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: ['get_data', 'make_folder', function(results, callback) { + * console.log('in write_file', JSON.stringify(results)); + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(results, callback) { + * console.log('in email_link', JSON.stringify(results)); + * // once the file is written let's email a link to it... + * // results.write_file contains the filename returned by write_file. + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); + * }] + * }, function(err, results) { + * console.log('err = ', err); + * console.log('results = ', results); + * }); + */ \ No newline at end of file diff --git a/live2d/node_modules/async/autoInject.js b/live2d/node_modules/async/autoInject.js new file mode 100644 index 0000000..bfbe7e8 --- /dev/null +++ b/live2d/node_modules/async/autoInject.js @@ -0,0 +1,170 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = autoInject; + +var _auto = require('./auto'); + +var _auto2 = _interopRequireDefault(_auto); + +var _baseForOwn = require('lodash/_baseForOwn'); + +var _baseForOwn2 = _interopRequireDefault(_baseForOwn); + +var _arrayMap = require('lodash/_arrayMap'); + +var _arrayMap2 = _interopRequireDefault(_arrayMap); + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _trim = require('lodash/trim'); + +var _trim2 = _interopRequireDefault(_trim); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; +var FN_ARG_SPLIT = /,/; +var FN_ARG = /(=.+)?(\s*)$/; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + +function parseParams(func) { + func = func.toString().replace(STRIP_COMMENTS, ''); + func = func.match(FN_ARGS)[2].replace(' ', ''); + func = func ? func.split(FN_ARG_SPLIT) : []; + func = func.map(function (arg) { + return (0, _trim2.default)(arg.replace(FN_ARG, '')); + }); + return func; +} + +/** + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent + * tasks are specified as parameters to the function, after the usual callback + * parameter, with the parameter names matching the names of the tasks it + * depends on. This can provide even more readable task graphs which can be + * easier to maintain. + * + * If a final callback is specified, the task results are similarly injected, + * specified as named parameters after the initial error parameter. + * + * The autoInject function is purely syntactic sugar and its semantics are + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. + * + * @name autoInject + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.auto]{@link module:ControlFlow.auto} + * @category Control Flow + * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of + * the form 'func([dependencies...], callback). The object's key of a property + * serves as the name of the task defined by that property, i.e. can be used + * when specifying requirements for other tasks. + * * The `callback` parameter is a `callback(err, result)` which must be called + * when finished, passing an `error` (which can be `null`) and the result of + * the function's execution. The remaining parameters name other tasks on + * which the task is dependent, and the results from those tasks are the + * arguments of those parameters. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback, and a `results` object with any completed + * task results, similar to `auto`. + * @example + * + * // The example from `auto` can be rewritten as follows: + * async.autoInject({ + * get_data: function(callback) { + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: function(get_data, make_folder, callback) { + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }, + * email_link: function(write_file, callback) { + * // once the file is written let's email a link to it... + * // write_file contains the filename returned by write_file. + * callback(null, {'file':write_file, 'email':'user@example.com'}); + * } + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); + * }); + * + * // If you are using a JS minifier that mangles parameter names, `autoInject` + * // will not work with plain functions, since the parameter names will be + * // collapsed to a single letter identifier. To work around this, you can + * // explicitly specify the names of the parameters your task function needs + * // in an array, similar to Angular.js dependency injection. + * + * // This still has an advantage over plain `auto`, since the results a task + * // depends on are still spread into arguments. + * async.autoInject({ + * //... + * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(write_file, callback) { + * callback(null, {'file':write_file, 'email':'user@example.com'}); + * }] + * //... + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); + * }); + */ +function autoInject(tasks, callback) { + var newTasks = {}; + + (0, _baseForOwn2.default)(tasks, function (taskFn, key) { + var params; + var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn); + var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0; + + if ((0, _isArray2.default)(taskFn)) { + params = taskFn.slice(0, -1); + taskFn = taskFn[taskFn.length - 1]; + + newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); + } else if (hasNoDeps) { + // no dependencies, use the function as-is + newTasks[key] = taskFn; + } else { + params = parseParams(taskFn); + if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { + throw new Error("autoInject task functions require explicit parameters."); + } + + // remove callback param + if (!fnIsAsync) params.pop(); + + newTasks[key] = params.concat(newTask); + } + + function newTask(results, taskCb) { + var newArgs = (0, _arrayMap2.default)(params, function (name) { + return results[name]; + }); + newArgs.push(taskCb); + (0, _wrapAsync2.default)(taskFn).apply(null, newArgs); + } + }); + + (0, _auto2.default)(newTasks, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/bower.json b/live2d/node_modules/async/bower.json new file mode 100644 index 0000000..7dbeb14 --- /dev/null +++ b/live2d/node_modules/async/bower.json @@ -0,0 +1,17 @@ +{ + "name": "async", + "main": "dist/async.js", + "ignore": [ + "bower_components", + "lib", + "mocha_test", + "node_modules", + "perf", + "support", + "**/.*", + "*.config.js", + "*.json", + "index.js", + "Makefile" + ] +} diff --git a/live2d/node_modules/async/cargo.js b/live2d/node_modules/async/cargo.js new file mode 100644 index 0000000..c7e59c7 --- /dev/null +++ b/live2d/node_modules/async/cargo.js @@ -0,0 +1,94 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = cargo; + +var _queue = require('./internal/queue'); + +var _queue2 = _interopRequireDefault(_queue); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * A cargo of tasks for the worker function to complete. Cargo inherits all of + * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. + * @typedef {Object} CargoObject + * @memberOf module:ControlFlow + * @property {Function} length - A function returning the number of items + * waiting to be processed. Invoke like `cargo.length()`. + * @property {number} payload - An `integer` for determining how many tasks + * should be process per round. This property can be changed after a `cargo` is + * created to alter the payload on-the-fly. + * @property {Function} push - Adds `task` to the `queue`. The callback is + * called once the `worker` has finished processing the task. Instead of a + * single task, an array of `tasks` can be submitted. The respective callback is + * used for every task in the list. Invoke like `cargo.push(task, [callback])`. + * @property {Function} saturated - A callback that is called when the + * `queue.length()` hits the concurrency and further tasks will be queued. + * @property {Function} empty - A callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - A callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke like `cargo.idle()`. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke like `cargo.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke like `cargo.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. + */ + +/** + * Creates a `cargo` object with the specified payload. Tasks added to the + * cargo will be processed altogether (up to the `payload` limit). If the + * `worker` is in progress, the task is queued until it becomes available. Once + * the `worker` has completed some tasks, each callback of those tasks is + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) + * for how `cargo` and `queue` work. + * + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers + * at a time, cargo passes an array of tasks to a single worker, repeating + * when the worker is finished. + * + * @name cargo + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} + * @category Control Flow + * @param {AsyncFunction} worker - An asynchronous function for processing an array + * of queued tasks. Invoked with `(tasks, callback)`. + * @param {number} [payload=Infinity] - An optional `integer` for determining + * how many tasks should be processed per round; if omitted, the default is + * unlimited. + * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the cargo and inner queue. + * @example + * + * // create a cargo object with payload 2 + * var cargo = async.cargo(function(tasks, callback) { + * for (var i=0; i async.dir(hello, 'world'); + * {hello: 'world'} + */ +exports.default = (0, _consoleFunc2.default)('dir'); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/dist/async.js b/live2d/node_modules/async/dist/async.js new file mode 100644 index 0000000..61c7588 --- /dev/null +++ b/live2d/node_modules/async/dist/async.js @@ -0,0 +1,5612 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.async = global.async || {}))); +}(this, (function (exports) { 'use strict'; + +function slice(arrayLike, start) { + start = start|0; + var newLen = Math.max(arrayLike.length - start, 0); + var newArr = Array(newLen); + for(var idx = 0; idx < newLen; idx++) { + newArr[idx] = arrayLike[start + idx]; + } + return newArr; +} + +/** + * Creates a continuation function with some arguments already applied. + * + * Useful as a shorthand when combined with other control flow functions. Any + * arguments passed to the returned function are added to the arguments + * originally passed to apply. + * + * @name apply + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {Function} fn - The function you want to eventually apply all + * arguments to. Invokes with (arguments...). + * @param {...*} arguments... - Any number of arguments to automatically apply + * when the continuation is called. + * @returns {Function} the partially-applied function + * @example + * + * // using apply + * async.parallel([ + * async.apply(fs.writeFile, 'testfile1', 'test1'), + * async.apply(fs.writeFile, 'testfile2', 'test2') + * ]); + * + * + * // the same process without using apply + * async.parallel([ + * function(callback) { + * fs.writeFile('testfile1', 'test1', callback); + * }, + * function(callback) { + * fs.writeFile('testfile2', 'test2', callback); + * } + * ]); + * + * // It's possible to pass any number of additional arguments when calling the + * // continuation: + * + * node> var fn = async.apply(sys.puts, 'one'); + * node> fn('two', 'three'); + * one + * two + * three + */ +var apply = function(fn/*, ...args*/) { + var args = slice(arguments, 1); + return function(/*callArgs*/) { + var callArgs = slice(arguments); + return fn.apply(null, args.concat(callArgs)); + }; +}; + +var initialParams = function (fn) { + return function (/*...args, callback*/) { + var args = slice(arguments); + var callback = args.pop(); + fn.call(this, args, callback); + }; +}; + +/** + * 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'); +} + +var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; +var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; + +function fallback(fn) { + setTimeout(fn, 0); +} + +function wrap(defer) { + return function (fn/*, ...args*/) { + var args = slice(arguments, 1); + defer(function () { + fn.apply(null, args); + }); + }; +} + +var _defer; + +if (hasSetImmediate) { + _defer = setImmediate; +} else if (hasNextTick) { + _defer = process.nextTick; +} else { + _defer = fallback; +} + +var setImmediate$1 = wrap(_defer); + +/** + * Take a sync function and make it async, passing its return value to a + * callback. This is useful for plugging sync functions into a waterfall, + * series, or other async functions. Any arguments passed to the generated + * function will be passed to the wrapped function (except for the final + * callback argument). Errors thrown will be passed to the callback. + * + * If the function passed to `asyncify` returns a Promise, that promises's + * resolved/rejected state will be used to call the callback, rather than simply + * the synchronous return value. + * + * This also means you can asyncify ES2017 `async` functions. + * + * @name asyncify + * @static + * @memberOf module:Utils + * @method + * @alias wrapSync + * @category Util + * @param {Function} func - The synchronous function, or Promise-returning + * function to convert to an {@link AsyncFunction}. + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be + * invoked with `(args..., callback)`. + * @example + * + * // passing a regular synchronous function + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(JSON.parse), + * function (data, next) { + * // data is the result of parsing the text. + * // If there was a parsing error, it would have been caught. + * } + * ], callback); + * + * // passing a function returning a promise + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(function (contents) { + * return db.model.create(contents); + * }), + * function (model, next) { + * // `model` is the instantiated model object. + * // If there was an error, this function would be skipped. + * } + * ], callback); + * + * // es2017 example, though `asyncify` is not needed if your JS environment + * // supports async functions out of the box + * var q = async.queue(async.asyncify(async function(file) { + * var intermediateStep = await processFile(file); + * return await somePromise(intermediateStep) + * })); + * + * q.push(files); + */ +function asyncify(func) { + return initialParams(function (args, callback) { + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if (isObject(result) && typeof result.then === 'function') { + result.then(function(value) { + invokeCallback(callback, null, value); + }, function(err) { + invokeCallback(callback, err.message ? err : new Error(err)); + }); + } else { + callback(null, result); + } + }); +} + +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (e) { + setImmediate$1(rethrow, e); + } +} + +function rethrow(error) { + throw error; +} + +var supportsSymbol = typeof Symbol === 'function'; + +function isAsync(fn) { + return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; +} + +function wrapAsync(asyncFn) { + return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; +} + +function applyEach$1(eachfn) { + return function(fns/*, ...args*/) { + var args = slice(arguments, 1); + var go = initialParams(function(args, callback) { + var that = this; + return eachfn(fns, function (fn, cb) { + wrapAsync(fn).apply(that, args.concat(cb)); + }, callback); + }); + if (args.length) { + return go.apply(this, args); + } + else { + return go; + } + }; +} + +/** 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 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.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.call(value, symToStringTag$1), + tag = value[symToStringTag$1]; + + try { + value[symToStringTag$1] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.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$1 = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString$1 = objectProto$1.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$1.call(value); +} + +/** `Object#toString` result references. */ +var nullTag = '[object Null]'; +var 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); +} + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]'; +var funcTag = '[object Function]'; +var genTag = '[object GeneratorFunction]'; +var 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 || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +/** 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); +} + +// A temporary value used to identify if the loop should be broken. +// See #1064, #1293 +var breakLoop = {}; + +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ +function noop() { + // No operation performed. +} + +function once(fn) { + return function () { + if (fn === null) return; + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} + +var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator; + +var getIterator = function (coll) { + return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol](); +}; + +/** + * 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 = '[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; +} + +/** Used for built-in method references. */ +var objectProto$3 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$2 = objectProto$3.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto$3.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$2.call(value, 'callee') && + !propertyIsEnumerable.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 = 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; + +/* 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); +} + +/** `Object#toString` result references. */ +var argsTag$1 = '[object Arguments]'; +var arrayTag = '[object Array]'; +var boolTag = '[object Boolean]'; +var dateTag = '[object Date]'; +var errorTag = '[object Error]'; +var funcTag$1 = '[object Function]'; +var mapTag = '[object Map]'; +var numberTag = '[object Number]'; +var objectTag = '[object Object]'; +var regexpTag = '[object RegExp]'; +var setTag = '[object Set]'; +var stringTag = '[object String]'; +var weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]'; +var dataViewTag = '[object DataView]'; +var float32Tag = '[object Float32Array]'; +var float64Tag = '[object Float64Array]'; +var int8Tag = '[object Int8Array]'; +var int16Tag = '[object Int16Array]'; +var int32Tag = '[object Int32Array]'; +var uint8Tag = '[object Uint8Array]'; +var uint8ClampedTag = '[object Uint8ClampedArray]'; +var uint16Tag = '[object Uint16Array]'; +var 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] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag$1] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = 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$2 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$1 = objectProto$2.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$1.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$5 = 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$5; + + 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$4 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$3 = objectProto$4.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$3.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); +} + +function createArrayIterator(coll) { + var i = -1; + var len = coll.length; + return function next() { + return ++i < len ? {value: coll[i], key: i} : null; + } +} + +function createES2015Iterator(iterator) { + var i = -1; + return function next() { + var item = iterator.next(); + if (item.done) + return null; + i++; + return {value: item.value, key: i}; + } +} + +function createObjectIterator(obj) { + var okeys = keys(obj); + var i = -1; + var len = okeys.length; + return function next() { + var key = okeys[++i]; + if (key === '__proto__') { + return next(); + } + return i < len ? {value: obj[key], key: key} : null; + }; +} + +function iterator(coll) { + if (isArrayLike(coll)) { + return createArrayIterator(coll); + } + + var iterator = getIterator(coll); + return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); +} + +function onlyOnce(fn) { + return function() { + if (fn === null) throw new Error("Callback was already called."); + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} + +function _eachOfLimit(limit) { + return function (obj, iteratee, callback) { + callback = once(callback || noop); + if (limit <= 0 || !obj) { + return callback(null); + } + var nextElem = iterator(obj); + var done = false; + var running = 0; + var looping = false; + + function iterateeCallback(err, value) { + running -= 1; + if (err) { + done = true; + callback(err); + } + else if (value === breakLoop || (done && running <= 0)) { + done = true; + return callback(null); + } + else if (!looping) { + replenish(); + } + } + + function replenish () { + looping = true; + while (running < limit && !done) { + var elem = nextElem(); + if (elem === null) { + done = true; + if (running <= 0) { + callback(null); + } + return; + } + running += 1; + iteratee(elem.value, elem.key, onlyOnce(iterateeCallback)); + } + looping = false; + } + + replenish(); + }; +} + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a + * time. + * + * @name eachOfLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. The `key` is the item's key, or index in the case of an + * array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachOfLimit(coll, limit, iteratee, callback) { + _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); +} + +function doLimit(fn, limit) { + return function (iterable, iteratee, callback) { + return fn(iterable, limit, iteratee, callback); + }; +} + +// eachOf implementation optimized for array-likes +function eachOfArrayLike(coll, iteratee, callback) { + callback = once(callback || noop); + var index = 0, + completed = 0, + length = coll.length; + if (length === 0) { + callback(null); + } + + function iteratorCallback(err, value) { + if (err) { + callback(err); + } else if ((++completed === length) || value === breakLoop) { + callback(null); + } + } + + for (; index < length; index++) { + iteratee(coll[index], index, onlyOnce(iteratorCallback)); + } +} + +// a generic version of eachOf which can handle array, object, and iterator cases. +var eachOfGeneric = doLimit(eachOfLimit, Infinity); + +/** + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument + * to the iteratee. + * + * @name eachOf + * @static + * @memberOf module:Collections + * @method + * @alias forEachOf + * @category Collection + * @see [async.each]{@link module:Collections.each} + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each + * item in `coll`. + * The `key` is the item's key, or index in the case of an array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; + * var configs = {}; + * + * async.forEachOf(obj, function (value, key, callback) { + * fs.readFile(__dirname + value, "utf8", function (err, data) { + * if (err) return callback(err); + * try { + * configs[key] = JSON.parse(data); + * } catch (e) { + * return callback(e); + * } + * callback(); + * }); + * }, function (err) { + * if (err) console.error(err.message); + * // configs is now a map of JSON data + * doSomethingWith(configs); + * }); + */ +var eachOf = function(coll, iteratee, callback) { + var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; + eachOfImplementation(coll, wrapAsync(iteratee), callback); +}; + +function doParallel(fn) { + return function (obj, iteratee, callback) { + return fn(eachOf, obj, wrapAsync(iteratee), callback); + }; +} + +function _asyncMap(eachfn, arr, iteratee, callback) { + callback = callback || noop; + arr = arr || []; + var results = []; + var counter = 0; + var _iteratee = wrapAsync(iteratee); + + eachfn(arr, function (value, _, callback) { + var index = counter++; + _iteratee(value, function (err, v) { + results[index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); +} + +/** + * Produces a new collection of values by mapping each value in `coll` through + * the `iteratee` function. The `iteratee` is called with an item from `coll` + * and a callback for when it has finished processing. Each of these callback + * takes 2 arguments: an `error`, and the transformed item from `coll`. If + * `iteratee` passes an error to its callback, the main `callback` (for the + * `map` function) is immediately called with the error. + * + * Note, that since this function applies the `iteratee` to each item in + * parallel, there is no guarantee that the `iteratee` functions will complete + * in order. However, the results array will be in the same order as the + * original `coll`. + * + * If `map` is passed an Object, the results will be an Array. The results + * will roughly be in the order of the original Objects' keys (but this can + * vary across JavaScript engines). + * + * @name map + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an Array of the + * transformed items from the `coll`. Invoked with (err, results). + * @example + * + * async.map(['file1','file2','file3'], fs.stat, function(err, results) { + * // results is now an array of stats for each file + * }); + */ +var map = doParallel(_asyncMap); + +/** + * Applies the provided arguments to each function in the array, calling + * `callback` after all functions have completed. If you only provide the first + * argument, `fns`, then it will return a function which lets you pass in the + * arguments as if it were a single function call. If more arguments are + * provided, `callback` is required while `args` is still optional. + * + * @name applyEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s + * to all call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument, `fns`, is provided, it will + * return a function which lets you pass in the arguments as if it were a single + * function call. The signature is `(..args, callback)`. If invoked with any + * arguments, `callback` is required. + * @example + * + * async.applyEach([enableSearch, updateSchema], 'bucket', callback); + * + * // partial application example: + * async.each( + * buckets, + * async.applyEach([enableSearch, updateSchema]), + * callback + * ); + */ +var applyEach = applyEach$1(map); + +function doParallelLimit(fn) { + return function (obj, limit, iteratee, callback) { + return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback); + }; +} + +/** + * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. + * + * @name mapLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). + */ +var mapLimit = doParallelLimit(_asyncMap); + +/** + * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. + * + * @name mapSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). + */ +var mapSeries = doLimit(mapLimit, 1); + +/** + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. + * + * @name applyEachSeries + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.applyEach]{@link module:ControlFlow.applyEach} + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all + * call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument is provided, it will return + * a function which lets you pass in the arguments as if it were a single + * function call. + */ +var applyEachSeries = applyEach$1(mapSeries); + +/** + * 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; +} + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} + +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); +} + +/** + * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on + * their requirements. Each function can optionally depend on other functions + * being completed first, and each function is run as soon as its requirements + * are satisfied. + * + * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence + * will stop. Further tasks will not execute (so any other functions depending + * on it will not run), and the main `callback` is immediately called with the + * error. + * + * {@link AsyncFunction}s also receive an object containing the results of functions which + * have completed so far as the first argument, if they have dependencies. If a + * task function has no dependencies, it will only be passed a callback. + * + * @name auto + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Object} tasks - An object. Each of its properties is either a + * function or an array of requirements, with the {@link AsyncFunction} itself the last item + * in the array. The object's key of a property serves as the name of the task + * defined by that property, i.e. can be used when specifying requirements for + * other tasks. The function receives one or two arguments: + * * a `results` object, containing the results of the previously executed + * functions, only passed if the task has any dependencies, + * * a `callback(err, result)` function, which must be called when finished, + * passing an `error` (which can be `null`) and the result of the function's + * execution. + * @param {number} [concurrency=Infinity] - An optional `integer` for + * determining the maximum number of tasks that can be run in parallel. By + * default, as many as possible. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback. Results are always returned; however, if an + * error occurs, no further `tasks` will be performed, and the results object + * will only contain partial results. Invoked with (err, results). + * @returns undefined + * @example + * + * async.auto({ + * // this function will just be passed a callback + * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), + * showData: ['readData', function(results, cb) { + * // results.readData is the file's contents + * // ... + * }] + * }, callback); + * + * async.auto({ + * get_data: function(callback) { + * console.log('in get_data'); + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * console.log('in make_folder'); + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: ['get_data', 'make_folder', function(results, callback) { + * console.log('in write_file', JSON.stringify(results)); + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(results, callback) { + * console.log('in email_link', JSON.stringify(results)); + * // once the file is written let's email a link to it... + * // results.write_file contains the filename returned by write_file. + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); + * }] + * }, function(err, results) { + * console.log('err = ', err); + * console.log('results = ', results); + * }); + */ +var auto = function (tasks, concurrency, callback) { + if (typeof concurrency === 'function') { + // concurrency is optional, shift the args. + callback = concurrency; + concurrency = null; + } + callback = once(callback || noop); + var keys$$1 = keys(tasks); + var numTasks = keys$$1.length; + if (!numTasks) { + return callback(null); + } + if (!concurrency) { + concurrency = numTasks; + } + + var results = {}; + var runningTasks = 0; + var hasError = false; + + var listeners = Object.create(null); + + var readyTasks = []; + + // for cycle detection: + var readyToCheck = []; // tasks that have been identified as reachable + // without the possibility of returning to an ancestor task + var uncheckedDependencies = {}; + + baseForOwn(tasks, function (task, key) { + if (!isArray(task)) { + // no dependencies + enqueueTask(key, [task]); + readyToCheck.push(key); + return; + } + + var dependencies = task.slice(0, task.length - 1); + var remainingDependencies = dependencies.length; + if (remainingDependencies === 0) { + enqueueTask(key, task); + readyToCheck.push(key); + return; + } + uncheckedDependencies[key] = remainingDependencies; + + arrayEach(dependencies, function (dependencyName) { + if (!tasks[dependencyName]) { + throw new Error('async.auto task `' + key + + '` has a non-existent dependency `' + + dependencyName + '` in ' + + dependencies.join(', ')); + } + addListener(dependencyName, function () { + remainingDependencies--; + if (remainingDependencies === 0) { + enqueueTask(key, task); + } + }); + }); + }); + + checkForDeadlocks(); + processQueue(); + + function enqueueTask(key, task) { + readyTasks.push(function () { + runTask(key, task); + }); + } + + function processQueue() { + if (readyTasks.length === 0 && runningTasks === 0) { + return callback(null, results); + } + while(readyTasks.length && runningTasks < concurrency) { + var run = readyTasks.shift(); + run(); + } + + } + + function addListener(taskName, fn) { + var taskListeners = listeners[taskName]; + if (!taskListeners) { + taskListeners = listeners[taskName] = []; + } + + taskListeners.push(fn); + } + + function taskComplete(taskName) { + var taskListeners = listeners[taskName] || []; + arrayEach(taskListeners, function (fn) { + fn(); + }); + processQueue(); + } + + + function runTask(key, task) { + if (hasError) return; + + var taskCallback = onlyOnce(function(err, result) { + runningTasks--; + if (arguments.length > 2) { + result = slice(arguments, 1); + } + if (err) { + var safeResults = {}; + baseForOwn(results, function(val, rkey) { + safeResults[rkey] = val; + }); + safeResults[key] = result; + hasError = true; + listeners = Object.create(null); + + callback(err, safeResults); + } else { + results[key] = result; + taskComplete(key); + } + }); + + runningTasks++; + var taskFn = wrapAsync(task[task.length - 1]); + if (task.length > 1) { + taskFn(results, taskCallback); + } else { + taskFn(taskCallback); + } + } + + function checkForDeadlocks() { + // Kahn's algorithm + // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm + // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html + var currentTask; + var counter = 0; + while (readyToCheck.length) { + currentTask = readyToCheck.pop(); + counter++; + arrayEach(getDependents(currentTask), function (dependent) { + if (--uncheckedDependencies[dependent] === 0) { + readyToCheck.push(dependent); + } + }); + } + + if (counter !== numTasks) { + throw new Error( + 'async.auto cannot execute tasks due to a recursive dependency' + ); + } + } + + function getDependents(taskName) { + var result = []; + baseForOwn(tasks, function (task, key) { + if (isArray(task) && baseIndexOf(task, taskName, 0) >= 0) { + result.push(key); + } + }); + return result; + } +}; + +/** + * A specialized version of `_.map` 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 the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined; +var symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ +function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ +function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +/** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function asciiToArray(string) { + return string.split(''); +} + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff'; +var rsComboMarksRange = '\\u0300-\\u036f'; +var reComboHalfMarksRange = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange = '\\u20d0-\\u20ff'; +var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; +var rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsZWJ = '\\u200d'; + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + +/** Used to compose unicode character classes. */ +var rsAstralRange$1 = '\\ud800-\\udfff'; +var rsComboMarksRange$1 = '\\u0300-\\u036f'; +var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff'; +var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; +var rsVarRange$1 = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange$1 + ']'; +var rsCombo = '[' + rsComboRange$1 + ']'; +var rsFitz = '\\ud83c[\\udffb-\\udfff]'; +var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')'; +var rsNonAstral = '[^' + rsAstralRange$1 + ']'; +var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}'; +var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]'; +var rsZWJ$1 = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?'; +var rsOptVar = '[' + rsVarRange$1 + ']?'; +var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*'; +var rsSeq = rsOptVar + reOptMod + rsOptJoin; +var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** + * Removes leading and trailing whitespace or specified characters from `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to trim. + * @param {string} [chars=whitespace] The characters to trim. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the trimmed string. + * @example + * + * _.trim(' abc '); + * // => 'abc' + * + * _.trim('-_-abc-_-', '_-'); + * // => 'abc' + * + * _.map([' foo ', ' bar '], _.trim); + * // => ['foo', 'bar'] + */ +function trim(string, chars, guard) { + string = toString(string); + if (string && (guard || chars === undefined)) { + return string.replace(reTrim, ''); + } + if (!string || !(chars = baseToString(chars))) { + return string; + } + var strSymbols = stringToArray(string), + chrSymbols = stringToArray(chars), + start = charsStartIndex(strSymbols, chrSymbols), + end = charsEndIndex(strSymbols, chrSymbols) + 1; + + return castSlice(strSymbols, start, end).join(''); +} + +var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; +var FN_ARG_SPLIT = /,/; +var FN_ARG = /(=.+)?(\s*)$/; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + +function parseParams(func) { + func = func.toString().replace(STRIP_COMMENTS, ''); + func = func.match(FN_ARGS)[2].replace(' ', ''); + func = func ? func.split(FN_ARG_SPLIT) : []; + func = func.map(function (arg){ + return trim(arg.replace(FN_ARG, '')); + }); + return func; +} + +/** + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent + * tasks are specified as parameters to the function, after the usual callback + * parameter, with the parameter names matching the names of the tasks it + * depends on. This can provide even more readable task graphs which can be + * easier to maintain. + * + * If a final callback is specified, the task results are similarly injected, + * specified as named parameters after the initial error parameter. + * + * The autoInject function is purely syntactic sugar and its semantics are + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. + * + * @name autoInject + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.auto]{@link module:ControlFlow.auto} + * @category Control Flow + * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of + * the form 'func([dependencies...], callback). The object's key of a property + * serves as the name of the task defined by that property, i.e. can be used + * when specifying requirements for other tasks. + * * The `callback` parameter is a `callback(err, result)` which must be called + * when finished, passing an `error` (which can be `null`) and the result of + * the function's execution. The remaining parameters name other tasks on + * which the task is dependent, and the results from those tasks are the + * arguments of those parameters. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback, and a `results` object with any completed + * task results, similar to `auto`. + * @example + * + * // The example from `auto` can be rewritten as follows: + * async.autoInject({ + * get_data: function(callback) { + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: function(get_data, make_folder, callback) { + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }, + * email_link: function(write_file, callback) { + * // once the file is written let's email a link to it... + * // write_file contains the filename returned by write_file. + * callback(null, {'file':write_file, 'email':'user@example.com'}); + * } + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); + * }); + * + * // If you are using a JS minifier that mangles parameter names, `autoInject` + * // will not work with plain functions, since the parameter names will be + * // collapsed to a single letter identifier. To work around this, you can + * // explicitly specify the names of the parameters your task function needs + * // in an array, similar to Angular.js dependency injection. + * + * // This still has an advantage over plain `auto`, since the results a task + * // depends on are still spread into arguments. + * async.autoInject({ + * //... + * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(write_file, callback) { + * callback(null, {'file':write_file, 'email':'user@example.com'}); + * }] + * //... + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); + * }); + */ +function autoInject(tasks, callback) { + var newTasks = {}; + + baseForOwn(tasks, function (taskFn, key) { + var params; + var fnIsAsync = isAsync(taskFn); + var hasNoDeps = + (!fnIsAsync && taskFn.length === 1) || + (fnIsAsync && taskFn.length === 0); + + if (isArray(taskFn)) { + params = taskFn.slice(0, -1); + taskFn = taskFn[taskFn.length - 1]; + + newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); + } else if (hasNoDeps) { + // no dependencies, use the function as-is + newTasks[key] = taskFn; + } else { + params = parseParams(taskFn); + if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { + throw new Error("autoInject task functions require explicit parameters."); + } + + // remove callback param + if (!fnIsAsync) params.pop(); + + newTasks[key] = params.concat(newTask); + } + + function newTask(results, taskCb) { + var newArgs = arrayMap(params, function (name) { + return results[name]; + }); + newArgs.push(taskCb); + wrapAsync(taskFn).apply(null, newArgs); + } + }); + + auto(newTasks, callback); +} + +// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation +// used for queues. This implementation assumes that the node provided by the user can be modified +// to adjust the next and last properties. We implement only the minimal functionality +// for queue support. +function DLL() { + this.head = this.tail = null; + this.length = 0; +} + +function setInitial(dll, node) { + dll.length = 1; + dll.head = dll.tail = node; +} + +DLL.prototype.removeLink = function(node) { + if (node.prev) node.prev.next = node.next; + else this.head = node.next; + if (node.next) node.next.prev = node.prev; + else this.tail = node.prev; + + node.prev = node.next = null; + this.length -= 1; + return node; +}; + +DLL.prototype.empty = function () { + while(this.head) this.shift(); + return this; +}; + +DLL.prototype.insertAfter = function(node, newNode) { + newNode.prev = node; + newNode.next = node.next; + if (node.next) node.next.prev = newNode; + else this.tail = newNode; + node.next = newNode; + this.length += 1; +}; + +DLL.prototype.insertBefore = function(node, newNode) { + newNode.prev = node.prev; + newNode.next = node; + if (node.prev) node.prev.next = newNode; + else this.head = newNode; + node.prev = newNode; + this.length += 1; +}; + +DLL.prototype.unshift = function(node) { + if (this.head) this.insertBefore(this.head, node); + else setInitial(this, node); +}; + +DLL.prototype.push = function(node) { + if (this.tail) this.insertAfter(this.tail, node); + else setInitial(this, node); +}; + +DLL.prototype.shift = function() { + return this.head && this.removeLink(this.head); +}; + +DLL.prototype.pop = function() { + return this.tail && this.removeLink(this.tail); +}; + +DLL.prototype.toArray = function () { + var arr = Array(this.length); + var curr = this.head; + for(var idx = 0; idx < this.length; idx++) { + arr[idx] = curr.data; + curr = curr.next; + } + return arr; +}; + +DLL.prototype.remove = function (testFn) { + var curr = this.head; + while(!!curr) { + var next = curr.next; + if (testFn(curr)) { + this.removeLink(curr); + } + curr = next; + } + return this; +}; + +function queue(worker, concurrency, payload) { + if (concurrency == null) { + concurrency = 1; + } + else if(concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var _worker = wrapAsync(worker); + var numRunning = 0; + var workersList = []; + + var processingScheduled = false; + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!isArray(data)) { + data = [data]; + } + if (data.length === 0 && q.idle()) { + // call drain immediately if there are no tasks + return setImmediate$1(function() { + q.drain(); + }); + } + + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + callback: callback || noop + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + } + + if (!processingScheduled) { + processingScheduled = true; + setImmediate$1(function() { + processingScheduled = false; + q.process(); + }); + } + } + + function _next(tasks) { + return function(err){ + numRunning -= 1; + + for (var i = 0, l = tasks.length; i < l; i++) { + var task = tasks[i]; + + var index = baseIndexOf(workersList, task, 0); + if (index === 0) { + workersList.shift(); + } else if (index > 0) { + workersList.splice(index, 1); + } + + task.callback.apply(task, arguments); + + if (err != null) { + q.error(err, task.data); + } + } + + if (numRunning <= (q.concurrency - q.buffer) ) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + q.process(); + }; + } + + var isProcessing = false; + var q = { + _tasks: new DLL(), + concurrency: concurrency, + payload: payload, + saturated: noop, + unsaturated:noop, + buffer: concurrency / 4, + empty: noop, + drain: noop, + error: noop, + started: false, + paused: false, + push: function (data, callback) { + _insert(data, false, callback); + }, + kill: function () { + q.drain = noop; + q._tasks.empty(); + }, + unshift: function (data, callback) { + _insert(data, true, callback); + }, + remove: function (testFn) { + q._tasks.remove(testFn); + }, + process: function () { + // Avoid trying to start too many processing operations. This can occur + // when callbacks resolve synchronously (#1267). + if (isProcessing) { + return; + } + isProcessing = true; + while(!q.paused && numRunning < q.concurrency && q._tasks.length){ + var tasks = [], data = []; + var l = q._tasks.length; + if (q.payload) l = Math.min(l, q.payload); + for (var i = 0; i < l; i++) { + var node = q._tasks.shift(); + tasks.push(node); + workersList.push(node); + data.push(node.data); + } + + numRunning += 1; + + if (q._tasks.length === 0) { + q.empty(); + } + + if (numRunning === q.concurrency) { + q.saturated(); + } + + var cb = onlyOnce(_next(tasks)); + _worker(data, cb); + } + isProcessing = false; + }, + length: function () { + return q._tasks.length; + }, + running: function () { + return numRunning; + }, + workersList: function () { + return workersList; + }, + idle: function() { + return q._tasks.length + numRunning === 0; + }, + pause: function () { + q.paused = true; + }, + resume: function () { + if (q.paused === false) { return; } + q.paused = false; + setImmediate$1(q.process); + } + }; + return q; +} + +/** + * A cargo of tasks for the worker function to complete. Cargo inherits all of + * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. + * @typedef {Object} CargoObject + * @memberOf module:ControlFlow + * @property {Function} length - A function returning the number of items + * waiting to be processed. Invoke like `cargo.length()`. + * @property {number} payload - An `integer` for determining how many tasks + * should be process per round. This property can be changed after a `cargo` is + * created to alter the payload on-the-fly. + * @property {Function} push - Adds `task` to the `queue`. The callback is + * called once the `worker` has finished processing the task. Instead of a + * single task, an array of `tasks` can be submitted. The respective callback is + * used for every task in the list. Invoke like `cargo.push(task, [callback])`. + * @property {Function} saturated - A callback that is called when the + * `queue.length()` hits the concurrency and further tasks will be queued. + * @property {Function} empty - A callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - A callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke like `cargo.idle()`. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke like `cargo.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke like `cargo.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. + */ + +/** + * Creates a `cargo` object with the specified payload. Tasks added to the + * cargo will be processed altogether (up to the `payload` limit). If the + * `worker` is in progress, the task is queued until it becomes available. Once + * the `worker` has completed some tasks, each callback of those tasks is + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) + * for how `cargo` and `queue` work. + * + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers + * at a time, cargo passes an array of tasks to a single worker, repeating + * when the worker is finished. + * + * @name cargo + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} + * @category Control Flow + * @param {AsyncFunction} worker - An asynchronous function for processing an array + * of queued tasks. Invoked with `(tasks, callback)`. + * @param {number} [payload=Infinity] - An optional `integer` for determining + * how many tasks should be processed per round; if omitted, the default is + * unlimited. + * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the cargo and inner queue. + * @example + * + * // create a cargo object with payload 2 + * var cargo = async.cargo(function(tasks, callback) { + * for (var i=0; i true + */ +function identity(value) { + return value; +} + +function _createTester(check, getResult) { + return function(eachfn, arr, iteratee, cb) { + cb = cb || noop; + var testPassed = false; + var testResult; + eachfn(arr, function(value, _, callback) { + iteratee(value, function(err, result) { + if (err) { + callback(err); + } else if (check(result) && !testResult) { + testPassed = true; + testResult = getResult(true, value); + callback(null, breakLoop); + } else { + callback(); + } + }); + }, function(err) { + if (err) { + cb(err); + } else { + cb(null, testPassed ? testResult : getResult(false)); + } + }); + }; +} + +function _findGetResult(v, x) { + return x; +} + +/** + * Returns the first value in `coll` that passes an async truth test. The + * `iteratee` is applied in parallel, meaning the first iteratee to return + * `true` will fire the detect `callback` with that result. That means the + * result might not be the first item in the original `coll` (in terms of order) + * that passes the test. + + * If order within the original `coll` is important, then look at + * [`detectSeries`]{@link module:Collections.detectSeries}. + * + * @name detect + * @static + * @memberOf module:Collections + * @method + * @alias find + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + * @example + * + * async.detect(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // result now equals the first file in the list that exists + * }); + */ +var detect = doParallel(_createTester(identity, _findGetResult)); + +/** + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a + * time. + * + * @name detectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findLimit + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +var detectLimit = doParallelLimit(_createTester(identity, _findGetResult)); + +/** + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. + * + * @name detectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findSeries + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +var detectSeries = doLimit(detectLimit, 1); + +function consoleFunc(name) { + return function (fn/*, ...args*/) { + var args = slice(arguments, 1); + args.push(function (err/*, ...args*/) { + var args = slice(arguments, 1); + if (typeof console === 'object') { + if (err) { + if (console.error) { + console.error(err); + } + } else if (console[name]) { + arrayEach(args, function (x) { + console[name](x); + }); + } + } + }); + wrapAsync(fn).apply(null, args); + }; +} + +/** + * Logs the result of an [`async` function]{@link AsyncFunction} to the + * `console` using `console.dir` to display the properties of the resulting object. + * Only works in Node.js or in browsers that support `console.dir` and + * `console.error` (such as FF and Chrome). + * If multiple arguments are returned from the async function, + * `console.dir` is called on each argument in order. + * + * @name dir + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} function - The function you want to eventually apply + * all arguments to. + * @param {...*} arguments... - Any number of arguments to apply to the function. + * @example + * + * // in a module + * var hello = function(name, callback) { + * setTimeout(function() { + * callback(null, {hello: name}); + * }, 1000); + * }; + * + * // in the node repl + * node> async.dir(hello, 'world'); + * {hello: 'world'} + */ +var dir = consoleFunc('dir'); + +/** + * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in + * the order of operations, the arguments `test` and `fn` are switched. + * + * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function. + * @name doDuring + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.during]{@link module:ControlFlow.during} + * @category Control Flow + * @param {AsyncFunction} fn - An async function which is called each time + * `test` passes. Invoked with (callback). + * @param {AsyncFunction} test - asynchronous truth test to perform before each + * execution of `fn`. Invoked with (...args, callback), where `...args` are the + * non-error args from the previous callback of `fn`. + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `fn` has stopped. `callback` + * will be passed an error if one occurred, otherwise `null`. + */ +function doDuring(fn, test, callback) { + callback = onlyOnce(callback || noop); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); + + function next(err/*, ...args*/) { + if (err) return callback(err); + var args = slice(arguments, 1); + args.push(check); + _test.apply(this, args); + } + + function check(err, truth) { + if (err) return callback(err); + if (!truth) return callback(null); + _fn(next); + } + + check(null, true); + +} + +/** + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in + * the order of operations, the arguments `test` and `iteratee` are switched. + * + * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. + * + * @name doWhilst + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} + * @category Control Flow + * @param {AsyncFunction} iteratee - A function which is called each time `test` + * passes. Invoked with (callback). + * @param {Function} test - synchronous truth test to perform after each + * execution of `iteratee`. Invoked with any non-error callback results of + * `iteratee`. + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `iteratee` has stopped. + * `callback` will be passed an error and any arguments passed to the final + * `iteratee`'s callback. Invoked with (err, [results]); + */ +function doWhilst(iteratee, test, callback) { + callback = onlyOnce(callback || noop); + var _iteratee = wrapAsync(iteratee); + var next = function(err/*, ...args*/) { + if (err) return callback(err); + var args = slice(arguments, 1); + if (test.apply(this, args)) return _iteratee(next); + callback.apply(null, [null].concat(args)); + }; + _iteratee(next); +} + +/** + * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the + * argument ordering differs from `until`. + * + * @name doUntil + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} + * @category Control Flow + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` fails. Invoked with (callback). + * @param {Function} test - synchronous truth test to perform after each + * execution of `iteratee`. Invoked with any non-error callback results of + * `iteratee`. + * @param {Function} [callback] - A callback which is called after the test + * function has passed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s + * callback. Invoked with (err, [results]); + */ +function doUntil(iteratee, test, callback) { + doWhilst(iteratee, function() { + return !test.apply(this, arguments); + }, callback); +} + +/** + * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that + * is passed a callback in the form of `function (err, truth)`. If error is + * passed to `test` or `fn`, the main callback is immediately called with the + * value of the error. + * + * @name during + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} + * @category Control Flow + * @param {AsyncFunction} test - asynchronous truth test to perform before each + * execution of `fn`. Invoked with (callback). + * @param {AsyncFunction} fn - An async function which is called each time + * `test` passes. Invoked with (callback). + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `fn` has stopped. `callback` + * will be passed an error, if one occurred, otherwise `null`. + * @example + * + * var count = 0; + * + * async.during( + * function (callback) { + * return callback(null, count < 5); + * }, + * function (callback) { + * count++; + * setTimeout(callback, 1000); + * }, + * function (err) { + * // 5 seconds have passed + * } + * ); + */ +function during(test, fn, callback) { + callback = onlyOnce(callback || noop); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); + + function next(err) { + if (err) return callback(err); + _test(check); + } + + function check(err, truth) { + if (err) return callback(err); + if (!truth) return callback(null); + _fn(next); + } + + _test(check); +} + +function _withoutIndex(iteratee) { + return function (value, index, callback) { + return iteratee(value, callback); + }; +} + +/** + * Applies the function `iteratee` to each item in `coll`, in parallel. + * The `iteratee` is called with an item from the list, and a callback for when + * it has finished. If the `iteratee` passes an error to its `callback`, the + * main `callback` (for the `each` function) is immediately called with the + * error. + * + * Note, that since this function applies `iteratee` to each item in parallel, + * there is no guarantee that the iteratee functions will complete in order. + * + * @name each + * @static + * @memberOf module:Collections + * @method + * @alias forEach + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to + * each item in `coll`. Invoked with (item, callback). + * The array index is not passed to the iteratee. + * If you need the index, use `eachOf`. + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * // assuming openFiles is an array of file names and saveFile is a function + * // to save the modified contents of that file: + * + * async.each(openFiles, saveFile, function(err){ + * // if any of the saves produced an error, err would equal that error + * }); + * + * // assuming openFiles is an array of file names + * async.each(openFiles, function(file, callback) { + * + * // Perform operation on file here. + * console.log('Processing file ' + file); + * + * if( file.length > 32 ) { + * console.log('This file name is too long'); + * callback('File name too long'); + * } else { + * // Do work to process file here + * console.log('File processed'); + * callback(); + * } + * }, function(err) { + * // if any of the file processing produced an error, err would equal that error + * if( err ) { + * // One of the iterations produced an error. + * // All processing will now stop. + * console.log('A file failed to process'); + * } else { + * console.log('All files have been processed successfully'); + * } + * }); + */ +function eachLimit(coll, iteratee, callback) { + eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback); +} + +/** + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. + * + * @name eachLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfLimit`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachLimit$1(coll, limit, iteratee, callback) { + _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); +} + +/** + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. + * + * @name eachSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfSeries`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +var eachSeries = doLimit(eachLimit$1, 1); + +/** + * Wrap an async function and ensure it calls its callback on a later tick of + * the event loop. If the function already calls its callback on a next tick, + * no extra deferral is added. This is useful for preventing stack overflows + * (`RangeError: Maximum call stack size exceeded`) and generally keeping + * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) + * contained. ES2017 `async` functions are returned as-is -- they are immune + * to Zalgo's corrupting influences, as they always resolve on a later tick. + * + * @name ensureAsync + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - an async function, one that expects a node-style + * callback as its last argument. + * @returns {AsyncFunction} Returns a wrapped function with the exact same call + * signature as the function passed in. + * @example + * + * function sometimesAsync(arg, callback) { + * if (cache[arg]) { + * return callback(null, cache[arg]); // this would be synchronous!! + * } else { + * doSomeIO(arg, callback); // this IO would be asynchronous + * } + * } + * + * // this has a risk of stack overflows if many results are cached in a row + * async.mapSeries(args, sometimesAsync, done); + * + * // this will defer sometimesAsync's callback if necessary, + * // preventing stack overflows + * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); + */ +function ensureAsync(fn) { + if (isAsync(fn)) return fn; + return initialParams(function (args, callback) { + var sync = true; + args.push(function () { + var innerArgs = arguments; + if (sync) { + setImmediate$1(function () { + callback.apply(null, innerArgs); + }); + } else { + callback.apply(null, innerArgs); + } + }); + fn.apply(this, args); + sync = false; + }); +} + +function notId(v) { + return !v; +} + +/** + * Returns `true` if every element in `coll` satisfies an async test. If any + * iteratee call returns `false`, the main `callback` is immediately called. + * + * @name every + * @static + * @memberOf module:Collections + * @method + * @alias all + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + * @example + * + * async.every(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then every file exists + * }); + */ +var every = doParallel(_createTester(notId, notId)); + +/** + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. + * + * @name everyLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +var everyLimit = doParallelLimit(_createTester(notId, notId)); + +/** + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. + * + * @name everySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in series. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +var everySeries = doLimit(everyLimit, 1); + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +function filterArray(eachfn, arr, iteratee, callback) { + var truthValues = new Array(arr.length); + eachfn(arr, function (x, index, callback) { + iteratee(x, function (err, v) { + truthValues[index] = !!v; + callback(err); + }); + }, function (err) { + if (err) return callback(err); + var results = []; + for (var i = 0; i < arr.length; i++) { + if (truthValues[i]) results.push(arr[i]); + } + callback(null, results); + }); +} + +function filterGeneric(eachfn, coll, iteratee, callback) { + var results = []; + eachfn(coll, function (x, index, callback) { + iteratee(x, function (err, v) { + if (err) { + callback(err); + } else { + if (v) { + results.push({index: index, value: x}); + } + callback(); + } + }); + }, function (err) { + if (err) { + callback(err); + } else { + callback(null, arrayMap(results.sort(function (a, b) { + return a.index - b.index; + }), baseProperty('value'))); + } + }); +} + +function _filter(eachfn, coll, iteratee, callback) { + var filter = isArrayLike(coll) ? filterArray : filterGeneric; + filter(eachfn, coll, wrapAsync(iteratee), callback || noop); +} + +/** + * Returns a new array of all the values in `coll` which pass an async truth + * test. This operation is performed in parallel, but the results array will be + * in the same order as the original. + * + * @name filter + * @static + * @memberOf module:Collections + * @method + * @alias select + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.filter(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of the existing files + * }); + */ +var filter = doParallel(_filter); + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a + * time. + * + * @name filterLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var filterLimit = doParallelLimit(_filter); + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. + * + * @name filterSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results) + */ +var filterSeries = doLimit(filterLimit, 1); + +/** + * Calls the asynchronous function `fn` with a callback parameter that allows it + * to call itself again, in series, indefinitely. + + * If an error is passed to the callback then `errback` is called with the + * error, and execution stops, otherwise it will never be called. + * + * @name forever + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} fn - an async function to call repeatedly. + * Invoked with (next). + * @param {Function} [errback] - when `fn` passes an error to it's callback, + * this function will be called, and execution stops. Invoked with (err). + * @example + * + * async.forever( + * function(next) { + * // next is suitable for passing to things that need a callback(err [, whatever]); + * // it will result in this function being called again. + * }, + * function(err) { + * // if next is called with a value in its first parameter, it will appear + * // in here as 'err', and execution will stop. + * } + * ); + */ +function forever(fn, errback) { + var done = onlyOnce(errback || noop); + var task = wrapAsync(ensureAsync(fn)); + + function next(err) { + if (err) return done(err); + task(next); + } + next(); +} + +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. + * + * @name groupByLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +var groupByLimit = function(coll, limit, iteratee, callback) { + callback = callback || noop; + var _iteratee = wrapAsync(iteratee); + mapLimit(coll, limit, function(val, callback) { + _iteratee(val, function(err, key) { + if (err) return callback(err); + return callback(null, {key: key, val: val}); + }); + }, function(err, mapResults) { + var result = {}; + // from MDN, handle object having an `hasOwnProperty` prop + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var i = 0; i < mapResults.length; i++) { + if (mapResults[i]) { + var key = mapResults[i].key; + var val = mapResults[i].val; + + if (hasOwnProperty.call(result, key)) { + result[key].push(val); + } else { + result[key] = [val]; + } + } + } + + return callback(err, result); + }); +}; + +/** + * Returns a new object, where each value corresponds to an array of items, from + * `coll`, that returned the corresponding key. That is, the keys of the object + * correspond to the values passed to the `iteratee` callback. + * + * Note: Since this function applies the `iteratee` to each item in parallel, + * there is no guarantee that the `iteratee` functions will complete in order. + * However, the values for each key in the `result` will be in the same order as + * the original `coll`. For Objects, the values will roughly be in the order of + * the original Objects' keys (but this can vary across JavaScript engines). + * + * @name groupBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + * @example + * + * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { + * db.findById(userId, function(err, user) { + * if (err) return callback(err); + * return callback(null, user.age); + * }); + * }, function(err, result) { + * // result is object containing the userIds grouped by age + * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; + * }); + */ +var groupBy = doLimit(groupByLimit, Infinity); + +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. + * + * @name groupBySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +var groupBySeries = doLimit(groupByLimit, 1); + +/** + * Logs the result of an `async` function to the `console`. Only works in + * Node.js or in browsers that support `console.log` and `console.error` (such + * as FF and Chrome). If multiple arguments are returned from the async + * function, `console.log` is called on each argument in order. + * + * @name log + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} function - The function you want to eventually apply + * all arguments to. + * @param {...*} arguments... - Any number of arguments to apply to the function. + * @example + * + * // in a module + * var hello = function(name, callback) { + * setTimeout(function() { + * callback(null, 'hello ' + name); + * }, 1000); + * }; + * + * // in the node repl + * node> async.log(hello, 'world'); + * 'hello world' + */ +var log = consoleFunc('log'); + +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a + * time. + * + * @name mapValuesLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +function mapValuesLimit(obj, limit, iteratee, callback) { + callback = once(callback || noop); + var newObj = {}; + var _iteratee = wrapAsync(iteratee); + eachOfLimit(obj, limit, function(val, key, next) { + _iteratee(val, key, function (err, result) { + if (err) return next(err); + newObj[key] = result; + next(); + }); + }, function (err) { + callback(err, newObj); + }); +} + +/** + * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. + * + * Produces a new Object by mapping each value of `obj` through the `iteratee` + * function. The `iteratee` is called each `value` and `key` from `obj` and a + * callback for when it has finished processing. Each of these callbacks takes + * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` + * passes an error to its callback, the main `callback` (for the `mapValues` + * function) is immediately called with the error. + * + * Note, the order of the keys in the result is not guaranteed. The keys will + * be roughly in the order they complete, (but this is very engine-specific) + * + * @name mapValues + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + * @example + * + * async.mapValues({ + * f1: 'file1', + * f2: 'file2', + * f3: 'file3' + * }, function (file, key, callback) { + * fs.stat(file, callback); + * }, function(err, result) { + * // result is now a map of stats for each file, e.g. + * // { + * // f1: [stats for file1], + * // f2: [stats for file2], + * // f3: [stats for file3] + * // } + * }); + */ + +var mapValues = doLimit(mapValuesLimit, Infinity); + +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. + * + * @name mapValuesSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +var mapValuesSeries = doLimit(mapValuesLimit, 1); + +function has(obj, key) { + return key in obj; +} + +/** + * Caches the results of an async function. When creating a hash to store + * function results against, the callback is omitted from the hash and an + * optional hash function can be used. + * + * If no hash function is specified, the first argument is used as a hash key, + * which may work reasonably if it is a string or a data type that converts to a + * distinct string. Note that objects and arrays will not behave reasonably. + * Neither will cases where the other arguments are significant. In such cases, + * specify your own hash function. + * + * The cache of results is exposed as the `memo` property of the function + * returned by `memoize`. + * + * @name memoize + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function to proxy and cache results from. + * @param {Function} hasher - An optional function for generating a custom hash + * for storing results. It has all the arguments applied to it apart from the + * callback, and must be synchronous. + * @returns {AsyncFunction} a memoized version of `fn` + * @example + * + * var slow_fn = function(name, callback) { + * // do something + * callback(null, result); + * }; + * var fn = async.memoize(slow_fn); + * + * // fn can now be used as if it were slow_fn + * fn('some name', function() { + * // callback + * }); + */ +function memoize(fn, hasher) { + var memo = Object.create(null); + var queues = Object.create(null); + hasher = hasher || identity; + var _fn = wrapAsync(fn); + var memoized = initialParams(function memoized(args, callback) { + var key = hasher.apply(null, args); + if (has(memo, key)) { + setImmediate$1(function() { + callback.apply(null, memo[key]); + }); + } else if (has(queues, key)) { + queues[key].push(callback); + } else { + queues[key] = [callback]; + _fn.apply(null, args.concat(function(/*args*/) { + var args = slice(arguments); + memo[key] = args; + var q = queues[key]; + delete queues[key]; + for (var i = 0, l = q.length; i < l; i++) { + q[i].apply(null, args); + } + })); + } + }); + memoized.memo = memo; + memoized.unmemoized = fn; + return memoized; +} + +/** + * Calls `callback` on a later loop around the event loop. In Node.js this just + * calls `process.nextTick`. In the browser it will use `setImmediate` if + * available, otherwise `setTimeout(callback, 0)`, which means other higher + * priority events may precede the execution of `callback`. + * + * This is used internally for browser-compatibility purposes. + * + * @name nextTick + * @static + * @memberOf module:Utils + * @method + * @see [async.setImmediate]{@link module:Utils.setImmediate} + * @category Util + * @param {Function} callback - The function to call on a later loop around + * the event loop. Invoked with (args...). + * @param {...*} args... - any number of additional arguments to pass to the + * callback on the next tick. + * @example + * + * var call_order = []; + * async.nextTick(function() { + * call_order.push('two'); + * // call_order now equals ['one','two'] + * }); + * call_order.push('one'); + * + * async.setImmediate(function (a, b, c) { + * // a, b, and c equal 1, 2, and 3 + * }, 1, 2, 3); + */ +var _defer$1; + +if (hasNextTick) { + _defer$1 = process.nextTick; +} else if (hasSetImmediate) { + _defer$1 = setImmediate; +} else { + _defer$1 = fallback; +} + +var nextTick = wrap(_defer$1); + +function _parallel(eachfn, tasks, callback) { + callback = callback || noop; + var results = isArrayLike(tasks) ? [] : {}; + + eachfn(tasks, function (task, key, callback) { + wrapAsync(task)(function (err, result) { + if (arguments.length > 2) { + result = slice(arguments, 1); + } + results[key] = result; + callback(err); + }); + }, function (err) { + callback(err, results); + }); +} + +/** + * Run the `tasks` collection of functions in parallel, without waiting until + * the previous function has completed. If any of the functions pass an error to + * its callback, the main `callback` is immediately called with the value of the + * error. Once the `tasks` have completed, the results are passed to the final + * `callback` as an array. + * + * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about + * parallel execution of code. If your tasks do not use any timers or perform + * any I/O, they will actually be executed in series. Any synchronous setup + * sections for each task will happen one after the other. JavaScript remains + * single-threaded. + * + * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the + * execution of other tasks when a task fails. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.parallel}. + * + * @name parallel + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + * + * @example + * async.parallel([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // optional callback + * function(err, results) { + * // the results array will equal ['one','two'] even though + * // the second function had a shorter timeout. + * }); + * + * // an example using an object instead of an array + * async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equals to: {one: 1, two: 2} + * }); + */ +function parallelLimit(tasks, callback) { + _parallel(eachOf, tasks, callback); +} + +/** + * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a + * time. + * + * @name parallelLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.parallel]{@link module:ControlFlow.parallel} + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + */ +function parallelLimit$1(tasks, limit, callback) { + _parallel(_eachOfLimit(limit), tasks, callback); +} + +/** + * A queue of tasks for the worker function to complete. + * @typedef {Object} QueueObject + * @memberOf module:ControlFlow + * @property {Function} length - a function returning the number of items + * waiting to be processed. Invoke with `queue.length()`. + * @property {boolean} started - a boolean indicating whether or not any + * items have been pushed and processed by the queue. + * @property {Function} running - a function returning the number of items + * currently being processed. Invoke with `queue.running()`. + * @property {Function} workersList - a function returning the array of items + * currently being processed. Invoke with `queue.workersList()`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke with `queue.idle()`. + * @property {number} concurrency - an integer for determining how many `worker` + * functions should be run in parallel. This property can be changed after a + * `queue` is created to alter the concurrency on-the-fly. + * @property {Function} push - add a new task to the `queue`. Calls `callback` + * once the `worker` has finished processing the task. Instead of a single task, + * a `tasks` array can be submitted. The respective callback is used for every + * task in the list. Invoke with `queue.push(task, [callback])`, + * @property {Function} unshift - add a new task to the front of the `queue`. + * Invoke with `queue.unshift(task, [callback])`. + * @property {Function} remove - remove items from the queue that match a test + * function. The test function will be passed an object with a `data` property, + * and a `priority` property, if this is a + * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. + * Invoked with `queue.remove(testFn)`, where `testFn` is of the form + * `function ({data, priority}) {}` and returns a Boolean. + * @property {Function} saturated - a callback that is called when the number of + * running workers hits the `concurrency` limit, and further tasks will be + * queued. + * @property {Function} unsaturated - a callback that is called when the number + * of running workers is less than the `concurrency` & `buffer` limits, and + * further tasks will not be queued. + * @property {number} buffer - A minimum threshold buffer in order to say that + * the `queue` is `unsaturated`. + * @property {Function} empty - a callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - a callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} error - a callback that is called when a task errors. + * Has the signature `function(error, task)`. + * @property {boolean} paused - a boolean for determining whether the queue is + * in a paused state. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke with `queue.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke with `queue.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. No more tasks + * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. + */ + +/** + * Creates a `queue` object with the specified `concurrency`. Tasks added to the + * `queue` are processed in parallel (up to the `concurrency` limit). If all + * `worker`s are in progress, the task is queued until one becomes available. + * Once a `worker` completes a `task`, that `task`'s callback is called. + * + * @name queue + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. Invoked with (task, callback). + * @param {number} [concurrency=1] - An `integer` for determining how many + * `worker` functions should be run in parallel. If omitted, the concurrency + * defaults to `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the queue. + * @example + * + * // create a queue object with concurrency 2 + * var q = async.queue(function(task, callback) { + * console.log('hello ' + task.name); + * callback(); + * }, 2); + * + * // assign a callback + * q.drain = function() { + * console.log('all items have been processed'); + * }; + * + * // add some items to the queue + * q.push({name: 'foo'}, function(err) { + * console.log('finished processing foo'); + * }); + * q.push({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + * + * // add some items to the queue (batch-wise) + * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { + * console.log('finished processing item'); + * }); + * + * // add some items to the front of the queue + * q.unshift({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + */ +var queue$1 = function (worker, concurrency) { + var _worker = wrapAsync(worker); + return queue(function (items, cb) { + _worker(items[0], cb); + }, concurrency, 1); +}; + +/** + * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and + * completed in ascending priority order. + * + * @name priorityQueue + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. + * Invoked with (task, callback). + * @param {number} concurrency - An `integer` for determining how many `worker` + * functions should be run in parallel. If omitted, the concurrency defaults to + * `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two + * differences between `queue` and `priorityQueue` objects: + * * `push(task, priority, [callback])` - `priority` should be a number. If an + * array of `tasks` is given, all tasks will be assigned the same priority. + * * The `unshift` method was removed. + */ +var priorityQueue = function(worker, concurrency) { + // Start with a normal queue + var q = queue$1(worker, concurrency); + + // Override push to accept second parameter representing priority + q.push = function(data, priority, callback) { + if (callback == null) callback = noop; + if (typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!isArray(data)) { + data = [data]; + } + if (data.length === 0) { + // call drain immediately if there are no tasks + return setImmediate$1(function() { + q.drain(); + }); + } + + priority = priority || 0; + var nextNode = q._tasks.head; + while (nextNode && priority >= nextNode.priority) { + nextNode = nextNode.next; + } + + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + priority: priority, + callback: callback + }; + + if (nextNode) { + q._tasks.insertBefore(nextNode, item); + } else { + q._tasks.push(item); + } + } + setImmediate$1(q.process); + }; + + // Remove unshift function + delete q.unshift; + + return q; +}; + +/** + * Runs the `tasks` array of functions in parallel, without waiting until the + * previous function has completed. Once any of the `tasks` complete or pass an + * error to its callback, the main `callback` is immediately called. It's + * equivalent to `Promise.race()`. + * + * @name race + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} + * to run. Each function can complete with an optional `result` value. + * @param {Function} callback - A callback to run once any of the functions have + * completed. This function gets an error or result from the first function that + * completed. Invoked with (err, result). + * @returns undefined + * @example + * + * async.race([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // main callback + * function(err, result) { + * // the result will be equal to 'two' as it finishes earlier + * }); + */ +function race(tasks, callback) { + callback = once(callback || noop); + if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); + if (!tasks.length) return callback(); + for (var i = 0, l = tasks.length; i < l; i++) { + wrapAsync(tasks[i])(callback); + } +} + +/** + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. + * + * @name reduceRight + * @static + * @memberOf module:Collections + * @method + * @see [async.reduce]{@link module:Collections.reduce} + * @alias foldr + * @category Collection + * @param {Array} array - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + */ +function reduceRight (array, memo, iteratee, callback) { + var reversed = slice(array).reverse(); + reduce(reversed, memo, iteratee, callback); +} + +/** + * Wraps the async function in another function that always completes with a + * result object, even when it errors. + * + * The result object has either the property `error` or `value`. + * + * @name reflect + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function you want to wrap + * @returns {Function} - A function that always passes null to it's callback as + * the error. The second argument to the callback will be an `object` with + * either an `error` or a `value` property. + * @example + * + * async.parallel([ + * async.reflect(function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }), + * async.reflect(function(callback) { + * // do some more stuff but error ... + * callback('bad stuff happened'); + * }), + * async.reflect(function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * }) + * ], + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = 'bad stuff happened' + * // results[2].value = 'two' + * }); + */ +function reflect(fn) { + var _fn = wrapAsync(fn); + return initialParams(function reflectOn(args, reflectCallback) { + args.push(function callback(error, cbArg) { + if (error) { + reflectCallback(null, { error: error }); + } else { + var value; + if (arguments.length <= 2) { + value = cbArg; + } else { + value = slice(arguments, 1); + } + reflectCallback(null, { value: value }); + } + }); + + return _fn.apply(this, args); + }); +} + +/** + * A helper function that wraps an array or an object of functions with `reflect`. + * + * @name reflectAll + * @static + * @memberOf module:Utils + * @method + * @see [async.reflect]{@link module:Utils.reflect} + * @category Util + * @param {Array|Object|Iterable} tasks - The collection of + * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. + * @returns {Array} Returns an array of async functions, each wrapped in + * `async.reflect` + * @example + * + * let tasks = [ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * // do some more stuff but error ... + * callback(new Error('bad stuff happened')); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = Error('bad stuff happened') + * // results[2].value = 'two' + * }); + * + * // an example using an object instead of an array + * let tasks = { + * one: function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * two: function(callback) { + * callback('two'); + * }, + * three: function(callback) { + * setTimeout(function() { + * callback(null, 'three'); + * }, 100); + * } + * }; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results.one.value = 'one' + * // results.two.error = 'two' + * // results.three.value = 'three' + * }); + */ +function reflectAll(tasks) { + var results; + if (isArray(tasks)) { + results = arrayMap(tasks, reflect); + } else { + results = {}; + baseForOwn(tasks, function(task, key) { + results[key] = reflect.call(this, task); + }); + } + return results; +} + +function reject$1(eachfn, arr, iteratee, callback) { + _filter(eachfn, arr, function(value, cb) { + iteratee(value, function(err, v) { + cb(err, !v); + }); + }, callback); +} + +/** + * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. + * + * @name reject + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.reject(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of missing files + * createFiles(results); + * }); + */ +var reject = doParallel(reject$1); + +/** + * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a + * time. + * + * @name rejectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var rejectLimit = doParallelLimit(reject$1); + +/** + * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. + * + * @name rejectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var rejectSeries = doLimit(rejectLimit, 1); + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant$1(value) { + return function() { + return value; + }; +} + +/** + * Attempts to get a successful response from `task` no more than `times` times + * before returning an error. If the task is successful, the `callback` will be + * passed the result of the successful task. If all attempts fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name retry + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @see [async.retryable]{@link module:ControlFlow.retryable} + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an + * object with `times` and `interval` or a number. + * * `times` - The number of attempts to make before giving up. The default + * is `5`. + * * `interval` - The time to wait between retries, in milliseconds. The + * default is `0`. The interval may also be specified as a function of the + * retry count (see example). + * * `errorFilter` - An optional synchronous function that is invoked on + * erroneous result. If it returns `true` the retry attempts will continue; + * if the function returns `false` the retry flow is aborted with the current + * attempt's error and result being returned to the final callback. + * Invoked with (err). + * * If `opts` is a number, the number specifies the number of times to retry, + * with the default interval of `0`. + * @param {AsyncFunction} task - An async function to retry. + * Invoked with (callback). + * @param {Function} [callback] - An optional callback which is called when the + * task has succeeded, or after the final failed attempt. It receives the `err` + * and `result` arguments of the last attempt at completing the `task`. Invoked + * with (err, results). + * + * @example + * + * // The `retry` function can be used as a stand-alone control flow by passing + * // a callback, as shown below: + * + * // try calling apiMethod 3 times + * async.retry(3, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 3 times, waiting 200 ms between each retry + * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 10 times with exponential backoff + * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) + * async.retry({ + * times: 10, + * interval: function(retryCount) { + * return 50 * Math.pow(2, retryCount); + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod the default 5 times no delay between each retry + * async.retry(apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod only when error condition satisfies, all other + * // errors will abort the retry control flow and return to final callback + * async.retry({ + * errorFilter: function(err) { + * return err.message === 'Temporary error'; // only retry on a specific error + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // to retry individual methods that are not as reliable within other + * // control flow functions, use the `retryable` wrapper: + * async.auto({ + * users: api.getUsers.bind(api), + * payments: async.retryable(3, api.getPayments.bind(api)) + * }, function(err, results) { + * // do something with the results + * }); + * + */ +function retry(opts, task, callback) { + var DEFAULT_TIMES = 5; + var DEFAULT_INTERVAL = 0; + + var options = { + times: DEFAULT_TIMES, + intervalFunc: constant$1(DEFAULT_INTERVAL) + }; + + function parseTimes(acc, t) { + if (typeof t === 'object') { + acc.times = +t.times || DEFAULT_TIMES; + + acc.intervalFunc = typeof t.interval === 'function' ? + t.interval : + constant$1(+t.interval || DEFAULT_INTERVAL); + + acc.errorFilter = t.errorFilter; + } else if (typeof t === 'number' || typeof t === 'string') { + acc.times = +t || DEFAULT_TIMES; + } else { + throw new Error("Invalid arguments for async.retry"); + } + } + + if (arguments.length < 3 && typeof opts === 'function') { + callback = task || noop; + task = opts; + } else { + parseTimes(options, opts); + callback = callback || noop; + } + + if (typeof task !== 'function') { + throw new Error("Invalid arguments for async.retry"); + } + + var _task = wrapAsync(task); + + var attempt = 1; + function retryAttempt() { + _task(function(err) { + if (err && attempt++ < options.times && + (typeof options.errorFilter != 'function' || + options.errorFilter(err))) { + setTimeout(retryAttempt, options.intervalFunc(attempt)); + } else { + callback.apply(null, arguments); + } + }); + } + + retryAttempt(); +} + +/** + * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method + * wraps a task and makes it retryable, rather than immediately calling it + * with retries. + * + * @name retryable + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.retry]{@link module:ControlFlow.retry} + * @category Control Flow + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional + * options, exactly the same as from `retry` + * @param {AsyncFunction} task - the asynchronous function to wrap. + * This function will be passed any arguments passed to the returned wrapper. + * Invoked with (...args, callback). + * @returns {AsyncFunction} The wrapped function, which when invoked, will + * retry on an error, based on the parameters specified in `opts`. + * This function will accept the same parameters as `task`. + * @example + * + * async.auto({ + * dep1: async.retryable(3, getFromFlakyService), + * process: ["dep1", async.retryable(3, function (results, cb) { + * maybeProcessData(results.dep1, cb); + * })] + * }, callback); + */ +var retryable = function (opts, task) { + if (!task) { + task = opts; + opts = null; + } + var _task = wrapAsync(task); + return initialParams(function (args, callback) { + function taskFn(cb) { + _task.apply(null, args.concat(cb)); + } + + if (opts) retry(opts, taskFn, callback); + else retry(taskFn, callback); + + }); +}; + +/** + * Run the functions in the `tasks` collection in series, each one running once + * the previous function has completed. If any functions in the series pass an + * error to its callback, no more functions are run, and `callback` is + * immediately called with the value of the error. Otherwise, `callback` + * receives an array of results when `tasks` have completed. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function, and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.series}. + * + * **Note** that while many implementations preserve the order of object + * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) + * explicitly states that + * + * > The mechanics and order of enumerating the properties is not specified. + * + * So if you rely on the order in which your series of functions are executed, + * and want this to work on all platforms, consider using an array. + * + * @name series + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing + * [async functions]{@link AsyncFunction} to run in series. + * Each function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This function gets a results array (or object) + * containing all the result arguments passed to the `task` callbacks. Invoked + * with (err, result). + * @example + * async.series([ + * function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }, + * function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * } + * ], + * // optional callback + * function(err, results) { + * // results is now equal to ['one', 'two'] + * }); + * + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback){ + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equal to: {one: 1, two: 2} + * }); + */ +function series(tasks, callback) { + _parallel(eachOfSeries, tasks, callback); +} + +/** + * Returns `true` if at least one element in the `coll` satisfies an async test. + * If any iteratee call returns `true`, the main `callback` is immediately + * called. + * + * @name some + * @static + * @memberOf module:Collections + * @method + * @alias any + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + * @example + * + * async.some(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then at least one of the files exists + * }); + */ +var some = doParallel(_createTester(Boolean, identity)); + +/** + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. + * + * @name someLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anyLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +var someLimit = doParallelLimit(_createTester(Boolean, identity)); + +/** + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. + * + * @name someSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anySeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in series. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +var someSeries = doLimit(someLimit, 1); + +/** + * Sorts a list by the results of running each `coll` value through an async + * `iteratee`. + * + * @name sortBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a value to use as the sort criteria as + * its `result`. + * Invoked with (item, callback). + * @param {Function} callback - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is the items + * from the original `coll` sorted by the values returned by the `iteratee` + * calls. Invoked with (err, results). + * @example + * + * async.sortBy(['file1','file2','file3'], function(file, callback) { + * fs.stat(file, function(err, stats) { + * callback(err, stats.mtime); + * }); + * }, function(err, results) { + * // results is now the original array of files sorted by + * // modified date + * }); + * + * // By modifying the callback parameter the + * // sorting order can be influenced: + * + * // ascending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x); + * }, function(err,result) { + * // result callback + * }); + * + * // descending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x*-1); //<- x*-1 instead of x, turns the order around + * }, function(err,result) { + * // result callback + * }); + */ +function sortBy (coll, iteratee, callback) { + var _iteratee = wrapAsync(iteratee); + map(coll, function (x, callback) { + _iteratee(x, function (err, criteria) { + if (err) return callback(err); + callback(null, {value: x, criteria: criteria}); + }); + }, function (err, results) { + if (err) return callback(err); + callback(null, arrayMap(results.sort(comparator), baseProperty('value'))); + }); + + function comparator(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + } +} + +/** + * Sets a time limit on an asynchronous function. If the function does not call + * its callback within the specified milliseconds, it will be called with a + * timeout error. The code property for the error object will be `'ETIMEDOUT'`. + * + * @name timeout + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} asyncFn - The async function to limit in time. + * @param {number} milliseconds - The specified time limit. + * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) + * to timeout Error for more information.. + * @returns {AsyncFunction} Returns a wrapped function that can be used with any + * of the control flow functions. + * Invoke this function with the same parameters as you would `asyncFunc`. + * @example + * + * function myFunction(foo, callback) { + * doAsyncTask(foo, function(err, data) { + * // handle errors + * if (err) return callback(err); + * + * // do some stuff ... + * + * // return processed data + * return callback(null, data); + * }); + * } + * + * var wrapped = async.timeout(myFunction, 1000); + * + * // call `wrapped` as you would `myFunction` + * wrapped({ bar: 'bar' }, function(err, data) { + * // if `myFunction` takes < 1000 ms to execute, `err` + * // and `data` will have their expected values + * + * // else `err` will be an Error with the code 'ETIMEDOUT' + * }); + */ +function timeout(asyncFn, milliseconds, info) { + var fn = wrapAsync(asyncFn); + + return initialParams(function (args, callback) { + var timedOut = false; + var timer; + + function timeoutCallback() { + var name = asyncFn.name || 'anonymous'; + var error = new Error('Callback function "' + name + '" timed out.'); + error.code = 'ETIMEDOUT'; + if (info) { + error.info = info; + } + timedOut = true; + callback(error); + } + + args.push(function () { + if (!timedOut) { + callback.apply(null, arguments); + clearTimeout(timer); + } + }); + + // setup timer and call original function + timer = setTimeout(timeoutCallback, milliseconds); + fn.apply(null, args); + }); +} + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil; +var nativeMax = Math.max; + +/** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ +function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; +} + +/** + * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a + * time. + * + * @name timesLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} count - The number of times to run the function. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see [async.map]{@link module:Collections.map}. + */ +function timeLimit(count, limit, iteratee, callback) { + var _iteratee = wrapAsync(iteratee); + mapLimit(baseRange(0, count, 1), limit, _iteratee, callback); +} + +/** + * Calls the `iteratee` function `n` times, and accumulates results in the same + * manner you would use with [map]{@link module:Collections.map}. + * + * @name times + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.map]{@link module:Collections.map} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + * @example + * + * // Pretend this is some complicated async factory + * var createUser = function(id, callback) { + * callback(null, { + * id: 'user' + id + * }); + * }; + * + * // generate 5 users + * async.times(5, function(n, next) { + * createUser(n, function(err, user) { + * next(err, user); + * }); + * }, function(err, users) { + * // we should now have 5 users + * }); + */ +var times = doLimit(timeLimit, Infinity); + +/** + * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. + * + * @name timesSeries + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + */ +var timesSeries = doLimit(timeLimit, 1); + +/** + * A relative of `reduce`. Takes an Object or Array, and iterates over each + * element in series, each step potentially mutating an `accumulator` value. + * The type of the accumulator defaults to the type of collection passed in. + * + * @name transform + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} [accumulator] - The initial state of the transform. If omitted, + * it will default to an empty Object or Array, depending on the type of `coll` + * @param {AsyncFunction} iteratee - A function applied to each item in the + * collection that potentially modifies the accumulator. + * Invoked with (accumulator, item, key, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the transformed accumulator. + * Invoked with (err, result). + * @example + * + * async.transform([1,2,3], function(acc, item, index, callback) { + * // pointless async: + * process.nextTick(function() { + * acc.push(item * 2) + * callback(null) + * }); + * }, function(err, result) { + * // result is now equal to [2, 4, 6] + * }); + * + * @example + * + * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { + * setImmediate(function () { + * obj[key] = val * 2; + * callback(); + * }) + * }, function (err, result) { + * // result is equal to {a: 2, b: 4, c: 6} + * }) + */ +function transform (coll, accumulator, iteratee, callback) { + if (arguments.length <= 3) { + callback = iteratee; + iteratee = accumulator; + accumulator = isArray(coll) ? [] : {}; + } + callback = once(callback || noop); + var _iteratee = wrapAsync(iteratee); + + eachOf(coll, function(v, k, cb) { + _iteratee(accumulator, v, k, cb); + }, function(err) { + callback(err, accumulator); + }); +} + +/** + * It runs each task in series but stops whenever any of the functions were + * successful. If one of the tasks were successful, the `callback` will be + * passed the result of the successful task. If all tasks fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name tryEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing functions to + * run, each function is passed a `callback(err, result)` it must call on + * completion with an error `err` (which can be `null`) and an optional `result` + * value. + * @param {Function} [callback] - An optional callback which is called when one + * of the tasks has succeeded, or all have failed. It receives the `err` and + * `result` arguments of the last attempt at completing the `task`. Invoked with + * (err, results). + * @example + * async.tryEach([ + * function getDataFromFirstWebsite(callback) { + * // Try getting the data from the first website + * callback(err, data); + * }, + * function getDataFromSecondWebsite(callback) { + * // First website failed, + * // Try getting the data from the backup website + * callback(err, data); + * } + * ], + * // optional callback + * function(err, results) { + * Now do something with the data. + * }); + * + */ +function tryEach(tasks, callback) { + var error = null; + var result; + callback = callback || noop; + eachSeries(tasks, function(task, callback) { + wrapAsync(task)(function (err, res/*, ...args*/) { + if (arguments.length > 2) { + result = slice(arguments, 1); + } else { + result = res; + } + error = err; + callback(!err); + }); + }, function () { + callback(error, result); + }); +} + +/** + * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, + * unmemoized form. Handy for testing. + * + * @name unmemoize + * @static + * @memberOf module:Utils + * @method + * @see [async.memoize]{@link module:Utils.memoize} + * @category Util + * @param {AsyncFunction} fn - the memoized function + * @returns {AsyncFunction} a function that calls the original unmemoized function + */ +function unmemoize(fn) { + return function () { + return (fn.unmemoized || fn).apply(null, arguments); + }; +} + +/** + * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when + * stopped, or an error occurs. + * + * @name whilst + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` passes. Invoked with (callback). + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s + * callback. Invoked with (err, [results]); + * @returns undefined + * @example + * + * var count = 0; + * async.whilst( + * function() { return count < 5; }, + * function(callback) { + * count++; + * setTimeout(function() { + * callback(null, count); + * }, 1000); + * }, + * function (err, n) { + * // 5 seconds have passed, n = 5 + * } + * ); + */ +function whilst(test, iteratee, callback) { + callback = onlyOnce(callback || noop); + var _iteratee = wrapAsync(iteratee); + if (!test()) return callback(null); + var next = function(err/*, ...args*/) { + if (err) return callback(err); + if (test()) return _iteratee(next); + var args = slice(arguments, 1); + callback.apply(null, [null].concat(args)); + }; + _iteratee(next); +} + +/** + * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when + * stopped, or an error occurs. `callback` will be passed an error and any + * arguments passed to the final `iteratee`'s callback. + * + * The inverse of [whilst]{@link module:ControlFlow.whilst}. + * + * @name until + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} + * @category Control Flow + * @param {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` fails. Invoked with (callback). + * @param {Function} [callback] - A callback which is called after the test + * function has passed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s + * callback. Invoked with (err, [results]); + */ +function until(test, iteratee, callback) { + whilst(function() { + return !test.apply(this, arguments); + }, iteratee, callback); +} + +/** + * Runs the `tasks` array of functions in series, each passing their results to + * the next in the array. However, if any of the `tasks` pass an error to their + * own callback, the next function is not executed, and the main `callback` is + * immediately called with the error. + * + * @name waterfall + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} + * to run. + * Each function should complete with any number of `result` values. + * The `result` values will be passed as arguments, in order, to the next task. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This will be passed the results of the last task's + * callback. Invoked with (err, [results]). + * @returns undefined + * @example + * + * async.waterfall([ + * function(callback) { + * callback(null, 'one', 'two'); + * }, + * function(arg1, arg2, callback) { + * // arg1 now equals 'one' and arg2 now equals 'two' + * callback(null, 'three'); + * }, + * function(arg1, callback) { + * // arg1 now equals 'three' + * callback(null, 'done'); + * } + * ], function (err, result) { + * // result now equals 'done' + * }); + * + * // Or, with named functions: + * async.waterfall([ + * myFirstFunction, + * mySecondFunction, + * myLastFunction, + * ], function (err, result) { + * // result now equals 'done' + * }); + * function myFirstFunction(callback) { + * callback(null, 'one', 'two'); + * } + * function mySecondFunction(arg1, arg2, callback) { + * // arg1 now equals 'one' and arg2 now equals 'two' + * callback(null, 'three'); + * } + * function myLastFunction(arg1, callback) { + * // arg1 now equals 'three' + * callback(null, 'done'); + * } + */ +var waterfall = function(tasks, callback) { + callback = once(callback || noop); + if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); + if (!tasks.length) return callback(); + var taskIndex = 0; + + function nextTask(args) { + var task = wrapAsync(tasks[taskIndex++]); + args.push(onlyOnce(next)); + task.apply(null, args); + } + + function next(err/*, ...args*/) { + if (err || taskIndex === tasks.length) { + return callback.apply(null, arguments); + } + nextTask(slice(arguments, 1)); + } + + nextTask([]); +}; + +/** + * An "async function" in the context of Async is an asynchronous function with + * a variable number of parameters, with the final parameter being a callback. + * (`function (arg1, arg2, ..., callback) {}`) + * The final callback is of the form `callback(err, results...)`, which must be + * called once the function is completed. The callback should be called with a + * Error as its first argument to signal that an error occurred. + * Otherwise, if no error occurred, it should be called with `null` as the first + * argument, and any additional `result` arguments that may apply, to signal + * successful completion. + * The callback must be called exactly once, ideally on a later tick of the + * JavaScript event loop. + * + * This type of function is also referred to as a "Node-style async function", + * or a "continuation passing-style function" (CPS). Most of the methods of this + * library are themselves CPS/Node-style async functions, or functions that + * return CPS/Node-style async functions. + * + * Wherever we accept a Node-style async function, we also directly accept an + * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. + * In this case, the `async` function will not be passed a final callback + * argument, and any thrown error will be used as the `err` argument of the + * implicit callback, and the return value will be used as the `result` value. + * (i.e. a `rejected` of the returned Promise becomes the `err` callback + * argument, and a `resolved` value becomes the `result`.) + * + * Note, due to JavaScript limitations, we can only detect native `async` + * functions and not transpilied implementations. + * Your environment must have `async`/`await` support for this to work. + * (e.g. Node > v7.6, or a recent version of a modern browser). + * If you are using `async` functions through a transpiler (e.g. Babel), you + * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, + * because the `async function` will be compiled to an ordinary function that + * returns a promise. + * + * @typedef {Function} AsyncFunction + * @static + */ + +/** + * Async is a utility module which provides straight-forward, powerful functions + * for working with asynchronous JavaScript. Although originally designed for + * use with [Node.js](http://nodejs.org) and installable via + * `npm install --save async`, it can also be used directly in the browser. + * @module async + * @see AsyncFunction + */ + + +/** + * A collection of `async` functions for manipulating collections, such as + * arrays and objects. + * @module Collections + */ + +/** + * A collection of `async` functions for controlling the flow through a script. + * @module ControlFlow + */ + +/** + * A collection of `async` utility functions. + * @module Utils + */ + +var index = { + apply: apply, + applyEach: applyEach, + applyEachSeries: applyEachSeries, + asyncify: asyncify, + auto: auto, + autoInject: autoInject, + cargo: cargo, + compose: compose, + concat: concat, + concatLimit: concatLimit, + concatSeries: concatSeries, + constant: constant, + detect: detect, + detectLimit: detectLimit, + detectSeries: detectSeries, + dir: dir, + doDuring: doDuring, + doUntil: doUntil, + doWhilst: doWhilst, + during: during, + each: eachLimit, + eachLimit: eachLimit$1, + eachOf: eachOf, + eachOfLimit: eachOfLimit, + eachOfSeries: eachOfSeries, + eachSeries: eachSeries, + ensureAsync: ensureAsync, + every: every, + everyLimit: everyLimit, + everySeries: everySeries, + filter: filter, + filterLimit: filterLimit, + filterSeries: filterSeries, + forever: forever, + groupBy: groupBy, + groupByLimit: groupByLimit, + groupBySeries: groupBySeries, + log: log, + map: map, + mapLimit: mapLimit, + mapSeries: mapSeries, + mapValues: mapValues, + mapValuesLimit: mapValuesLimit, + mapValuesSeries: mapValuesSeries, + memoize: memoize, + nextTick: nextTick, + parallel: parallelLimit, + parallelLimit: parallelLimit$1, + priorityQueue: priorityQueue, + queue: queue$1, + race: race, + reduce: reduce, + reduceRight: reduceRight, + reflect: reflect, + reflectAll: reflectAll, + reject: reject, + rejectLimit: rejectLimit, + rejectSeries: rejectSeries, + retry: retry, + retryable: retryable, + seq: seq, + series: series, + setImmediate: setImmediate$1, + some: some, + someLimit: someLimit, + someSeries: someSeries, + sortBy: sortBy, + timeout: timeout, + times: times, + timesLimit: timeLimit, + timesSeries: timesSeries, + transform: transform, + tryEach: tryEach, + unmemoize: unmemoize, + until: until, + waterfall: waterfall, + whilst: whilst, + + // aliases + all: every, + allLimit: everyLimit, + allSeries: everySeries, + any: some, + anyLimit: someLimit, + anySeries: someSeries, + find: detect, + findLimit: detectLimit, + findSeries: detectSeries, + forEach: eachLimit, + forEachSeries: eachSeries, + forEachLimit: eachLimit$1, + forEachOf: eachOf, + forEachOfSeries: eachOfSeries, + forEachOfLimit: eachOfLimit, + inject: reduce, + foldl: reduce, + foldr: reduceRight, + select: filter, + selectLimit: filterLimit, + selectSeries: filterSeries, + wrapSync: asyncify +}; + +exports['default'] = index; +exports.apply = apply; +exports.applyEach = applyEach; +exports.applyEachSeries = applyEachSeries; +exports.asyncify = asyncify; +exports.auto = auto; +exports.autoInject = autoInject; +exports.cargo = cargo; +exports.compose = compose; +exports.concat = concat; +exports.concatLimit = concatLimit; +exports.concatSeries = concatSeries; +exports.constant = constant; +exports.detect = detect; +exports.detectLimit = detectLimit; +exports.detectSeries = detectSeries; +exports.dir = dir; +exports.doDuring = doDuring; +exports.doUntil = doUntil; +exports.doWhilst = doWhilst; +exports.during = during; +exports.each = eachLimit; +exports.eachLimit = eachLimit$1; +exports.eachOf = eachOf; +exports.eachOfLimit = eachOfLimit; +exports.eachOfSeries = eachOfSeries; +exports.eachSeries = eachSeries; +exports.ensureAsync = ensureAsync; +exports.every = every; +exports.everyLimit = everyLimit; +exports.everySeries = everySeries; +exports.filter = filter; +exports.filterLimit = filterLimit; +exports.filterSeries = filterSeries; +exports.forever = forever; +exports.groupBy = groupBy; +exports.groupByLimit = groupByLimit; +exports.groupBySeries = groupBySeries; +exports.log = log; +exports.map = map; +exports.mapLimit = mapLimit; +exports.mapSeries = mapSeries; +exports.mapValues = mapValues; +exports.mapValuesLimit = mapValuesLimit; +exports.mapValuesSeries = mapValuesSeries; +exports.memoize = memoize; +exports.nextTick = nextTick; +exports.parallel = parallelLimit; +exports.parallelLimit = parallelLimit$1; +exports.priorityQueue = priorityQueue; +exports.queue = queue$1; +exports.race = race; +exports.reduce = reduce; +exports.reduceRight = reduceRight; +exports.reflect = reflect; +exports.reflectAll = reflectAll; +exports.reject = reject; +exports.rejectLimit = rejectLimit; +exports.rejectSeries = rejectSeries; +exports.retry = retry; +exports.retryable = retryable; +exports.seq = seq; +exports.series = series; +exports.setImmediate = setImmediate$1; +exports.some = some; +exports.someLimit = someLimit; +exports.someSeries = someSeries; +exports.sortBy = sortBy; +exports.timeout = timeout; +exports.times = times; +exports.timesLimit = timeLimit; +exports.timesSeries = timesSeries; +exports.transform = transform; +exports.tryEach = tryEach; +exports.unmemoize = unmemoize; +exports.until = until; +exports.waterfall = waterfall; +exports.whilst = whilst; +exports.all = every; +exports.allLimit = everyLimit; +exports.allSeries = everySeries; +exports.any = some; +exports.anyLimit = someLimit; +exports.anySeries = someSeries; +exports.find = detect; +exports.findLimit = detectLimit; +exports.findSeries = detectSeries; +exports.forEach = eachLimit; +exports.forEachSeries = eachSeries; +exports.forEachLimit = eachLimit$1; +exports.forEachOf = eachOf; +exports.forEachOfSeries = eachOfSeries; +exports.forEachOfLimit = eachOfLimit; +exports.inject = reduce; +exports.foldl = reduce; +exports.foldr = reduceRight; +exports.select = filter; +exports.selectLimit = filterLimit; +exports.selectSeries = filterSeries; +exports.wrapSync = asyncify; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/live2d/node_modules/async/dist/async.min.js b/live2d/node_modules/async/dist/async.min.js new file mode 100644 index 0000000..0b9e113 --- /dev/null +++ b/live2d/node_modules/async/dist/async.min.js @@ -0,0 +1,2 @@ +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async=n.async||{})}(this,function(n){"use strict";function t(n,t){t|=0;for(var e=Math.max(n.length-t,0),r=Array(e),u=0;u-1&&n%1==0&&n<=Tt}function d(n){return null!=n&&v(n.length)&&!y(n)}function m(){}function g(n){return function(){if(null!==n){var t=n;n=null,t.apply(this,arguments)}}}function b(n,t){for(var e=-1,r=Array(n);++e-1&&n%1==0&&nu?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var i=Array(u);++r=r?n:Z(n,t,e)}function tn(n,t){for(var e=n.length;e--&&J(t,n[e],0)>-1;);return e}function en(n,t){for(var e=-1,r=n.length;++e-1;);return e}function rn(n){return n.split("")}function un(n){return Xe.test(n)}function on(n){return n.match(mr)||[]}function cn(n){return un(n)?on(n):rn(n)}function fn(n){return null==n?"":Y(n)}function an(n,t,e){if(n=fn(n),n&&(e||void 0===t))return n.replace(gr,"");if(!n||!(t=Y(t)))return n;var r=cn(n),u=cn(t),i=en(r,u),o=tn(r,u)+1;return nn(r,i,o).join("")}function ln(n){return n=n.toString().replace(kr,""),n=n.match(br)[2].replace(" ",""),n=n?n.split(jr):[],n=n.map(function(n){return an(n.replace(Sr,""))})}function sn(n,t){var e={};N(n,function(n,t){function r(t,e){var r=K(u,function(n){return t[n]});r.push(e),a(n).apply(null,r)}var u,i=f(n),o=!i&&1===n.length||i&&0===n.length;if(Pt(n))u=n.slice(0,-1),n=n[n.length-1],e[t]=u.concat(u.length>0?r:n);else if(o)e[t]=n;else{if(u=ln(n),0===n.length&&!i&&0===u.length)throw new Error("autoInject task functions require explicit parameters.");i||u.pop(),e[t]=u.concat(r)}}),Ve(e,t)}function pn(){this.head=this.tail=null,this.length=0}function hn(n,t){n.length=1,n.head=n.tail=t}function yn(n,t,e){function r(n,t,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");if(s.started=!0,Pt(n)||(n=[n]),0===n.length&&s.idle())return lt(function(){s.drain()});for(var r=0,u=n.length;r0&&c.splice(i,1),u.callback.apply(u,arguments),null!=t&&s.error(t,u.data)}o<=s.concurrency-s.buffer&&s.unsaturated(),s.idle()&&s.drain(),s.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var i=a(n),o=0,c=[],f=!1,l=!1,s={_tasks:new pn,concurrency:t,payload:e,saturated:m,unsaturated:m,buffer:t/4,empty:m,drain:m,error:m,started:!1,paused:!1,push:function(n,t){r(n,!1,t)},kill:function(){s.drain=m,s._tasks.empty()},unshift:function(n,t){r(n,!0,t)},remove:function(n){s._tasks.remove(n)},process:function(){if(!l){for(l=!0;!s.paused&&o2&&(i=t(arguments,1)),u[e]=i,r(n)})},function(n){r(n,u)})}function Dn(n,t){Vn(Fe,n,t)}function Rn(n,t,e){Vn(q(t),n,e)}function Cn(n,t){if(t=g(t||m),!Pt(n))return t(new TypeError("First argument to race must be an array of functions"));if(!n.length)return t();for(var e=0,r=n.length;er?1:0}var u=a(t);Ie(n,function(n,t){u(n,function(e,r){return e?t(e):void t(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,K(t.sort(r),Bn("value")))})}function Xn(n,t,e){var r=a(n);return ct(function(u,i){function o(){var t=n.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",e&&(r.info=e),f=!0,i(r)}var c,f=!1;u.push(function(){f||(i.apply(null,arguments),clearTimeout(c))}),c=setTimeout(o,t),r.apply(null,u)})}function Yn(n,t,e,r){for(var u=-1,i=iu(uu((t-n)/(e||1)),0),o=Array(i);i--;)o[r?i:++u]=n,n+=e;return o}function Zn(n,t,e,r){var u=a(e);Ue(Yn(0,n,1),t,u,r)}function nt(n,t,e,r){arguments.length<=3&&(r=e,e=t,t=Pt(n)?[]:{}),r=g(r||m);var u=a(e);Fe(n,function(n,e,r){u(t,n,e,r)},function(n){r(n,t)})}function tt(n,e){var r,u=null;e=e||m,Ur(n,function(n,e){a(n)(function(n,i){r=arguments.length>2?t(arguments,1):i,u=n,e(!n)})},function(){e(u,r)})}function et(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function rt(n,e,r){r=U(r||m);var u=a(e);if(!n())return r(null);var i=function(e){if(e)return r(e);if(n())return u(i);var o=t(arguments,1);r.apply(null,[null].concat(o))};u(i)}function ut(n,t,e){rt(function(){return!n.apply(this,arguments)},t,e)}var it,ot=function(n){var e=t(arguments,1);return function(){var r=t(arguments);return n.apply(null,e.concat(r))}},ct=function(n){return function(){var e=t(arguments),r=e.pop();n.call(this,e,r)}},ft="function"==typeof setImmediate&&setImmediate,at="object"==typeof process&&"function"==typeof process.nextTick;it=ft?setImmediate:at?process.nextTick:r;var lt=u(it),st="function"==typeof Symbol,pt="object"==typeof global&&global&&global.Object===Object&&global,ht="object"==typeof self&&self&&self.Object===Object&&self,yt=pt||ht||Function("return this")(),vt=yt.Symbol,dt=Object.prototype,mt=dt.hasOwnProperty,gt=dt.toString,bt=vt?vt.toStringTag:void 0,jt=Object.prototype,St=jt.toString,kt="[object Null]",Lt="[object Undefined]",Ot=vt?vt.toStringTag:void 0,wt="[object AsyncFunction]",xt="[object Function]",Et="[object GeneratorFunction]",At="[object Proxy]",Tt=9007199254740991,_t={},Bt="function"==typeof Symbol&&Symbol.iterator,Ft=function(n){return Bt&&n[Bt]&&n[Bt]()},It="[object Arguments]",Mt=Object.prototype,Ut=Mt.hasOwnProperty,qt=Mt.propertyIsEnumerable,zt=S(function(){return arguments}())?S:function(n){return j(n)&&Ut.call(n,"callee")&&!qt.call(n,"callee")},Pt=Array.isArray,Vt="object"==typeof n&&n&&!n.nodeType&&n,Dt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Rt=Dt&&Dt.exports===Vt,Ct=Rt?yt.Buffer:void 0,$t=Ct?Ct.isBuffer:void 0,Wt=$t||k,Nt=9007199254740991,Qt=/^(?:0|[1-9]\d*)$/,Gt="[object Arguments]",Ht="[object Array]",Jt="[object Boolean]",Kt="[object Date]",Xt="[object Error]",Yt="[object Function]",Zt="[object Map]",ne="[object Number]",te="[object Object]",ee="[object RegExp]",re="[object Set]",ue="[object String]",ie="[object WeakMap]",oe="[object ArrayBuffer]",ce="[object DataView]",fe="[object Float32Array]",ae="[object Float64Array]",le="[object Int8Array]",se="[object Int16Array]",pe="[object Int32Array]",he="[object Uint8Array]",ye="[object Uint8ClampedArray]",ve="[object Uint16Array]",de="[object Uint32Array]",me={};me[fe]=me[ae]=me[le]=me[se]=me[pe]=me[he]=me[ye]=me[ve]=me[de]=!0,me[Gt]=me[Ht]=me[oe]=me[Jt]=me[ce]=me[Kt]=me[Xt]=me[Yt]=me[Zt]=me[ne]=me[te]=me[ee]=me[re]=me[ue]=me[ie]=!1;var ge="object"==typeof n&&n&&!n.nodeType&&n,be=ge&&"object"==typeof module&&module&&!module.nodeType&&module,je=be&&be.exports===ge,Se=je&&pt.process,ke=function(){try{var n=be&&be.require&&be.require("util").types;return n?n:Se&&Se.binding&&Se.binding("util")}catch(n){}}(),Le=ke&&ke.isTypedArray,Oe=Le?w(Le):O,we=Object.prototype,xe=we.hasOwnProperty,Ee=Object.prototype,Ae=A(Object.keys,Object),Te=Object.prototype,_e=Te.hasOwnProperty,Be=P(z,1/0),Fe=function(n,t,e){var r=d(n)?V:Be;r(n,a(t),e)},Ie=D(R),Me=l(Ie),Ue=C(R),qe=P(Ue,1),ze=l(qe),Pe=W(),Ve=function(n,e,r){function u(n,t){j.push(function(){f(n,t)})}function i(){if(0===j.length&&0===v)return r(null,y);for(;j.length&&v2&&(u=t(arguments,1)),e){var i={};N(y,function(n,t){i[t]=n}),i[n]=u,d=!0,b=Object.create(null),r(e,i)}else y[n]=u,c(n)});v++;var i=a(e[e.length-1]);e.length>1?i(y,u):i(u)}}function l(){for(var n,t=0;S.length;)n=S.pop(),t++,$(s(n),function(n){0===--k[n]&&S.push(n)});if(t!==h)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function s(t){var e=[];return N(n,function(n,r){Pt(n)&&J(n,t,0)>=0&&e.push(r)}),e}"function"==typeof e&&(r=e,e=null),r=g(r||m);var p=_(n),h=p.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=!1,b=Object.create(null),j=[],S=[],k={};N(n,function(t,e){if(!Pt(t))return u(e,[t]),void S.push(e);var r=t.slice(0,t.length-1),i=r.length;return 0===i?(u(e,t),void S.push(e)):(k[e]=i,void $(r,function(c){if(!n[c])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+c+"` in "+r.join(", "));o(c,function(){i--,0===i&&u(e,t)})}))}),l(),i()},De="[object Symbol]",Re=1/0,Ce=vt?vt.prototype:void 0,$e=Ce?Ce.toString:void 0,We="\\ud800-\\udfff",Ne="\\u0300-\\u036f",Qe="\\ufe20-\\ufe2f",Ge="\\u20d0-\\u20ff",He=Ne+Qe+Ge,Je="\\ufe0e\\ufe0f",Ke="\\u200d",Xe=RegExp("["+Ke+We+He+Je+"]"),Ye="\\ud800-\\udfff",Ze="\\u0300-\\u036f",nr="\\ufe20-\\ufe2f",tr="\\u20d0-\\u20ff",er=Ze+nr+tr,rr="\\ufe0e\\ufe0f",ur="["+Ye+"]",ir="["+er+"]",or="\\ud83c[\\udffb-\\udfff]",cr="(?:"+ir+"|"+or+")",fr="[^"+Ye+"]",ar="(?:\\ud83c[\\udde6-\\uddff]){2}",lr="[\\ud800-\\udbff][\\udc00-\\udfff]",sr="\\u200d",pr=cr+"?",hr="["+rr+"]?",yr="(?:"+sr+"(?:"+[fr,ar,lr].join("|")+")"+hr+pr+")*",vr=hr+pr+yr,dr="(?:"+[fr+ir+"?",ir,ar,lr,ur].join("|")+")",mr=RegExp(or+"(?="+or+")|"+dr+vr,"g"),gr=/^\s+|\s+$/g,br=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,jr=/,/,Sr=/(=.+)?(\s*)$/,kr=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;pn.prototype.removeLink=function(n){return n.prev?n.prev.next=n.next:this.head=n.next,n.next?n.next.prev=n.prev:this.tail=n.prev,n.prev=n.next=null,this.length-=1,n},pn.prototype.empty=function(){for(;this.head;)this.shift();return this},pn.prototype.insertAfter=function(n,t){t.prev=n,t.next=n.next,n.next?n.next.prev=t:this.tail=t,n.next=t,this.length+=1},pn.prototype.insertBefore=function(n,t){t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:this.head=t,n.prev=t,this.length+=1},pn.prototype.unshift=function(n){this.head?this.insertBefore(this.head,n):hn(this,n)},pn.prototype.push=function(n){this.tail?this.insertAfter(this.tail,n):hn(this,n)},pn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},pn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},pn.prototype.toArray=function(){for(var n=Array(this.length),t=this.head,e=0;e=u.priority;)u=u.next;for(var i=0,o=n.length;i 32 ) { + * console.log('This file name is too long'); + * callback('File name too long'); + * } else { + * // Do work to process file here + * console.log('File processed'); + * callback(); + * } + * }, function(err) { + * // if any of the file processing produced an error, err would equal that error + * if( err ) { + * // One of the iterations produced an error. + * // All processing will now stop. + * console.log('A file failed to process'); + * } else { + * console.log('All files have been processed successfully'); + * } + * }); + */ +function eachLimit(coll, iteratee, callback) { + (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/eachLimit.js b/live2d/node_modules/async/eachLimit.js new file mode 100644 index 0000000..fff721b --- /dev/null +++ b/live2d/node_modules/async/eachLimit.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = eachLimit; + +var _eachOfLimit = require('./internal/eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _withoutIndex = require('./internal/withoutIndex'); + +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. + * + * @name eachLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfLimit`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachLimit(coll, limit, iteratee, callback) { + (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/eachOf.js b/live2d/node_modules/async/eachOf.js new file mode 100644 index 0000000..055b9bd --- /dev/null +++ b/live2d/node_modules/async/eachOf.js @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (coll, iteratee, callback) { + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; + eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); +}; + +var _isArrayLike = require('lodash/isArrayLike'); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _breakLoop = require('./internal/breakLoop'); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// eachOf implementation optimized for array-likes +function eachOfArrayLike(coll, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var index = 0, + completed = 0, + length = coll.length; + if (length === 0) { + callback(null); + } + + function iteratorCallback(err, value) { + if (err) { + callback(err); + } else if (++completed === length || value === _breakLoop2.default) { + callback(null); + } + } + + for (; index < length; index++) { + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); + } +} + +// a generic version of eachOf which can handle array, object, and iterator cases. +var eachOfGeneric = (0, _doLimit2.default)(_eachOfLimit2.default, Infinity); + +/** + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument + * to the iteratee. + * + * @name eachOf + * @static + * @memberOf module:Collections + * @method + * @alias forEachOf + * @category Collection + * @see [async.each]{@link module:Collections.each} + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each + * item in `coll`. + * The `key` is the item's key, or index in the case of an array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; + * var configs = {}; + * + * async.forEachOf(obj, function (value, key, callback) { + * fs.readFile(__dirname + value, "utf8", function (err, data) { + * if (err) return callback(err); + * try { + * configs[key] = JSON.parse(data); + * } catch (e) { + * return callback(e); + * } + * callback(); + * }); + * }, function (err) { + * if (err) console.error(err.message); + * // configs is now a map of JSON data + * doSomethingWith(configs); + * }); + */ +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/eachOfLimit.js b/live2d/node_modules/async/eachOfLimit.js new file mode 100644 index 0000000..30a1329 --- /dev/null +++ b/live2d/node_modules/async/eachOfLimit.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = eachOfLimit; + +var _eachOfLimit2 = require('./internal/eachOfLimit'); + +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a + * time. + * + * @name eachOfLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. The `key` is the item's key, or index in the case of an + * array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachOfLimit(coll, limit, iteratee, callback) { + (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/eachOfSeries.js b/live2d/node_modules/async/eachOfSeries.js new file mode 100644 index 0000000..9dfd711 --- /dev/null +++ b/live2d/node_modules/async/eachOfSeries.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. + * + * @name eachOfSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Invoked with (err). + */ +exports.default = (0, _doLimit2.default)(_eachOfLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/eachSeries.js b/live2d/node_modules/async/eachSeries.js new file mode 100644 index 0000000..55c7840 --- /dev/null +++ b/live2d/node_modules/async/eachSeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _eachLimit = require('./eachLimit'); + +var _eachLimit2 = _interopRequireDefault(_eachLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. + * + * @name eachSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfSeries`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +exports.default = (0, _doLimit2.default)(_eachLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/ensureAsync.js b/live2d/node_modules/async/ensureAsync.js new file mode 100644 index 0000000..1f57aec --- /dev/null +++ b/live2d/node_modules/async/ensureAsync.js @@ -0,0 +1,73 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = ensureAsync; + +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _wrapAsync = require('./internal/wrapAsync'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Wrap an async function and ensure it calls its callback on a later tick of + * the event loop. If the function already calls its callback on a next tick, + * no extra deferral is added. This is useful for preventing stack overflows + * (`RangeError: Maximum call stack size exceeded`) and generally keeping + * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) + * contained. ES2017 `async` functions are returned as-is -- they are immune + * to Zalgo's corrupting influences, as they always resolve on a later tick. + * + * @name ensureAsync + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - an async function, one that expects a node-style + * callback as its last argument. + * @returns {AsyncFunction} Returns a wrapped function with the exact same call + * signature as the function passed in. + * @example + * + * function sometimesAsync(arg, callback) { + * if (cache[arg]) { + * return callback(null, cache[arg]); // this would be synchronous!! + * } else { + * doSomeIO(arg, callback); // this IO would be asynchronous + * } + * } + * + * // this has a risk of stack overflows if many results are cached in a row + * async.mapSeries(args, sometimesAsync, done); + * + * // this will defer sometimesAsync's callback if necessary, + * // preventing stack overflows + * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); + */ +function ensureAsync(fn) { + if ((0, _wrapAsync.isAsync)(fn)) return fn; + return (0, _initialParams2.default)(function (args, callback) { + var sync = true; + args.push(function () { + var innerArgs = arguments; + if (sync) { + (0, _setImmediate2.default)(function () { + callback.apply(null, innerArgs); + }); + } else { + callback.apply(null, innerArgs); + } + }); + fn.apply(this, args); + sync = false; + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/every.js b/live2d/node_modules/async/every.js new file mode 100644 index 0000000..d0565b0 --- /dev/null +++ b/live2d/node_modules/async/every.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _notId = require('./internal/notId'); + +var _notId2 = _interopRequireDefault(_notId); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns `true` if every element in `coll` satisfies an async test. If any + * iteratee call returns `false`, the main `callback` is immediately called. + * + * @name every + * @static + * @memberOf module:Collections + * @method + * @alias all + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + * @example + * + * async.every(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then every file exists + * }); + */ +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/everyLimit.js b/live2d/node_modules/async/everyLimit.js new file mode 100644 index 0000000..a1a759a --- /dev/null +++ b/live2d/node_modules/async/everyLimit.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _notId = require('./internal/notId'); + +var _notId2 = _interopRequireDefault(_notId); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. + * + * @name everyLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/everySeries.js b/live2d/node_modules/async/everySeries.js new file mode 100644 index 0000000..23bfebb --- /dev/null +++ b/live2d/node_modules/async/everySeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _everyLimit = require('./everyLimit'); + +var _everyLimit2 = _interopRequireDefault(_everyLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. + * + * @name everySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in series. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +exports.default = (0, _doLimit2.default)(_everyLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/filter.js b/live2d/node_modules/async/filter.js new file mode 100644 index 0000000..54772d5 --- /dev/null +++ b/live2d/node_modules/async/filter.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filter = require('./internal/filter'); + +var _filter2 = _interopRequireDefault(_filter); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns a new array of all the values in `coll` which pass an async truth + * test. This operation is performed in parallel, but the results array will be + * in the same order as the original. + * + * @name filter + * @static + * @memberOf module:Collections + * @method + * @alias select + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.filter(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of the existing files + * }); + */ +exports.default = (0, _doParallel2.default)(_filter2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/filterLimit.js b/live2d/node_modules/async/filterLimit.js new file mode 100644 index 0000000..06216f7 --- /dev/null +++ b/live2d/node_modules/async/filterLimit.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filter = require('./internal/filter'); + +var _filter2 = _interopRequireDefault(_filter); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a + * time. + * + * @name filterLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +exports.default = (0, _doParallelLimit2.default)(_filter2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/filterSeries.js b/live2d/node_modules/async/filterSeries.js new file mode 100644 index 0000000..e48d966 --- /dev/null +++ b/live2d/node_modules/async/filterSeries.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filterLimit = require('./filterLimit'); + +var _filterLimit2 = _interopRequireDefault(_filterLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. + * + * @name filterSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results) + */ +exports.default = (0, _doLimit2.default)(_filterLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/find.js b/live2d/node_modules/async/find.js new file mode 100644 index 0000000..db46783 --- /dev/null +++ b/live2d/node_modules/async/find.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _findGetResult = require('./internal/findGetResult'); + +var _findGetResult2 = _interopRequireDefault(_findGetResult); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns the first value in `coll` that passes an async truth test. The + * `iteratee` is applied in parallel, meaning the first iteratee to return + * `true` will fire the detect `callback` with that result. That means the + * result might not be the first item in the original `coll` (in terms of order) + * that passes the test. + + * If order within the original `coll` is important, then look at + * [`detectSeries`]{@link module:Collections.detectSeries}. + * + * @name detect + * @static + * @memberOf module:Collections + * @method + * @alias find + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + * @example + * + * async.detect(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // result now equals the first file in the list that exists + * }); + */ +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/findLimit.js b/live2d/node_modules/async/findLimit.js new file mode 100644 index 0000000..6bf6560 --- /dev/null +++ b/live2d/node_modules/async/findLimit.js @@ -0,0 +1,48 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _findGetResult = require('./internal/findGetResult'); + +var _findGetResult2 = _interopRequireDefault(_findGetResult); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a + * time. + * + * @name detectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findLimit + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/findSeries.js b/live2d/node_modules/async/findSeries.js new file mode 100644 index 0000000..6fe16c9 --- /dev/null +++ b/live2d/node_modules/async/findSeries.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _detectLimit = require('./detectLimit'); + +var _detectLimit2 = _interopRequireDefault(_detectLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. + * + * @name detectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findSeries + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +exports.default = (0, _doLimit2.default)(_detectLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/foldl.js b/live2d/node_modules/async/foldl.js new file mode 100644 index 0000000..3fb8019 --- /dev/null +++ b/live2d/node_modules/async/foldl.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reduce; + +var _eachOfSeries = require('./eachOfSeries'); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Reduces `coll` into a single value using an async `iteratee` to return each + * successive step. `memo` is the initial state of the reduction. This function + * only operates in series. + * + * For performance reasons, it may make sense to split a call to this function + * into a parallel map, and then use the normal `Array.prototype.reduce` on the + * results. This function is for situations where each step in the reduction + * needs to be async; if you can get the data before reducing it, then it's + * probably a good idea to do so. + * + * @name reduce + * @static + * @memberOf module:Collections + * @method + * @alias inject + * @alias foldl + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + * @example + * + * async.reduce([1,2,3], 0, function(memo, item, callback) { + * // pointless async: + * process.nextTick(function() { + * callback(null, memo + item) + * }); + * }, function(err, result) { + * // result is now equal to the last value of memo, which is 6 + * }); + */ +function reduce(coll, memo, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _eachOfSeries2.default)(coll, function (x, i, callback) { + _iteratee(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/foldr.js b/live2d/node_modules/async/foldr.js new file mode 100644 index 0000000..3d17d32 --- /dev/null +++ b/live2d/node_modules/async/foldr.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reduceRight; + +var _reduce = require('./reduce'); + +var _reduce2 = _interopRequireDefault(_reduce); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. + * + * @name reduceRight + * @static + * @memberOf module:Collections + * @method + * @see [async.reduce]{@link module:Collections.reduce} + * @alias foldr + * @category Collection + * @param {Array} array - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + */ +function reduceRight(array, memo, iteratee, callback) { + var reversed = (0, _slice2.default)(array).reverse(); + (0, _reduce2.default)(reversed, memo, iteratee, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEach.js b/live2d/node_modules/async/forEach.js new file mode 100644 index 0000000..4b20af3 --- /dev/null +++ b/live2d/node_modules/async/forEach.js @@ -0,0 +1,82 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = eachLimit; + +var _eachOf = require('./eachOf'); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _withoutIndex = require('./internal/withoutIndex'); + +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Applies the function `iteratee` to each item in `coll`, in parallel. + * The `iteratee` is called with an item from the list, and a callback for when + * it has finished. If the `iteratee` passes an error to its `callback`, the + * main `callback` (for the `each` function) is immediately called with the + * error. + * + * Note, that since this function applies `iteratee` to each item in parallel, + * there is no guarantee that the iteratee functions will complete in order. + * + * @name each + * @static + * @memberOf module:Collections + * @method + * @alias forEach + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to + * each item in `coll`. Invoked with (item, callback). + * The array index is not passed to the iteratee. + * If you need the index, use `eachOf`. + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * // assuming openFiles is an array of file names and saveFile is a function + * // to save the modified contents of that file: + * + * async.each(openFiles, saveFile, function(err){ + * // if any of the saves produced an error, err would equal that error + * }); + * + * // assuming openFiles is an array of file names + * async.each(openFiles, function(file, callback) { + * + * // Perform operation on file here. + * console.log('Processing file ' + file); + * + * if( file.length > 32 ) { + * console.log('This file name is too long'); + * callback('File name too long'); + * } else { + * // Do work to process file here + * console.log('File processed'); + * callback(); + * } + * }, function(err) { + * // if any of the file processing produced an error, err would equal that error + * if( err ) { + * // One of the iterations produced an error. + * // All processing will now stop. + * console.log('A file failed to process'); + * } else { + * console.log('All files have been processed successfully'); + * } + * }); + */ +function eachLimit(coll, iteratee, callback) { + (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEachLimit.js b/live2d/node_modules/async/forEachLimit.js new file mode 100644 index 0000000..fff721b --- /dev/null +++ b/live2d/node_modules/async/forEachLimit.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = eachLimit; + +var _eachOfLimit = require('./internal/eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _withoutIndex = require('./internal/withoutIndex'); + +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. + * + * @name eachLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfLimit`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachLimit(coll, limit, iteratee, callback) { + (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEachOf.js b/live2d/node_modules/async/forEachOf.js new file mode 100644 index 0000000..055b9bd --- /dev/null +++ b/live2d/node_modules/async/forEachOf.js @@ -0,0 +1,111 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (coll, iteratee, callback) { + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; + eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); +}; + +var _isArrayLike = require('lodash/isArrayLike'); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _breakLoop = require('./internal/breakLoop'); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// eachOf implementation optimized for array-likes +function eachOfArrayLike(coll, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var index = 0, + completed = 0, + length = coll.length; + if (length === 0) { + callback(null); + } + + function iteratorCallback(err, value) { + if (err) { + callback(err); + } else if (++completed === length || value === _breakLoop2.default) { + callback(null); + } + } + + for (; index < length; index++) { + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); + } +} + +// a generic version of eachOf which can handle array, object, and iterator cases. +var eachOfGeneric = (0, _doLimit2.default)(_eachOfLimit2.default, Infinity); + +/** + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument + * to the iteratee. + * + * @name eachOf + * @static + * @memberOf module:Collections + * @method + * @alias forEachOf + * @category Collection + * @see [async.each]{@link module:Collections.each} + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each + * item in `coll`. + * The `key` is the item's key, or index in the case of an array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; + * var configs = {}; + * + * async.forEachOf(obj, function (value, key, callback) { + * fs.readFile(__dirname + value, "utf8", function (err, data) { + * if (err) return callback(err); + * try { + * configs[key] = JSON.parse(data); + * } catch (e) { + * return callback(e); + * } + * callback(); + * }); + * }, function (err) { + * if (err) console.error(err.message); + * // configs is now a map of JSON data + * doSomethingWith(configs); + * }); + */ +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEachOfLimit.js b/live2d/node_modules/async/forEachOfLimit.js new file mode 100644 index 0000000..30a1329 --- /dev/null +++ b/live2d/node_modules/async/forEachOfLimit.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = eachOfLimit; + +var _eachOfLimit2 = require('./internal/eachOfLimit'); + +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a + * time. + * + * @name eachOfLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. The `key` is the item's key, or index in the case of an + * array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachOfLimit(coll, limit, iteratee, callback) { + (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEachOfSeries.js b/live2d/node_modules/async/forEachOfSeries.js new file mode 100644 index 0000000..9dfd711 --- /dev/null +++ b/live2d/node_modules/async/forEachOfSeries.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. + * + * @name eachOfSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Invoked with (err). + */ +exports.default = (0, _doLimit2.default)(_eachOfLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forEachSeries.js b/live2d/node_modules/async/forEachSeries.js new file mode 100644 index 0000000..55c7840 --- /dev/null +++ b/live2d/node_modules/async/forEachSeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _eachLimit = require('./eachLimit'); + +var _eachLimit2 = _interopRequireDefault(_eachLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. + * + * @name eachSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfSeries`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +exports.default = (0, _doLimit2.default)(_eachLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/forever.js b/live2d/node_modules/async/forever.js new file mode 100644 index 0000000..6c7b8a4 --- /dev/null +++ b/live2d/node_modules/async/forever.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = forever; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _ensureAsync = require('./ensureAsync'); + +var _ensureAsync2 = _interopRequireDefault(_ensureAsync); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Calls the asynchronous function `fn` with a callback parameter that allows it + * to call itself again, in series, indefinitely. + + * If an error is passed to the callback then `errback` is called with the + * error, and execution stops, otherwise it will never be called. + * + * @name forever + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} fn - an async function to call repeatedly. + * Invoked with (next). + * @param {Function} [errback] - when `fn` passes an error to it's callback, + * this function will be called, and execution stops. Invoked with (err). + * @example + * + * async.forever( + * function(next) { + * // next is suitable for passing to things that need a callback(err [, whatever]); + * // it will result in this function being called again. + * }, + * function(err) { + * // if next is called with a value in its first parameter, it will appear + * // in here as 'err', and execution will stop. + * } + * ); + */ +function forever(fn, errback) { + var done = (0, _onlyOnce2.default)(errback || _noop2.default); + var task = (0, _wrapAsync2.default)((0, _ensureAsync2.default)(fn)); + + function next(err) { + if (err) return done(err); + task(next); + } + next(); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/groupBy.js b/live2d/node_modules/async/groupBy.js new file mode 100644 index 0000000..755cba7 --- /dev/null +++ b/live2d/node_modules/async/groupBy.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +var _groupByLimit = require('./groupByLimit'); + +var _groupByLimit2 = _interopRequireDefault(_groupByLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns a new object, where each value corresponds to an array of items, from + * `coll`, that returned the corresponding key. That is, the keys of the object + * correspond to the values passed to the `iteratee` callback. + * + * Note: Since this function applies the `iteratee` to each item in parallel, + * there is no guarantee that the `iteratee` functions will complete in order. + * However, the values for each key in the `result` will be in the same order as + * the original `coll`. For Objects, the values will roughly be in the order of + * the original Objects' keys (but this can vary across JavaScript engines). + * + * @name groupBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + * @example + * + * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { + * db.findById(userId, function(err, user) { + * if (err) return callback(err); + * return callback(null, user.age); + * }); + * }, function(err, result) { + * // result is object containing the userIds grouped by age + * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; + * }); + */ +exports.default = (0, _doLimit2.default)(_groupByLimit2.default, Infinity); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/groupByLimit.js b/live2d/node_modules/async/groupByLimit.js new file mode 100644 index 0000000..fec13f8 --- /dev/null +++ b/live2d/node_modules/async/groupByLimit.js @@ -0,0 +1,71 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (coll, limit, iteratee, callback) { + callback = callback || _noop2.default; + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _mapLimit2.default)(coll, limit, function (val, callback) { + _iteratee(val, function (err, key) { + if (err) return callback(err); + return callback(null, { key: key, val: val }); + }); + }, function (err, mapResults) { + var result = {}; + // from MDN, handle object having an `hasOwnProperty` prop + var hasOwnProperty = Object.prototype.hasOwnProperty; + + for (var i = 0; i < mapResults.length; i++) { + if (mapResults[i]) { + var key = mapResults[i].key; + var val = mapResults[i].val; + + if (hasOwnProperty.call(result, key)) { + result[key].push(val); + } else { + result[key] = [val]; + } + } + } + + return callback(err, result); + }); +}; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _mapLimit = require('./mapLimit'); + +var _mapLimit2 = _interopRequireDefault(_mapLimit); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +; +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. + * + * @name groupByLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/groupBySeries.js b/live2d/node_modules/async/groupBySeries.js new file mode 100644 index 0000000..b94805e --- /dev/null +++ b/live2d/node_modules/async/groupBySeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +var _groupByLimit = require('./groupByLimit'); + +var _groupByLimit2 = _interopRequireDefault(_groupByLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. + * + * @name groupBySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +exports.default = (0, _doLimit2.default)(_groupByLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/index.js b/live2d/node_modules/async/index.js new file mode 100644 index 0000000..c39d8d8 --- /dev/null +++ b/live2d/node_modules/async/index.js @@ -0,0 +1,582 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.wrapSync = exports.selectSeries = exports.selectLimit = exports.select = exports.foldr = exports.foldl = exports.inject = exports.forEachOfLimit = exports.forEachOfSeries = exports.forEachOf = exports.forEachLimit = exports.forEachSeries = exports.forEach = exports.findSeries = exports.findLimit = exports.find = exports.anySeries = exports.anyLimit = exports.any = exports.allSeries = exports.allLimit = exports.all = exports.whilst = exports.waterfall = exports.until = exports.unmemoize = exports.tryEach = exports.transform = exports.timesSeries = exports.timesLimit = exports.times = exports.timeout = exports.sortBy = exports.someSeries = exports.someLimit = exports.some = exports.setImmediate = exports.series = exports.seq = exports.retryable = exports.retry = exports.rejectSeries = exports.rejectLimit = exports.reject = exports.reflectAll = exports.reflect = exports.reduceRight = exports.reduce = exports.race = exports.queue = exports.priorityQueue = exports.parallelLimit = exports.parallel = exports.nextTick = exports.memoize = exports.mapValuesSeries = exports.mapValuesLimit = exports.mapValues = exports.mapSeries = exports.mapLimit = exports.map = exports.log = exports.groupBySeries = exports.groupByLimit = exports.groupBy = exports.forever = exports.filterSeries = exports.filterLimit = exports.filter = exports.everySeries = exports.everyLimit = exports.every = exports.ensureAsync = exports.eachSeries = exports.eachOfSeries = exports.eachOfLimit = exports.eachOf = exports.eachLimit = exports.each = exports.during = exports.doWhilst = exports.doUntil = exports.doDuring = exports.dir = exports.detectSeries = exports.detectLimit = exports.detect = exports.constant = exports.concatSeries = exports.concatLimit = exports.concat = exports.compose = exports.cargo = exports.autoInject = exports.auto = exports.asyncify = exports.applyEachSeries = exports.applyEach = exports.apply = undefined; + +var _apply = require('./apply'); + +var _apply2 = _interopRequireDefault(_apply); + +var _applyEach = require('./applyEach'); + +var _applyEach2 = _interopRequireDefault(_applyEach); + +var _applyEachSeries = require('./applyEachSeries'); + +var _applyEachSeries2 = _interopRequireDefault(_applyEachSeries); + +var _asyncify = require('./asyncify'); + +var _asyncify2 = _interopRequireDefault(_asyncify); + +var _auto = require('./auto'); + +var _auto2 = _interopRequireDefault(_auto); + +var _autoInject = require('./autoInject'); + +var _autoInject2 = _interopRequireDefault(_autoInject); + +var _cargo = require('./cargo'); + +var _cargo2 = _interopRequireDefault(_cargo); + +var _compose = require('./compose'); + +var _compose2 = _interopRequireDefault(_compose); + +var _concat = require('./concat'); + +var _concat2 = _interopRequireDefault(_concat); + +var _concatLimit = require('./concatLimit'); + +var _concatLimit2 = _interopRequireDefault(_concatLimit); + +var _concatSeries = require('./concatSeries'); + +var _concatSeries2 = _interopRequireDefault(_concatSeries); + +var _constant = require('./constant'); + +var _constant2 = _interopRequireDefault(_constant); + +var _detect = require('./detect'); + +var _detect2 = _interopRequireDefault(_detect); + +var _detectLimit = require('./detectLimit'); + +var _detectLimit2 = _interopRequireDefault(_detectLimit); + +var _detectSeries = require('./detectSeries'); + +var _detectSeries2 = _interopRequireDefault(_detectSeries); + +var _dir = require('./dir'); + +var _dir2 = _interopRequireDefault(_dir); + +var _doDuring = require('./doDuring'); + +var _doDuring2 = _interopRequireDefault(_doDuring); + +var _doUntil = require('./doUntil'); + +var _doUntil2 = _interopRequireDefault(_doUntil); + +var _doWhilst = require('./doWhilst'); + +var _doWhilst2 = _interopRequireDefault(_doWhilst); + +var _during = require('./during'); + +var _during2 = _interopRequireDefault(_during); + +var _each = require('./each'); + +var _each2 = _interopRequireDefault(_each); + +var _eachLimit = require('./eachLimit'); + +var _eachLimit2 = _interopRequireDefault(_eachLimit); + +var _eachOf = require('./eachOf'); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _eachOfSeries = require('./eachOfSeries'); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +var _eachSeries = require('./eachSeries'); + +var _eachSeries2 = _interopRequireDefault(_eachSeries); + +var _ensureAsync = require('./ensureAsync'); + +var _ensureAsync2 = _interopRequireDefault(_ensureAsync); + +var _every = require('./every'); + +var _every2 = _interopRequireDefault(_every); + +var _everyLimit = require('./everyLimit'); + +var _everyLimit2 = _interopRequireDefault(_everyLimit); + +var _everySeries = require('./everySeries'); + +var _everySeries2 = _interopRequireDefault(_everySeries); + +var _filter = require('./filter'); + +var _filter2 = _interopRequireDefault(_filter); + +var _filterLimit = require('./filterLimit'); + +var _filterLimit2 = _interopRequireDefault(_filterLimit); + +var _filterSeries = require('./filterSeries'); + +var _filterSeries2 = _interopRequireDefault(_filterSeries); + +var _forever = require('./forever'); + +var _forever2 = _interopRequireDefault(_forever); + +var _groupBy = require('./groupBy'); + +var _groupBy2 = _interopRequireDefault(_groupBy); + +var _groupByLimit = require('./groupByLimit'); + +var _groupByLimit2 = _interopRequireDefault(_groupByLimit); + +var _groupBySeries = require('./groupBySeries'); + +var _groupBySeries2 = _interopRequireDefault(_groupBySeries); + +var _log = require('./log'); + +var _log2 = _interopRequireDefault(_log); + +var _map = require('./map'); + +var _map2 = _interopRequireDefault(_map); + +var _mapLimit = require('./mapLimit'); + +var _mapLimit2 = _interopRequireDefault(_mapLimit); + +var _mapSeries = require('./mapSeries'); + +var _mapSeries2 = _interopRequireDefault(_mapSeries); + +var _mapValues = require('./mapValues'); + +var _mapValues2 = _interopRequireDefault(_mapValues); + +var _mapValuesLimit = require('./mapValuesLimit'); + +var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); + +var _mapValuesSeries = require('./mapValuesSeries'); + +var _mapValuesSeries2 = _interopRequireDefault(_mapValuesSeries); + +var _memoize = require('./memoize'); + +var _memoize2 = _interopRequireDefault(_memoize); + +var _nextTick = require('./nextTick'); + +var _nextTick2 = _interopRequireDefault(_nextTick); + +var _parallel = require('./parallel'); + +var _parallel2 = _interopRequireDefault(_parallel); + +var _parallelLimit = require('./parallelLimit'); + +var _parallelLimit2 = _interopRequireDefault(_parallelLimit); + +var _priorityQueue = require('./priorityQueue'); + +var _priorityQueue2 = _interopRequireDefault(_priorityQueue); + +var _queue = require('./queue'); + +var _queue2 = _interopRequireDefault(_queue); + +var _race = require('./race'); + +var _race2 = _interopRequireDefault(_race); + +var _reduce = require('./reduce'); + +var _reduce2 = _interopRequireDefault(_reduce); + +var _reduceRight = require('./reduceRight'); + +var _reduceRight2 = _interopRequireDefault(_reduceRight); + +var _reflect = require('./reflect'); + +var _reflect2 = _interopRequireDefault(_reflect); + +var _reflectAll = require('./reflectAll'); + +var _reflectAll2 = _interopRequireDefault(_reflectAll); + +var _reject = require('./reject'); + +var _reject2 = _interopRequireDefault(_reject); + +var _rejectLimit = require('./rejectLimit'); + +var _rejectLimit2 = _interopRequireDefault(_rejectLimit); + +var _rejectSeries = require('./rejectSeries'); + +var _rejectSeries2 = _interopRequireDefault(_rejectSeries); + +var _retry = require('./retry'); + +var _retry2 = _interopRequireDefault(_retry); + +var _retryable = require('./retryable'); + +var _retryable2 = _interopRequireDefault(_retryable); + +var _seq = require('./seq'); + +var _seq2 = _interopRequireDefault(_seq); + +var _series = require('./series'); + +var _series2 = _interopRequireDefault(_series); + +var _setImmediate = require('./setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _some = require('./some'); + +var _some2 = _interopRequireDefault(_some); + +var _someLimit = require('./someLimit'); + +var _someLimit2 = _interopRequireDefault(_someLimit); + +var _someSeries = require('./someSeries'); + +var _someSeries2 = _interopRequireDefault(_someSeries); + +var _sortBy = require('./sortBy'); + +var _sortBy2 = _interopRequireDefault(_sortBy); + +var _timeout = require('./timeout'); + +var _timeout2 = _interopRequireDefault(_timeout); + +var _times = require('./times'); + +var _times2 = _interopRequireDefault(_times); + +var _timesLimit = require('./timesLimit'); + +var _timesLimit2 = _interopRequireDefault(_timesLimit); + +var _timesSeries = require('./timesSeries'); + +var _timesSeries2 = _interopRequireDefault(_timesSeries); + +var _transform = require('./transform'); + +var _transform2 = _interopRequireDefault(_transform); + +var _tryEach = require('./tryEach'); + +var _tryEach2 = _interopRequireDefault(_tryEach); + +var _unmemoize = require('./unmemoize'); + +var _unmemoize2 = _interopRequireDefault(_unmemoize); + +var _until = require('./until'); + +var _until2 = _interopRequireDefault(_until); + +var _waterfall = require('./waterfall'); + +var _waterfall2 = _interopRequireDefault(_waterfall); + +var _whilst = require('./whilst'); + +var _whilst2 = _interopRequireDefault(_whilst); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = { + apply: _apply2.default, + applyEach: _applyEach2.default, + applyEachSeries: _applyEachSeries2.default, + asyncify: _asyncify2.default, + auto: _auto2.default, + autoInject: _autoInject2.default, + cargo: _cargo2.default, + compose: _compose2.default, + concat: _concat2.default, + concatLimit: _concatLimit2.default, + concatSeries: _concatSeries2.default, + constant: _constant2.default, + detect: _detect2.default, + detectLimit: _detectLimit2.default, + detectSeries: _detectSeries2.default, + dir: _dir2.default, + doDuring: _doDuring2.default, + doUntil: _doUntil2.default, + doWhilst: _doWhilst2.default, + during: _during2.default, + each: _each2.default, + eachLimit: _eachLimit2.default, + eachOf: _eachOf2.default, + eachOfLimit: _eachOfLimit2.default, + eachOfSeries: _eachOfSeries2.default, + eachSeries: _eachSeries2.default, + ensureAsync: _ensureAsync2.default, + every: _every2.default, + everyLimit: _everyLimit2.default, + everySeries: _everySeries2.default, + filter: _filter2.default, + filterLimit: _filterLimit2.default, + filterSeries: _filterSeries2.default, + forever: _forever2.default, + groupBy: _groupBy2.default, + groupByLimit: _groupByLimit2.default, + groupBySeries: _groupBySeries2.default, + log: _log2.default, + map: _map2.default, + mapLimit: _mapLimit2.default, + mapSeries: _mapSeries2.default, + mapValues: _mapValues2.default, + mapValuesLimit: _mapValuesLimit2.default, + mapValuesSeries: _mapValuesSeries2.default, + memoize: _memoize2.default, + nextTick: _nextTick2.default, + parallel: _parallel2.default, + parallelLimit: _parallelLimit2.default, + priorityQueue: _priorityQueue2.default, + queue: _queue2.default, + race: _race2.default, + reduce: _reduce2.default, + reduceRight: _reduceRight2.default, + reflect: _reflect2.default, + reflectAll: _reflectAll2.default, + reject: _reject2.default, + rejectLimit: _rejectLimit2.default, + rejectSeries: _rejectSeries2.default, + retry: _retry2.default, + retryable: _retryable2.default, + seq: _seq2.default, + series: _series2.default, + setImmediate: _setImmediate2.default, + some: _some2.default, + someLimit: _someLimit2.default, + someSeries: _someSeries2.default, + sortBy: _sortBy2.default, + timeout: _timeout2.default, + times: _times2.default, + timesLimit: _timesLimit2.default, + timesSeries: _timesSeries2.default, + transform: _transform2.default, + tryEach: _tryEach2.default, + unmemoize: _unmemoize2.default, + until: _until2.default, + waterfall: _waterfall2.default, + whilst: _whilst2.default, + + // aliases + all: _every2.default, + allLimit: _everyLimit2.default, + allSeries: _everySeries2.default, + any: _some2.default, + anyLimit: _someLimit2.default, + anySeries: _someSeries2.default, + find: _detect2.default, + findLimit: _detectLimit2.default, + findSeries: _detectSeries2.default, + forEach: _each2.default, + forEachSeries: _eachSeries2.default, + forEachLimit: _eachLimit2.default, + forEachOf: _eachOf2.default, + forEachOfSeries: _eachOfSeries2.default, + forEachOfLimit: _eachOfLimit2.default, + inject: _reduce2.default, + foldl: _reduce2.default, + foldr: _reduceRight2.default, + select: _filter2.default, + selectLimit: _filterLimit2.default, + selectSeries: _filterSeries2.default, + wrapSync: _asyncify2.default +}; /** + * An "async function" in the context of Async is an asynchronous function with + * a variable number of parameters, with the final parameter being a callback. + * (`function (arg1, arg2, ..., callback) {}`) + * The final callback is of the form `callback(err, results...)`, which must be + * called once the function is completed. The callback should be called with a + * Error as its first argument to signal that an error occurred. + * Otherwise, if no error occurred, it should be called with `null` as the first + * argument, and any additional `result` arguments that may apply, to signal + * successful completion. + * The callback must be called exactly once, ideally on a later tick of the + * JavaScript event loop. + * + * This type of function is also referred to as a "Node-style async function", + * or a "continuation passing-style function" (CPS). Most of the methods of this + * library are themselves CPS/Node-style async functions, or functions that + * return CPS/Node-style async functions. + * + * Wherever we accept a Node-style async function, we also directly accept an + * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. + * In this case, the `async` function will not be passed a final callback + * argument, and any thrown error will be used as the `err` argument of the + * implicit callback, and the return value will be used as the `result` value. + * (i.e. a `rejected` of the returned Promise becomes the `err` callback + * argument, and a `resolved` value becomes the `result`.) + * + * Note, due to JavaScript limitations, we can only detect native `async` + * functions and not transpilied implementations. + * Your environment must have `async`/`await` support for this to work. + * (e.g. Node > v7.6, or a recent version of a modern browser). + * If you are using `async` functions through a transpiler (e.g. Babel), you + * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, + * because the `async function` will be compiled to an ordinary function that + * returns a promise. + * + * @typedef {Function} AsyncFunction + * @static + */ + +/** + * Async is a utility module which provides straight-forward, powerful functions + * for working with asynchronous JavaScript. Although originally designed for + * use with [Node.js](http://nodejs.org) and installable via + * `npm install --save async`, it can also be used directly in the browser. + * @module async + * @see AsyncFunction + */ + +/** + * A collection of `async` functions for manipulating collections, such as + * arrays and objects. + * @module Collections + */ + +/** + * A collection of `async` functions for controlling the flow through a script. + * @module ControlFlow + */ + +/** + * A collection of `async` utility functions. + * @module Utils + */ + +exports.apply = _apply2.default; +exports.applyEach = _applyEach2.default; +exports.applyEachSeries = _applyEachSeries2.default; +exports.asyncify = _asyncify2.default; +exports.auto = _auto2.default; +exports.autoInject = _autoInject2.default; +exports.cargo = _cargo2.default; +exports.compose = _compose2.default; +exports.concat = _concat2.default; +exports.concatLimit = _concatLimit2.default; +exports.concatSeries = _concatSeries2.default; +exports.constant = _constant2.default; +exports.detect = _detect2.default; +exports.detectLimit = _detectLimit2.default; +exports.detectSeries = _detectSeries2.default; +exports.dir = _dir2.default; +exports.doDuring = _doDuring2.default; +exports.doUntil = _doUntil2.default; +exports.doWhilst = _doWhilst2.default; +exports.during = _during2.default; +exports.each = _each2.default; +exports.eachLimit = _eachLimit2.default; +exports.eachOf = _eachOf2.default; +exports.eachOfLimit = _eachOfLimit2.default; +exports.eachOfSeries = _eachOfSeries2.default; +exports.eachSeries = _eachSeries2.default; +exports.ensureAsync = _ensureAsync2.default; +exports.every = _every2.default; +exports.everyLimit = _everyLimit2.default; +exports.everySeries = _everySeries2.default; +exports.filter = _filter2.default; +exports.filterLimit = _filterLimit2.default; +exports.filterSeries = _filterSeries2.default; +exports.forever = _forever2.default; +exports.groupBy = _groupBy2.default; +exports.groupByLimit = _groupByLimit2.default; +exports.groupBySeries = _groupBySeries2.default; +exports.log = _log2.default; +exports.map = _map2.default; +exports.mapLimit = _mapLimit2.default; +exports.mapSeries = _mapSeries2.default; +exports.mapValues = _mapValues2.default; +exports.mapValuesLimit = _mapValuesLimit2.default; +exports.mapValuesSeries = _mapValuesSeries2.default; +exports.memoize = _memoize2.default; +exports.nextTick = _nextTick2.default; +exports.parallel = _parallel2.default; +exports.parallelLimit = _parallelLimit2.default; +exports.priorityQueue = _priorityQueue2.default; +exports.queue = _queue2.default; +exports.race = _race2.default; +exports.reduce = _reduce2.default; +exports.reduceRight = _reduceRight2.default; +exports.reflect = _reflect2.default; +exports.reflectAll = _reflectAll2.default; +exports.reject = _reject2.default; +exports.rejectLimit = _rejectLimit2.default; +exports.rejectSeries = _rejectSeries2.default; +exports.retry = _retry2.default; +exports.retryable = _retryable2.default; +exports.seq = _seq2.default; +exports.series = _series2.default; +exports.setImmediate = _setImmediate2.default; +exports.some = _some2.default; +exports.someLimit = _someLimit2.default; +exports.someSeries = _someSeries2.default; +exports.sortBy = _sortBy2.default; +exports.timeout = _timeout2.default; +exports.times = _times2.default; +exports.timesLimit = _timesLimit2.default; +exports.timesSeries = _timesSeries2.default; +exports.transform = _transform2.default; +exports.tryEach = _tryEach2.default; +exports.unmemoize = _unmemoize2.default; +exports.until = _until2.default; +exports.waterfall = _waterfall2.default; +exports.whilst = _whilst2.default; +exports.all = _every2.default; +exports.allLimit = _everyLimit2.default; +exports.allSeries = _everySeries2.default; +exports.any = _some2.default; +exports.anyLimit = _someLimit2.default; +exports.anySeries = _someSeries2.default; +exports.find = _detect2.default; +exports.findLimit = _detectLimit2.default; +exports.findSeries = _detectSeries2.default; +exports.forEach = _each2.default; +exports.forEachSeries = _eachSeries2.default; +exports.forEachLimit = _eachLimit2.default; +exports.forEachOf = _eachOf2.default; +exports.forEachOfSeries = _eachOfSeries2.default; +exports.forEachOfLimit = _eachOfLimit2.default; +exports.inject = _reduce2.default; +exports.foldl = _reduce2.default; +exports.foldr = _reduceRight2.default; +exports.select = _filter2.default; +exports.selectLimit = _filterLimit2.default; +exports.selectSeries = _filterSeries2.default; +exports.wrapSync = _asyncify2.default; \ No newline at end of file diff --git a/live2d/node_modules/async/inject.js b/live2d/node_modules/async/inject.js new file mode 100644 index 0000000..3fb8019 --- /dev/null +++ b/live2d/node_modules/async/inject.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reduce; + +var _eachOfSeries = require('./eachOfSeries'); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Reduces `coll` into a single value using an async `iteratee` to return each + * successive step. `memo` is the initial state of the reduction. This function + * only operates in series. + * + * For performance reasons, it may make sense to split a call to this function + * into a parallel map, and then use the normal `Array.prototype.reduce` on the + * results. This function is for situations where each step in the reduction + * needs to be async; if you can get the data before reducing it, then it's + * probably a good idea to do so. + * + * @name reduce + * @static + * @memberOf module:Collections + * @method + * @alias inject + * @alias foldl + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + * @example + * + * async.reduce([1,2,3], 0, function(memo, item, callback) { + * // pointless async: + * process.nextTick(function() { + * callback(null, memo + item) + * }); + * }, function(err, result) { + * // result is now equal to the last value of memo, which is 6 + * }); + */ +function reduce(coll, memo, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _eachOfSeries2.default)(coll, function (x, i, callback) { + _iteratee(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/DoublyLinkedList.js b/live2d/node_modules/async/internal/DoublyLinkedList.js new file mode 100644 index 0000000..7e71728 --- /dev/null +++ b/live2d/node_modules/async/internal/DoublyLinkedList.js @@ -0,0 +1,88 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = DLL; +// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation +// used for queues. This implementation assumes that the node provided by the user can be modified +// to adjust the next and last properties. We implement only the minimal functionality +// for queue support. +function DLL() { + this.head = this.tail = null; + this.length = 0; +} + +function setInitial(dll, node) { + dll.length = 1; + dll.head = dll.tail = node; +} + +DLL.prototype.removeLink = function (node) { + if (node.prev) node.prev.next = node.next;else this.head = node.next; + if (node.next) node.next.prev = node.prev;else this.tail = node.prev; + + node.prev = node.next = null; + this.length -= 1; + return node; +}; + +DLL.prototype.empty = function () { + while (this.head) this.shift(); + return this; +}; + +DLL.prototype.insertAfter = function (node, newNode) { + newNode.prev = node; + newNode.next = node.next; + if (node.next) node.next.prev = newNode;else this.tail = newNode; + node.next = newNode; + this.length += 1; +}; + +DLL.prototype.insertBefore = function (node, newNode) { + newNode.prev = node.prev; + newNode.next = node; + if (node.prev) node.prev.next = newNode;else this.head = newNode; + node.prev = newNode; + this.length += 1; +}; + +DLL.prototype.unshift = function (node) { + if (this.head) this.insertBefore(this.head, node);else setInitial(this, node); +}; + +DLL.prototype.push = function (node) { + if (this.tail) this.insertAfter(this.tail, node);else setInitial(this, node); +}; + +DLL.prototype.shift = function () { + return this.head && this.removeLink(this.head); +}; + +DLL.prototype.pop = function () { + return this.tail && this.removeLink(this.tail); +}; + +DLL.prototype.toArray = function () { + var arr = Array(this.length); + var curr = this.head; + for (var idx = 0; idx < this.length; idx++) { + arr[idx] = curr.data; + curr = curr.next; + } + return arr; +}; + +DLL.prototype.remove = function (testFn) { + var curr = this.head; + while (!!curr) { + var next = curr.next; + if (testFn(curr)) { + this.removeLink(curr); + } + curr = next; + } + return this; +}; +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/applyEach.js b/live2d/node_modules/async/internal/applyEach.js new file mode 100644 index 0000000..322e03c --- /dev/null +++ b/live2d/node_modules/async/internal/applyEach.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = applyEach; + +var _slice = require('./slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _initialParams = require('./initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function applyEach(eachfn) { + return function (fns /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + var go = (0, _initialParams2.default)(function (args, callback) { + var that = this; + return eachfn(fns, function (fn, cb) { + (0, _wrapAsync2.default)(fn).apply(that, args.concat(cb)); + }, callback); + }); + if (args.length) { + return go.apply(this, args); + } else { + return go; + } + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/breakLoop.js b/live2d/node_modules/async/internal/breakLoop.js new file mode 100644 index 0000000..1065058 --- /dev/null +++ b/live2d/node_modules/async/internal/breakLoop.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// A temporary value used to identify if the loop should be broken. +// See #1064, #1293 +exports.default = {}; +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/consoleFunc.js b/live2d/node_modules/async/internal/consoleFunc.js new file mode 100644 index 0000000..603f48e --- /dev/null +++ b/live2d/node_modules/async/internal/consoleFunc.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = consoleFunc; + +var _arrayEach = require('lodash/_arrayEach'); + +var _arrayEach2 = _interopRequireDefault(_arrayEach); + +var _slice = require('./slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function consoleFunc(name) { + return function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + args.push(function (err /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + if (typeof console === 'object') { + if (err) { + if (console.error) { + console.error(err); + } + } else if (console[name]) { + (0, _arrayEach2.default)(args, function (x) { + console[name](x); + }); + } + } + }); + (0, _wrapAsync2.default)(fn).apply(null, args); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/createTester.js b/live2d/node_modules/async/internal/createTester.js new file mode 100644 index 0000000..ce96e8b --- /dev/null +++ b/live2d/node_modules/async/internal/createTester.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _createTester; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _breakLoop = require('./breakLoop'); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _createTester(check, getResult) { + return function (eachfn, arr, iteratee, cb) { + cb = cb || _noop2.default; + var testPassed = false; + var testResult; + eachfn(arr, function (value, _, callback) { + iteratee(value, function (err, result) { + if (err) { + callback(err); + } else if (check(result) && !testResult) { + testPassed = true; + testResult = getResult(true, value); + callback(null, _breakLoop2.default); + } else { + callback(); + } + }); + }, function (err) { + if (err) { + cb(err); + } else { + cb(null, testPassed ? testResult : getResult(false)); + } + }); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/doLimit.js b/live2d/node_modules/async/internal/doLimit.js new file mode 100644 index 0000000..963c608 --- /dev/null +++ b/live2d/node_modules/async/internal/doLimit.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = doLimit; +function doLimit(fn, limit) { + return function (iterable, iteratee, callback) { + return fn(iterable, limit, iteratee, callback); + }; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/doParallel.js b/live2d/node_modules/async/internal/doParallel.js new file mode 100644 index 0000000..bb40207 --- /dev/null +++ b/live2d/node_modules/async/internal/doParallel.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = doParallel; + +var _eachOf = require('../eachOf'); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function doParallel(fn) { + return function (obj, iteratee, callback) { + return fn(_eachOf2.default, obj, (0, _wrapAsync2.default)(iteratee), callback); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/doParallelLimit.js b/live2d/node_modules/async/internal/doParallelLimit.js new file mode 100644 index 0000000..a7e963d --- /dev/null +++ b/live2d/node_modules/async/internal/doParallelLimit.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = doParallelLimit; + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function doParallelLimit(fn) { + return function (obj, limit, iteratee, callback) { + return fn((0, _eachOfLimit2.default)(limit), obj, (0, _wrapAsync2.default)(iteratee), callback); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/eachOfLimit.js b/live2d/node_modules/async/internal/eachOfLimit.js new file mode 100644 index 0000000..6f6fe55 --- /dev/null +++ b/live2d/node_modules/async/internal/eachOfLimit.js @@ -0,0 +1,74 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _eachOfLimit; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./once'); + +var _once2 = _interopRequireDefault(_once); + +var _iterator = require('./iterator'); + +var _iterator2 = _interopRequireDefault(_iterator); + +var _onlyOnce = require('./onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _breakLoop = require('./breakLoop'); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _eachOfLimit(limit) { + return function (obj, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + if (limit <= 0 || !obj) { + return callback(null); + } + var nextElem = (0, _iterator2.default)(obj); + var done = false; + var running = 0; + var looping = false; + + function iterateeCallback(err, value) { + running -= 1; + if (err) { + done = true; + callback(err); + } else if (value === _breakLoop2.default || done && running <= 0) { + done = true; + return callback(null); + } else if (!looping) { + replenish(); + } + } + + function replenish() { + looping = true; + while (running < limit && !done) { + var elem = nextElem(); + if (elem === null) { + done = true; + if (running <= 0) { + callback(null); + } + return; + } + running += 1; + iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback)); + } + looping = false; + } + + replenish(); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/filter.js b/live2d/node_modules/async/internal/filter.js new file mode 100644 index 0000000..74f3986 --- /dev/null +++ b/live2d/node_modules/async/internal/filter.js @@ -0,0 +1,75 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _filter; + +var _arrayMap = require('lodash/_arrayMap'); + +var _arrayMap2 = _interopRequireDefault(_arrayMap); + +var _isArrayLike = require('lodash/isArrayLike'); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _baseProperty = require('lodash/_baseProperty'); + +var _baseProperty2 = _interopRequireDefault(_baseProperty); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function filterArray(eachfn, arr, iteratee, callback) { + var truthValues = new Array(arr.length); + eachfn(arr, function (x, index, callback) { + iteratee(x, function (err, v) { + truthValues[index] = !!v; + callback(err); + }); + }, function (err) { + if (err) return callback(err); + var results = []; + for (var i = 0; i < arr.length; i++) { + if (truthValues[i]) results.push(arr[i]); + } + callback(null, results); + }); +} + +function filterGeneric(eachfn, coll, iteratee, callback) { + var results = []; + eachfn(coll, function (x, index, callback) { + iteratee(x, function (err, v) { + if (err) { + callback(err); + } else { + if (v) { + results.push({ index: index, value: x }); + } + callback(); + } + }); + }, function (err) { + if (err) { + callback(err); + } else { + callback(null, (0, _arrayMap2.default)(results.sort(function (a, b) { + return a.index - b.index; + }), (0, _baseProperty2.default)('value'))); + } + }); +} + +function _filter(eachfn, coll, iteratee, callback) { + var filter = (0, _isArrayLike2.default)(coll) ? filterArray : filterGeneric; + filter(eachfn, coll, (0, _wrapAsync2.default)(iteratee), callback || _noop2.default); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/findGetResult.js b/live2d/node_modules/async/internal/findGetResult.js new file mode 100644 index 0000000..f8d3fe0 --- /dev/null +++ b/live2d/node_modules/async/internal/findGetResult.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _findGetResult; +function _findGetResult(v, x) { + return x; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/getIterator.js b/live2d/node_modules/async/internal/getIterator.js new file mode 100644 index 0000000..3eadd24 --- /dev/null +++ b/live2d/node_modules/async/internal/getIterator.js @@ -0,0 +1,13 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (coll) { + return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol](); +}; + +var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator; + +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/initialParams.js b/live2d/node_modules/async/internal/initialParams.js new file mode 100644 index 0000000..df02cb1 --- /dev/null +++ b/live2d/node_modules/async/internal/initialParams.js @@ -0,0 +1,21 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (fn) { + return function () /*...args, callback*/{ + var args = (0, _slice2.default)(arguments); + var callback = args.pop(); + fn.call(this, args, callback); + }; +}; + +var _slice = require('./slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/iterator.js b/live2d/node_modules/async/internal/iterator.js new file mode 100644 index 0000000..886beb5 --- /dev/null +++ b/live2d/node_modules/async/internal/iterator.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = iterator; + +var _isArrayLike = require('lodash/isArrayLike'); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _getIterator = require('./getIterator'); + +var _getIterator2 = _interopRequireDefault(_getIterator); + +var _keys = require('lodash/keys'); + +var _keys2 = _interopRequireDefault(_keys); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createArrayIterator(coll) { + var i = -1; + var len = coll.length; + return function next() { + return ++i < len ? { value: coll[i], key: i } : null; + }; +} + +function createES2015Iterator(iterator) { + var i = -1; + return function next() { + var item = iterator.next(); + if (item.done) return null; + i++; + return { value: item.value, key: i }; + }; +} + +function createObjectIterator(obj) { + var okeys = (0, _keys2.default)(obj); + var i = -1; + var len = okeys.length; + return function next() { + var key = okeys[++i]; + if (key === '__proto__') { + return next(); + } + return i < len ? { value: obj[key], key: key } : null; + }; +} + +function iterator(coll) { + if ((0, _isArrayLike2.default)(coll)) { + return createArrayIterator(coll); + } + + var iterator = (0, _getIterator2.default)(coll); + return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/map.js b/live2d/node_modules/async/internal/map.js new file mode 100644 index 0000000..f4f2aa5 --- /dev/null +++ b/live2d/node_modules/async/internal/map.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _asyncMap; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _asyncMap(eachfn, arr, iteratee, callback) { + callback = callback || _noop2.default; + arr = arr || []; + var results = []; + var counter = 0; + var _iteratee = (0, _wrapAsync2.default)(iteratee); + + eachfn(arr, function (value, _, callback) { + var index = counter++; + _iteratee(value, function (err, v) { + results[index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/notId.js b/live2d/node_modules/async/internal/notId.js new file mode 100644 index 0000000..0106c92 --- /dev/null +++ b/live2d/node_modules/async/internal/notId.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = notId; +function notId(v) { + return !v; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/once.js b/live2d/node_modules/async/internal/once.js new file mode 100644 index 0000000..f0c379f --- /dev/null +++ b/live2d/node_modules/async/internal/once.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = once; +function once(fn) { + return function () { + if (fn === null) return; + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/onlyOnce.js b/live2d/node_modules/async/internal/onlyOnce.js new file mode 100644 index 0000000..f2e3001 --- /dev/null +++ b/live2d/node_modules/async/internal/onlyOnce.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = onlyOnce; +function onlyOnce(fn) { + return function () { + if (fn === null) throw new Error("Callback was already called."); + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/parallel.js b/live2d/node_modules/async/internal/parallel.js new file mode 100644 index 0000000..c97293b --- /dev/null +++ b/live2d/node_modules/async/internal/parallel.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _parallel; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _isArrayLike = require('lodash/isArrayLike'); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _slice = require('./slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _parallel(eachfn, tasks, callback) { + callback = callback || _noop2.default; + var results = (0, _isArrayLike2.default)(tasks) ? [] : {}; + + eachfn(tasks, function (task, key, callback) { + (0, _wrapAsync2.default)(task)(function (err, result) { + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); + } + results[key] = result; + callback(err); + }); + }, function (err) { + callback(err, results); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/queue.js b/live2d/node_modules/async/internal/queue.js new file mode 100644 index 0000000..19534a7 --- /dev/null +++ b/live2d/node_modules/async/internal/queue.js @@ -0,0 +1,204 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = queue; + +var _baseIndexOf = require('lodash/_baseIndexOf'); + +var _baseIndexOf2 = _interopRequireDefault(_baseIndexOf); + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _onlyOnce = require('./onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _setImmediate = require('./setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _DoublyLinkedList = require('./DoublyLinkedList'); + +var _DoublyLinkedList2 = _interopRequireDefault(_DoublyLinkedList); + +var _wrapAsync = require('./wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function queue(worker, concurrency, payload) { + if (concurrency == null) { + concurrency = 1; + } else if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var _worker = (0, _wrapAsync2.default)(worker); + var numRunning = 0; + var workersList = []; + + var processingScheduled = false; + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!(0, _isArray2.default)(data)) { + data = [data]; + } + if (data.length === 0 && q.idle()) { + // call drain immediately if there are no tasks + return (0, _setImmediate2.default)(function () { + q.drain(); + }); + } + + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + callback: callback || _noop2.default + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + } + + if (!processingScheduled) { + processingScheduled = true; + (0, _setImmediate2.default)(function () { + processingScheduled = false; + q.process(); + }); + } + } + + function _next(tasks) { + return function (err) { + numRunning -= 1; + + for (var i = 0, l = tasks.length; i < l; i++) { + var task = tasks[i]; + + var index = (0, _baseIndexOf2.default)(workersList, task, 0); + if (index === 0) { + workersList.shift(); + } else if (index > 0) { + workersList.splice(index, 1); + } + + task.callback.apply(task, arguments); + + if (err != null) { + q.error(err, task.data); + } + } + + if (numRunning <= q.concurrency - q.buffer) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + q.process(); + }; + } + + var isProcessing = false; + var q = { + _tasks: new _DoublyLinkedList2.default(), + concurrency: concurrency, + payload: payload, + saturated: _noop2.default, + unsaturated: _noop2.default, + buffer: concurrency / 4, + empty: _noop2.default, + drain: _noop2.default, + error: _noop2.default, + started: false, + paused: false, + push: function (data, callback) { + _insert(data, false, callback); + }, + kill: function () { + q.drain = _noop2.default; + q._tasks.empty(); + }, + unshift: function (data, callback) { + _insert(data, true, callback); + }, + remove: function (testFn) { + q._tasks.remove(testFn); + }, + process: function () { + // Avoid trying to start too many processing operations. This can occur + // when callbacks resolve synchronously (#1267). + if (isProcessing) { + return; + } + isProcessing = true; + while (!q.paused && numRunning < q.concurrency && q._tasks.length) { + var tasks = [], + data = []; + var l = q._tasks.length; + if (q.payload) l = Math.min(l, q.payload); + for (var i = 0; i < l; i++) { + var node = q._tasks.shift(); + tasks.push(node); + workersList.push(node); + data.push(node.data); + } + + numRunning += 1; + + if (q._tasks.length === 0) { + q.empty(); + } + + if (numRunning === q.concurrency) { + q.saturated(); + } + + var cb = (0, _onlyOnce2.default)(_next(tasks)); + _worker(data, cb); + } + isProcessing = false; + }, + length: function () { + return q._tasks.length; + }, + running: function () { + return numRunning; + }, + workersList: function () { + return workersList; + }, + idle: function () { + return q._tasks.length + numRunning === 0; + }, + pause: function () { + q.paused = true; + }, + resume: function () { + if (q.paused === false) { + return; + } + q.paused = false; + (0, _setImmediate2.default)(q.process); + } + }; + return q; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/reject.js b/live2d/node_modules/async/internal/reject.js new file mode 100644 index 0000000..5dbfcfb --- /dev/null +++ b/live2d/node_modules/async/internal/reject.js @@ -0,0 +1,21 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reject; + +var _filter = require('./filter'); + +var _filter2 = _interopRequireDefault(_filter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function reject(eachfn, arr, iteratee, callback) { + (0, _filter2.default)(eachfn, arr, function (value, cb) { + iteratee(value, function (err, v) { + cb(err, !v); + }); + }, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/setImmediate.js b/live2d/node_modules/async/internal/setImmediate.js new file mode 100644 index 0000000..3545f2b --- /dev/null +++ b/live2d/node_modules/async/internal/setImmediate.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.hasNextTick = exports.hasSetImmediate = undefined; +exports.fallback = fallback; +exports.wrap = wrap; + +var _slice = require('./slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate; +var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; + +function fallback(fn) { + setTimeout(fn, 0); +} + +function wrap(defer) { + return function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + defer(function () { + fn.apply(null, args); + }); + }; +} + +var _defer; + +if (hasSetImmediate) { + _defer = setImmediate; +} else if (hasNextTick) { + _defer = process.nextTick; +} else { + _defer = fallback; +} + +exports.default = wrap(_defer); \ No newline at end of file diff --git a/live2d/node_modules/async/internal/slice.js b/live2d/node_modules/async/internal/slice.js new file mode 100644 index 0000000..56f10c0 --- /dev/null +++ b/live2d/node_modules/async/internal/slice.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = slice; +function slice(arrayLike, start) { + start = start | 0; + var newLen = Math.max(arrayLike.length - start, 0); + var newArr = Array(newLen); + for (var idx = 0; idx < newLen; idx++) { + newArr[idx] = arrayLike[start + idx]; + } + return newArr; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/withoutIndex.js b/live2d/node_modules/async/internal/withoutIndex.js new file mode 100644 index 0000000..2bd3579 --- /dev/null +++ b/live2d/node_modules/async/internal/withoutIndex.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _withoutIndex; +function _withoutIndex(iteratee) { + return function (value, index, callback) { + return iteratee(value, callback); + }; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/internal/wrapAsync.js b/live2d/node_modules/async/internal/wrapAsync.js new file mode 100644 index 0000000..bc6c966 --- /dev/null +++ b/live2d/node_modules/async/internal/wrapAsync.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isAsync = undefined; + +var _asyncify = require('../asyncify'); + +var _asyncify2 = _interopRequireDefault(_asyncify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var supportsSymbol = typeof Symbol === 'function'; + +function isAsync(fn) { + return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; +} + +function wrapAsync(asyncFn) { + return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn; +} + +exports.default = wrapAsync; +exports.isAsync = isAsync; \ No newline at end of file diff --git a/live2d/node_modules/async/log.js b/live2d/node_modules/async/log.js new file mode 100644 index 0000000..c643867 --- /dev/null +++ b/live2d/node_modules/async/log.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _consoleFunc = require('./internal/consoleFunc'); + +var _consoleFunc2 = _interopRequireDefault(_consoleFunc); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Logs the result of an `async` function to the `console`. Only works in + * Node.js or in browsers that support `console.log` and `console.error` (such + * as FF and Chrome). If multiple arguments are returned from the async + * function, `console.log` is called on each argument in order. + * + * @name log + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} function - The function you want to eventually apply + * all arguments to. + * @param {...*} arguments... - Any number of arguments to apply to the function. + * @example + * + * // in a module + * var hello = function(name, callback) { + * setTimeout(function() { + * callback(null, 'hello ' + name); + * }, 1000); + * }; + * + * // in the node repl + * node> async.log(hello, 'world'); + * 'hello world' + */ +exports.default = (0, _consoleFunc2.default)('log'); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/map.js b/live2d/node_modules/async/map.js new file mode 100644 index 0000000..67c9cda --- /dev/null +++ b/live2d/node_modules/async/map.js @@ -0,0 +1,54 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _map = require('./internal/map'); + +var _map2 = _interopRequireDefault(_map); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Produces a new collection of values by mapping each value in `coll` through + * the `iteratee` function. The `iteratee` is called with an item from `coll` + * and a callback for when it has finished processing. Each of these callback + * takes 2 arguments: an `error`, and the transformed item from `coll`. If + * `iteratee` passes an error to its callback, the main `callback` (for the + * `map` function) is immediately called with the error. + * + * Note, that since this function applies the `iteratee` to each item in + * parallel, there is no guarantee that the `iteratee` functions will complete + * in order. However, the results array will be in the same order as the + * original `coll`. + * + * If `map` is passed an Object, the results will be an Array. The results + * will roughly be in the order of the original Objects' keys (but this can + * vary across JavaScript engines). + * + * @name map + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an Array of the + * transformed items from the `coll`. Invoked with (err, results). + * @example + * + * async.map(['file1','file2','file3'], fs.stat, function(err, results) { + * // results is now an array of stats for each file + * }); + */ +exports.default = (0, _doParallel2.default)(_map2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/mapLimit.js b/live2d/node_modules/async/mapLimit.js new file mode 100644 index 0000000..c8b60d8 --- /dev/null +++ b/live2d/node_modules/async/mapLimit.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _map = require('./internal/map'); + +var _map2 = _interopRequireDefault(_map); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. + * + * @name mapLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). + */ +exports.default = (0, _doParallelLimit2.default)(_map2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/mapSeries.js b/live2d/node_modules/async/mapSeries.js new file mode 100644 index 0000000..61b42d0 --- /dev/null +++ b/live2d/node_modules/async/mapSeries.js @@ -0,0 +1,36 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapLimit = require('./mapLimit'); + +var _mapLimit2 = _interopRequireDefault(_mapLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. + * + * @name mapSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.map]{@link module:Collections.map} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). + */ +exports.default = (0, _doLimit2.default)(_mapLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/mapValues.js b/live2d/node_modules/async/mapValues.js new file mode 100644 index 0000000..3d838ca --- /dev/null +++ b/live2d/node_modules/async/mapValues.js @@ -0,0 +1,63 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapValuesLimit = require('./mapValuesLimit'); + +var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. + * + * Produces a new Object by mapping each value of `obj` through the `iteratee` + * function. The `iteratee` is called each `value` and `key` from `obj` and a + * callback for when it has finished processing. Each of these callbacks takes + * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` + * passes an error to its callback, the main `callback` (for the `mapValues` + * function) is immediately called with the error. + * + * Note, the order of the keys in the result is not guaranteed. The keys will + * be roughly in the order they complete, (but this is very engine-specific) + * + * @name mapValues + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + * @example + * + * async.mapValues({ + * f1: 'file1', + * f2: 'file2', + * f3: 'file3' + * }, function (file, key, callback) { + * fs.stat(file, callback); + * }, function(err, result) { + * // result is now a map of stats for each file, e.g. + * // { + * // f1: [stats for file1], + * // f2: [stats for file2], + * // f3: [stats for file3] + * // } + * }); + */ + +exports.default = (0, _doLimit2.default)(_mapValuesLimit2.default, Infinity); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/mapValuesLimit.js b/live2d/node_modules/async/mapValuesLimit.js new file mode 100644 index 0000000..912a8b5 --- /dev/null +++ b/live2d/node_modules/async/mapValuesLimit.js @@ -0,0 +1,61 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = mapValuesLimit; + +var _eachOfLimit = require('./eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a + * time. + * + * @name mapValuesLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +function mapValuesLimit(obj, limit, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var newObj = {}; + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _eachOfLimit2.default)(obj, limit, function (val, key, next) { + _iteratee(val, key, function (err, result) { + if (err) return next(err); + newObj[key] = result; + next(); + }); + }, function (err) { + callback(err, newObj); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/mapValuesSeries.js b/live2d/node_modules/async/mapValuesSeries.js new file mode 100644 index 0000000..b378c4a --- /dev/null +++ b/live2d/node_modules/async/mapValuesSeries.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapValuesLimit = require('./mapValuesLimit'); + +var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. + * + * @name mapValuesSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +exports.default = (0, _doLimit2.default)(_mapValuesLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/memoize.js b/live2d/node_modules/async/memoize.js new file mode 100644 index 0000000..1f2b566 --- /dev/null +++ b/live2d/node_modules/async/memoize.js @@ -0,0 +1,101 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = memoize; + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function has(obj, key) { + return key in obj; +} + +/** + * Caches the results of an async function. When creating a hash to store + * function results against, the callback is omitted from the hash and an + * optional hash function can be used. + * + * If no hash function is specified, the first argument is used as a hash key, + * which may work reasonably if it is a string or a data type that converts to a + * distinct string. Note that objects and arrays will not behave reasonably. + * Neither will cases where the other arguments are significant. In such cases, + * specify your own hash function. + * + * The cache of results is exposed as the `memo` property of the function + * returned by `memoize`. + * + * @name memoize + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function to proxy and cache results from. + * @param {Function} hasher - An optional function for generating a custom hash + * for storing results. It has all the arguments applied to it apart from the + * callback, and must be synchronous. + * @returns {AsyncFunction} a memoized version of `fn` + * @example + * + * var slow_fn = function(name, callback) { + * // do something + * callback(null, result); + * }; + * var fn = async.memoize(slow_fn); + * + * // fn can now be used as if it were slow_fn + * fn('some name', function() { + * // callback + * }); + */ +function memoize(fn, hasher) { + var memo = Object.create(null); + var queues = Object.create(null); + hasher = hasher || _identity2.default; + var _fn = (0, _wrapAsync2.default)(fn); + var memoized = (0, _initialParams2.default)(function memoized(args, callback) { + var key = hasher.apply(null, args); + if (has(memo, key)) { + (0, _setImmediate2.default)(function () { + callback.apply(null, memo[key]); + }); + } else if (has(queues, key)) { + queues[key].push(callback); + } else { + queues[key] = [callback]; + _fn.apply(null, args.concat(function () /*args*/{ + var args = (0, _slice2.default)(arguments); + memo[key] = args; + var q = queues[key]; + delete queues[key]; + for (var i = 0, l = q.length; i < l; i++) { + q[i].apply(null, args); + } + })); + } + }); + memoized.memo = memo; + memoized.unmemoized = fn; + return memoized; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/nextTick.js b/live2d/node_modules/async/nextTick.js new file mode 100644 index 0000000..886f58e --- /dev/null +++ b/live2d/node_modules/async/nextTick.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _setImmediate = require('./internal/setImmediate'); + +/** + * Calls `callback` on a later loop around the event loop. In Node.js this just + * calls `process.nextTick`. In the browser it will use `setImmediate` if + * available, otherwise `setTimeout(callback, 0)`, which means other higher + * priority events may precede the execution of `callback`. + * + * This is used internally for browser-compatibility purposes. + * + * @name nextTick + * @static + * @memberOf module:Utils + * @method + * @see [async.setImmediate]{@link module:Utils.setImmediate} + * @category Util + * @param {Function} callback - The function to call on a later loop around + * the event loop. Invoked with (args...). + * @param {...*} args... - any number of additional arguments to pass to the + * callback on the next tick. + * @example + * + * var call_order = []; + * async.nextTick(function() { + * call_order.push('two'); + * // call_order now equals ['one','two'] + * }); + * call_order.push('one'); + * + * async.setImmediate(function (a, b, c) { + * // a, b, and c equal 1, 2, and 3 + * }, 1, 2, 3); + */ +var _defer; + +if (_setImmediate.hasNextTick) { + _defer = process.nextTick; +} else if (_setImmediate.hasSetImmediate) { + _defer = setImmediate; +} else { + _defer = _setImmediate.fallback; +} + +exports.default = (0, _setImmediate.wrap)(_defer); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/package.json b/live2d/node_modules/async/package.json new file mode 100644 index 0000000..76b3db7 --- /dev/null +++ b/live2d/node_modules/async/package.json @@ -0,0 +1,80 @@ +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "version": "2.6.4", + "main": "dist/async.js", + "author": "Caolan McMahon", + "homepage": "https://caolan.github.io/async/", + "repository": { + "type": "git", + "url": "https://github.com/caolan/async.git" + }, + "bugs": { + "url": "https://github.com/caolan/async/issues" + }, + "keywords": [ + "async", + "callback", + "module", + "utility" + ], + "dependencies": { + "lodash": "^4.17.14" + }, + "devDependencies": { + "babel-cli": "^6.24.0", + "babel-core": "^6.26.3", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-istanbul": "^2.0.1", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", + "babel-preset-es2015": "^6.3.13", + "babel-preset-es2017": "^6.22.0", + "babelify": "^8.0.0", + "benchmark": "^2.1.1", + "bluebird": "^3.4.6", + "browserify": "^16.2.2", + "chai": "^4.1.2", + "cheerio": "^0.22.0", + "coveralls": "^3.0.1", + "es6-promise": "^2.3.0", + "eslint": "^2.13.1", + "fs-extra": "^0.26.7", + "gh-pages-deploy": "^0.5.0", + "jsdoc": "^3.4.0", + "karma": "^2.0.2", + "karma-browserify": "^5.2.0", + "karma-firefox-launcher": "^1.1.0", + "karma-mocha": "^1.2.0", + "karma-mocha-reporter": "^2.2.0", + "mocha": "^5.2.0", + "native-promise-only": "^0.8.0-a", + "nyc": "^11.8.0", + "rimraf": "^2.5.0", + "rollup": "^0.36.3", + "rollup-plugin-node-resolve": "^2.0.0", + "rollup-plugin-npm": "^2.0.0", + "rsvp": "^3.0.18", + "semver": "^5.5.0", + "uglify-js": "~2.7.3", + "yargs": "^11.0.0" + }, + "scripts": { + "coverage": "nyc npm run mocha-node-test -- --grep @nycinvalid --invert", + "coveralls": "npm run coverage && nyc report --reporter=text-lcov | coveralls", + "jsdoc": "jsdoc -c ./support/jsdoc/jsdoc.json && node support/jsdoc/jsdoc-fix-html.js", + "lint": "eslint lib/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/build/ support/*.js karma.conf.js", + "mocha-browser-test": "karma start", + "mocha-node-test": "mocha mocha_test/ --compilers js:babel-core/register", + "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test", + "test": "npm run lint && npm run mocha-node-test" + }, + "license": "MIT", + "gh-pages-deploy": { + "staticpath": "docs" + }, + "nyc": { + "exclude": [ + "mocha_test" + ] + } +} \ No newline at end of file diff --git a/live2d/node_modules/async/parallel.js b/live2d/node_modules/async/parallel.js new file mode 100644 index 0000000..da28a4d --- /dev/null +++ b/live2d/node_modules/async/parallel.js @@ -0,0 +1,90 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = parallelLimit; + +var _eachOf = require('./eachOf'); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _parallel = require('./internal/parallel'); + +var _parallel2 = _interopRequireDefault(_parallel); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Run the `tasks` collection of functions in parallel, without waiting until + * the previous function has completed. If any of the functions pass an error to + * its callback, the main `callback` is immediately called with the value of the + * error. Once the `tasks` have completed, the results are passed to the final + * `callback` as an array. + * + * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about + * parallel execution of code. If your tasks do not use any timers or perform + * any I/O, they will actually be executed in series. Any synchronous setup + * sections for each task will happen one after the other. JavaScript remains + * single-threaded. + * + * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the + * execution of other tasks when a task fails. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.parallel}. + * + * @name parallel + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + * + * @example + * async.parallel([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // optional callback + * function(err, results) { + * // the results array will equal ['one','two'] even though + * // the second function had a shorter timeout. + * }); + * + * // an example using an object instead of an array + * async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equals to: {one: 1, two: 2} + * }); + */ +function parallelLimit(tasks, callback) { + (0, _parallel2.default)(_eachOf2.default, tasks, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/parallelLimit.js b/live2d/node_modules/async/parallelLimit.js new file mode 100644 index 0000000..a026526 --- /dev/null +++ b/live2d/node_modules/async/parallelLimit.js @@ -0,0 +1,40 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = parallelLimit; + +var _eachOfLimit = require('./internal/eachOfLimit'); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _parallel = require('./internal/parallel'); + +var _parallel2 = _interopRequireDefault(_parallel); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a + * time. + * + * @name parallelLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.parallel]{@link module:ControlFlow.parallel} + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + */ +function parallelLimit(tasks, limit, callback) { + (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/priorityQueue.js b/live2d/node_modules/async/priorityQueue.js new file mode 100644 index 0000000..3a5f023 --- /dev/null +++ b/live2d/node_modules/async/priorityQueue.js @@ -0,0 +1,98 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (worker, concurrency) { + // Start with a normal queue + var q = (0, _queue2.default)(worker, concurrency); + + // Override push to accept second parameter representing priority + q.push = function (data, priority, callback) { + if (callback == null) callback = _noop2.default; + if (typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!(0, _isArray2.default)(data)) { + data = [data]; + } + if (data.length === 0) { + // call drain immediately if there are no tasks + return (0, _setImmediate2.default)(function () { + q.drain(); + }); + } + + priority = priority || 0; + var nextNode = q._tasks.head; + while (nextNode && priority >= nextNode.priority) { + nextNode = nextNode.next; + } + + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + priority: priority, + callback: callback + }; + + if (nextNode) { + q._tasks.insertBefore(nextNode, item); + } else { + q._tasks.push(item); + } + } + (0, _setImmediate2.default)(q.process); + }; + + // Remove unshift function + delete q.unshift; + + return q; +}; + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _setImmediate = require('./setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _queue = require('./queue'); + +var _queue2 = _interopRequireDefault(_queue); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; + +/** + * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and + * completed in ascending priority order. + * + * @name priorityQueue + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. + * Invoked with (task, callback). + * @param {number} concurrency - An `integer` for determining how many `worker` + * functions should be run in parallel. If omitted, the concurrency defaults to + * `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two + * differences between `queue` and `priorityQueue` objects: + * * `push(task, priority, [callback])` - `priority` should be a number. If an + * array of `tasks` is given, all tasks will be assigned the same priority. + * * The `unshift` method was removed. + */ \ No newline at end of file diff --git a/live2d/node_modules/async/queue.js b/live2d/node_modules/async/queue.js new file mode 100644 index 0000000..0ca8ba2 --- /dev/null +++ b/live2d/node_modules/async/queue.js @@ -0,0 +1,130 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (worker, concurrency) { + var _worker = (0, _wrapAsync2.default)(worker); + return (0, _queue2.default)(function (items, cb) { + _worker(items[0], cb); + }, concurrency, 1); +}; + +var _queue = require('./internal/queue'); + +var _queue2 = _interopRequireDefault(_queue); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; + +/** + * A queue of tasks for the worker function to complete. + * @typedef {Object} QueueObject + * @memberOf module:ControlFlow + * @property {Function} length - a function returning the number of items + * waiting to be processed. Invoke with `queue.length()`. + * @property {boolean} started - a boolean indicating whether or not any + * items have been pushed and processed by the queue. + * @property {Function} running - a function returning the number of items + * currently being processed. Invoke with `queue.running()`. + * @property {Function} workersList - a function returning the array of items + * currently being processed. Invoke with `queue.workersList()`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke with `queue.idle()`. + * @property {number} concurrency - an integer for determining how many `worker` + * functions should be run in parallel. This property can be changed after a + * `queue` is created to alter the concurrency on-the-fly. + * @property {Function} push - add a new task to the `queue`. Calls `callback` + * once the `worker` has finished processing the task. Instead of a single task, + * a `tasks` array can be submitted. The respective callback is used for every + * task in the list. Invoke with `queue.push(task, [callback])`, + * @property {Function} unshift - add a new task to the front of the `queue`. + * Invoke with `queue.unshift(task, [callback])`. + * @property {Function} remove - remove items from the queue that match a test + * function. The test function will be passed an object with a `data` property, + * and a `priority` property, if this is a + * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. + * Invoked with `queue.remove(testFn)`, where `testFn` is of the form + * `function ({data, priority}) {}` and returns a Boolean. + * @property {Function} saturated - a callback that is called when the number of + * running workers hits the `concurrency` limit, and further tasks will be + * queued. + * @property {Function} unsaturated - a callback that is called when the number + * of running workers is less than the `concurrency` & `buffer` limits, and + * further tasks will not be queued. + * @property {number} buffer - A minimum threshold buffer in order to say that + * the `queue` is `unsaturated`. + * @property {Function} empty - a callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - a callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} error - a callback that is called when a task errors. + * Has the signature `function(error, task)`. + * @property {boolean} paused - a boolean for determining whether the queue is + * in a paused state. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke with `queue.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke with `queue.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. No more tasks + * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. + */ + +/** + * Creates a `queue` object with the specified `concurrency`. Tasks added to the + * `queue` are processed in parallel (up to the `concurrency` limit). If all + * `worker`s are in progress, the task is queued until one becomes available. + * Once a `worker` completes a `task`, that `task`'s callback is called. + * + * @name queue + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. Invoked with (task, callback). + * @param {number} [concurrency=1] - An `integer` for determining how many + * `worker` functions should be run in parallel. If omitted, the concurrency + * defaults to `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the queue. + * @example + * + * // create a queue object with concurrency 2 + * var q = async.queue(function(task, callback) { + * console.log('hello ' + task.name); + * callback(); + * }, 2); + * + * // assign a callback + * q.drain = function() { + * console.log('all items have been processed'); + * }; + * + * // add some items to the queue + * q.push({name: 'foo'}, function(err) { + * console.log('finished processing foo'); + * }); + * q.push({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + * + * // add some items to the queue (batch-wise) + * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { + * console.log('finished processing item'); + * }); + * + * // add some items to the front of the queue + * q.unshift({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + */ \ No newline at end of file diff --git a/live2d/node_modules/async/race.js b/live2d/node_modules/async/race.js new file mode 100644 index 0000000..6713c74 --- /dev/null +++ b/live2d/node_modules/async/race.js @@ -0,0 +1,70 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = race; + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Runs the `tasks` array of functions in parallel, without waiting until the + * previous function has completed. Once any of the `tasks` complete or pass an + * error to its callback, the main `callback` is immediately called. It's + * equivalent to `Promise.race()`. + * + * @name race + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} + * to run. Each function can complete with an optional `result` value. + * @param {Function} callback - A callback to run once any of the functions have + * completed. This function gets an error or result from the first function that + * completed. Invoked with (err, result). + * @returns undefined + * @example + * + * async.race([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // main callback + * function(err, result) { + * // the result will be equal to 'two' as it finishes earlier + * }); + */ +function race(tasks, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + if (!(0, _isArray2.default)(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); + if (!tasks.length) return callback(); + for (var i = 0, l = tasks.length; i < l; i++) { + (0, _wrapAsync2.default)(tasks[i])(callback); + } +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/reduce.js b/live2d/node_modules/async/reduce.js new file mode 100644 index 0000000..3fb8019 --- /dev/null +++ b/live2d/node_modules/async/reduce.js @@ -0,0 +1,78 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reduce; + +var _eachOfSeries = require('./eachOfSeries'); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Reduces `coll` into a single value using an async `iteratee` to return each + * successive step. `memo` is the initial state of the reduction. This function + * only operates in series. + * + * For performance reasons, it may make sense to split a call to this function + * into a parallel map, and then use the normal `Array.prototype.reduce` on the + * results. This function is for situations where each step in the reduction + * needs to be async; if you can get the data before reducing it, then it's + * probably a good idea to do so. + * + * @name reduce + * @static + * @memberOf module:Collections + * @method + * @alias inject + * @alias foldl + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + * @example + * + * async.reduce([1,2,3], 0, function(memo, item, callback) { + * // pointless async: + * process.nextTick(function() { + * callback(null, memo + item) + * }); + * }, function(err, result) { + * // result is now equal to the last value of memo, which is 6 + * }); + */ +function reduce(coll, memo, iteratee, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _eachOfSeries2.default)(coll, function (x, i, callback) { + _iteratee(memo, x, function (err, v) { + memo = v; + callback(err); + }); + }, function (err) { + callback(err, memo); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/reduceRight.js b/live2d/node_modules/async/reduceRight.js new file mode 100644 index 0000000..3d17d32 --- /dev/null +++ b/live2d/node_modules/async/reduceRight.js @@ -0,0 +1,44 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reduceRight; + +var _reduce = require('./reduce'); + +var _reduce2 = _interopRequireDefault(_reduce); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. + * + * @name reduceRight + * @static + * @memberOf module:Collections + * @method + * @see [async.reduce]{@link module:Collections.reduce} + * @alias foldr + * @category Collection + * @param {Array} array - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + */ +function reduceRight(array, memo, iteratee, callback) { + var reversed = (0, _slice2.default)(array).reverse(); + (0, _reduce2.default)(reversed, memo, iteratee, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/reflect.js b/live2d/node_modules/async/reflect.js new file mode 100644 index 0000000..098ba86 --- /dev/null +++ b/live2d/node_modules/async/reflect.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reflect; + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Wraps the async function in another function that always completes with a + * result object, even when it errors. + * + * The result object has either the property `error` or `value`. + * + * @name reflect + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function you want to wrap + * @returns {Function} - A function that always passes null to it's callback as + * the error. The second argument to the callback will be an `object` with + * either an `error` or a `value` property. + * @example + * + * async.parallel([ + * async.reflect(function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }), + * async.reflect(function(callback) { + * // do some more stuff but error ... + * callback('bad stuff happened'); + * }), + * async.reflect(function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * }) + * ], + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = 'bad stuff happened' + * // results[2].value = 'two' + * }); + */ +function reflect(fn) { + var _fn = (0, _wrapAsync2.default)(fn); + return (0, _initialParams2.default)(function reflectOn(args, reflectCallback) { + args.push(function callback(error, cbArg) { + if (error) { + reflectCallback(null, { error: error }); + } else { + var value; + if (arguments.length <= 2) { + value = cbArg; + } else { + value = (0, _slice2.default)(arguments, 1); + } + reflectCallback(null, { value: value }); + } + }); + + return _fn.apply(this, args); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/reflectAll.js b/live2d/node_modules/async/reflectAll.js new file mode 100644 index 0000000..966e83d --- /dev/null +++ b/live2d/node_modules/async/reflectAll.js @@ -0,0 +1,105 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = reflectAll; + +var _reflect = require('./reflect'); + +var _reflect2 = _interopRequireDefault(_reflect); + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _arrayMap2 = require('lodash/_arrayMap'); + +var _arrayMap3 = _interopRequireDefault(_arrayMap2); + +var _baseForOwn = require('lodash/_baseForOwn'); + +var _baseForOwn2 = _interopRequireDefault(_baseForOwn); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * A helper function that wraps an array or an object of functions with `reflect`. + * + * @name reflectAll + * @static + * @memberOf module:Utils + * @method + * @see [async.reflect]{@link module:Utils.reflect} + * @category Util + * @param {Array|Object|Iterable} tasks - The collection of + * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. + * @returns {Array} Returns an array of async functions, each wrapped in + * `async.reflect` + * @example + * + * let tasks = [ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * // do some more stuff but error ... + * callback(new Error('bad stuff happened')); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = Error('bad stuff happened') + * // results[2].value = 'two' + * }); + * + * // an example using an object instead of an array + * let tasks = { + * one: function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * two: function(callback) { + * callback('two'); + * }, + * three: function(callback) { + * setTimeout(function() { + * callback(null, 'three'); + * }, 100); + * } + * }; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results.one.value = 'one' + * // results.two.error = 'two' + * // results.three.value = 'three' + * }); + */ +function reflectAll(tasks) { + var results; + if ((0, _isArray2.default)(tasks)) { + results = (0, _arrayMap3.default)(tasks, _reflect2.default); + } else { + results = {}; + (0, _baseForOwn2.default)(tasks, function (task, key) { + results[key] = _reflect2.default.call(this, task); + }); + } + return results; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/reject.js b/live2d/node_modules/async/reject.js new file mode 100644 index 0000000..53802b5 --- /dev/null +++ b/live2d/node_modules/async/reject.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _reject = require('./internal/reject'); + +var _reject2 = _interopRequireDefault(_reject); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. + * + * @name reject + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.reject(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of missing files + * createFiles(results); + * }); + */ +exports.default = (0, _doParallel2.default)(_reject2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/rejectLimit.js b/live2d/node_modules/async/rejectLimit.js new file mode 100644 index 0000000..74bba7f --- /dev/null +++ b/live2d/node_modules/async/rejectLimit.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _reject = require('./internal/reject'); + +var _reject2 = _interopRequireDefault(_reject); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a + * time. + * + * @name rejectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +exports.default = (0, _doParallelLimit2.default)(_reject2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/rejectSeries.js b/live2d/node_modules/async/rejectSeries.js new file mode 100644 index 0000000..f905588 --- /dev/null +++ b/live2d/node_modules/async/rejectSeries.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _rejectLimit = require('./rejectLimit'); + +var _rejectLimit2 = _interopRequireDefault(_rejectLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. + * + * @name rejectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +exports.default = (0, _doLimit2.default)(_rejectLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/retry.js b/live2d/node_modules/async/retry.js new file mode 100644 index 0000000..6a1aa1e --- /dev/null +++ b/live2d/node_modules/async/retry.js @@ -0,0 +1,156 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = retry; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _constant = require('lodash/constant'); + +var _constant2 = _interopRequireDefault(_constant); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Attempts to get a successful response from `task` no more than `times` times + * before returning an error. If the task is successful, the `callback` will be + * passed the result of the successful task. If all attempts fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name retry + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @see [async.retryable]{@link module:ControlFlow.retryable} + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an + * object with `times` and `interval` or a number. + * * `times` - The number of attempts to make before giving up. The default + * is `5`. + * * `interval` - The time to wait between retries, in milliseconds. The + * default is `0`. The interval may also be specified as a function of the + * retry count (see example). + * * `errorFilter` - An optional synchronous function that is invoked on + * erroneous result. If it returns `true` the retry attempts will continue; + * if the function returns `false` the retry flow is aborted with the current + * attempt's error and result being returned to the final callback. + * Invoked with (err). + * * If `opts` is a number, the number specifies the number of times to retry, + * with the default interval of `0`. + * @param {AsyncFunction} task - An async function to retry. + * Invoked with (callback). + * @param {Function} [callback] - An optional callback which is called when the + * task has succeeded, or after the final failed attempt. It receives the `err` + * and `result` arguments of the last attempt at completing the `task`. Invoked + * with (err, results). + * + * @example + * + * // The `retry` function can be used as a stand-alone control flow by passing + * // a callback, as shown below: + * + * // try calling apiMethod 3 times + * async.retry(3, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 3 times, waiting 200 ms between each retry + * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 10 times with exponential backoff + * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) + * async.retry({ + * times: 10, + * interval: function(retryCount) { + * return 50 * Math.pow(2, retryCount); + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod the default 5 times no delay between each retry + * async.retry(apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod only when error condition satisfies, all other + * // errors will abort the retry control flow and return to final callback + * async.retry({ + * errorFilter: function(err) { + * return err.message === 'Temporary error'; // only retry on a specific error + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // to retry individual methods that are not as reliable within other + * // control flow functions, use the `retryable` wrapper: + * async.auto({ + * users: api.getUsers.bind(api), + * payments: async.retryable(3, api.getPayments.bind(api)) + * }, function(err, results) { + * // do something with the results + * }); + * + */ +function retry(opts, task, callback) { + var DEFAULT_TIMES = 5; + var DEFAULT_INTERVAL = 0; + + var options = { + times: DEFAULT_TIMES, + intervalFunc: (0, _constant2.default)(DEFAULT_INTERVAL) + }; + + function parseTimes(acc, t) { + if (typeof t === 'object') { + acc.times = +t.times || DEFAULT_TIMES; + + acc.intervalFunc = typeof t.interval === 'function' ? t.interval : (0, _constant2.default)(+t.interval || DEFAULT_INTERVAL); + + acc.errorFilter = t.errorFilter; + } else if (typeof t === 'number' || typeof t === 'string') { + acc.times = +t || DEFAULT_TIMES; + } else { + throw new Error("Invalid arguments for async.retry"); + } + } + + if (arguments.length < 3 && typeof opts === 'function') { + callback = task || _noop2.default; + task = opts; + } else { + parseTimes(options, opts); + callback = callback || _noop2.default; + } + + if (typeof task !== 'function') { + throw new Error("Invalid arguments for async.retry"); + } + + var _task = (0, _wrapAsync2.default)(task); + + var attempt = 1; + function retryAttempt() { + _task(function (err) { + if (err && attempt++ < options.times && (typeof options.errorFilter != 'function' || options.errorFilter(err))) { + setTimeout(retryAttempt, options.intervalFunc(attempt)); + } else { + callback.apply(null, arguments); + } + }); + } + + retryAttempt(); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/retryable.js b/live2d/node_modules/async/retryable.js new file mode 100644 index 0000000..002bfb0 --- /dev/null +++ b/live2d/node_modules/async/retryable.js @@ -0,0 +1,65 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (opts, task) { + if (!task) { + task = opts; + opts = null; + } + var _task = (0, _wrapAsync2.default)(task); + return (0, _initialParams2.default)(function (args, callback) { + function taskFn(cb) { + _task.apply(null, args.concat(cb)); + } + + if (opts) (0, _retry2.default)(opts, taskFn, callback);else (0, _retry2.default)(taskFn, callback); + }); +}; + +var _retry = require('./retry'); + +var _retry2 = _interopRequireDefault(_retry); + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; + +/** + * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method + * wraps a task and makes it retryable, rather than immediately calling it + * with retries. + * + * @name retryable + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.retry]{@link module:ControlFlow.retry} + * @category Control Flow + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional + * options, exactly the same as from `retry` + * @param {AsyncFunction} task - the asynchronous function to wrap. + * This function will be passed any arguments passed to the returned wrapper. + * Invoked with (...args, callback). + * @returns {AsyncFunction} The wrapped function, which when invoked, will + * retry on an error, based on the parameters specified in `opts`. + * This function will accept the same parameters as `task`. + * @example + * + * async.auto({ + * dep1: async.retryable(3, getFromFlakyService), + * process: ["dep1", async.retryable(3, function (results, cb) { + * maybeProcessData(results.dep1, cb); + * })] + * }, callback); + */ \ No newline at end of file diff --git a/live2d/node_modules/async/select.js b/live2d/node_modules/async/select.js new file mode 100644 index 0000000..54772d5 --- /dev/null +++ b/live2d/node_modules/async/select.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filter = require('./internal/filter'); + +var _filter2 = _interopRequireDefault(_filter); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns a new array of all the values in `coll` which pass an async truth + * test. This operation is performed in parallel, but the results array will be + * in the same order as the original. + * + * @name filter + * @static + * @memberOf module:Collections + * @method + * @alias select + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.filter(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of the existing files + * }); + */ +exports.default = (0, _doParallel2.default)(_filter2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/selectLimit.js b/live2d/node_modules/async/selectLimit.js new file mode 100644 index 0000000..06216f7 --- /dev/null +++ b/live2d/node_modules/async/selectLimit.js @@ -0,0 +1,37 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filter = require('./internal/filter'); + +var _filter2 = _interopRequireDefault(_filter); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a + * time. + * + * @name filterLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +exports.default = (0, _doParallelLimit2.default)(_filter2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/selectSeries.js b/live2d/node_modules/async/selectSeries.js new file mode 100644 index 0000000..e48d966 --- /dev/null +++ b/live2d/node_modules/async/selectSeries.js @@ -0,0 +1,35 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _filterLimit = require('./filterLimit'); + +var _filterLimit2 = _interopRequireDefault(_filterLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. + * + * @name filterSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results) + */ +exports.default = (0, _doLimit2.default)(_filterLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/seq.js b/live2d/node_modules/async/seq.js new file mode 100644 index 0000000..ff86ef9 --- /dev/null +++ b/live2d/node_modules/async/seq.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = seq; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _reduce = require('./reduce'); + +var _reduce2 = _interopRequireDefault(_reduce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _arrayMap = require('lodash/_arrayMap'); + +var _arrayMap2 = _interopRequireDefault(_arrayMap); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Version of the compose function that is more natural to read. Each function + * consumes the return value of the previous function. It is the equivalent of + * [compose]{@link module:ControlFlow.compose} with the arguments reversed. + * + * Each function is executed with the `this` binding of the composed function. + * + * @name seq + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.compose]{@link module:ControlFlow.compose} + * @category Control Flow + * @param {...AsyncFunction} functions - the asynchronous functions to compose + * @returns {Function} a function that composes the `functions` in order + * @example + * + * // Requires lodash (or underscore), express3 and dresende's orm2. + * // Part of an app, that fetches cats of the logged user. + * // This example uses `seq` function to avoid overnesting and error + * // handling clutter. + * app.get('/cats', function(request, response) { + * var User = request.models.User; + * async.seq( + * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) + * function(user, fn) { + * user.getCats(fn); // 'getCats' has signature (callback(err, data)) + * } + * )(req.session.user_id, function (err, cats) { + * if (err) { + * console.error(err); + * response.json({ status: 'error', message: err.message }); + * } else { + * response.json({ status: 'ok', message: 'Cats found', data: cats }); + * } + * }); + * }); + */ +function seq() /*...functions*/{ + var _functions = (0, _arrayMap2.default)(arguments, _wrapAsync2.default); + return function () /*...args*/{ + var args = (0, _slice2.default)(arguments); + var that = this; + + var cb = args[args.length - 1]; + if (typeof cb == 'function') { + args.pop(); + } else { + cb = _noop2.default; + } + + (0, _reduce2.default)(_functions, args, function (newargs, fn, cb) { + fn.apply(that, newargs.concat(function (err /*, ...nextargs*/) { + var nextargs = (0, _slice2.default)(arguments, 1); + cb(err, nextargs); + })); + }, function (err, results) { + cb.apply(that, [err].concat(results)); + }); + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/series.js b/live2d/node_modules/async/series.js new file mode 100644 index 0000000..e8c2928 --- /dev/null +++ b/live2d/node_modules/async/series.js @@ -0,0 +1,85 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = series; + +var _parallel = require('./internal/parallel'); + +var _parallel2 = _interopRequireDefault(_parallel); + +var _eachOfSeries = require('./eachOfSeries'); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Run the functions in the `tasks` collection in series, each one running once + * the previous function has completed. If any functions in the series pass an + * error to its callback, no more functions are run, and `callback` is + * immediately called with the value of the error. Otherwise, `callback` + * receives an array of results when `tasks` have completed. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function, and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.series}. + * + * **Note** that while many implementations preserve the order of object + * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) + * explicitly states that + * + * > The mechanics and order of enumerating the properties is not specified. + * + * So if you rely on the order in which your series of functions are executed, + * and want this to work on all platforms, consider using an array. + * + * @name series + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing + * [async functions]{@link AsyncFunction} to run in series. + * Each function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This function gets a results array (or object) + * containing all the result arguments passed to the `task` callbacks. Invoked + * with (err, result). + * @example + * async.series([ + * function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }, + * function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * } + * ], + * // optional callback + * function(err, results) { + * // results is now equal to ['one', 'two'] + * }); + * + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback){ + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equal to: {one: 1, two: 2} + * }); + */ +function series(tasks, callback) { + (0, _parallel2.default)(_eachOfSeries2.default, tasks, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/setImmediate.js b/live2d/node_modules/async/setImmediate.js new file mode 100644 index 0000000..e52f7c5 --- /dev/null +++ b/live2d/node_modules/async/setImmediate.js @@ -0,0 +1,45 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Calls `callback` on a later loop around the event loop. In Node.js this just + * calls `setImmediate`. In the browser it will use `setImmediate` if + * available, otherwise `setTimeout(callback, 0)`, which means other higher + * priority events may precede the execution of `callback`. + * + * This is used internally for browser-compatibility purposes. + * + * @name setImmediate + * @static + * @memberOf module:Utils + * @method + * @see [async.nextTick]{@link module:Utils.nextTick} + * @category Util + * @param {Function} callback - The function to call on a later loop around + * the event loop. Invoked with (args...). + * @param {...*} args... - any number of additional arguments to pass to the + * callback on the next tick. + * @example + * + * var call_order = []; + * async.nextTick(function() { + * call_order.push('two'); + * // call_order now equals ['one','two'] + * }); + * call_order.push('one'); + * + * async.setImmediate(function (a, b, c) { + * // a, b, and c equal 1, 2, and 3 + * }, 1, 2, 3); + */ +exports.default = _setImmediate2.default; +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/some.js b/live2d/node_modules/async/some.js new file mode 100644 index 0000000..a8e70f7 --- /dev/null +++ b/live2d/node_modules/async/some.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallel = require('./internal/doParallel'); + +var _doParallel2 = _interopRequireDefault(_doParallel); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Returns `true` if at least one element in the `coll` satisfies an async test. + * If any iteratee call returns `true`, the main `callback` is immediately + * called. + * + * @name some + * @static + * @memberOf module:Collections + * @method + * @alias any + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + * @example + * + * async.some(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then at least one of the files exists + * }); + */ +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(Boolean, _identity2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/someLimit.js b/live2d/node_modules/async/someLimit.js new file mode 100644 index 0000000..24ca3f4 --- /dev/null +++ b/live2d/node_modules/async/someLimit.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createTester = require('./internal/createTester'); + +var _createTester2 = _interopRequireDefault(_createTester); + +var _doParallelLimit = require('./internal/doParallelLimit'); + +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); + +var _identity = require('lodash/identity'); + +var _identity2 = _interopRequireDefault(_identity); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. + * + * @name someLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anyLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(Boolean, _identity2.default)); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/someSeries.js b/live2d/node_modules/async/someSeries.js new file mode 100644 index 0000000..dc24ed2 --- /dev/null +++ b/live2d/node_modules/async/someSeries.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _someLimit = require('./someLimit'); + +var _someLimit2 = _interopRequireDefault(_someLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. + * + * @name someSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anySeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in series. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +exports.default = (0, _doLimit2.default)(_someLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/sortBy.js b/live2d/node_modules/async/sortBy.js new file mode 100644 index 0000000..ee5e93d --- /dev/null +++ b/live2d/node_modules/async/sortBy.js @@ -0,0 +1,91 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = sortBy; + +var _arrayMap = require('lodash/_arrayMap'); + +var _arrayMap2 = _interopRequireDefault(_arrayMap); + +var _baseProperty = require('lodash/_baseProperty'); + +var _baseProperty2 = _interopRequireDefault(_baseProperty); + +var _map = require('./map'); + +var _map2 = _interopRequireDefault(_map); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Sorts a list by the results of running each `coll` value through an async + * `iteratee`. + * + * @name sortBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a value to use as the sort criteria as + * its `result`. + * Invoked with (item, callback). + * @param {Function} callback - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is the items + * from the original `coll` sorted by the values returned by the `iteratee` + * calls. Invoked with (err, results). + * @example + * + * async.sortBy(['file1','file2','file3'], function(file, callback) { + * fs.stat(file, function(err, stats) { + * callback(err, stats.mtime); + * }); + * }, function(err, results) { + * // results is now the original array of files sorted by + * // modified date + * }); + * + * // By modifying the callback parameter the + * // sorting order can be influenced: + * + * // ascending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x); + * }, function(err,result) { + * // result callback + * }); + * + * // descending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x*-1); //<- x*-1 instead of x, turns the order around + * }, function(err,result) { + * // result callback + * }); + */ +function sortBy(coll, iteratee, callback) { + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _map2.default)(coll, function (x, callback) { + _iteratee(x, function (err, criteria) { + if (err) return callback(err); + callback(null, { value: x, criteria: criteria }); + }); + }, function (err, results) { + if (err) return callback(err); + callback(null, (0, _arrayMap2.default)(results.sort(comparator), (0, _baseProperty2.default)('value'))); + }); + + function comparator(left, right) { + var a = left.criteria, + b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + } +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/timeout.js b/live2d/node_modules/async/timeout.js new file mode 100644 index 0000000..b5cb505 --- /dev/null +++ b/live2d/node_modules/async/timeout.js @@ -0,0 +1,89 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = timeout; + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Sets a time limit on an asynchronous function. If the function does not call + * its callback within the specified milliseconds, it will be called with a + * timeout error. The code property for the error object will be `'ETIMEDOUT'`. + * + * @name timeout + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} asyncFn - The async function to limit in time. + * @param {number} milliseconds - The specified time limit. + * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) + * to timeout Error for more information.. + * @returns {AsyncFunction} Returns a wrapped function that can be used with any + * of the control flow functions. + * Invoke this function with the same parameters as you would `asyncFunc`. + * @example + * + * function myFunction(foo, callback) { + * doAsyncTask(foo, function(err, data) { + * // handle errors + * if (err) return callback(err); + * + * // do some stuff ... + * + * // return processed data + * return callback(null, data); + * }); + * } + * + * var wrapped = async.timeout(myFunction, 1000); + * + * // call `wrapped` as you would `myFunction` + * wrapped({ bar: 'bar' }, function(err, data) { + * // if `myFunction` takes < 1000 ms to execute, `err` + * // and `data` will have their expected values + * + * // else `err` will be an Error with the code 'ETIMEDOUT' + * }); + */ +function timeout(asyncFn, milliseconds, info) { + var fn = (0, _wrapAsync2.default)(asyncFn); + + return (0, _initialParams2.default)(function (args, callback) { + var timedOut = false; + var timer; + + function timeoutCallback() { + var name = asyncFn.name || 'anonymous'; + var error = new Error('Callback function "' + name + '" timed out.'); + error.code = 'ETIMEDOUT'; + if (info) { + error.info = info; + } + timedOut = true; + callback(error); + } + + args.push(function () { + if (!timedOut) { + callback.apply(null, arguments); + clearTimeout(timer); + } + }); + + // setup timer and call original function + timer = setTimeout(timeoutCallback, milliseconds); + fn.apply(null, args); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/times.js b/live2d/node_modules/async/times.js new file mode 100644 index 0000000..b5ca24d --- /dev/null +++ b/live2d/node_modules/async/times.js @@ -0,0 +1,50 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _timesLimit = require('./timesLimit'); + +var _timesLimit2 = _interopRequireDefault(_timesLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Calls the `iteratee` function `n` times, and accumulates results in the same + * manner you would use with [map]{@link module:Collections.map}. + * + * @name times + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.map]{@link module:Collections.map} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + * @example + * + * // Pretend this is some complicated async factory + * var createUser = function(id, callback) { + * callback(null, { + * id: 'user' + id + * }); + * }; + * + * // generate 5 users + * async.times(5, function(n, next) { + * createUser(n, function(err, user) { + * next(err, user); + * }); + * }, function(err, users) { + * // we should now have 5 users + * }); + */ +exports.default = (0, _doLimit2.default)(_timesLimit2.default, Infinity); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/timesLimit.js b/live2d/node_modules/async/timesLimit.js new file mode 100644 index 0000000..aad8495 --- /dev/null +++ b/live2d/node_modules/async/timesLimit.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = timeLimit; + +var _mapLimit = require('./mapLimit'); + +var _mapLimit2 = _interopRequireDefault(_mapLimit); + +var _baseRange = require('lodash/_baseRange'); + +var _baseRange2 = _interopRequireDefault(_baseRange); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a + * time. + * + * @name timesLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} count - The number of times to run the function. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see [async.map]{@link module:Collections.map}. + */ +function timeLimit(count, limit, iteratee, callback) { + var _iteratee = (0, _wrapAsync2.default)(iteratee); + (0, _mapLimit2.default)((0, _baseRange2.default)(0, count, 1), limit, _iteratee, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/timesSeries.js b/live2d/node_modules/async/timesSeries.js new file mode 100644 index 0000000..f187a35 --- /dev/null +++ b/live2d/node_modules/async/timesSeries.js @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _timesLimit = require('./timesLimit'); + +var _timesLimit2 = _interopRequireDefault(_timesLimit); + +var _doLimit = require('./internal/doLimit'); + +var _doLimit2 = _interopRequireDefault(_doLimit); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. + * + * @name timesSeries + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + */ +exports.default = (0, _doLimit2.default)(_timesLimit2.default, 1); +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/transform.js b/live2d/node_modules/async/transform.js new file mode 100644 index 0000000..84ee217 --- /dev/null +++ b/live2d/node_modules/async/transform.js @@ -0,0 +1,87 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = transform; + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _eachOf = require('./eachOf'); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * A relative of `reduce`. Takes an Object or Array, and iterates over each + * element in series, each step potentially mutating an `accumulator` value. + * The type of the accumulator defaults to the type of collection passed in. + * + * @name transform + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} [accumulator] - The initial state of the transform. If omitted, + * it will default to an empty Object or Array, depending on the type of `coll` + * @param {AsyncFunction} iteratee - A function applied to each item in the + * collection that potentially modifies the accumulator. + * Invoked with (accumulator, item, key, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the transformed accumulator. + * Invoked with (err, result). + * @example + * + * async.transform([1,2,3], function(acc, item, index, callback) { + * // pointless async: + * process.nextTick(function() { + * acc.push(item * 2) + * callback(null) + * }); + * }, function(err, result) { + * // result is now equal to [2, 4, 6] + * }); + * + * @example + * + * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { + * setImmediate(function () { + * obj[key] = val * 2; + * callback(); + * }) + * }, function (err, result) { + * // result is equal to {a: 2, b: 4, c: 6} + * }) + */ +function transform(coll, accumulator, iteratee, callback) { + if (arguments.length <= 3) { + callback = iteratee; + iteratee = accumulator; + accumulator = (0, _isArray2.default)(coll) ? [] : {}; + } + callback = (0, _once2.default)(callback || _noop2.default); + var _iteratee = (0, _wrapAsync2.default)(iteratee); + + (0, _eachOf2.default)(coll, function (v, k, cb) { + _iteratee(accumulator, v, k, cb); + }, function (err) { + callback(err, accumulator); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/tryEach.js b/live2d/node_modules/async/tryEach.js new file mode 100644 index 0000000..f4e4c97 --- /dev/null +++ b/live2d/node_modules/async/tryEach.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = tryEach; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _eachSeries = require('./eachSeries'); + +var _eachSeries2 = _interopRequireDefault(_eachSeries); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * It runs each task in series but stops whenever any of the functions were + * successful. If one of the tasks were successful, the `callback` will be + * passed the result of the successful task. If all tasks fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name tryEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing functions to + * run, each function is passed a `callback(err, result)` it must call on + * completion with an error `err` (which can be `null`) and an optional `result` + * value. + * @param {Function} [callback] - An optional callback which is called when one + * of the tasks has succeeded, or all have failed. It receives the `err` and + * `result` arguments of the last attempt at completing the `task`. Invoked with + * (err, results). + * @example + * async.tryEach([ + * function getDataFromFirstWebsite(callback) { + * // Try getting the data from the first website + * callback(err, data); + * }, + * function getDataFromSecondWebsite(callback) { + * // First website failed, + * // Try getting the data from the backup website + * callback(err, data); + * } + * ], + * // optional callback + * function(err, results) { + * Now do something with the data. + * }); + * + */ +function tryEach(tasks, callback) { + var error = null; + var result; + callback = callback || _noop2.default; + (0, _eachSeries2.default)(tasks, function (task, callback) { + (0, _wrapAsync2.default)(task)(function (err, res /*, ...args*/) { + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); + } else { + result = res; + } + error = err; + callback(!err); + }); + }, function () { + callback(error, result); + }); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/unmemoize.js b/live2d/node_modules/async/unmemoize.js new file mode 100644 index 0000000..08f9f9f --- /dev/null +++ b/live2d/node_modules/async/unmemoize.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = unmemoize; +/** + * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, + * unmemoized form. Handy for testing. + * + * @name unmemoize + * @static + * @memberOf module:Utils + * @method + * @see [async.memoize]{@link module:Utils.memoize} + * @category Util + * @param {AsyncFunction} fn - the memoized function + * @returns {AsyncFunction} a function that calls the original unmemoized function + */ +function unmemoize(fn) { + return function () { + return (fn.unmemoized || fn).apply(null, arguments); + }; +} +module.exports = exports["default"]; \ No newline at end of file diff --git a/live2d/node_modules/async/until.js b/live2d/node_modules/async/until.js new file mode 100644 index 0000000..29955ab --- /dev/null +++ b/live2d/node_modules/async/until.js @@ -0,0 +1,41 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = until; + +var _whilst = require('./whilst'); + +var _whilst2 = _interopRequireDefault(_whilst); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when + * stopped, or an error occurs. `callback` will be passed an error and any + * arguments passed to the final `iteratee`'s callback. + * + * The inverse of [whilst]{@link module:ControlFlow.whilst}. + * + * @name until + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} + * @category Control Flow + * @param {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` fails. Invoked with (callback). + * @param {Function} [callback] - A callback which is called after the test + * function has passed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s + * callback. Invoked with (err, [results]); + */ +function until(test, iteratee, callback) { + (0, _whilst2.default)(function () { + return !test.apply(this, arguments); + }, iteratee, callback); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/waterfall.js b/live2d/node_modules/async/waterfall.js new file mode 100644 index 0000000..d547d6b --- /dev/null +++ b/live2d/node_modules/async/waterfall.js @@ -0,0 +1,113 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (tasks, callback) { + callback = (0, _once2.default)(callback || _noop2.default); + if (!(0, _isArray2.default)(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); + if (!tasks.length) return callback(); + var taskIndex = 0; + + function nextTask(args) { + var task = (0, _wrapAsync2.default)(tasks[taskIndex++]); + args.push((0, _onlyOnce2.default)(next)); + task.apply(null, args); + } + + function next(err /*, ...args*/) { + if (err || taskIndex === tasks.length) { + return callback.apply(null, arguments); + } + nextTask((0, _slice2.default)(arguments, 1)); + } + + nextTask([]); +}; + +var _isArray = require('lodash/isArray'); + +var _isArray2 = _interopRequireDefault(_isArray); + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _once = require('./internal/once'); + +var _once2 = _interopRequireDefault(_once); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports['default']; + +/** + * Runs the `tasks` array of functions in series, each passing their results to + * the next in the array. However, if any of the `tasks` pass an error to their + * own callback, the next function is not executed, and the main `callback` is + * immediately called with the error. + * + * @name waterfall + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array} tasks - An array of [async functions]{@link AsyncFunction} + * to run. + * Each function should complete with any number of `result` values. + * The `result` values will be passed as arguments, in order, to the next task. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This will be passed the results of the last task's + * callback. Invoked with (err, [results]). + * @returns undefined + * @example + * + * async.waterfall([ + * function(callback) { + * callback(null, 'one', 'two'); + * }, + * function(arg1, arg2, callback) { + * // arg1 now equals 'one' and arg2 now equals 'two' + * callback(null, 'three'); + * }, + * function(arg1, callback) { + * // arg1 now equals 'three' + * callback(null, 'done'); + * } + * ], function (err, result) { + * // result now equals 'done' + * }); + * + * // Or, with named functions: + * async.waterfall([ + * myFirstFunction, + * mySecondFunction, + * myLastFunction, + * ], function (err, result) { + * // result now equals 'done' + * }); + * function myFirstFunction(callback) { + * callback(null, 'one', 'two'); + * } + * function mySecondFunction(arg1, arg2, callback) { + * // arg1 now equals 'one' and arg2 now equals 'two' + * callback(null, 'three'); + * } + * function myLastFunction(arg1, callback) { + * // arg1 now equals 'three' + * callback(null, 'done'); + * } + */ \ No newline at end of file diff --git a/live2d/node_modules/async/whilst.js b/live2d/node_modules/async/whilst.js new file mode 100644 index 0000000..9c4d8f6 --- /dev/null +++ b/live2d/node_modules/async/whilst.js @@ -0,0 +1,72 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = whilst; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +var _onlyOnce = require('./internal/onlyOnce'); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when + * stopped, or an error occurs. + * + * @name whilst + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` passes. Invoked with (callback). + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `iteratee` has stopped. `callback` + * will be passed an error and any arguments passed to the final `iteratee`'s + * callback. Invoked with (err, [results]); + * @returns undefined + * @example + * + * var count = 0; + * async.whilst( + * function() { return count < 5; }, + * function(callback) { + * count++; + * setTimeout(function() { + * callback(null, count); + * }, 1000); + * }, + * function (err, n) { + * // 5 seconds have passed, n = 5 + * } + * ); + */ +function whilst(test, iteratee, callback) { + callback = (0, _onlyOnce2.default)(callback || _noop2.default); + var _iteratee = (0, _wrapAsync2.default)(iteratee); + if (!test()) return callback(null); + var next = function (err /*, ...args*/) { + if (err) return callback(err); + if (test()) return _iteratee(next); + var args = (0, _slice2.default)(arguments, 1); + callback.apply(null, [null].concat(args)); + }; + _iteratee(next); +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/async/wrapSync.js b/live2d/node_modules/async/wrapSync.js new file mode 100644 index 0000000..5e3fc91 --- /dev/null +++ b/live2d/node_modules/async/wrapSync.js @@ -0,0 +1,110 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = asyncify; + +var _isObject = require('lodash/isObject'); + +var _isObject2 = _interopRequireDefault(_isObject); + +var _initialParams = require('./internal/initialParams'); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Take a sync function and make it async, passing its return value to a + * callback. This is useful for plugging sync functions into a waterfall, + * series, or other async functions. Any arguments passed to the generated + * function will be passed to the wrapped function (except for the final + * callback argument). Errors thrown will be passed to the callback. + * + * If the function passed to `asyncify` returns a Promise, that promises's + * resolved/rejected state will be used to call the callback, rather than simply + * the synchronous return value. + * + * This also means you can asyncify ES2017 `async` functions. + * + * @name asyncify + * @static + * @memberOf module:Utils + * @method + * @alias wrapSync + * @category Util + * @param {Function} func - The synchronous function, or Promise-returning + * function to convert to an {@link AsyncFunction}. + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be + * invoked with `(args..., callback)`. + * @example + * + * // passing a regular synchronous function + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(JSON.parse), + * function (data, next) { + * // data is the result of parsing the text. + * // If there was a parsing error, it would have been caught. + * } + * ], callback); + * + * // passing a function returning a promise + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(function (contents) { + * return db.model.create(contents); + * }), + * function (model, next) { + * // `model` is the instantiated model object. + * // If there was an error, this function would be skipped. + * } + * ], callback); + * + * // es2017 example, though `asyncify` is not needed if your JS environment + * // supports async functions out of the box + * var q = async.queue(async.asyncify(async function(file) { + * var intermediateStep = await processFile(file); + * return await somePromise(intermediateStep) + * })); + * + * q.push(files); + */ +function asyncify(func) { + return (0, _initialParams2.default)(function (args, callback) { + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if ((0, _isObject2.default)(result) && typeof result.then === 'function') { + result.then(function (value) { + invokeCallback(callback, null, value); + }, function (err) { + invokeCallback(callback, err.message ? err : new Error(err)); + }); + } else { + callback(null, result); + } + }); +} + +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (e) { + (0, _setImmediate2.default)(rethrow, e); + } +} + +function rethrow(error) { + throw error; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/live2d/node_modules/balanced-match/.github/FUNDING.yml b/live2d/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 0000000..cea8b16 --- /dev/null +++ b/live2d/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/live2d/node_modules/balanced-match/LICENSE.md b/live2d/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/live2d/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/live2d/node_modules/balanced-match/README.md b/live2d/node_modules/balanced-match/README.md new file mode 100644 index 0000000..d2a48b6 --- /dev/null +++ b/live2d/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/live2d/node_modules/balanced-match/index.js b/live2d/node_modules/balanced-match/index.js new file mode 100644 index 0000000..c67a646 --- /dev/null +++ b/live2d/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/live2d/node_modules/balanced-match/package.json b/live2d/node_modules/balanced-match/package.json new file mode 100644 index 0000000..ce6073e --- /dev/null +++ b/live2d/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/live2d/node_modules/brace-expansion/LICENSE b/live2d/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/live2d/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +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. diff --git a/live2d/node_modules/brace-expansion/README.md b/live2d/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/live2d/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +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. diff --git a/live2d/node_modules/brace-expansion/index.js b/live2d/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/live2d/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/live2d/node_modules/brace-expansion/package.json b/live2d/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..a18faa8 --- /dev/null +++ b/live2d/node_modules/brace-expansion/package.json @@ -0,0 +1,47 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.11", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/live2d/node_modules/call-bind/.eslintignore b/live2d/node_modules/call-bind/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/live2d/node_modules/call-bind/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/live2d/node_modules/call-bind/.eslintrc b/live2d/node_modules/call-bind/.eslintrc new file mode 100644 index 0000000..dfa9a6c --- /dev/null +++ b/live2d/node_modules/call-bind/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + "no-magic-numbers": 0, + }, +} diff --git a/live2d/node_modules/call-bind/.github/FUNDING.yml b/live2d/node_modules/call-bind/.github/FUNDING.yml new file mode 100644 index 0000000..c70c2ec --- /dev/null +++ b/live2d/node_modules/call-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/call-bind/.nycrc b/live2d/node_modules/call-bind/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/call-bind/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/call-bind/CHANGELOG.md b/live2d/node_modules/call-bind/CHANGELOG.md new file mode 100644 index 0000000..c653f70 --- /dev/null +++ b/live2d/node_modules/call-bind/CHANGELOG.md @@ -0,0 +1,93 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03) +- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590) + +## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05 + +### Commits + +- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa) +- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5) +- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582) + +## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19 + +### Commits + +- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d) +- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871) + +## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19 + +## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19 + +### Commits + +- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453) +- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5) +- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90) +- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4) +- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11) +- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223) +- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5) +- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05) +- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329) +- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958) +- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5) +- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3) +- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91) +- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60) + +## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11 + +### Commits + +- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d) + +## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08 + +### Commits + +- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1) +- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e) +- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb) +- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71) +- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee) +- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2) +- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8) +- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6) + +## v1.0.0 - 2020-10-30 + +### Commits + +- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50) +- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df) +- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65) +- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13) +- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4) +- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717) +- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af) +- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650) +- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f) diff --git a/live2d/node_modules/call-bind/LICENSE b/live2d/node_modules/call-bind/LICENSE new file mode 100644 index 0000000..48f05d0 --- /dev/null +++ b/live2d/node_modules/call-bind/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +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. diff --git a/live2d/node_modules/call-bind/README.md b/live2d/node_modules/call-bind/README.md new file mode 100644 index 0000000..48e9047 --- /dev/null +++ b/live2d/node_modules/call-bind/README.md @@ -0,0 +1,64 @@ +# call-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robustly `.call.bind()` a function. + +## Getting started + +```sh +npm install --save call-bind +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBind = require('call-bind'); +const callBound = require('call-bind/callBound'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBind(f); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(1, 2, 3); + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind.svg +[deps-url]: https://david-dm.org/ljharb/call-bind +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind +[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind +[actions-url]: https://github.com/ljharb/call-bind/actions diff --git a/live2d/node_modules/call-bind/callBound.js b/live2d/node_modules/call-bind/callBound.js new file mode 100644 index 0000000..8374adf --- /dev/null +++ b/live2d/node_modules/call-bind/callBound.js @@ -0,0 +1,15 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBind = require('./'); + +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBind(intrinsic); + } + return intrinsic; +}; diff --git a/live2d/node_modules/call-bind/index.js b/live2d/node_modules/call-bind/index.js new file mode 100644 index 0000000..01c5b3d --- /dev/null +++ b/live2d/node_modules/call-bind/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var bind = require('function-bind'); +var GetIntrinsic = require('get-intrinsic'); +var setFunctionLength = require('set-function-length'); + +var $TypeError = require('es-errors/type'); +var $apply = GetIntrinsic('%Function.prototype.apply%'); +var $call = GetIntrinsic('%Function.prototype.call%'); +var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); + +var $defineProperty = require('es-define-property'); +var $max = GetIntrinsic('%Math.max%'); + +module.exports = function callBind(originalFunction) { + if (typeof originalFunction !== 'function') { + throw new $TypeError('a function is required'); + } + var func = $reflectApply(bind, $call, arguments); + return setFunctionLength( + func, + 1 + $max(0, originalFunction.length - (arguments.length - 1)), + true + ); +}; + +var applyBind = function applyBind() { + return $reflectApply(bind, $apply, arguments); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} diff --git a/live2d/node_modules/call-bind/package.json b/live2d/node_modules/call-bind/package.json new file mode 100644 index 0000000..5ba88ff --- /dev/null +++ b/live2d/node_modules/call-bind/package.json @@ -0,0 +1,95 @@ +{ + "name": "call-bind", + "version": "1.0.7", + "description": "Robustly `.call.bind()` a function", + "main": "index.js", + "exports": { + ".": "./index.js", + "./callBound": "./callBound.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bind.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "callbind", + "callbound", + "call", + "bind", + "bound", + "call-bind", + "call-bound", + "function", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bind/issues" + }, + "homepage": "https://github.com/ljharb/call-bind#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/live2d/node_modules/call-bind/test/callBound.js b/live2d/node_modules/call-bind/test/callBound.js new file mode 100644 index 0000000..c32319d --- /dev/null +++ b/live2d/node_modules/call-bind/test/callBound.js @@ -0,0 +1,54 @@ +'use strict'; + +var test = require('tape'); + +var callBound = require('../callBound'); + +test('callBound', function (t) { + // static primitive + t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); + t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); + + // static non-function object + t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); + t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); + t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); + t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); + + // static function + t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); + t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); + + // prototype primitive + t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); + t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); + + // prototype function + t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself'); + t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); + t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); + t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); + + t['throws']( + function () { callBound('does not exist'); }, + SyntaxError, + 'nonexistent intrinsic throws' + ); + t['throws']( + function () { callBound('does not exist', true); }, + SyntaxError, + 'allowMissing arg still throws for unknown intrinsic' + ); + + t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { + st['throws']( + function () { callBound('WeakRef'); }, + TypeError, + 'real but absent intrinsic throws' + ); + st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); + st.end(); + }); + + t.end(); +}); diff --git a/live2d/node_modules/call-bind/test/index.js b/live2d/node_modules/call-bind/test/index.js new file mode 100644 index 0000000..1fd4668 --- /dev/null +++ b/live2d/node_modules/call-bind/test/index.js @@ -0,0 +1,80 @@ +'use strict'; + +var callBind = require('../'); +var bind = require('function-bind'); +var gOPD = require('gopd'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); + +var test = require('tape'); + +/* + * older engines have length nonconfigurable + * in io.js v3, it is configurable except on bound functions, hence the .bind() + */ +var functionsHaveConfigurableLengths = !!( + gOPD + && Object.getOwnPropertyDescriptor + && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable +); + +test('callBind', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + function () { callBind(nonFunction); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + + var sentinel = { sentinel: true }; + var func = function (a, b) { + // eslint-disable-next-line no-invalid-this + return [!hasStrictMode && this === global ? undefined : this, a, b]; + }; + t.equal(func.length, 2, 'original function length is 2'); + t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); + t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); + t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); + + var bound = callBind(func); + t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); + + var boundR = callBind(func, sentinel); + t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); + t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); + t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); + + var boundArg = callBind(func, sentinel, 1); + t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); + t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); + t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); + t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); + + t.test('callBind.apply', function (st) { + var aBound = callBind.apply(func); + st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args'); + st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + + var aBoundArg = callBind.apply(func); + st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args'); + st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); + st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); + + var aBoundR = callBind.apply(func, sentinel); + st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args'); + st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args'); + st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args'); + + st.end(); + }); + + t.end(); +}); diff --git a/live2d/node_modules/commander/CHANGELOG.md b/live2d/node_modules/commander/CHANGELOG.md new file mode 100644 index 0000000..7dce779 --- /dev/null +++ b/live2d/node_modules/commander/CHANGELOG.md @@ -0,0 +1,419 @@ +2.20.3 / 2019-10-11 +================== + + * Support Node.js 0.10 (Revert #1059) + * Ran "npm unpublish commander@2.20.2". There is no 2.20.2. + +2.20.1 / 2019-09-29 +================== + + * Improve executable subcommand tracking + * Update dev dependencies + +2.20.0 / 2019-04-02 +================== + + * fix: resolve symbolic links completely when hunting for subcommands (#935) + * Update index.d.ts (#930) + * Update Readme.md (#924) + * Remove --save option as it isn't required anymore (#918) + * Add link to the license file (#900) + * Added example of receiving args from options (#858) + * Added missing semicolon (#882) + * Add extension to .eslintrc (#876) + +2.19.0 / 2018-10-02 +================== + + * Removed newline after Options and Commands headers (#864) + * Bugfix - Error output (#862) + * Fix to change default value to string (#856) + +2.18.0 / 2018-09-07 +================== + + * Standardize help output (#853) + * chmod 644 travis.yml (#851) + * add support for execute typescript subcommand via ts-node (#849) + +2.17.1 / 2018-08-07 +================== + + * Fix bug in command emit (#844) + +2.17.0 / 2018-08-03 +================== + + * fixed newline output after help information (#833) + * Fix to emit the action even without command (#778) + * npm update (#823) + +2.16.0 / 2018-06-29 +================== + + * Remove Makefile and `test/run` (#821) + * Make 'npm test' run on Windows (#820) + * Add badge to display install size (#807) + * chore: cache node_modules (#814) + * chore: remove Node.js 4 (EOL), add Node.js 10 (#813) + * fixed typo in readme (#812) + * Fix types (#804) + * Update eslint to resolve vulnerabilities in lodash (#799) + * updated readme with custom event listeners. (#791) + * fix tests (#794) + +2.15.0 / 2018-03-07 +================== + + * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm + * Arguments description + +2.14.1 / 2018-02-07 +================== + + * Fix typing of help function + +2.14.0 / 2018-02-05 +================== + + * only register the option:version event once + * Fixes issue #727: Passing empty string for option on command is set to undefined + * enable eqeqeq rule + * resolves #754 add linter configuration to project + * resolves #560 respect custom name for version option + * document how to override the version flag + * document using options per command + +2.13.0 / 2018-01-09 +================== + + * Do not print default for --no- + * remove trailing spaces in command help + * Update CI's Node.js to LTS and latest version + * typedefs: Command and Option types added to commander namespace + +2.12.2 / 2017-11-28 +================== + + * fix: typings are not shipped + +2.12.1 / 2017-11-23 +================== + + * Move @types/node to dev dependency + +2.12.0 / 2017-11-22 +================== + + * add attributeName() method to Option objects + * Documentation updated for options with --no prefix + * typings: `outputHelp` takes a string as the first parameter + * typings: use overloads + * feat(typings): update to match js api + * Print default value in option help + * Fix translation error + * Fail when using same command and alias (#491) + * feat(typings): add help callback + * fix bug when description is add after command with options (#662) + * Format js code + * Rename History.md to CHANGELOG.md (#668) + * feat(typings): add typings to support TypeScript (#646) + * use current node + +2.11.0 / 2017-07-03 +================== + + * Fix help section order and padding (#652) + * feature: support for signals to subcommands (#632) + * Fixed #37, --help should not display first (#447) + * Fix translation errors. (#570) + * Add package-lock.json + * Remove engines + * Upgrade package version + * Prefix events to prevent conflicts between commands and options (#494) + * Removing dependency on graceful-readlink + * Support setting name in #name function and make it chainable + * Add .vscode directory to .gitignore (Visual Studio Code metadata) + * Updated link to ruby commander in readme files + +2.10.0 / 2017-06-19 +================== + + * Update .travis.yml. drop support for older node.js versions. + * Fix require arguments in README.md + * On SemVer you do not start from 0.0.1 + * Add missing semi colon in readme + * Add save param to npm install + * node v6 travis test + * Update Readme_zh-CN.md + * Allow literal '--' to be passed-through as an argument + * Test subcommand alias help + * link build badge to master branch + * Support the alias of Git style sub-command + * added keyword commander for better search result on npm + * Fix Sub-Subcommands + * test node.js stable + * Fixes TypeError when a command has an option called `--description` + * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets. + * Add chinese Readme file + +2.9.0 / 2015-10-13 +================== + + * Add option `isDefault` to set default subcommand #415 @Qix- + * Add callback to allow filtering or post-processing of help text #434 @djulien + * Fix `undefined` text in help information close #414 #416 @zhiyelee + +2.8.1 / 2015-04-22 +================== + + * Back out `support multiline description` Close #396 #397 + +2.8.0 / 2015-04-07 +================== + + * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee + * Fix bug in Git-style sub-commands #372 @zhiyelee + * Allow commands to be hidden from help #383 @tonylukasavage + * When git-style sub-commands are in use, yet none are called, display help #382 @claylo + * Add ability to specify arguments syntax for top-level command #258 @rrthomas + * Support multiline descriptions #208 @zxqfox + +2.7.1 / 2015-03-11 +================== + + * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367. + +2.7.0 / 2015-03-09 +================== + + * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee + * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage + * Add support for camelCase on `opts()`. Close #353 @nkzawa + * Add node.js 0.12 and io.js to travis.yml + * Allow RegEx options. #337 @palanik + * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito + * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee + +2.6.0 / 2014-12-30 +================== + + * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee + * Add application description to the help msg. Close #112 @dalssoft + +2.5.1 / 2014-12-15 +================== + + * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee + +2.5.0 / 2014-10-24 +================== + + * add support for variadic arguments. Closes #277 @whitlockjc + +2.4.0 / 2014-10-17 +================== + + * fixed a bug on executing the coercion function of subcommands option. Closes #270 + * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage + * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage + * fixed a bug on subcommand name. Closes #248 @jonathandelgado + * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr + +2.3.0 / 2014-07-16 +================== + + * add command alias'. Closes PR #210 + * fix: Typos. Closes #99 + * fix: Unused fs module. Closes #217 + +2.2.0 / 2014-03-29 +================== + + * add passing of previous option value + * fix: support subcommands on windows. Closes #142 + * Now the defaultValue passed as the second argument of the coercion function. + +2.1.0 / 2013-11-21 +================== + + * add: allow cflag style option params, unit test, fixes #174 + +2.0.0 / 2013-07-18 +================== + + * remove input methods (.prompt, .confirm, etc) + +1.3.2 / 2013-07-18 +================== + + * add support for sub-commands to co-exist with the original command + +1.3.1 / 2013-07-18 +================== + + * add quick .runningCommand hack so you can opt-out of other logic when running a sub command + +1.3.0 / 2013-07-09 +================== + + * add EACCES error handling + * fix sub-command --help + +1.2.0 / 2013-06-13 +================== + + * allow "-" hyphen as an option argument + * support for RegExp coercion + +1.1.1 / 2012-11-20 +================== + + * add more sub-command padding + * fix .usage() when args are present. Closes #106 + +1.1.0 / 2012-11-16 +================== + + * add git-style executable subcommand support. Closes #94 + +1.0.5 / 2012-10-09 +================== + + * fix `--name` clobbering. Closes #92 + * fix examples/help. Closes #89 + +1.0.4 / 2012-09-03 +================== + + * add `outputHelp()` method. + +1.0.3 / 2012-08-30 +================== + + * remove invalid .version() defaulting + +1.0.2 / 2012-08-24 +================== + + * add `--foo=bar` support [arv] + * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus] + +1.0.1 / 2012-08-03 +================== + + * fix issue #56 + * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode()) + +1.0.0 / 2012-07-05 +================== + + * add support for optional option descriptions + * add defaulting of `.version()` to package.json's version + +0.6.1 / 2012-06-01 +================== + + * Added: append (yes or no) on confirmation + * Added: allow node.js v0.7.x + +0.6.0 / 2012-04-10 +================== + + * Added `.prompt(obj, callback)` support. Closes #49 + * Added default support to .choose(). Closes #41 + * Fixed the choice example + +0.5.1 / 2011-12-20 +================== + + * Fixed `password()` for recent nodes. Closes #36 + +0.5.0 / 2011-12-04 +================== + + * Added sub-command option support [itay] + +0.4.3 / 2011-12-04 +================== + + * Fixed custom help ordering. Closes #32 + +0.4.2 / 2011-11-24 +================== + + * Added travis support + * Fixed: line-buffered input automatically trimmed. Closes #31 + +0.4.1 / 2011-11-18 +================== + + * Removed listening for "close" on --help + +0.4.0 / 2011-11-15 +================== + + * Added support for `--`. Closes #24 + +0.3.3 / 2011-11-14 +================== + + * Fixed: wait for close event when writing help info [Jerry Hamlet] + +0.3.2 / 2011-11-01 +================== + + * Fixed long flag definitions with values [felixge] + +0.3.1 / 2011-10-31 +================== + + * Changed `--version` short flag to `-V` from `-v` + * Changed `.version()` so it's configurable [felixge] + +0.3.0 / 2011-10-31 +================== + + * Added support for long flags only. Closes #18 + +0.2.1 / 2011-10-24 +================== + + * "node": ">= 0.4.x < 0.7.0". Closes #20 + +0.2.0 / 2011-09-26 +================== + + * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] + +0.1.0 / 2011-08-24 +================== + + * Added support for custom `--help` output + +0.0.5 / 2011-08-18 +================== + + * Changed: when the user enters nothing prompt for password again + * Fixed issue with passwords beginning with numbers [NuckChorris] + +0.0.4 / 2011-08-15 +================== + + * Fixed `Commander#args` + +0.0.3 / 2011-08-15 +================== + + * Added default option value support + +0.0.2 / 2011-08-15 +================== + + * Added mask support to `Command#password(str[, mask], fn)` + * Added `Command#password(str, fn)` + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/live2d/node_modules/commander/LICENSE b/live2d/node_modules/commander/LICENSE new file mode 100644 index 0000000..10f997a --- /dev/null +++ b/live2d/node_modules/commander/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk + +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. diff --git a/live2d/node_modules/commander/Readme.md b/live2d/node_modules/commander/Readme.md new file mode 100644 index 0000000..c846e7a --- /dev/null +++ b/live2d/node_modules/commander/Readme.md @@ -0,0 +1,428 @@ +# Commander.js + + +[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js) +[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander) +[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true) +[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander) +[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander). + [API documentation](http://tj.github.com/commander.js/) + + +## Installation + + $ npm install commander + +## Option parsing + +Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .version('0.1.0') + .option('-p, --peppers', 'Add peppers') + .option('-P, --pineapple', 'Add pineapple') + .option('-b, --bbq-sauce', 'Add bbq sauce') + .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') + .parse(process.argv); + +console.log('you ordered a pizza with:'); +if (program.peppers) console.log(' - peppers'); +if (program.pineapple) console.log(' - pineapple'); +if (program.bbqSauce) console.log(' - bbq'); +console.log(' - %s cheese', program.cheese); +``` + +Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. + +Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .option('--no-sauce', 'Remove sauce') + .parse(process.argv); + +console.log('you ordered a pizza'); +if (program.sauce) console.log(' with sauce'); +else console.log(' without sauce'); +``` + +To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs. + +e.g. ```.option('-m --myarg [myVar]', 'my super cool description')``` + +Then to access the input if it was passed in. + +e.g. ```var myInput = program.myarg``` + +**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in. + + +## Version option + +Calling the `version` implicitly adds the `-V` and `--version` options to the command. +When either of these options is present, the command prints the version number and exits. + + $ ./examples/pizza -V + 0.0.1 + +If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method. + +```js +program + .version('0.0.1', '-v, --version') +``` + +The version flags can be named anything, but the long option is required. + +## Command-specific options + +You can attach options to a command. + +```js +#!/usr/bin/env node + +var program = require('commander'); + +program + .command('rm

') + .option('-r, --recursive', 'Remove recursively') + .action(function (dir, cmd) { + console.log('remove ' + dir + (cmd.recursive ? ' recursively' : '')) + }) + +program.parse(process.argv) +``` + +A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated. + +## Coercion + +```js +function range(val) { + return val.split('..').map(Number); +} + +function list(val) { + return val.split(','); +} + +function collect(val, memo) { + memo.push(val); + return memo; +} + +function increaseVerbosity(v, total) { + return total + 1; +} + +program + .version('0.1.0') + .usage('[options] ') + .option('-i, --integer ', 'An integer argument', parseInt) + .option('-f, --float ', 'A float argument', parseFloat) + .option('-r, --range ..', 'A range', range) + .option('-l, --list ', 'A list', list) + .option('-o, --optional [value]', 'An optional value') + .option('-c, --collect [value]', 'A repeatable value', collect, []) + .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) + .parse(process.argv); + +console.log(' int: %j', program.integer); +console.log(' float: %j', program.float); +console.log(' optional: %j', program.optional); +program.range = program.range || []; +console.log(' range: %j..%j', program.range[0], program.range[1]); +console.log(' list: %j', program.list); +console.log(' collect: %j', program.collect); +console.log(' verbosity: %j', program.verbose); +console.log(' args: %j', program.args); +``` + +## Regular Expression +```js +program + .version('0.1.0') + .option('-s --size ', 'Pizza size', /^(large|medium|small)$/i, 'medium') + .option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i) + .parse(process.argv); + +console.log(' size: %j', program.size); +console.log(' drink: %j', program.drink); +``` + +## Variadic arguments + + The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to + append `...` to the argument name. Here is an example: + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .version('0.1.0') + .command('rmdir [otherDirs...]') + .action(function (dir, otherDirs) { + console.log('rmdir %s', dir); + if (otherDirs) { + otherDirs.forEach(function (oDir) { + console.log('rmdir %s', oDir); + }); + } + }); + +program.parse(process.argv); +``` + + An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed + to your action as demonstrated above. + +## Specify the argument syntax + +```js +#!/usr/bin/env node + +var program = require('commander'); + +program + .version('0.1.0') + .arguments(' [env]') + .action(function (cmd, env) { + cmdValue = cmd; + envValue = env; + }); + +program.parse(process.argv); + +if (typeof cmdValue === 'undefined') { + console.error('no command given!'); + process.exit(1); +} +console.log('command:', cmdValue); +console.log('environment:', envValue || "no environment given"); +``` +Angled brackets (e.g. ``) indicate required input. Square brackets (e.g. `[env]`) indicate optional input. + +## Git-style sub-commands + +```js +// file: ./examples/pm +var program = require('commander'); + +program + .version('0.1.0') + .command('install [name]', 'install one or more packages') + .command('search [query]', 'search with optional query') + .command('list', 'list packages installed', {isDefault: true}) + .parse(process.argv); +``` + +When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools. +The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`. + +Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified. + +If the program is designed to be installed globally, make sure the executables have proper modes, like `755`. + +### `--harmony` + +You can enable `--harmony` option in two ways: +* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern. +* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process. + +## Automated --help + + The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: + +``` +$ ./examples/pizza --help +Usage: pizza [options] + +An application for pizzas ordering + +Options: + -h, --help output usage information + -V, --version output the version number + -p, --peppers Add peppers + -P, --pineapple Add pineapple + -b, --bbq Add bbq sauce + -c, --cheese Add the specified type of cheese [marble] + -C, --no-cheese You do not want any cheese +``` + +## Custom help + + You can display arbitrary `-h, --help` information + by listening for "--help". Commander will automatically + exit once you are done so that the remainder of your program + does not execute causing undesired behaviors, for example + in the following executable "stuff" will not output when + `--help` is used. + +```js +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var program = require('commander'); + +program + .version('0.1.0') + .option('-f, --foo', 'enable some foo') + .option('-b, --bar', 'enable some bar') + .option('-B, --baz', 'enable some baz'); + +// must be before .parse() since +// node's emit() is immediate + +program.on('--help', function(){ + console.log('') + console.log('Examples:'); + console.log(' $ custom-help --help'); + console.log(' $ custom-help -h'); +}); + +program.parse(process.argv); + +console.log('stuff'); +``` + +Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run: + +``` +Usage: custom-help [options] + +Options: + -h, --help output usage information + -V, --version output the version number + -f, --foo enable some foo + -b, --bar enable some bar + -B, --baz enable some baz + +Examples: + $ custom-help --help + $ custom-help -h +``` + +## .outputHelp(cb) + +Output help information without exiting. +Optional callback cb allows post-processing of help text before it is displayed. + +If you want to display help by default (e.g. if no command was provided), you can use something like: + +```js +var program = require('commander'); +var colors = require('colors'); + +program + .version('0.1.0') + .command('getstream [url]', 'get stream URL') + .parse(process.argv); + +if (!process.argv.slice(2).length) { + program.outputHelp(make_red); +} + +function make_red(txt) { + return colors.red(txt); //display the help text in red on the console +} +``` + +## .help(cb) + + Output help information and exit immediately. + Optional callback cb allows post-processing of help text before it is displayed. + + +## Custom event listeners + You can execute custom actions by listening to command and option events. + +```js +program.on('option:verbose', function () { + process.env.VERBOSE = this.verbose; +}); + +// error on unknown commands +program.on('command:*', function () { + console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' ')); + process.exit(1); +}); +``` + +## Examples + +```js +var program = require('commander'); + +program + .version('0.1.0') + .option('-C, --chdir ', 'change the working directory') + .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + .option('-T, --no-tests', 'ignore test hook'); + +program + .command('setup [env]') + .description('run setup commands for all envs') + .option("-s, --setup_mode [mode]", "Which setup mode to use") + .action(function(env, options){ + var mode = options.setup_mode || "normal"; + env = env || 'all'; + console.log('setup for %s env(s) with %s mode', env, mode); + }); + +program + .command('exec ') + .alias('ex') + .description('execute the given remote cmd') + .option("-e, --exec_mode ", "Which exec mode to use") + .action(function(cmd, options){ + console.log('exec "%s" using %s mode', cmd, options.exec_mode); + }).on('--help', function() { + console.log(''); + console.log('Examples:'); + console.log(''); + console.log(' $ deploy exec sequential'); + console.log(' $ deploy exec async'); + }); + +program + .command('*') + .action(function(env){ + console.log('deploying "%s"', env); + }); + +program.parse(process.argv); +``` + +More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. + +## License + +[MIT](https://github.com/tj/commander.js/blob/master/LICENSE) diff --git a/live2d/node_modules/commander/index.js b/live2d/node_modules/commander/index.js new file mode 100644 index 0000000..ec1d61d --- /dev/null +++ b/live2d/node_modules/commander/index.js @@ -0,0 +1,1224 @@ +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter; +var spawn = require('child_process').spawn; +var path = require('path'); +var dirname = path.dirname; +var basename = path.basename; +var fs = require('fs'); + +/** + * Inherit `Command` from `EventEmitter.prototype`. + */ + +require('util').inherits(Command, EventEmitter); + +/** + * Expose the root command. + */ + +exports = module.exports = new Command(); + +/** + * Expose `Command`. + */ + +exports.Command = Command; + +/** + * Expose `Option`. + */ + +exports.Option = Option; + +/** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {String} flags + * @param {String} description + * @api public + */ + +function Option(flags, description) { + this.flags = flags; + this.required = flags.indexOf('<') >= 0; + this.optional = flags.indexOf('[') >= 0; + this.bool = flags.indexOf('-no-') === -1; + flags = flags.split(/[ ,|]+/); + if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); + this.long = flags.shift(); + this.description = description || ''; +} + +/** + * Return option name. + * + * @return {String} + * @api private + */ + +Option.prototype.name = function() { + return this.long + .replace('--', '') + .replace('no-', ''); +}; + +/** + * Return option name, in a camelcase format that can be used + * as a object attribute key. + * + * @return {String} + * @api private + */ + +Option.prototype.attributeName = function() { + return camelcase(this.name()); +}; + +/** + * Check if `arg` matches the short or long flag. + * + * @param {String} arg + * @return {Boolean} + * @api private + */ + +Option.prototype.is = function(arg) { + return this.short === arg || this.long === arg; +}; + +/** + * Initialize a new `Command`. + * + * @param {String} name + * @api public + */ + +function Command(name) { + this.commands = []; + this.options = []; + this._execs = {}; + this._allowUnknownOption = false; + this._args = []; + this._name = name || ''; +} + +/** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * Examples: + * + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function() { + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd) { + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('teardown [otherDirs...]') + * .description('run teardown commands') + * .action(function(dir, otherDirs) { + * console.log('dir "%s"', dir); + * if (otherDirs) { + * otherDirs.forEach(function (oDir) { + * console.log('dir "%s"', oDir); + * }); + * } + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env) { + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {String} name + * @param {String} [desc] for git-style sub-commands + * @return {Command} the new command + * @api public + */ + +Command.prototype.command = function(name, desc, opts) { + if (typeof desc === 'object' && desc !== null) { + opts = desc; + desc = null; + } + opts = opts || {}; + var args = name.split(/ +/); + var cmd = new Command(args.shift()); + + if (desc) { + cmd.description(desc); + this.executables = true; + this._execs[cmd._name] = true; + if (opts.isDefault) this.defaultExecutable = cmd._name; + } + cmd._noHelp = !!opts.noHelp; + this.commands.push(cmd); + cmd.parseExpectedArgs(args); + cmd.parent = this; + + if (desc) return this; + return cmd; +}; + +/** + * Define argument syntax for the top-level command. + * + * @api public + */ + +Command.prototype.arguments = function(desc) { + return this.parseExpectedArgs(desc.split(/ +/)); +}; + +/** + * Add an implicit `help [cmd]` subcommand + * which invokes `--help` for the given command. + * + * @api private + */ + +Command.prototype.addImplicitHelpCommand = function() { + this.command('help [cmd]', 'display help for [cmd]'); +}; + +/** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {Array} args + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parseExpectedArgs = function(args) { + if (!args.length) return; + var self = this; + args.forEach(function(arg) { + var argDetails = { + required: false, + name: '', + variadic: false + }; + + switch (arg[0]) { + case '<': + argDetails.required = true; + argDetails.name = arg.slice(1, -1); + break; + case '[': + argDetails.name = arg.slice(1, -1); + break; + } + + if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { + argDetails.variadic = true; + argDetails.name = argDetails.name.slice(0, -3); + } + if (argDetails.name) { + self._args.push(argDetails); + } + }); + return this; +}; + +/** + * Register callback `fn` for the command. + * + * Examples: + * + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {Function} fn + * @return {Command} for chaining + * @api public + */ + +Command.prototype.action = function(fn) { + var self = this; + var listener = function(args, unknown) { + // Parse any so-far unknown options + args = args || []; + unknown = unknown || []; + + var parsed = self.parseOptions(unknown); + + // Output help if necessary + outputHelpIfNecessary(self, parsed.unknown); + + // If there are still any unknown options, then we simply + // die, unless someone asked for help, in which case we give it + // to them, and then we die. + if (parsed.unknown.length > 0) { + self.unknownOption(parsed.unknown[0]); + } + + // Leftover arguments need to be pushed back. Fixes issue #56 + if (parsed.args.length) args = parsed.args.concat(args); + + self._args.forEach(function(arg, i) { + if (arg.required && args[i] == null) { + self.missingArgument(arg.name); + } else if (arg.variadic) { + if (i !== self._args.length - 1) { + self.variadicArgNotLast(arg.name); + } + + args[i] = args.splice(i); + } + }); + + // Always append ourselves to the end of the arguments, + // to make sure we match the number of arguments the user + // expects + if (self._args.length) { + args[self._args.length] = self; + } else { + args.push(self); + } + + fn.apply(self, args); + }; + var parent = this.parent || this; + var name = parent === this ? '*' : this._name; + parent.on('command:' + name, listener); + if (this._alias) parent.on('command:' + this._alias, listener); + return this; +}; + +/** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * Examples: + * + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {String} flags + * @param {String} description + * @param {Function|*} [fn] or default + * @param {*} [defaultValue] + * @return {Command} for chaining + * @api public + */ + +Command.prototype.option = function(flags, description, fn, defaultValue) { + var self = this, + option = new Option(flags, description), + oname = option.name(), + name = option.attributeName(); + + // default as 3rd arg + if (typeof fn !== 'function') { + if (fn instanceof RegExp) { + var regex = fn; + fn = function(val, def) { + var m = regex.exec(val); + return m ? m[0] : def; + }; + } else { + defaultValue = fn; + fn = null; + } + } + + // preassign default value only for --no-*, [optional], or + if (!option.bool || option.optional || option.required) { + // when --no-* we make sure default is true + if (!option.bool) defaultValue = true; + // preassign only if we have a default + if (defaultValue !== undefined) { + self[name] = defaultValue; + option.defaultValue = defaultValue; + } + } + + // register the option + this.options.push(option); + + // when it's passed assign the value + // and conditionally invoke the callback + this.on('option:' + oname, function(val) { + // coercion + if (val !== null && fn) { + val = fn(val, self[name] === undefined ? defaultValue : self[name]); + } + + // unassigned or bool + if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') { + // if no value, bool true, and we have a default, then use it! + if (val == null) { + self[name] = option.bool + ? defaultValue || true + : false; + } else { + self[name] = val; + } + } else if (val !== null) { + // reassign + self[name] = val; + } + }); + + return this; +}; + +/** + * Allow unknown options on the command line. + * + * @param {Boolean} arg if `true` or omitted, no error will be thrown + * for unknown options. + * @api public + */ +Command.prototype.allowUnknownOption = function(arg) { + this._allowUnknownOption = arguments.length === 0 || arg; + return this; +}; + +/** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {Array} argv + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parse = function(argv) { + // implicit help + if (this.executables) this.addImplicitHelpCommand(); + + // store raw args + this.rawArgs = argv; + + // guess name + this._name = this._name || basename(argv[1], '.js'); + + // github-style sub-commands with no sub-command + if (this.executables && argv.length < 3 && !this.defaultExecutable) { + // this user needs help + argv.push('--help'); + } + + // process argv + var parsed = this.parseOptions(this.normalize(argv.slice(2))); + var args = this.args = parsed.args; + + var result = this.parseArgs(this.args, parsed.unknown); + + // executable sub-commands + var name = result.args[0]; + + var aliasCommand = null; + // check alias of sub commands + if (name) { + aliasCommand = this.commands.filter(function(command) { + return command.alias() === name; + })[0]; + } + + if (this._execs[name] === true) { + return this.executeSubCommand(argv, args, parsed.unknown); + } else if (aliasCommand) { + // is alias of a subCommand + args[0] = aliasCommand._name; + return this.executeSubCommand(argv, args, parsed.unknown); + } else if (this.defaultExecutable) { + // use the default subcommand + args.unshift(this.defaultExecutable); + return this.executeSubCommand(argv, args, parsed.unknown); + } + + return result; +}; + +/** + * Execute a sub-command executable. + * + * @param {Array} argv + * @param {Array} args + * @param {Array} unknown + * @api private + */ + +Command.prototype.executeSubCommand = function(argv, args, unknown) { + args = args.concat(unknown); + + if (!args.length) this.help(); + if (args[0] === 'help' && args.length === 1) this.help(); + + // --help + if (args[0] === 'help') { + args[0] = args[1]; + args[1] = '--help'; + } + + // executable + var f = argv[1]; + // name of the subcommand, link `pm-install` + var bin = basename(f, path.extname(f)) + '-' + args[0]; + + // In case of globally installed, get the base dir where executable + // subcommand file should be located at + var baseDir; + + var resolvedLink = fs.realpathSync(f); + + baseDir = dirname(resolvedLink); + + // prefer local `./` to bin in the $PATH + var localBin = path.join(baseDir, bin); + + // whether bin file is a js script with explicit `.js` or `.ts` extension + var isExplicitJS = false; + if (exists(localBin + '.js')) { + bin = localBin + '.js'; + isExplicitJS = true; + } else if (exists(localBin + '.ts')) { + bin = localBin + '.ts'; + isExplicitJS = true; + } else if (exists(localBin)) { + bin = localBin; + } + + args = args.slice(1); + + var proc; + if (process.platform !== 'win32') { + if (isExplicitJS) { + args.unshift(bin); + // add executable arguments to spawn + args = (process.execArgv || []).concat(args); + + proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] }); + } else { + proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); + } + } else { + args.unshift(bin); + proc = spawn(process.execPath, args, { stdio: 'inherit' }); + } + + var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; + signals.forEach(function(signal) { + process.on(signal, function() { + if (proc.killed === false && proc.exitCode === null) { + proc.kill(signal); + } + }); + }); + proc.on('close', process.exit.bind(process)); + proc.on('error', function(err) { + if (err.code === 'ENOENT') { + console.error('error: %s(1) does not exist, try --help', bin); + } else if (err.code === 'EACCES') { + console.error('error: %s(1) not executable. try chmod or run with root', bin); + } + process.exit(1); + }); + + // Store the reference to the child process + this.runningCommand = proc; +}; + +/** + * Normalize `args`, splitting joined short flags. For example + * the arg "-abc" is equivalent to "-a -b -c". + * This also normalizes equal sign and splits "--abc=def" into "--abc def". + * + * @param {Array} args + * @return {Array} + * @api private + */ + +Command.prototype.normalize = function(args) { + var ret = [], + arg, + lastOpt, + index; + + for (var i = 0, len = args.length; i < len; ++i) { + arg = args[i]; + if (i > 0) { + lastOpt = this.optionFor(args[i - 1]); + } + + if (arg === '--') { + // Honor option terminator + ret = ret.concat(args.slice(i)); + break; + } else if (lastOpt && lastOpt.required) { + ret.push(arg); + } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') { + arg.slice(1).split('').forEach(function(c) { + ret.push('-' + c); + }); + } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { + ret.push(arg.slice(0, index), arg.slice(index + 1)); + } else { + ret.push(arg); + } + } + + return ret; +}; + +/** + * Parse command `args`. + * + * When listener(s) are available those + * callbacks are invoked, otherwise the "*" + * event is emitted and those actions are invoked. + * + * @param {Array} args + * @return {Command} for chaining + * @api private + */ + +Command.prototype.parseArgs = function(args, unknown) { + var name; + + if (args.length) { + name = args[0]; + if (this.listeners('command:' + name).length) { + this.emit('command:' + args.shift(), args, unknown); + } else { + this.emit('command:*', args); + } + } else { + outputHelpIfNecessary(this, unknown); + + // If there were no args and we have unknown options, + // then they are extraneous and we need to error. + if (unknown.length > 0) { + this.unknownOption(unknown[0]); + } + if (this.commands.length === 0 && + this._args.filter(function(a) { return a.required; }).length === 0) { + this.emit('command:*'); + } + } + + return this; +}; + +/** + * Return an option matching `arg` if any. + * + * @param {String} arg + * @return {Option} + * @api private + */ + +Command.prototype.optionFor = function(arg) { + for (var i = 0, len = this.options.length; i < len; ++i) { + if (this.options[i].is(arg)) { + return this.options[i]; + } + } +}; + +/** + * Parse options from `argv` returning `argv` + * void of these options. + * + * @param {Array} argv + * @return {Array} + * @api public + */ + +Command.prototype.parseOptions = function(argv) { + var args = [], + len = argv.length, + literal, + option, + arg; + + var unknownOptions = []; + + // parse options + for (var i = 0; i < len; ++i) { + arg = argv[i]; + + // literal args after -- + if (literal) { + args.push(arg); + continue; + } + + if (arg === '--') { + literal = true; + continue; + } + + // find matching Option + option = this.optionFor(arg); + + // option is defined + if (option) { + // requires arg + if (option.required) { + arg = argv[++i]; + if (arg == null) return this.optionMissingArgument(option); + this.emit('option:' + option.name(), arg); + // optional arg + } else if (option.optional) { + arg = argv[i + 1]; + if (arg == null || (arg[0] === '-' && arg !== '-')) { + arg = null; + } else { + ++i; + } + this.emit('option:' + option.name(), arg); + // bool + } else { + this.emit('option:' + option.name()); + } + continue; + } + + // looks like an option + if (arg.length > 1 && arg[0] === '-') { + unknownOptions.push(arg); + + // If the next argument looks like it might be + // an argument for this option, we pass it on. + // If it isn't, then it'll simply be ignored + if ((i + 1) < argv.length && argv[i + 1][0] !== '-') { + unknownOptions.push(argv[++i]); + } + continue; + } + + // arg + args.push(arg); + } + + return { args: args, unknown: unknownOptions }; +}; + +/** + * Return an object containing options as key-value pairs + * + * @return {Object} + * @api public + */ +Command.prototype.opts = function() { + var result = {}, + len = this.options.length; + + for (var i = 0; i < len; i++) { + var key = this.options[i].attributeName(); + result[key] = key === this._versionOptionName ? this._version : this[key]; + } + return result; +}; + +/** + * Argument `name` is missing. + * + * @param {String} name + * @api private + */ + +Command.prototype.missingArgument = function(name) { + console.error("error: missing required argument `%s'", name); + process.exit(1); +}; + +/** + * `Option` is missing an argument, but received `flag` or nothing. + * + * @param {String} option + * @param {String} flag + * @api private + */ + +Command.prototype.optionMissingArgument = function(option, flag) { + if (flag) { + console.error("error: option `%s' argument missing, got `%s'", option.flags, flag); + } else { + console.error("error: option `%s' argument missing", option.flags); + } + process.exit(1); +}; + +/** + * Unknown option `flag`. + * + * @param {String} flag + * @api private + */ + +Command.prototype.unknownOption = function(flag) { + if (this._allowUnknownOption) return; + console.error("error: unknown option `%s'", flag); + process.exit(1); +}; + +/** + * Variadic argument with `name` is not the last argument as required. + * + * @param {String} name + * @api private + */ + +Command.prototype.variadicArgNotLast = function(name) { + console.error("error: variadic arguments must be last `%s'", name); + process.exit(1); +}; + +/** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {String} str + * @param {String} [flags] + * @return {Command} for chaining + * @api public + */ + +Command.prototype.version = function(str, flags) { + if (arguments.length === 0) return this._version; + this._version = str; + flags = flags || '-V, --version'; + var versionOption = new Option(flags, 'output the version number'); + this._versionOptionName = versionOption.long.substr(2) || 'version'; + this.options.push(versionOption); + this.on('option:' + this._versionOptionName, function() { + process.stdout.write(str + '\n'); + process.exit(0); + }); + return this; +}; + +/** + * Set the description to `str`. + * + * @param {String} str + * @param {Object} argsDescription + * @return {String|Command} + * @api public + */ + +Command.prototype.description = function(str, argsDescription) { + if (arguments.length === 0) return this._description; + this._description = str; + this._argsDescription = argsDescription; + return this; +}; + +/** + * Set an alias for the command + * + * @param {String} alias + * @return {String|Command} + * @api public + */ + +Command.prototype.alias = function(alias) { + var command = this; + if (this.commands.length !== 0) { + command = this.commands[this.commands.length - 1]; + } + + if (arguments.length === 0) return command._alias; + + if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + + command._alias = alias; + return this; +}; + +/** + * Set / get the command usage `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.usage = function(str) { + var args = this._args.map(function(arg) { + return humanReadableArgName(arg); + }); + + var usage = '[options]' + + (this.commands.length ? ' [command]' : '') + + (this._args.length ? ' ' + args.join(' ') : ''); + + if (arguments.length === 0) return this._usage || usage; + this._usage = str; + + return this; +}; + +/** + * Get or set the name of the command + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.name = function(str) { + if (arguments.length === 0) return this._name; + this._name = str; + return this; +}; + +/** + * Return prepared commands. + * + * @return {Array} + * @api private + */ + +Command.prototype.prepareCommands = function() { + return this.commands.filter(function(cmd) { + return !cmd._noHelp; + }).map(function(cmd) { + var args = cmd._args.map(function(arg) { + return humanReadableArgName(arg); + }).join(' '); + + return [ + cmd._name + + (cmd._alias ? '|' + cmd._alias : '') + + (cmd.options.length ? ' [options]' : '') + + (args ? ' ' + args : ''), + cmd._description + ]; + }); +}; + +/** + * Return the largest command length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestCommandLength = function() { + var commands = this.prepareCommands(); + return commands.reduce(function(max, command) { + return Math.max(max, command[0].length); + }, 0); +}; + +/** + * Return the largest option length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestOptionLength = function() { + var options = [].slice.call(this.options); + options.push({ + flags: '-h, --help' + }); + return options.reduce(function(max, option) { + return Math.max(max, option.flags.length); + }, 0); +}; + +/** + * Return the largest arg length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestArgLength = function() { + return this._args.reduce(function(max, arg) { + return Math.max(max, arg.name.length); + }, 0); +}; + +/** + * Return the pad width. + * + * @return {Number} + * @api private + */ + +Command.prototype.padWidth = function() { + var width = this.largestOptionLength(); + if (this._argsDescription && this._args.length) { + if (this.largestArgLength() > width) { + width = this.largestArgLength(); + } + } + + if (this.commands && this.commands.length) { + if (this.largestCommandLength() > width) { + width = this.largestCommandLength(); + } + } + + return width; +}; + +/** + * Return help for options. + * + * @return {String} + * @api private + */ + +Command.prototype.optionHelp = function() { + var width = this.padWidth(); + + // Append the help information + return this.options.map(function(option) { + return pad(option.flags, width) + ' ' + option.description + + ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); + }).concat([pad('-h, --help', width) + ' ' + 'output usage information']) + .join('\n'); +}; + +/** + * Return command help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.commandHelp = function() { + if (!this.commands.length) return ''; + + var commands = this.prepareCommands(); + var width = this.padWidth(); + + return [ + 'Commands:', + commands.map(function(cmd) { + var desc = cmd[1] ? ' ' + cmd[1] : ''; + return (desc ? pad(cmd[0], width) : cmd[0]) + desc; + }).join('\n').replace(/^/gm, ' '), + '' + ].join('\n'); +}; + +/** + * Return program help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.helpInformation = function() { + var desc = []; + if (this._description) { + desc = [ + this._description, + '' + ]; + + var argsDescription = this._argsDescription; + if (argsDescription && this._args.length) { + var width = this.padWidth(); + desc.push('Arguments:'); + desc.push(''); + this._args.forEach(function(arg) { + desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]); + }); + desc.push(''); + } + } + + var cmdName = this._name; + if (this._alias) { + cmdName = cmdName + '|' + this._alias; + } + var usage = [ + 'Usage: ' + cmdName + ' ' + this.usage(), + '' + ]; + + var cmds = []; + var commandHelp = this.commandHelp(); + if (commandHelp) cmds = [commandHelp]; + + var options = [ + 'Options:', + '' + this.optionHelp().replace(/^/gm, ' '), + '' + ]; + + return usage + .concat(desc) + .concat(options) + .concat(cmds) + .join('\n'); +}; + +/** + * Output help information for this command + * + * @api public + */ + +Command.prototype.outputHelp = function(cb) { + if (!cb) { + cb = function(passthru) { + return passthru; + }; + } + process.stdout.write(cb(this.helpInformation())); + this.emit('--help'); +}; + +/** + * Output help information and exit. + * + * @api public + */ + +Command.prototype.help = function(cb) { + this.outputHelp(cb); + process.exit(); +}; + +/** + * Camel-case the given `flag` + * + * @param {String} flag + * @return {String} + * @api private + */ + +function camelcase(flag) { + return flag.split('-').reduce(function(str, word) { + return str + word[0].toUpperCase() + word.slice(1); + }); +} + +/** + * Pad `str` to `width`. + * + * @param {String} str + * @param {Number} width + * @return {String} + * @api private + */ + +function pad(str, width) { + var len = Math.max(0, width - str.length); + return str + Array(len + 1).join(' '); +} + +/** + * Output help information if necessary + * + * @param {Command} command to output help for + * @param {Array} array of options to search for -h or --help + * @api private + */ + +function outputHelpIfNecessary(cmd, options) { + options = options || []; + for (var i = 0; i < options.length; i++) { + if (options[i] === '--help' || options[i] === '-h') { + cmd.outputHelp(); + process.exit(0); + } + } +} + +/** + * Takes an argument an returns its human readable equivalent for help usage. + * + * @param {Object} arg + * @return {String} + * @api private + */ + +function humanReadableArgName(arg) { + var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); + + return arg.required + ? '<' + nameOutput + '>' + : '[' + nameOutput + ']'; +} + +// for versions before node v0.8 when there weren't `fs.existsSync` +function exists(file) { + try { + if (fs.statSync(file).isFile()) { + return true; + } + } catch (e) { + return false; + } +} diff --git a/live2d/node_modules/commander/package.json b/live2d/node_modules/commander/package.json new file mode 100644 index 0000000..0023c5c --- /dev/null +++ b/live2d/node_modules/commander/package.json @@ -0,0 +1,38 @@ +{ + "name": "commander", + "version": "2.20.3", + "description": "the complete solution for node.js command-line programs", + "keywords": [ + "commander", + "command", + "option", + "parser" + ], + "author": "TJ Holowaychuk ", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tj/commander.js.git" + }, + "scripts": { + "lint": "eslint index.js", + "test": "node test/run.js && npm run test-typings", + "test-typings": "tsc -p tsconfig.json" + }, + "main": "index", + "files": [ + "index.js", + "typings/index.d.ts" + ], + "dependencies": {}, + "devDependencies": { + "@types/node": "^12.7.8", + "eslint": "^6.4.0", + "should": "^13.2.3", + "sinon": "^7.5.0", + "standard": "^14.3.1", + "ts-node": "^8.4.1", + "typescript": "^3.6.3" + }, + "typings": "typings/index.d.ts" +} diff --git a/live2d/node_modules/commander/typings/index.d.ts b/live2d/node_modules/commander/typings/index.d.ts new file mode 100644 index 0000000..bcda277 --- /dev/null +++ b/live2d/node_modules/commander/typings/index.d.ts @@ -0,0 +1,310 @@ +// Type definitions for commander 2.11 +// Project: https://github.com/visionmedia/commander.js +// Definitions by: Alan Agius , Marcelo Dezem , vvakame , Jules Randolph +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace local { + + class Option { + flags: string; + required: boolean; + optional: boolean; + bool: boolean; + short?: string; + long: string; + description: string; + + /** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {string} flags + * @param {string} [description] + */ + constructor(flags: string, description?: string); + } + + class Command extends NodeJS.EventEmitter { + [key: string]: any; + + args: string[]; + + /** + * Initialize a new `Command`. + * + * @param {string} [name] + */ + constructor(name?: string); + + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {string} str + * @param {string} [flags] + * @returns {Command} for chaining + */ + version(str: string, flags?: string): Command; + + /** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * @example + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function() { + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd) { + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('teardown [otherDirs...]') + * .description('run teardown commands') + * .action(function(dir, otherDirs) { + * console.log('dir "%s"', dir); + * if (otherDirs) { + * otherDirs.forEach(function (oDir) { + * console.log('dir "%s"', oDir); + * }); + * } + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env) { + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {string} name + * @param {string} [desc] for git-style sub-commands + * @param {CommandOptions} [opts] command options + * @returns {Command} the new command + */ + command(name: string, desc?: string, opts?: commander.CommandOptions): Command; + + /** + * Define argument syntax for the top-level command. + * + * @param {string} desc + * @returns {Command} for chaining + */ + arguments(desc: string): Command; + + /** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {string[]} args + * @returns {Command} for chaining + */ + parseExpectedArgs(args: string[]): Command; + + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {(...args: any[]) => void} fn + * @returns {Command} for chaining + */ + action(fn: (...args: any[]) => void): Command; + + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {string} flags + * @param {string} [description] + * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default + * @param {*} [defaultValue] + * @returns {Command} for chaining + */ + option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; + option(flags: string, description?: string, defaultValue?: any): Command; + + /** + * Allow unknown options on the command line. + * + * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. + * @returns {Command} for chaining + */ + allowUnknownOption(arg?: boolean): Command; + + /** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {string[]} argv + * @returns {Command} for chaining + */ + parse(argv: string[]): Command; + + /** + * Parse options from `argv` returning `argv` void of these options. + * + * @param {string[]} argv + * @returns {ParseOptionsResult} + */ + parseOptions(argv: string[]): commander.ParseOptionsResult; + + /** + * Return an object containing options as key-value pairs + * + * @returns {{[key: string]: any}} + */ + opts(): { [key: string]: any }; + + /** + * Set the description to `str`. + * + * @param {string} str + * @param {{[argName: string]: string}} argsDescription + * @return {(Command | string)} + */ + description(str: string, argsDescription?: {[argName: string]: string}): Command; + description(): string; + + /** + * Set an alias for the command. + * + * @param {string} alias + * @return {(Command | string)} + */ + alias(alias: string): Command; + alias(): string; + + /** + * Set or get the command usage. + * + * @param {string} str + * @return {(Command | string)} + */ + usage(str: string): Command; + usage(): string; + + /** + * Set the name of the command. + * + * @param {string} str + * @return {Command} + */ + name(str: string): Command; + + /** + * Get the name of the command. + * + * @return {string} + */ + name(): string; + + /** + * Output help information for this command. + * + * @param {(str: string) => string} [cb] + */ + outputHelp(cb?: (str: string) => string): void; + + /** Output help information and exit. + * + * @param {(str: string) => string} [cb] + */ + help(cb?: (str: string) => string): never; + } + +} + +declare namespace commander { + + type Command = local.Command + + type Option = local.Option + + interface CommandOptions { + noHelp?: boolean; + isDefault?: boolean; + } + + interface ParseOptionsResult { + args: string[]; + unknown: string[]; + } + + interface CommanderStatic extends Command { + Command: typeof local.Command; + Option: typeof local.Option; + CommandOptions: CommandOptions; + ParseOptionsResult: ParseOptionsResult; + } + +} + +declare const commander: commander.CommanderStatic; +export = commander; diff --git a/live2d/node_modules/commondir/LICENSE b/live2d/node_modules/commondir/LICENSE new file mode 100644 index 0000000..3d59c73 --- /dev/null +++ b/live2d/node_modules/commondir/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2013 James Halliday (mail@substack.net) + +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. \ No newline at end of file diff --git a/live2d/node_modules/commondir/example/dir.js b/live2d/node_modules/commondir/example/dir.js new file mode 100644 index 0000000..e86a346 --- /dev/null +++ b/live2d/node_modules/commondir/example/dir.js @@ -0,0 +1,3 @@ +var commondir = require('../'); +var dir = commondir(process.argv.slice(2)); +console.log(dir); diff --git a/live2d/node_modules/commondir/index.js b/live2d/node_modules/commondir/index.js new file mode 100644 index 0000000..fa77d04 --- /dev/null +++ b/live2d/node_modules/commondir/index.js @@ -0,0 +1,29 @@ +var path = require('path'); + +module.exports = function (basedir, relfiles) { + if (relfiles) { + var files = relfiles.map(function (r) { + return path.resolve(basedir, r); + }); + } + else { + var files = basedir; + } + + var res = files.slice(1).reduce(function (ps, file) { + if (!file.match(/^([A-Za-z]:)?\/|\\/)) { + throw new Error('relative path without a basedir'); + } + + var xs = file.split(/\/+|\\+/); + for ( + var i = 0; + ps[i] === xs[i] && i < Math.min(ps.length, xs.length); + i++ + ); + return ps.slice(0, i); + }, files[0].split(/\/+|\\+/)); + + // Windows correctly handles paths with forward-slashes + return res.length > 1 ? res.join('/') : '/' +}; diff --git a/live2d/node_modules/commondir/package.json b/live2d/node_modules/commondir/package.json new file mode 100644 index 0000000..7320d95 --- /dev/null +++ b/live2d/node_modules/commondir/package.json @@ -0,0 +1,34 @@ +{ + "name": "commondir", + "version": "1.0.1", + "description": "compute the closest common parent for file paths", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "tape": "^3.5.0" + }, + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "http://github.com/substack/node-commondir.git" + }, + "keywords": [ + "common", + "path", + "directory", + "file", + "parent", + "root" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "engine": { + "node": ">=0.4" + } +} diff --git a/live2d/node_modules/commondir/readme.markdown b/live2d/node_modules/commondir/readme.markdown new file mode 100644 index 0000000..6c20607 --- /dev/null +++ b/live2d/node_modules/commondir/readme.markdown @@ -0,0 +1,48 @@ +# commondir + +compute the closest common parent directory among an array of directories + +# example + +``` js +var commondir = require('commondir'); +var dir = commondir(process.argv.slice(2)) +console.log(dir); +``` + +output: + +``` +$ node dir.js /x/y/z /x/y /x/y/w/q +/x/y +$ node ../baz ../../foo/quux ./bizzy +/foo +``` + +# methods + +``` js +var commondir = require('commondir'); +``` + +## commondir(absolutePaths) + +Compute the closest common parent directory for an array `absolutePaths`. + +## commondir(basedir, relativePaths) + +Compute the closest common parent directory for an array `relativePaths` which +will be resolved for each `dir` in `relativePaths` according to: +`path.resolve(basedir, dir)`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install commondir +``` + +# license + +MIT diff --git a/live2d/node_modules/commondir/test/dirs.js b/live2d/node_modules/commondir/test/dirs.js new file mode 100644 index 0000000..7e55c9b --- /dev/null +++ b/live2d/node_modules/commondir/test/dirs.js @@ -0,0 +1,55 @@ +var test = require('tape'); +var commondir = require('../'); + +test('common', function (t) { + t.equal( + commondir([ '/foo', '//foo/bar', '/foo//bar/baz' ]), + '/foo' + ); + t.equal( + commondir([ '/a/b/c', '/a/b', '/a/b/c/d/e' ]), + '/a/b' + ); + t.equal( + commondir([ '/x/y/z/w', '/xy/z', '/x/y/z' ]), + '/' + ); + t.equal( + commondir([ 'X:\\foo', 'X:\\\\foo\\bar', 'X://foo/bar/baz' ]), + 'X:/foo' + ); + t.equal( + commondir([ 'X:\\a\\b\\c', 'X:\\a\\b', 'X:\\a\\b\\c\\d\\e' ]), + 'X:/a/b' + ); + t.equal( + commondir([ 'X:\\x\\y\\z\\w', '\\\\xy\\z', '\\x\\y\\z' ]), + '/' + ); + t.throws(function () { + commondir([ '/x/y/z/w', 'qrs', '/x/y/z' ]); + }); + t.end(); +}); + +test('base', function (t) { + t.equal( + commondir('/foo/bar', [ 'baz', './quux', '../bar/bazzy' ]), + '/foo/bar' + ); + t.equal( + commondir('/a/b', [ 'c', '../b/.', '../../a/b/e' ]), + '/a/b' + ); + t.equal( + commondir('/a/b/c', [ '..', '../d', '../../a/z/e' ]), + '/a' + ); + t.equal( + commondir('/foo/bar', [ 'baz', '.\\quux', '..\\bar\\bazzy' ]), + '/foo/bar' + ); + // Tests including X:\ basedirs must wait until path.resolve supports + // Windows-style paths, starting in Node.js v0.5.X + t.end(); +}); diff --git a/live2d/node_modules/concat-map/.travis.yml b/live2d/node_modules/concat-map/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/live2d/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/live2d/node_modules/concat-map/LICENSE b/live2d/node_modules/concat-map/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/live2d/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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. diff --git a/live2d/node_modules/concat-map/README.markdown b/live2d/node_modules/concat-map/README.markdown new file mode 100644 index 0000000..408f70a --- /dev/null +++ b/live2d/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/live2d/node_modules/concat-map/example/map.js b/live2d/node_modules/concat-map/example/map.js new file mode 100644 index 0000000..3365621 --- /dev/null +++ b/live2d/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/live2d/node_modules/concat-map/index.js b/live2d/node_modules/concat-map/index.js new file mode 100644 index 0000000..b29a781 --- /dev/null +++ b/live2d/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/live2d/node_modules/concat-map/package.json b/live2d/node_modules/concat-map/package.json new file mode 100644 index 0000000..d3640e6 --- /dev/null +++ b/live2d/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "name" : "concat-map", + "description" : "concatenative mapdashery", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/node-concat-map.git" + }, + "main" : "index.js", + "keywords" : [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories" : { + "example" : "example", + "test" : "test" + }, + "scripts" : { + "test" : "tape test/*.js" + }, + "devDependencies" : { + "tape" : "~2.4.0" + }, + "license" : "MIT", + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "ie" : [ 6, 7, 8, 9 ], + "ff" : [ 3.5, 10, 15.0 ], + "chrome" : [ 10, 22 ], + "safari" : [ 5.1 ], + "opera" : [ 12 ] + } + } +} diff --git a/live2d/node_modules/concat-map/test/map.js b/live2d/node_modules/concat-map/test/map.js new file mode 100644 index 0000000..fdbd702 --- /dev/null +++ b/live2d/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/live2d/node_modules/define-data-property/.eslintrc b/live2d/node_modules/define-data-property/.eslintrc new file mode 100644 index 0000000..75443e8 --- /dev/null +++ b/live2d/node_modules/define-data-property/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "id-length": 0, + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": "off", + }, + }, + ], +} diff --git a/live2d/node_modules/define-data-property/.github/FUNDING.yml b/live2d/node_modules/define-data-property/.github/FUNDING.yml new file mode 100644 index 0000000..3e17725 --- /dev/null +++ b/live2d/node_modules/define-data-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/define-data-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/define-data-property/.nycrc b/live2d/node_modules/define-data-property/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/live2d/node_modules/define-data-property/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/define-data-property/CHANGELOG.md b/live2d/node_modules/define-data-property/CHANGELOG.md new file mode 100644 index 0000000..4eed75e --- /dev/null +++ b/live2d/node_modules/define-data-property/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13 + +### Commits + +- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453) +- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153) + +## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12 + +### Commits + +- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318) +- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e) +- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc) +- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd) +- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804) +- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de) + +## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05 + +### Commits + +- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f) +- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a) +- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d89be50`](https://github.com/ljharb/define-data-property/commit/d89be50571175888d391238605122679f7e65ffc) +- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b) +- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646) + +## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12 + +### Commits + +- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94) +- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3) +- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548) +- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0) +- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142) + +## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13 + +### Commits + +- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72) +- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792) + +## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12 + +### Commits + +- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69) +- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7) +- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee) + +## v1.0.0 - 2023-09-12 + +### Commits + +- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196) +- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d) +- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed) +- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e) +- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375) diff --git a/live2d/node_modules/define-data-property/LICENSE b/live2d/node_modules/define-data-property/LICENSE new file mode 100644 index 0000000..b4213ac --- /dev/null +++ b/live2d/node_modules/define-data-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +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. diff --git a/live2d/node_modules/define-data-property/README.md b/live2d/node_modules/define-data-property/README.md new file mode 100644 index 0000000..f2304da --- /dev/null +++ b/live2d/node_modules/define-data-property/README.md @@ -0,0 +1,67 @@ +# define-data-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Define a data property on an object. Will fall back to assignment in an engine without descriptors. + +The three `non*` argument can also be passed `null`, which will use the existing state if available. + +The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment. + +## Usage + +```javascript +var defineDataProperty = require('define-data-property'); +var assert = require('assert'); + +var obj = {}; +defineDataProperty(obj, 'key', 'value'); +defineDataProperty( + obj, + 'key2', + 'value', + true, // nonEnumerable, optional + false, // nonWritable, optional + true, // nonConfigurable, optional + false // loose, optional +); + +assert.deepEqual( + Object.getOwnPropertyDescriptors(obj), + { + key: { + configurable: true, + enumerable: true, + value: 'value', + writable: true, + }, + key2: { + configurable: false, + enumerable: false, + value: 'value', + writable: true, + }, + } +); +``` + +[package-url]: https://npmjs.org/package/define-data-property +[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg +[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg +[deps-url]: https://david-dm.org/ljharb/define-data-property +[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/define-data-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property +[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property +[actions-url]: https://github.com/ljharb/define-data-property/actions diff --git a/live2d/node_modules/define-data-property/index.d.ts b/live2d/node_modules/define-data-property/index.d.ts new file mode 100644 index 0000000..b56a77d --- /dev/null +++ b/live2d/node_modules/define-data-property/index.d.ts @@ -0,0 +1,12 @@ + +declare function defineDataProperty( + obj: Record, + property: keyof typeof obj, + value: typeof obj[typeof property], + nonEnumerable?: boolean | null, + nonWritable?: boolean | null, + nonConfigurable?: boolean | null, + loose?: boolean +): void; + +export = defineDataProperty; \ No newline at end of file diff --git a/live2d/node_modules/define-data-property/index.js b/live2d/node_modules/define-data-property/index.js new file mode 100644 index 0000000..e1a38c0 --- /dev/null +++ b/live2d/node_modules/define-data-property/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); + +var gopd = require('gopd'); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; diff --git a/live2d/node_modules/define-data-property/package.json b/live2d/node_modules/define-data-property/package.json new file mode 100644 index 0000000..eec4097 --- /dev/null +++ b/live2d/node_modules/define-data-property/package.json @@ -0,0 +1,106 @@ +{ + "name": "define-data-property", + "version": "1.1.4", + "description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/define-data-property.git" + }, + "keywords": [ + "define", + "data", + "property", + "object", + "accessor", + "javascript", + "ecmascript", + "enumerable", + "configurable", + "writable" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/define-data-property/issues" + }, + "homepage": "https://github.com/ljharb/define-data-property#readme", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/object.getownpropertydescriptors": "^2.1.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "hasown": "^2.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "object.getownpropertydescriptors": "^2.1.7", + "reflect.ownkeys": "^1.1.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types/reflect.ownkeys" + ] + } +} diff --git a/live2d/node_modules/define-data-property/test/index.js b/live2d/node_modules/define-data-property/test/index.js new file mode 100644 index 0000000..68204c6 --- /dev/null +++ b/live2d/node_modules/define-data-property/test/index.js @@ -0,0 +1,392 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var hasOwn = require('hasown'); +var hasPropertyDescriptors = require('has-property-descriptors')(); +var getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); +var ownKeys = require('reflect.ownkeys'); + +var defineDataProperty = require('../'); + +test('defineDataProperty', function (t) { + t.test('argument validation', function (st) { + forEach(v.primitives, function (nonObject) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty(nonObject, 'key', 'value'); }, + TypeError, + 'throws on non-object input: ' + inspect(nonObject) + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, nonPropertyKey, 'value'); }, + TypeError, + 'throws on non-PropertyKey input: ' + inspect(nonPropertyKey) + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + if (nonBoolean !== null) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', nonBoolean); }, + TypeError, + 'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonWritable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean) + ); + } + }); + + st.end(); + }); + + t.test('normal data property', function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + st.ok(hasOwn(obj, 'existing'), 'has initial own property'); + st.equal(obj.existing, 'existing property', 'has expected initial value'); + + var res = defineDataProperty(obj, 'added', 'added property'); + st.equal(res, void undefined, 'returns `undefined`'); + st.ok(hasOwn(obj, 'added'), 'has expected own property'); + st.equal(obj.added, 'added property', 'has expected value'); + + defineDataProperty(obj, 'existing', 'new value'); + st.ok(hasOwn(obj, 'existing'), 'still has expected own property'); + st.equal(obj.existing, 'new value', 'has new expected value'); + + defineDataProperty(obj, 'explicit1', 'new value', false); + st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)'); + st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)'); + + defineDataProperty(obj, 'explicit2', 'new value', false, false); + st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)'); + st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)'); + + defineDataProperty(obj, 'explicit3', 'new value', false, false, false); + st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)'); + st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)'); + + st.end(); + }); + + t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) { + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'added', 'added value 1', true, null, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: !hasPropertyDescriptors, + value: 'added value 1', + writable: true + } + }, + 'in loose mode, obj still adds property 1' + ); + + defineDataProperty(obj, 'added', 'added value 2', false, true, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: true, + value: 'added value 2', + writable: !hasPropertyDescriptors + } + }, + 'in loose mode, obj still adds property 2' + ); + + defineDataProperty(obj, 'added', 'added value 3', false, false, true, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: !hasPropertyDescriptors, + enumerable: true, + value: 'added value 3', + writable: true + } + }, + 'in loose mode, obj still adds property 3' + ); + + st.end(); + }); + + t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', true); }, + SyntaxError, + 'nonEnumerable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st.deepEqual( + ownKeys(obj), + ['existing'], + 'obj still has expected keys' + ); + st.equal(obj.existing, 'existing property', 'obj still has expected values'); + + st.end(); + }); + + t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'nonEnum', null, true); + defineDataProperty(obj, 'nonWrit', null, false, true); + defineDataProperty(obj, 'nonConf', null, false, false, true); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj has expected property descriptors' + ); + + st.end(); + }); + + t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + // test case changing an existing non-normal property + + /** @type {Record} */ + var obj = {}; + Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true }); + Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false }); + Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true }); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj initially has expected property descriptors' + ); + + defineDataProperty(obj, 'nonEnum', 'new value', false); + defineDataProperty(obj, 'nonWrit', 'new value', false, false); + st['throws']( + function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); }, + TypeError, + 'can not alter a nonconfigurable property' + ); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj ends up with expected property descriptors' + ); + + st.end(); + }); + + t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var frozen = Object.freeze({ existing: true }); + + st['throws']( + function () { defineDataProperty(frozen, 'existing', 'new value'); }, + TypeError, + 'frozen object can not modify an existing property' + ); + + st['throws']( + function () { defineDataProperty(frozen, 'new', 'new property'); }, + TypeError, + 'frozen object can not add a new property' + ); + + st.end(); + }); + + t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var sealed = Object.seal({ existing: true }); + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: true, + writable: true + }, + 'existing value on sealed object has expected descriptor' + ); + + defineDataProperty(sealed, 'existing', 'new value'); + + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: 'new value', + writable: true + }, + 'existing value on sealed object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(sealed, 'new', 'new property'); }, + TypeError, + 'sealed object can not add a new property' + ); + + st.end(); + }); + + t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var nonExt = Object.preventExtensions({ existing: true }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: true, + value: true, + writable: true + }, + 'existing value on non-extensible object has expected descriptor' + ); + + defineDataProperty(nonExt, 'existing', 'new value', true); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: false, + value: 'new value', + writable: true + }, + 'existing value on non-extensible object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(nonExt, 'new', 'new property'); }, + TypeError, + 'non-extensible object can not add a new property' + ); + + st.end(); + }); + + t.end(); +}); diff --git a/live2d/node_modules/define-data-property/tsconfig.json b/live2d/node_modules/define-data-property/tsconfig.json new file mode 100644 index 0000000..69f060d --- /dev/null +++ b/live2d/node_modules/define-data-property/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/live2d/node_modules/earcut/LICENSE b/live2d/node_modules/earcut/LICENSE new file mode 100644 index 0000000..9b7a7f7 --- /dev/null +++ b/live2d/node_modules/earcut/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2016, Mapbox + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +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. diff --git a/live2d/node_modules/earcut/README.md b/live2d/node_modules/earcut/README.md new file mode 100644 index 0000000..b5cd911 --- /dev/null +++ b/live2d/node_modules/earcut/README.md @@ -0,0 +1,255 @@ +## Earcut + +The fastest and smallest JavaScript polygon triangulation library. 3KB gzipped. + +[![Build Status](https://travis-ci.org/mapbox/earcut.svg?branch=master)](https://travis-ci.org/mapbox/earcut) +[![Coverage Status](https://coveralls.io/repos/mapbox/earcut/badge.svg?branch=master)](https://coveralls.io/r/mapbox/earcut?branch=master) +[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/mapbox/earcut.svg)](http://isitmaintained.com/project/mapbox/earcut "Average time to resolve an issue") +[![Percentage of issues still open](http://isitmaintained.com/badge/open/mapbox/earcut.svg)](http://isitmaintained.com/project/mapbox/earcut "Percentage of issues still open") +[![](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects) + +#### The algorithm + +The library implements a modified ear slicing algorithm, +optimized by [z-order curve](http://en.wikipedia.org/wiki/Z-order_curve) hashing +and extended to handle holes, twisted polygons, degeneracies and self-intersections +in a way that doesn't _guarantee_ correctness of triangulation, +but attempts to always produce acceptable results for practical data. + +It's based on ideas from +[FIST: Fast Industrial-Strength Triangulation of Polygons](http://www.cosy.sbg.ac.at/~held/projects/triang/triang.html) by Martin Held +and [Triangulation by Ear Clipping](http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf) by David Eberly. + +#### Why another triangulation library? + +The aim of this project is to create a JS triangulation library +that is **fast enough for real-time triangulation in the browser**, +sacrificing triangulation quality for raw speed and simplicity, +while being robust enough to handle most practical datasets without crashing or producing garbage. +Some benchmarks using Node 0.12: + +(ops/sec) | pts | earcut | libtess | poly2tri | pnltri | polyk +------------------| ---- | --------- | -------- | -------- | --------- | ------ +OSM building | 15 | _795,935_ | _50,640_ | _61,501_ | _122,966_ | _175,570_ +dude shape | 94 | _35,658_ | _10,339_ | _8,784_ | _11,172_ | _13,557_ +holed dude shape | 104 | _28,319_ | _8,883_ | _7,494_ | _2,130_ | n/a +complex OSM water | 2523 | _543_ | _77.54_ | failure | failure | n/a +huge OSM water | 5667 | _95_ | _29.30_ | failure | failure | n/a + +The original use case it was created for is [Mapbox GL](https://www.mapbox.com/mapbox-gl), WebGL-based interactive maps. + +If you want to get correct triangulation even on very bad data with lots of self-intersections +and earcut is not precise enough, take a look at [libtess.js](https://github.com/brendankenny/libtess.js). + +#### Usage + +```js +var triangles = earcut([10,0, 0,50, 60,60, 70,10]); // returns [1,0,3, 3,2,1] +``` + +Signature: `earcut(vertices[, holes, dimensions = 2])`. + +* `vertices` is a flat array of vertex coordinates like `[x0,y0, x1,y1, x2,y2, ...]`. +* `holes` is an array of hole _indices_ if any + (e.g. `[5, 8]` for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). +* `dimensions` is the number of coordinates per vertex in the input array (`2` by default). + +Each group of three vertex indices in the resulting array forms a triangle. + +```js +// triangulating a polygon with a hole +earcut([0,0, 100,0, 100,100, 0,100, 20,20, 80,20, 80,80, 20,80], [4]); +// [3,0,4, 5,4,0, 3,4,7, 5,0,1, 2,3,7, 6,5,1, 2,7,6, 6,1,2] + +// triangulating a polygon with 3d coords +earcut([10,0,1, 0,50,2, 60,60,3, 70,10,4], null, 3); +// [1,0,3, 3,2,1] +``` + +If you pass a single vertex as a hole, Earcut treats it as a Steiner point. + +If your input is a multi-dimensional array (e.g. [GeoJSON Polygon](http://geojson.org/geojson-spec.html#polygon)), +you can convert it to the format expected by Earcut with `earcut.flatten`: + +```js +var data = earcut.flatten(geojson.geometry.coordinates); +var triangles = earcut(data.vertices, data.holes, data.dimensions); +``` + +After getting a triangulation, you can verify its correctness with `earcut.deviation`: + +```js +var deviation = earcut.deviation(vertices, holes, dimensions, triangles); +``` + +Returns the relative difference between the total area of triangles and the area of the input polygon. +`0` means the triangulation is fully correct. + +#### Install + +NPM and Browserify: + +```bash +npm install earcut +``` + +Browser builds on CDN: + +- [development build](https://unpkg.com/earcut@2.2.4/dist/earcut.dev.js) +- [minified production build](https://unpkg.com/earcut@2.2.4/dist/earcut.min.js) + +Running tests: + +```bash +npm test +``` + +![](https://cloud.githubusercontent.com/assets/25395/5778431/e8ec0c10-9da3-11e4-8d4e-a2ced6a7d2b7.png) + +#### Ports to other languages + +- [mapbox/earcut.hpp](https://github.com/mapbox/earcut.hpp) (C++11) +- [earcut4j/earcut4j](https://github.com/earcut4j/earcut4j) (Java) +- [the3deers/earcut-java](https://github.com/the3deers/earcut-java) (Java) +- [Larpon/earcut](https://github.com/Larpon/earcut) (V) +- [Cawfree/earcut-j](https://github.com/Cawfree/earcut-j) (Java, outdated) + +#### Changelog + +##### 2.2.4 (Jul 5, 2022) + +- Improved performance by 10–15%. +- Fixed another rare race condition that could lead to an infinite loop. + +##### 2.2.3 (Jul 8, 2021) + +- Fixed a rare race condition that could lead to an infinite loop. + +##### 2.2.2 (Jan 21, 2020) + +- Fixed yet another rare race condition when a hole shared an edge with an outer ring. + +##### 2.2.1 (Sep 19, 2019) + +- Fixed another rare case with touching holes. + +##### 2.2.0 (Sep 18, 2019) + +- Fixed a handful of rare race conditions. + +##### 2.1.5 (Feb 5, 2019) + +- Fixed a race condition with coincident holes that could lead to bad triangulation. + +##### 2.1.4 (Dec 4, 2018) + +- Fixed a race condition that could lead to a freeze on degenerate input. + +##### 2.1.3 (Jan 4, 2018) + +- Improved performance for bigger inputs (5-12%). + +##### 2.1.2 (Oct 23, 2017) + +- Fixed a few race conditions where bad input would cause an error. + +##### 2.1.1 (Mar 17, 2016) + +- Fixed a rare race condition where the split routine would choose bad diagonals. +- Fixed a rare race condition in the "cure local intersections" routine. +- Fixed a rare race condition where a hole that shares a point with the outer ring would be handled incorrectly. +- Fixed a bug where a closing point wouldn't be filtered as duplicate, sometimes breaking triangulation. + +##### 2.1.0 (Mar 11, 2016) + +- Added `earcut.deviation` function for verifying correctness of triangulation. +- Added `earcut.flatten` function for converting GeoJSON-like input into a format Earcut expects. + +##### 2.0.9 (Mar 10, 2016) + +- Fixed a rare race condition where a hole would be handled incorrectly. + +##### 2.0.8 (Jan 19, 2016) + +- Fixed a rare race condition with a hole touching outer ring. + +##### 2.0.7 (Nov 18, 2015) + +- Changed the algorithm to avoid filtering colinear/duplicate vertices unless it can't triangulate the polygon otherwise. + Improves performance on simpler shapes and fixes some 3D use cases. + +##### 2.0.6 (Oct 26, 2015) + +- Improved robustness and reliability of the triangulation algorithm. +- Improved performance by up to 15%. +- Significantly improved source code clarity. + +##### 2.0.5 (Oct 12, 2015) + +- Fixed a z-curve hashing bug that could lead to unexpected results in very rare cases involving shapes with lots of points. + +##### 2.0.4 (Oct 8, 2015) + +- Fixed one more extremely rare race condition, lol! + +##### 2.0.3 (Oct 8, 2015) + +- Fixed yet another rare race condition (multiple holes connected with colinear bridges). +- Fixed crash on empty input. + +##### 2.0.2 (Jul 8, 2015) + +- Fixed one more rare race condition with a holed polygon. + +##### 2.0.1 (May 11, 2015) + +- Added Steiner points support. + +##### 2.0.0 (Apr 30, 2015) + +- **Breaking**: changed the API to accept a flat input array of vertices with hole indices and return triangle indices. + It makes the indexed output much faster than it was before (up to 30%) and improves memory footprint. + +##### 1.4.2 (Mar 18, 2015) + +- Fixed another rare edge case with a tiny hole in a huge polygon. + +##### 1.4.1 (Mar 17, 2015) + +- Fixed a rare edge case that led to incomplete triangulation. + +##### 1.4.0 (Mar 9, 2015) + +- Fixed indexed output to produce indices not multiplied by dimension and work with any number of dimensions. + +##### 1.3.0 (Feb 24, 2015) + +- Added a second argument to `earcut` that switches output format to flat vertex and index arrays if set to `true`. + +##### 1.2.3 (Feb 10, 2015) + +- Improved performance (especially on recent v8) by avoiding `Array` `push` with multiple arguments. + +##### 1.2.2 (Jan 27, 2015) + +- Significantly improved performance for polygons with self-intersections + (e.g. big OSM water polygons are now handled 2-3x faster) + +##### 1.2.1 (Jan 26, 2015) + +- Significantly improved performance on polygons with high number of vertices + by using z-order curve hashing for vertex lookup. +- Slightly improved overall performance with better point filtering. + +##### 1.1.0 (Jan 21, 2015) + +- Improved performance on polygons with holes by switching from Held to Eberly hole elimination algorithm +- More robustness fixes and tests + +##### 1.0.1 — 1.0.6 (Jan 20, 2015) + +- Various robustness improvements and fixes. + +##### 1.0.0 (Jan 18, 2015) + +- Initial release. diff --git a/live2d/node_modules/earcut/dist/earcut.dev.js b/live2d/node_modules/earcut/dist/earcut.dev.js new file mode 100644 index 0000000..58af40d --- /dev/null +++ b/live2d/node_modules/earcut/dist/earcut.dev.js @@ -0,0 +1,687 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.earcut = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 32767 / invSize : 0; + } + + earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); + + return triangles; +} + +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; +} + +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) break; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim | 0); + triangles.push(ear.i / dim | 0); + triangles.push(next.i / dim | 0); + + removeNode(ear); + + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(filterPoints(ear), triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + var p = c.next; + while (p !== a) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + // z-order range for the current triangle bbox; + var minZ = zOrder(x0, y0, minX, minY, invSize), + maxZ = zOrder(x1, y1, minX, minY, invSize); + + var p = ear.prevZ, + n = ear.nextZ; + + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim | 0); + triangles.push(p.i / dim | 0); + triangles.push(b.i / dim | 0); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return filterPoints(p); +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize, 0); + earcutLinked(c, triangles, dim, minX, minY, invSize, 0); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + outerNode = eliminateHole(queue[i], outerNode); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + var bridge = findHoleBridge(hole, outerNode); + if (!bridge) { + return outerNode; + } + + var bridgeReverse = splitPolygon(bridge, hole); + + // filter collinear points around the cuts + filterPoints(bridgeReverse, bridgeReverse.next); + return filterPoints(bridge, bridge.next); +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + m = p.x < p.next.x ? p : p.next; + if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m; + + do { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if (locallyInside(p, hole) && + (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } while (p !== stop); + + return m; +} + +// whether sector in vertex m contains sector in vertex p in the same coordinates +function sectorContainsSector(m, p) { + return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; +} + +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = (x - minX) * invSize | 0; + y = (y - minY) * invSize | 0; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && + (ax - px) * (by - py) >= (bx - px) * (ay - py) && + (bx - px) * (cy - py) >= (cx - px) * (by - py); +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges + (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible + (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + var o1 = sign(area(p1, q1, p2)); + var o2 = sign(area(p1, q1, q2)); + var o3 = sign(area(p2, q2, p1)); + var o4 = sign(area(p2, q2, q1)); + + if (o1 !== o2 && o3 !== o4) return true; // general case + + if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 + if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 + if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 + if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 + + return false; +} + +// for collinear points p, q, r, check if point q lies on segment pr +function onSegment(p, q, r) { + return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); +} + +function sign(num) { + return num > 0 ? 1 : num < 0 ? -1 : 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = 0; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; + +},{}]},{},[1])(1) +}); + +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvZWFyY3V0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTt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3aGlsZSAocCAhPT0gc3RhcnQpO1xuXG4gICAgcC5wcmV2Wi5uZXh0WiA9IG51bGw7XG4gICAgcC5wcmV2WiA9IG51bGw7XG5cbiAgICBzb3J0TGlua2VkKHApO1xufVxuXG4vLyBTaW1vbiBUYXRoYW0ncyBsaW5rZWQgbGlzdCBtZXJnZSBzb3J0IGFsZ29yaXRobVxuLy8gaHR0cDovL3d3dy5jaGlhcmsuZ3JlZW5lbmQub3JnLnVrL35zZ3RhdGhhbS9hbGdvcml0aG1zL2xpc3Rzb3J0Lmh0bWxcbmZ1bmN0aW9uIHNvcnRMaW5rZWQobGlzdCkge1xuICAgIHZhciBpLCBwLCBxLCBlLCB0YWlsLCBudW1NZXJnZXMsIHBTaXplLCBxU2l6ZSxcbiAgICAgICAgaW5TaXplID0gMTtcblxuICAgIGRvIHtcbiAgICAgICAgcCA9IGxpc3Q7XG4gICAgICAgIGxpc3QgPSBudWxsO1xuICAgICAgICB0YWlsID0gbnVsbDtcbiAgICAgICAgbnVtTWVyZ2VzID0gMDtcblxuICAgICAgICB3aGlsZSAocCkge1xuICAgICAgICAgICAgbnVtTWVyZ2VzKys7XG4gICAgICAgICAgICBxID0gcDtcbiAgICAgICAgICAgIHBTaXplID0gMDtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBpblNpemU7IGkrKykge1xuICAgICAgICAgICAgICAgIHBTaXplKys7XG4gICAgICAgICAgICAgICAgcSA9IHEubmV4dFo7XG4gICAgICAgICAgICAgICAgaWYgKCFxKSBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHFTaXplID0gaW5TaXplO1xuXG4gICAgICAgICAgICB3aGlsZSAocFNpemUgPiAwIHx8IChxU2l6ZSA+IDAgJiYgcSkpIHtcblxuICAgICAgICAgICAgICAgIGlmIChwU2l6ZSAhPT0gMCAmJiAocVNpemUgPT09IDAgfHwgIXEgfHwgcC56IDw9IHEueikpIHtcbiAgICAgICAgICAgICAgICAgICAgZSA9IHA7XG4gICAgICAgICAgICAgICAgICAgIHAgPSBwLm5leHRaO1xuICAgICAgICAgICAgICAgICAgICBwU2l6ZS0tO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGUgPSBxO1xuICAgICAgICAgICAgICAgICAgICBxID0gcS5uZXh0WjtcbiAgICAgICAgICAgICAgICAgICAgcVNpemUtLTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAodGFpbCkgdGFpbC5uZXh0WiA9IGU7XG4gICAgICAgICAgICAgICAgZWxzZSBsaXN0ID0gZTtcblxuICAgICAgICAgICAgICAgIGUucHJldlogPSB0YWlsO1xuICAgICAgICAgICAgICAgIHRhaWwgPSBlO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBwID0gcTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRhaWwubmV4dFogPSBudWxsO1xuICAgICAgICBpblNpemUgKj0gMjtcblxuICAgIH0gd2hpbGUgKG51bU1lcmdlcyA+IDEpO1xuXG4gICAgcmV0dXJuIGxpc3Q7XG59XG5cbi8vIHotb3JkZXIgb2YgYSBwb2ludCBnaXZlbiBjb29yZHMgYW5kIGludmVyc2Ugb2YgdGhlIGxvbmdlciBzaWRlIG9mIGRhdGEgYmJveFxuZnVuY3Rpb24gek9yZGVyKHgsIHksIG1pblgsIG1pblksIGludlNpemUpIHtcbiAgICAvLyBjb29yZHMgYXJlIHRyYW5zZm9ybWVkIGludG8gbm9uLW5lZ2F0aXZlIDE1LWJpdCBpbnRlZ2VyIHJhbmdlXG4gICAgeCA9ICh4IC0gbWluWCkgKiBpbnZTaXplIHwgMDtcbiAgICB5ID0gKHkgLSBtaW5ZKSAqIGludlNpemUgfCAwO1xuXG4gICAgeCA9ICh4IHwgKHggPDwgOCkpICYgMHgwMEZGMDBGRjtcbiAgICB4ID0gKHggfCAoeCA8PCA0KSkgJiAweDBGMEYwRjBGO1xuICAgIHggPSAoeCB8ICh4IDw8I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9yICh2YXIgaSA9IHN0YXJ0LCBqID0gZW5kIC0gZGltOyBpIDwgZW5kOyBpICs9IGRpbSkge1xuICAgICAgICBzdW0gKz0gKGRhdGFbal0gLSBkYXRhW2ldKSAqIChkYXRhW2kgKyAxXSArIGRhdGFbaiArIDFdKTtcbiAgICAgICAgaiA9IGk7XG4gICAgfVxuICAgIHJldHVybiBzdW07XG59XG5cbi8vIHR1cm4gYSBwb2x5Z29uIGluIGEgbXVsdGktZGltZW5zaW9uYWwgYXJyYXkgZm9ybSAoZS5nLiBhcyBpbiBHZW9KU09OKSBpbnRvIGEgZm9ybSBFYXJjdXQgYWNjZXB0c1xuZWFyY3V0LmZsYXR0ZW4gPSBmdW5jdGlvbiAoZGF0YSkge1xuICAgIHZhciBkaW0gPSBkYXRhWzBdWzBdLmxlbmd0aCxcbiAgICAgICAgcmVzdWx0ID0ge3ZlcnRpY2VzOiBbXSwgaG9sZXM6IFtdLCBkaW1lbnNpb25zOiBkaW19LFxuICAgICAgICBob2xlSW5kZXggPSAwO1xuXG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgZGF0YVtpXS5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgZm9yICh2YXIgZCA9IDA7IGQgPCBkaW07IGQrKykgcmVzdWx0LnZlcnRpY2VzLnB1c2goZGF0YVtpXVtqXVtkXSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGkgPiAwKSB7XG4gICAgICAgICAgICBob2xlSW5kZXggKz0gZGF0YVtpIC0gMV0ubGVuZ3RoO1xuICAgICAgICAgICAgcmVzdWx0LmhvbGVzLnB1c2goaG9sZUluZGV4KTtcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcmVzdWx0O1xufTtcbiJdfQ== diff --git a/live2d/node_modules/earcut/dist/earcut.min.js b/live2d/node_modules/earcut/dist/earcut.min.js new file mode 100644 index 0000000..79cf67e --- /dev/null +++ b/live2d/node_modules/earcut/dist/earcut.min.js @@ -0,0 +1 @@ +!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).earcut=e()}(function(){return function r(x,i,u){function f(n,e){if(!i[n]){if(!x[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(o)return o(n,!0);throw(e=new Error("Cannot find module '"+n+"'")).code="MODULE_NOT_FOUND",e}t=i[n]={exports:{}},x[n][0].call(t.exports,function(e){return f(x[n][1][e]||e)},t,t.exports,r,x,i,u)}return i[n].exports}for(var o="function"==typeof require&&require,e=0;e=r.next.y&&r.next.y!==r.y){var f=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=x&&u=r.x&&r.x>=p&&x!==r.x&&D(it.x||r.x===t.x&&function(e,n){return E(e.prev,e,n.prev)<0&&E(n.next,e,e.next)<0}(t,r)))&&(t=r,a=o)),r=r.next,r!==v;);return t}(e,n);if(!t)return n;n=j(t,e);return q(n,n.next),q(t,t.next)}(o[x],t);return t}(e,n,p,t)),e.length>80*t){for(var a=r=e[0],l=x=e[1],h=t;h=d&&w&&w.z<=Z;){if(g.x>=l&&g.x<=s&&g.y>=h&&g.y<=c&&g!==x&&g!==u&&D(f,p,o,y,v,a,g.x,g.y)&&0<=E(g.prev,g,g.next))return;if(g=g.prevZ,w.x>=l&&w.x<=s&&w.y>=h&&w.y<=c&&w!==x&&w!==u&&D(f,p,o,y,v,a,w.x,w.y)&&0<=E(w.prev,w,w.next))return;w=w.nextZ}for(;g&&g.z>=d;){if(g.x>=l&&g.x<=s&&g.y>=h&&g.y<=c&&g!==x&&g!==u&&D(f,p,o,y,v,a,g.x,g.y)&&0<=E(g.prev,g,g.next))return;g=g.prevZ}for(;w&&w.z<=Z;){if(w.x>=l&&w.x<=s&&w.y>=h&&w.y<=c&&w!==x&&w!==u&&D(f,p,o,y,v,a,w.x,w.y)&&0<=E(w.prev,w,w.next))return;w=w.nextZ}return 1}(e,r,x,i):function(e){var n=e.prev,t=e,e=e.next;if(0<=E(n,t,e))return;var r=n.x,x=t.x,i=e.x,u=n.y,f=t.y,o=e.y,v=r=v&&l.x<=y&&l.y>=p&&l.y<=a&&D(r,u,x,f,i,o,l.x,l.y)&&0<=E(l.prev,l,l.next))return;l=l.next}return 1}(e))n.push(b.i/t|0),n.push(e.i/t|0),n.push(m.i/t|0),C(e),e=m.next,z=m.next;else if((e=m)===z){u?1===u?O(e=function(e,n,t){var r=e;do{var x=r.prev,i=r.next.next}while(!N(x,i)&&U(x,r,r.next,i)&&_(x,i)&&_(i,x)&&(n.push(x.i/t|0),n.push(r.i/t|0),n.push(i.i/t|0),C(r),C(r.next),r=e=i),r=r.next,r!==e);return q(r)}(q(e),n,t),n,t,r,x,i,2):2===u&&function(e,n,t,r,x,i){var u=e;do{for(var f,o=u.next.next;o!==u.prev;){if(u.i!==o.i&&function(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!function(e,n){var t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&U(t,t.next,e,n))return 1}while(t=t.next,t!==e);return}(e,n)&&(_(e,n)&&_(n,e)&&function(e,n){var t=e,r=!1,x=(e.x+n.x)/2,i=(e.y+n.y)/2;for(;t.y>i!=t.next.y>i&&t.next.y!==t.y&&x<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next,t!==e;);return r}(e,n)&&(E(e.prev,e,n.prev)||E(e,n.prev,n))||N(e,n)&&0=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function v(e){return 0 dist/earcut.dev.js", + "build-min": "mkdirp dist && browserify src/earcut.js -s earcut | uglifyjs -c -m > dist/earcut.min.js", + "prepublishOnly": "npm run build-dev && npm run build-min", + "cov": "c8 tape test/*.js", + "coveralls": "npm run cov && c8 report -r lcov && coveralls < ./coverage/lcov.info" + }, + "author": "Vladimir Agafonkin", + "license": "ISC", + "devDependencies": { + "benchmark": "^2.1.4", + "browserify": "^17.0.0", + "c8": "^7.11.3", + "coveralls": "^3.1.1", + "eslint": "^8.19.0", + "eslint-config-mourner": "^2.0.3", + "mkdirp": "^1.0.4", + "tape": "^5.5.3", + "uglify-js": "^3.16.2", + "watchify": "^4.0.0" + }, + "eslintConfig": { + "extends": "mourner" + }, + "repository": { + "type": "git", + "url": "git://github.com/mapbox/earcut.git" + } +} diff --git a/live2d/node_modules/earcut/src/earcut.js b/live2d/node_modules/earcut/src/earcut.js new file mode 100644 index 0000000..61a4202 --- /dev/null +++ b/live2d/node_modules/earcut/src/earcut.js @@ -0,0 +1,681 @@ +'use strict'; + +module.exports = earcut; +module.exports.default = earcut; + +function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode || outerNode.next === outerNode.prev) return triangles; + + var minX, minY, maxX, maxY, x, y, invSize; + + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } + + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 32767 / invSize : 0; + } + + earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); + + return triangles; +} + +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; +} + +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) break; + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; +} + +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) return; + + // interlink polygon nodes in z-order + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim | 0); + triangles.push(ear.i / dim | 0); + triangles.push(next.i / dim | 0); + + removeNode(ear); + + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(filterPoints(ear), triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } + + break; + } + } +} + +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + var p = c.next; + while (p !== a) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } + + return true; +} + +function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; + + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + // z-order range for the current triangle bbox; + var minZ = zOrder(x0, y0, minX, minY, invSize), + maxZ = zOrder(x1, y1, minX, minY, invSize); + + var p = ear.prevZ, + n = ear.nextZ; + + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } + + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } + + return true; +} + +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim | 0); + triangles.push(p.i / dim | 0); + triangles.push(b.i / dim | 0); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return filterPoints(p); +} + +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize, 0); + earcutLinked(c, triangles, dim, minX, minY, invSize, 0); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); +} + +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + outerNode = eliminateHole(queue[i], outerNode); + } + + return outerNode; +} + +function compareX(a, b) { + return a.x - b.x; +} + +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + var bridge = findHoleBridge(hole, outerNode); + if (!bridge) { + return outerNode; + } + + var bridgeReverse = splitPolygon(bridge, hole); + + // filter collinear points around the cuts + filterPoints(bridgeReverse, bridgeReverse.next); + return filterPoints(bridge, bridge.next); +} + +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + m = p.x < p.next.x ? p : p.next; + if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) return null; + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m; + + do { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if (locallyInside(p, hole) && + (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } while (p !== stop); + + return m; +} + +// whether sector in vertex m contains sector in vertex p in the same coordinates +function sectorContainsSector(m, p) { + return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; +} + +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; + } + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; +} + +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = (x - minX) * invSize | 0; + y = (y - minY) * invSize | 0; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); +} + +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p; + p = p.next; + } while (p !== start); + + return leftmost; +} + +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && + (ax - px) * (by - py) >= (bx - px) * (ay - py) && + (bx - px) * (cy - py) >= (cx - px) * (by - py); +} + +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges + (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible + (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case +} + +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} + +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} + +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + var o1 = sign(area(p1, q1, p2)); + var o2 = sign(area(p1, q1, q2)); + var o3 = sign(area(p2, q2, p1)); + var o4 = sign(area(p2, q2, q1)); + + if (o1 !== o2 && o3 !== o4) return true; // general case + + if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 + if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 + if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 + if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 + + return false; +} + +// for collinear points p, q, r, check if point q lies on segment pr +function onSegment(p, q, r) { + return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); +} + +function sign(num) { + return num > 0 ? 1 : num < 0 ? -1 : 0; +} + +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); + + return false; +} + +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} + +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); + + return inside; +} + +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; +} + +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} + +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = 0; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; +}; diff --git a/live2d/node_modules/email-addresses/.travis.yml b/live2d/node_modules/email-addresses/.travis.yml new file mode 100644 index 0000000..ecea0eb --- /dev/null +++ b/live2d/node_modules/email-addresses/.travis.yml @@ -0,0 +1,26 @@ +language: node_js + +env: + - CXX=g++-4.8 + +node_js: + - "4" + - "6" + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + +before_install: + - $CXX --version + - npm install node-gyp -g + +before_script: + +script: + - npm test + +sudo: false diff --git a/live2d/node_modules/email-addresses/Changes.md b/live2d/node_modules/email-addresses/Changes.md new file mode 100644 index 0000000..3bc5262 --- /dev/null +++ b/live2d/node_modules/email-addresses/Changes.md @@ -0,0 +1,63 @@ + +## 2019-10-24 - 3.1.0 +- Added "atInDisplayName" option (#46) +- Added "comments" field to result mailbox (#46) + +## 2018-11-09 - 3.0.3 +- No changes + +## 2018-09-21 - 3.0.2 +- Fixed npe with rejectTLD option (#33) + +## 2017-06-21 - 3.0.0 + +Note: There is a major version bump because of two things: changes to the typescript definition and changes to the results returned for "group" addresses. + +- Full typescript definition (#30, a12b003) +- Fixed typescript "typings" field in package.json (#32) +- Proper results for groups (#31). Previously a "group" "address" would show its results as a single address, but it is now returned as a list. See the typescript definition for full return type. +- Support for parsing RFC6854 originator fields (#31). This adds new functions: parseFrom, parseSender, parseReplyTo. It also adds a new option "startAt". See source for possible values of "startAt". + +## 2016-04-30 - + +- minified version + +## 2015-12-28 - 2.0.2 + +- Improves type definition #18 +- Adds TypeScript definition file and declares in package.json #17 +- remove inaccurate comment on obs-FWS +- add bower.json + + +## 2014-11-02 - 2.0.1 + +- properly parse unquoted names with periods (version 2.0.1) + + +## 2014-10-14 - 2.0.0 + +- add rejectTLD option, off by default +- add proper unicode support (rfc 6532) +- improve 'semantic interpretation' of names + + +## 2014-09-08 - 1.1.2 + +- document the return values more +- for 'address', 'local', and 'domain' convenience methods return semantic content +- update readme to show results from current code +- fix invalid reference to address node introduced in 51836f1 +- support loading in the browser #4 + + +# 2014-01-10 - 1.1.1 + +- return name and other fields with whitespace collapsed properly (closes #2) +- readme: add "why use this" and "installation" +- readme: link to @dominicsayers #1 + + +## 2013-09-10 - 1.1.0 + +- Initial commit diff --git a/live2d/node_modules/email-addresses/LICENSE b/live2d/node_modules/email-addresses/LICENSE new file mode 100644 index 0000000..f379208 --- /dev/null +++ b/live2d/node_modules/email-addresses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Fog Creek Software + +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. diff --git a/live2d/node_modules/email-addresses/README.md b/live2d/node_modules/email-addresses/README.md new file mode 100644 index 0000000..b2c925c --- /dev/null +++ b/live2d/node_modules/email-addresses/README.md @@ -0,0 +1,208 @@ +email-addresses.js +================== + +An RFC 5322 email address parser. + +v 3.1.0 + +What? +----- +Want to see if something could be an email address? Want to grab the display name or just the address out of a string? Put your regexes down and use this parser! + +This library does not validate email addresses - we can't really do that without sending an email. However, it attempts to parse addresses using the (fairly liberal) grammar specified in RFC 5322. You can use this to check if user input looks like an email address. + +Note carefully though - this parser supports all features of RFC 5322, which means that `"Bob Example" ` +is a valid email address. If you just want to validate the `bob@example.com` part, that is RFC 5321, for which you want +to use something like node-address-rfc2821. + +Why use this? +------------- +Use this library because you can be sure it really respects the RFC: + - The functions in the recursive decent parser match up with the productions in the RFC + - The productions from the RFC are written above each function for easy verification + - Tests include all of the test cases from the [is_email](https://github.com/dominicsayers/isemail) project, which are extensive + +Installation +------------ +npm install email-addresses + +Example +------- + +``` +$ node +> addrs = require("email-addresses") +{ [Function: parse5322] + parseOneAddress: [Function: parseOneAddressSimple], + parseAddressList: [Function: parseAddressListSimple] } +> addrs.parseOneAddress('"Jack Bowman" ') +{ parts: + { name: [Object], + address: [Object], + local: [Object], + domain: [Object] }, + name: 'Jack Bowman', + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' } +> addrs.parseAddressList('jack@fogcreek.com, Bob ') +[ { parts: + { name: null, + address: [Object], + local: [Object], + domain: [Object] }, + name: null, + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' }, + { parts: + { name: [Object], + address: [Object], + local: [Object], + domain: [Object] }, + name: 'Bob', + address: 'bob@example.com', + local: 'bob', + domain: 'example.com' } ] +> addrs("jack@fogcreek.com") +{ ast: + { name: 'address-list', + tokens: 'jack@fogcreek.com', + semantic: 'jack@fogcreek.com', + children: [ [Object] ] }, + addresses: + [ { node: [Object], + parts: [Object], + name: null, + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' } ] } +> addrs("bogus") +null +``` + +API +--- + +`obj = addrs(opts)` +=================== + +Call the module directly as a function to get access to the AST. Returns null for a failed parse (an invalid +address). + +Options: + +* `string` - An email address to parse. Parses as `address-list`, a list of email addresses separated by commas. +* `object` with the following keys: + * `input` - An email address to parse. Required. + * `rfc6532` - Enable rfc6532 support (unicode in email addresses). Default: `false`. + * `partial` - Allow a failed parse to return the AST it managed to produce so far. Default: `false`. + * `simple` - Return just the address or addresses parsed. Default: `false`. + * `strict` - Turn off features of RFC 5322 marked "Obsolete". Default: `false`. + * `rejectTLD` - Require at least one `.` in domain names. Default: `false`. + * `startAt` - Start the parser at one of `address-list`, `from`, `sender`, `reply-to`. Default: `address-list`. + +Returns an object with the following properties: + +* `ast` - the full AST of the parse. +* `addresses` - array of addresses found. Each has the following properties: + * `parts` - components of the AST that make up the address. + * `type` - The type of the node, e.g. `mailbox`, `address`, `group`. + * `name` - The extracted name from the email. e.g. parsing `"Bob" ` will give `Bob` for the `name`. + * `address` - The full email address. e.g. parsing the above will give `bob@example.com` for the `address`. + * `local` - The local part. e.g. parsing the above will give `bob` for `local`. + * `domain` - The domain part. e.g. parsing the above will give `example.com` for `domain`. + +Note if `simple` is set, the return will be an array of addresses rather than the object above. + +Note that addresses can contain a `group` address, which in contrast to the `address` objects +will simply contain two properties: a `name` and `addresses` which is an array of the addresses in +the group. You can identify groups because they will have a `type` of `group`. A group looks +something like this: `Managing Partners:ben@example.com,carol@example.com;` + +`obj = addrs.parseOneAddress(opts)` +=================================== + +Parse a single email address. + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a single address object as described above. If you set `simple: false` the returned object +includes a `node` object that contains the AST for the address. + +`obj = addrs.parseAddressList(opts)` +==================================== + +Parse a list of email addresses separated by comma. + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a list of address objects as described above. If you set `simple: false` each address will +include a `node` object that containst the AST for the address. + +`obj = addrs.parseFrom(opts)` +============================= + +Parse an email header "From:" address (specified as mailbox-list or address-list). + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a list of address objects as described above. If you set `simple: false` each address will +include a `node` object that containst the AST for the address. + +`obj = addrs.parseSender(opts)` +=============================== + +Parse an email header "Sender:" address (specified as mailbox or address). + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a single address object as described above. If you set `simple: false` the returned object +includes a `node` object that contains the AST for the address. + +`obj = addrs.parseReplyTo(opts)` +================================ + +Parse an email header "Reply-To:" address (specified as address-list). + +Operates identically to `addrs.parseAddressList(opts)`. + +Usage +----- +If you want to simply check whether an address or address list parses, you'll want to call the following functions and check whether the results are null or not: ```parseOneAddress``` for a single address and ```parseAddressList``` for multiple addresses. + +If you want to examine the parsed address, for example to extract a name or address, you have some options. The object returned by ```parseOneAddress``` has four helper values on it: ```name```, ```address```, ```local```, and ```domain```. See the example above to understand is actually returned. (These are equivalent to ```parts.name.semantic```, ```parts.address.semantic```, etc.) These values try to be smart about collapsing whitespace, quotations, and excluding RFC 5322 comments. If you desire, you can also obtain the raw parsed tokens or semantic tokens for those fields. The ```parts``` value is an object referencing nodes in the AST generated. Nodes in the AST have two values of interest here, ```tokens``` and ```semantic```. + +``` +> a = addrs.parseOneAddress('Jack Bowman ') +> a.parts.name.tokens +'Jack Bowman ' +> a.name +'Jack Bowman' +> a.parts.name.semantic +'Jack Bowman ' +> a.parts.address.tokens +'jack@fogcreek.com ' +> a.address +'jack@fogcreek.com' +> a.parts.address.semantic +'jack@fogcreek.com' +``` + +If you need to, you can inspect the AST directly. The entire AST is returned when calling the module's function. + +References +---------- + - http://tools.ietf.org/html/rfc5322 + - https://tools.ietf.org/html/rfc6532 + - https://tools.ietf.org/html/rfc6854 + - http://code.google.com/p/isemail/ + +Props +----- +Many thanks to [Dominic Sayers](https://github.com/dominicsayers) and his documentation and tests +for the [is_email](https://github.com/dominicsayers/isemail) function which helped greatly in writing this parser. + +License +------- +Licensed under the MIT License. See the LICENSE file. diff --git a/live2d/node_modules/email-addresses/bower.json b/live2d/node_modules/email-addresses/bower.json new file mode 100644 index 0000000..e6df0ad --- /dev/null +++ b/live2d/node_modules/email-addresses/bower.json @@ -0,0 +1,29 @@ +{ + "name": "email-addresses", + "version": "3.1.0", + "homepage": "https://github.com/jackbearheart/email-addresses", + "authors": [ + "Jack Bearheart " + ], + "description": "An email address parser based on rfc5322", + "main": "./lib/email-addresses.js", + "moduleType": [ + "globals", + "node" + ], + "keywords": [ + "email", + "address", + "parser", + "rfc5322", + "5322" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/live2d/node_modules/email-addresses/lib/email-addresses.d.ts b/live2d/node_modules/email-addresses/lib/email-addresses.d.ts new file mode 100644 index 0000000..034d408 --- /dev/null +++ b/live2d/node_modules/email-addresses/lib/email-addresses.d.ts @@ -0,0 +1,107 @@ +declare module emailAddresses { + function parseOneAddress(input: string | Options): ParsedMailbox | ParsedGroup; + function parseAddressList(input: string | Options): (ParsedMailbox | ParsedGroup)[]; + function parseFrom(input: string | Options): (ParsedMailbox | ParsedGroup)[]; + function parseSender(input: string | Options): ParsedMailbox | ParsedGroup; + function parseReplyTo(input: string | Options): (ParsedMailbox | ParsedGroup)[]; + + interface ParsedMailbox { + node?: ASTNode; + parts: { + name: ASTNode; + address: ASTNode; + local: ASTNode; + domain: ASTNode; + comments: ASTNode[]; + }; + type: string; + name: string; + address: string; + local: string; + domain: string; + } + + interface ParsedGroup { + node?: ASTNode; + parts: { + name: ASTNode; + }; + type: string; + name: string; + addresses: ParsedMailbox[]; + } + + interface ASTNode { + name: string; + tokens: string; + semantic: string; + children: ASTNode[]; + } + + interface Options { + input: string; + oneResult?: boolean; + partial?: boolean; + rejectTLD?: boolean; + rfc6532?: boolean; + simple?: boolean; + startAt?: string; + strict?: boolean; + } + + interface ParsedResult { + ast: ASTNode; + addresses: (ParsedMailbox | ParsedGroup)[]; + } +} + +declare function emailAddresses(opts: emailAddresses.Options): emailAddresses.ParsedResult; + +declare module "email-addresses" { + export = emailAddresses; +} + +/* Example usage: + +// Run this file with: +// tsc test.ts && NODE_PATH="../emailaddresses/lib" node test.js +/// +import emailAddresses = require('email-addresses'); + +function isParsedMailbox(mailboxOrGroup: emailAddresses.ParsedMailbox | emailAddresses.ParsedGroup): mailboxOrGroup is emailAddresses.ParsedMailbox { + return mailboxOrGroup.type === 'mailbox'; +} + +var testEmail : string = "TestName (a comment) "; +console.log(testEmail); + +var parsed = emailAddresses.parseOneAddress(testEmail); +console.log(parsed); + +var a : string = parsed.parts.name.children[0].name; +console.log(a); + +if (isParsedMailbox(parsed)) { + var comment : string = parsed.parts.comments[0].tokens; + console.log(comment); +} else { + console.error('error, should be a ParsedMailbox'); +} + +// + +var emailList : string = "TestName , TestName2 "; +console.log(emailList); + +var parsedList = emailAddresses.parseAddressList(emailList); +console.log(parsedList); + +var b : string = parsedList[1].parts.name.children[0].semantic; +console.log(b); + +// + +var parsedByModuleFxn = emailAddresses({ input: emailList, rfc6532: true }); +console.log(parsedByModuleFxn.addresses[0].name); + +*/ diff --git a/live2d/node_modules/email-addresses/lib/email-addresses.js b/live2d/node_modules/email-addresses/lib/email-addresses.js new file mode 100644 index 0000000..3e10bc0 --- /dev/null +++ b/live2d/node_modules/email-addresses/lib/email-addresses.js @@ -0,0 +1,1090 @@ + +// email-addresses.js - RFC 5322 email address parser +// v 3.1.0 +// +// http://tools.ietf.org/html/rfc5322 +// +// This library does not validate email addresses. +// emailAddresses attempts to parse addresses using the (fairly liberal) +// grammar specified in RFC 5322. +// +// email-addresses returns { +// ast: , +// addresses: [{ +// node: , +// name: , +// address: , +// local: , +// domain: +// }, ...] +// } +// +// emailAddresses.parseOneAddress and emailAddresses.parseAddressList +// work as you might expect. Try it out. +// +// Many thanks to Dominic Sayers and his documentation on the is_email function, +// http://code.google.com/p/isemail/ , which helped greatly in writing this parser. + +(function (global) { +"use strict"; + +function parse5322(opts) { + + // tokenizing functions + + function inStr() { return pos < len; } + function curTok() { return parseString[pos]; } + function getPos() { return pos; } + function setPos(i) { pos = i; } + function nextTok() { pos += 1; } + function initialize() { + pos = 0; + len = parseString.length; + } + + // parser helper functions + + function o(name, value) { + return { + name: name, + tokens: value || "", + semantic: value || "", + children: [] + }; + } + + function wrap(name, ast) { + var n; + if (ast === null) { return null; } + n = o(name); + n.tokens = ast.tokens; + n.semantic = ast.semantic; + n.children.push(ast); + return n; + } + + function add(parent, child) { + if (child !== null) { + parent.tokens += child.tokens; + parent.semantic += child.semantic; + } + parent.children.push(child); + return parent; + } + + function compareToken(fxnCompare) { + var tok; + if (!inStr()) { return null; } + tok = curTok(); + if (fxnCompare(tok)) { + nextTok(); + return o('token', tok); + } + return null; + } + + function literal(lit) { + return function literalFunc() { + return wrap('literal', compareToken(function (tok) { + return tok === lit; + })); + }; + } + + function and() { + var args = arguments; + return function andFunc() { + var i, s, result, start; + start = getPos(); + s = o('and'); + for (i = 0; i < args.length; i += 1) { + result = args[i](); + if (result === null) { + setPos(start); + return null; + } + add(s, result); + } + return s; + }; + } + + function or() { + var args = arguments; + return function orFunc() { + var i, result, start; + start = getPos(); + for (i = 0; i < args.length; i += 1) { + result = args[i](); + if (result !== null) { + return result; + } + setPos(start); + } + return null; + }; + } + + function opt(prod) { + return function optFunc() { + var result, start; + start = getPos(); + result = prod(); + if (result !== null) { + return result; + } + else { + setPos(start); + return o('opt'); + } + }; + } + + function invis(prod) { + return function invisFunc() { + var result = prod(); + if (result !== null) { + result.semantic = ""; + } + return result; + }; + } + + function colwsp(prod) { + return function collapseSemanticWhitespace() { + var result = prod(); + if (result !== null && result.semantic.length > 0) { + result.semantic = " "; + } + return result; + }; + } + + function star(prod, minimum) { + return function starFunc() { + var s, result, count, start, min; + start = getPos(); + s = o('star'); + count = 0; + min = minimum === undefined ? 0 : minimum; + while ((result = prod()) !== null) { + count = count + 1; + add(s, result); + } + if (count >= min) { + return s; + } + else { + setPos(start); + return null; + } + }; + } + + // One expects names to get normalized like this: + // " First Last " -> "First Last" + // "First Last" -> "First Last" + // "First Last" -> "First Last" + function collapseWhitespace(s) { + return s.replace(/([ \t]|\r\n)+/g, ' ').replace(/^\s*/, '').replace(/\s*$/, ''); + } + + // UTF-8 pseudo-production (RFC 6532) + // RFC 6532 extends RFC 5322 productions to include UTF-8 + // using the following productions: + // UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 + // UTF8-2 = + // UTF8-3 = + // UTF8-4 = + // + // For reference, the extended RFC 5322 productions are: + // VCHAR =/ UTF8-non-ascii + // ctext =/ UTF8-non-ascii + // atext =/ UTF8-non-ascii + // qtext =/ UTF8-non-ascii + // dtext =/ UTF8-non-ascii + function isUTF8NonAscii(tok) { + // In JavaScript, we just deal directly with Unicode code points, + // so we aren't checking individual bytes for UTF-8 encoding. + // Just check that the character is non-ascii. + return tok.charCodeAt(0) >= 128; + } + + + // common productions (RFC 5234) + // http://tools.ietf.org/html/rfc5234 + // B.1. Core Rules + + // CR = %x0D + // ; carriage return + function cr() { return wrap('cr', literal('\r')()); } + + // CRLF = CR LF + // ; Internet standard newline + function crlf() { return wrap('crlf', and(cr, lf)()); } + + // DQUOTE = %x22 + // ; " (Double Quote) + function dquote() { return wrap('dquote', literal('"')()); } + + // HTAB = %x09 + // ; horizontal tab + function htab() { return wrap('htab', literal('\t')()); } + + // LF = %x0A + // ; linefeed + function lf() { return wrap('lf', literal('\n')()); } + + // SP = %x20 + function sp() { return wrap('sp', literal(' ')()); } + + // VCHAR = %x21-7E + // ; visible (printing) characters + function vchar() { + return wrap('vchar', compareToken(function vcharFunc(tok) { + var code = tok.charCodeAt(0); + var accept = (0x21 <= code && code <= 0x7E); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + })); + } + + // WSP = SP / HTAB + // ; white space + function wsp() { return wrap('wsp', or(sp, htab)()); } + + + // email productions (RFC 5322) + // http://tools.ietf.org/html/rfc5322 + // 3.2.1. Quoted characters + + // quoted-pair = ("\" (VCHAR / WSP)) / obs-qp + function quotedPair() { + var qp = wrap('quoted-pair', + or( + and(literal('\\'), or(vchar, wsp)), + obsQP + )()); + if (qp === null) { return null; } + // a quoted pair will be two characters, and the "\" character + // should be semantically "invisible" (RFC 5322 3.2.1) + qp.semantic = qp.semantic[1]; + return qp; + } + + // 3.2.2. Folding White Space and Comments + + // FWS = ([*WSP CRLF] 1*WSP) / obs-FWS + function fws() { + return wrap('fws', or( + obsFws, + and( + opt(and( + star(wsp), + invis(crlf) + )), + star(wsp, 1) + ) + )()); + } + + // ctext = %d33-39 / ; Printable US-ASCII + // %d42-91 / ; characters not including + // %d93-126 / ; "(", ")", or "\" + // obs-ctext + function ctext() { + return wrap('ctext', or( + function ctextFunc1() { + return compareToken(function ctextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 <= code && code <= 39) || + (42 <= code && code <= 91) || + (93 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsCtext + )()); + } + + // ccontent = ctext / quoted-pair / comment + function ccontent() { + return wrap('ccontent', or(ctext, quotedPair, comment)()); + } + + // comment = "(" *([FWS] ccontent) [FWS] ")" + function comment() { + return wrap('comment', and( + literal('('), + star(and(opt(fws), ccontent)), + opt(fws), + literal(')') + )()); + } + + // CFWS = (1*([FWS] comment) [FWS]) / FWS + function cfws() { + return wrap('cfws', or( + and( + star( + and(opt(fws), comment), + 1 + ), + opt(fws) + ), + fws + )()); + } + + // 3.2.3. Atom + + //atext = ALPHA / DIGIT / ; Printable US-ASCII + // "!" / "#" / ; characters not including + // "$" / "%" / ; specials. Used for atoms. + // "&" / "'" / + // "*" / "+" / + // "-" / "/" / + // "=" / "?" / + // "^" / "_" / + // "`" / "{" / + // "|" / "}" / + // "~" + function atext() { + return wrap('atext', compareToken(function atextFunc(tok) { + var accept = + ('a' <= tok && tok <= 'z') || + ('A' <= tok && tok <= 'Z') || + ('0' <= tok && tok <= '9') || + (['!', '#', '$', '%', '&', '\'', '*', '+', '-', '/', + '=', '?', '^', '_', '`', '{', '|', '}', '~'].indexOf(tok) >= 0); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + })); + } + + // atom = [CFWS] 1*atext [CFWS] + function atom() { + return wrap('atom', and(colwsp(opt(cfws)), star(atext, 1), colwsp(opt(cfws)))()); + } + + // dot-atom-text = 1*atext *("." 1*atext) + function dotAtomText() { + var s, maybeText; + s = wrap('dot-atom-text', star(atext, 1)()); + if (s === null) { return s; } + maybeText = star(and(literal('.'), star(atext, 1)))(); + if (maybeText !== null) { + add(s, maybeText); + } + return s; + } + + // dot-atom = [CFWS] dot-atom-text [CFWS] + function dotAtom() { + return wrap('dot-atom', and(invis(opt(cfws)), dotAtomText, invis(opt(cfws)))()); + } + + // 3.2.4. Quoted Strings + + // qtext = %d33 / ; Printable US-ASCII + // %d35-91 / ; characters not including + // %d93-126 / ; "\" or the quote character + // obs-qtext + function qtext() { + return wrap('qtext', or( + function qtextFunc1() { + return compareToken(function qtextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 === code) || + (35 <= code && code <= 91) || + (93 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsQtext + )()); + } + + // qcontent = qtext / quoted-pair + function qcontent() { + return wrap('qcontent', or(qtext, quotedPair)()); + } + + // quoted-string = [CFWS] + // DQUOTE *([FWS] qcontent) [FWS] DQUOTE + // [CFWS] + function quotedString() { + return wrap('quoted-string', and( + invis(opt(cfws)), + invis(dquote), star(and(opt(colwsp(fws)), qcontent)), opt(invis(fws)), invis(dquote), + invis(opt(cfws)) + )()); + } + + // 3.2.5 Miscellaneous Tokens + + // word = atom / quoted-string + function word() { + return wrap('word', or(atom, quotedString)()); + } + + // phrase = 1*word / obs-phrase + function phrase() { + return wrap('phrase', or(obsPhrase, star(word, 1))()); + } + + // 3.4. Address Specification + // address = mailbox / group + function address() { + return wrap('address', or(mailbox, group)()); + } + + // mailbox = name-addr / addr-spec + function mailbox() { + return wrap('mailbox', or(nameAddr, addrSpec)()); + } + + // name-addr = [display-name] angle-addr + function nameAddr() { + return wrap('name-addr', and(opt(displayName), angleAddr)()); + } + + // angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / + // obs-angle-addr + function angleAddr() { + return wrap('angle-addr', or( + and( + invis(opt(cfws)), + literal('<'), + addrSpec, + literal('>'), + invis(opt(cfws)) + ), + obsAngleAddr + )()); + } + + // group = display-name ":" [group-list] ";" [CFWS] + function group() { + return wrap('group', and( + displayName, + literal(':'), + opt(groupList), + literal(';'), + invis(opt(cfws)) + )()); + } + + // display-name = phrase + function displayName() { + return wrap('display-name', function phraseFixedSemantic() { + var result = phrase(); + if (result !== null) { + result.semantic = collapseWhitespace(result.semantic); + } + return result; + }()); + } + + // mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list + function mailboxList() { + return wrap('mailbox-list', or( + and( + mailbox, + star(and(literal(','), mailbox)) + ), + obsMboxList + )()); + } + + // address-list = (address *("," address)) / obs-addr-list + function addressList() { + return wrap('address-list', or( + and( + address, + star(and(literal(','), address)) + ), + obsAddrList + )()); + } + + // group-list = mailbox-list / CFWS / obs-group-list + function groupList() { + return wrap('group-list', or( + mailboxList, + invis(cfws), + obsGroupList + )()); + } + + // 3.4.1 Addr-Spec Specification + + // local-part = dot-atom / quoted-string / obs-local-part + function localPart() { + // note: quoted-string, dotAtom are proper subsets of obs-local-part + // so we really just have to look for obsLocalPart, if we don't care about the exact parse tree + return wrap('local-part', or(obsLocalPart, dotAtom, quotedString)()); + } + + // dtext = %d33-90 / ; Printable US-ASCII + // %d94-126 / ; characters not including + // obs-dtext ; "[", "]", or "\" + function dtext() { + return wrap('dtext', or( + function dtextFunc1() { + return compareToken(function dtextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 <= code && code <= 90) || + (94 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsDtext + )() + ); + } + + // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS] + function domainLiteral() { + return wrap('domain-literal', and( + invis(opt(cfws)), + literal('['), + star(and(opt(fws), dtext)), + opt(fws), + literal(']'), + invis(opt(cfws)) + )()); + } + + // domain = dot-atom / domain-literal / obs-domain + function domain() { + return wrap('domain', function domainCheckTLD() { + var result = or(obsDomain, dotAtom, domainLiteral)(); + if (opts.rejectTLD) { + if (result && result.semantic && result.semantic.indexOf('.') < 0) { + return null; + } + } + // strip all whitespace from domains + if (result) { + result.semantic = result.semantic.replace(/\s+/g, ''); + } + return result; + }()); + } + + // addr-spec = local-part "@" domain + function addrSpec() { + return wrap('addr-spec', and( + localPart, literal('@'), domain + )()); + } + + // 3.6.2 Originator Fields + // Below we only parse the field body, not the name of the field + // like "From:", "Sender:", or "Reply-To:". Other libraries that + // parse email headers can parse those and defer to these productions + // for the "RFC 5322" part. + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // from = "From:" (mailbox-list / address-list) CRLF + function fromSpec() { + return wrap('from', or( + mailboxList, + addressList + )()); + } + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // sender = "Sender:" (mailbox / address) CRLF + function senderSpec() { + return wrap('sender', or( + mailbox, + address + )()); + } + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // reply-to = "Reply-To:" address-list CRLF + function replyToSpec() { + return wrap('reply-to', addressList()); + } + + // 4.1. Miscellaneous Obsolete Tokens + + // obs-NO-WS-CTL = %d1-8 / ; US-ASCII control + // %d11 / ; characters that do not + // %d12 / ; include the carriage + // %d14-31 / ; return, line feed, and + // %d127 ; white space characters + function obsNoWsCtl() { + return opts.strict ? null : wrap('obs-NO-WS-CTL', compareToken(function (tok) { + var code = tok.charCodeAt(0); + return ((1 <= code && code <= 8) || + (11 === code || 12 === code) || + (14 <= code && code <= 31) || + (127 === code)); + })); + } + + // obs-ctext = obs-NO-WS-CTL + function obsCtext() { return opts.strict ? null : wrap('obs-ctext', obsNoWsCtl()); } + + // obs-qtext = obs-NO-WS-CTL + function obsQtext() { return opts.strict ? null : wrap('obs-qtext', obsNoWsCtl()); } + + // obs-qp = "\" (%d0 / obs-NO-WS-CTL / LF / CR) + function obsQP() { + return opts.strict ? null : wrap('obs-qp', and( + literal('\\'), + or(literal('\0'), obsNoWsCtl, lf, cr) + )()); + } + + // obs-phrase = word *(word / "." / CFWS) + function obsPhrase() { + if (opts.strict ) return null; + return opts.atInDisplayName ? wrap('obs-phrase', and( + word, + star(or(word, literal('.'), literal('@'), colwsp(cfws))) + )()) : + wrap('obs-phrase', and( + word, + star(or(word, literal('.'), colwsp(cfws))) + )()); + } + + // 4.2. Obsolete Folding White Space + + // NOTE: read the errata http://www.rfc-editor.org/errata_search.php?rfc=5322&eid=1908 + // obs-FWS = 1*([CRLF] WSP) + function obsFws() { + return opts.strict ? null : wrap('obs-FWS', star( + and(invis(opt(crlf)), wsp), + 1 + )()); + } + + // 4.4. Obsolete Addressing + + // obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS] + function obsAngleAddr() { + return opts.strict ? null : wrap('obs-angle-addr', and( + invis(opt(cfws)), + literal('<'), + obsRoute, + addrSpec, + literal('>'), + invis(opt(cfws)) + )()); + } + + // obs-route = obs-domain-list ":" + function obsRoute() { + return opts.strict ? null : wrap('obs-route', and( + obsDomainList, + literal(':') + )()); + } + + // obs-domain-list = *(CFWS / ",") "@" domain + // *("," [CFWS] ["@" domain]) + function obsDomainList() { + return opts.strict ? null : wrap('obs-domain-list', and( + star(or(invis(cfws), literal(','))), + literal('@'), + domain, + star(and( + literal(','), + invis(opt(cfws)), + opt(and(literal('@'), domain)) + )) + )()); + } + + // obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS]) + function obsMboxList() { + return opts.strict ? null : wrap('obs-mbox-list', and( + star(and( + invis(opt(cfws)), + literal(',') + )), + mailbox, + star(and( + literal(','), + opt(and( + mailbox, + invis(cfws) + )) + )) + )()); + } + + // obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) + function obsAddrList() { + return opts.strict ? null : wrap('obs-addr-list', and( + star(and( + invis(opt(cfws)), + literal(',') + )), + address, + star(and( + literal(','), + opt(and( + address, + invis(cfws) + )) + )) + )()); + } + + // obs-group-list = 1*([CFWS] ",") [CFWS] + function obsGroupList() { + return opts.strict ? null : wrap('obs-group-list', and( + star(and( + invis(opt(cfws)), + literal(',') + ), 1), + invis(opt(cfws)) + )()); + } + + // obs-local-part = word *("." word) + function obsLocalPart() { + return opts.strict ? null : wrap('obs-local-part', and(word, star(and(literal('.'), word)))()); + } + + // obs-domain = atom *("." atom) + function obsDomain() { + return opts.strict ? null : wrap('obs-domain', and(atom, star(and(literal('.'), atom)))()); + } + + // obs-dtext = obs-NO-WS-CTL / quoted-pair + function obsDtext() { + return opts.strict ? null : wrap('obs-dtext', or(obsNoWsCtl, quotedPair)()); + } + + ///////////////////////////////////////////////////// + + // ast analysis + + function findNode(name, root) { + var i, stack, node; + if (root === null || root === undefined) { return null; } + stack = [root]; + while (stack.length > 0) { + node = stack.pop(); + if (node.name === name) { + return node; + } + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + return null; + } + + function findAllNodes(name, root) { + var i, stack, node, result; + if (root === null || root === undefined) { return null; } + stack = [root]; + result = []; + while (stack.length > 0) { + node = stack.pop(); + if (node.name === name) { + result.push(node); + } + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + return result; + } + + function findAllNodesNoChildren(names, root) { + var i, stack, node, result, namesLookup; + if (root === null || root === undefined) { return null; } + stack = [root]; + result = []; + namesLookup = {}; + for (i = 0; i < names.length; i += 1) { + namesLookup[names[i]] = true; + } + + while (stack.length > 0) { + node = stack.pop(); + if (node.name in namesLookup) { + result.push(node); + // don't look at children (hence findAllNodesNoChildren) + } else { + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + } + return result; + } + + function giveResult(ast) { + var addresses, groupsAndMailboxes, i, groupOrMailbox, result; + if (ast === null) { + return null; + } + addresses = []; + + // An address is a 'group' (i.e. a list of mailboxes) or a 'mailbox'. + groupsAndMailboxes = findAllNodesNoChildren(['group', 'mailbox'], ast); + for (i = 0; i < groupsAndMailboxes.length; i += 1) { + groupOrMailbox = groupsAndMailboxes[i]; + if (groupOrMailbox.name === 'group') { + addresses.push(giveResultGroup(groupOrMailbox)); + } else if (groupOrMailbox.name === 'mailbox') { + addresses.push(giveResultMailbox(groupOrMailbox)); + } + } + + result = { + ast: ast, + addresses: addresses, + }; + if (opts.simple) { + result = simplifyResult(result); + } + if (opts.oneResult) { + return oneResult(result); + } + if (opts.simple) { + return result && result.addresses; + } else { + return result; + } + } + + function giveResultGroup(group) { + var i; + var groupName = findNode('display-name', group); + var groupResultMailboxes = []; + var mailboxes = findAllNodesNoChildren(['mailbox'], group); + for (i = 0; i < mailboxes.length; i += 1) { + groupResultMailboxes.push(giveResultMailbox(mailboxes[i])); + } + return { + node: group, + parts: { + name: groupName, + }, + type: group.name, // 'group' + name: grabSemantic(groupName), + addresses: groupResultMailboxes, + }; + } + + function giveResultMailbox(mailbox) { + var name = findNode('display-name', mailbox); + var aspec = findNode('addr-spec', mailbox); + var cfws = findAllNodes('cfws', mailbox); + var comments = findAllNodesNoChildren(['comment'], mailbox); + + + var local = findNode('local-part', aspec); + var domain = findNode('domain', aspec); + return { + node: mailbox, + parts: { + name: name, + address: aspec, + local: local, + domain: domain, + comments: cfws + }, + type: mailbox.name, // 'mailbox' + name: grabSemantic(name), + address: grabSemantic(aspec), + local: grabSemantic(local), + domain: grabSemantic(domain), + comments: concatComments(comments), + groupName: grabSemantic(mailbox.groupName), + }; + } + + function grabSemantic(n) { + return n !== null && n !== undefined ? n.semantic : null; + } + + function simplifyResult(result) { + var i; + if (result && result.addresses) { + for (i = 0; i < result.addresses.length; i += 1) { + delete result.addresses[i].node; + } + } + return result; + } + + function concatComments(comments) { + var result = ''; + if (comments) { + for (var i = 0; i < comments.length; i += 1) { + result += grabSemantic(comments[i]); + } + } + return result; + } + + function oneResult(result) { + if (!result) { return null; } + if (!opts.partial && result.addresses.length > 1) { return null; } + return result.addresses && result.addresses[0]; + } + + ///////////////////////////////////////////////////// + + var parseString, pos, len, parsed, startProduction; + + opts = handleOpts(opts, {}); + if (opts === null) { return null; } + + parseString = opts.input; + + startProduction = { + 'address': address, + 'address-list': addressList, + 'angle-addr': angleAddr, + 'from': fromSpec, + 'group': group, + 'mailbox': mailbox, + 'mailbox-list': mailboxList, + 'reply-to': replyToSpec, + 'sender': senderSpec, + }[opts.startAt] || addressList; + + if (!opts.strict) { + initialize(); + opts.strict = true; + parsed = startProduction(parseString); + if (opts.partial || !inStr()) { + return giveResult(parsed); + } + opts.strict = false; + } + + initialize(); + parsed = startProduction(parseString); + if (!opts.partial && inStr()) { return null; } + return giveResult(parsed); +} + +function parseOneAddressSimple(opts) { + return parse5322(handleOpts(opts, { + oneResult: true, + rfc6532: true, + simple: true, + startAt: 'address-list', + })); +} + +function parseAddressListSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'address-list', + })); +} + +function parseFromSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'from', + })); +} + +function parseSenderSimple(opts) { + return parse5322(handleOpts(opts, { + oneResult: true, + rfc6532: true, + simple: true, + startAt: 'sender', + })); +} + +function parseReplyToSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'reply-to', + })); +} + +function handleOpts(opts, defs) { + function isString(str) { + return Object.prototype.toString.call(str) === '[object String]'; + } + + function isObject(o) { + return o === Object(o); + } + + function isNullUndef(o) { + return o === null || o === undefined; + } + + var defaults, o; + + if (isString(opts)) { + opts = { input: opts }; + } else if (!isObject(opts)) { + return null; + } + + if (!isString(opts.input)) { return null; } + if (!defs) { return null; } + + defaults = { + oneResult: false, + partial: false, + rejectTLD: false, + rfc6532: false, + simple: false, + startAt: 'address-list', + strict: false, + atInDisplayName: false + }; + + for (o in defaults) { + if (isNullUndef(opts[o])) { + opts[o] = !isNullUndef(defs[o]) ? defs[o] : defaults[o]; + } + } + return opts; +} + +parse5322.parseOneAddress = parseOneAddressSimple; +parse5322.parseAddressList = parseAddressListSimple; +parse5322.parseFrom = parseFromSimple; +parse5322.parseSender = parseSenderSimple; +parse5322.parseReplyTo = parseReplyToSimple; + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = parse5322; +} else { + global.emailAddresses = parse5322; +} + +}(this)); diff --git a/live2d/node_modules/email-addresses/lib/email-addresses.min.js b/live2d/node_modules/email-addresses/lib/email-addresses.min.js new file mode 100644 index 0000000..d7cfb25 --- /dev/null +++ b/live2d/node_modules/email-addresses/lib/email-addresses.min.js @@ -0,0 +1 @@ +(function(global){"use strict";function parse5322(opts){function inStr(){return pos0){result.semantic=" "}return result}}function star(prod,minimum){return function starFunc(){var s,result,count,start,min;start=getPos();s=o("star");count=0;min=minimum===undefined?0:minimum;while((result=prod())!==null){count=count+1;add(s,result)}if(count>=min){return s}else{setPos(start);return null}}}function collapseWhitespace(s){return s.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}function isUTF8NonAscii(tok){return tok.charCodeAt(0)>=128}function cr(){return wrap("cr",literal("\r")())}function crlf(){return wrap("crlf",and(cr,lf)())}function dquote(){return wrap("dquote",literal('"')())}function htab(){return wrap("htab",literal("\t")())}function lf(){return wrap("lf",literal("\n")())}function sp(){return wrap("sp",literal(" ")())}function vchar(){return wrap("vchar",compareToken(function vcharFunc(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept}))}function wsp(){return wrap("wsp",or(sp,htab)())}function quotedPair(){var qp=wrap("quoted-pair",or(and(literal("\\"),or(vchar,wsp)),obsQP)());if(qp===null){return null}qp.semantic=qp.semantic[1];return qp}function fws(){return wrap("fws",or(obsFws,and(opt(and(star(wsp),invis(crlf))),star(wsp,1)))())}function ctext(){return wrap("ctext",or(function ctextFunc1(){return compareToken(function ctextFunc2(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=39||42<=code&&code<=91||93<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsCtext)())}function ccontent(){return wrap("ccontent",or(ctext,quotedPair,comment)())}function comment(){return wrap("comment",and(literal("("),star(and(opt(fws),ccontent)),opt(fws),literal(")"))())}function cfws(){return wrap("cfws",or(and(star(and(opt(fws),comment),1),opt(fws)),fws)())}function atext(){return wrap("atext",compareToken(function atextFunc(tok){var accept="a"<=tok&&tok<="z"||"A"<=tok&&tok<="Z"||"0"<=tok&&tok<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(tok)>=0;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept}))}function atom(){return wrap("atom",and(colwsp(opt(cfws)),star(atext,1),colwsp(opt(cfws)))())}function dotAtomText(){var s,maybeText;s=wrap("dot-atom-text",star(atext,1)());if(s===null){return s}maybeText=star(and(literal("."),star(atext,1)))();if(maybeText!==null){add(s,maybeText)}return s}function dotAtom(){return wrap("dot-atom",and(invis(opt(cfws)),dotAtomText,invis(opt(cfws)))())}function qtext(){return wrap("qtext",or(function qtextFunc1(){return compareToken(function qtextFunc2(tok){var code=tok.charCodeAt(0);var accept=33===code||35<=code&&code<=91||93<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsQtext)())}function qcontent(){return wrap("qcontent",or(qtext,quotedPair)())}function quotedString(){return wrap("quoted-string",and(invis(opt(cfws)),invis(dquote),star(and(opt(colwsp(fws)),qcontent)),opt(invis(fws)),invis(dquote),invis(opt(cfws)))())}function word(){return wrap("word",or(atom,quotedString)())}function phrase(){return wrap("phrase",or(obsPhrase,star(word,1))())}function address(){return wrap("address",or(mailbox,group)())}function mailbox(){return wrap("mailbox",or(nameAddr,addrSpec)())}function nameAddr(){return wrap("name-addr",and(opt(displayName),angleAddr)())}function angleAddr(){return wrap("angle-addr",or(and(invis(opt(cfws)),literal("<"),addrSpec,literal(">"),invis(opt(cfws))),obsAngleAddr)())}function group(){return wrap("group",and(displayName,literal(":"),opt(groupList),literal(";"),invis(opt(cfws)))())}function displayName(){return wrap("display-name",function phraseFixedSemantic(){var result=phrase();if(result!==null){result.semantic=collapseWhitespace(result.semantic)}return result}())}function mailboxList(){return wrap("mailbox-list",or(and(mailbox,star(and(literal(","),mailbox))),obsMboxList)())}function addressList(){return wrap("address-list",or(and(address,star(and(literal(","),address))),obsAddrList)())}function groupList(){return wrap("group-list",or(mailboxList,invis(cfws),obsGroupList)())}function localPart(){return wrap("local-part",or(obsLocalPart,dotAtom,quotedString)())}function dtext(){return wrap("dtext",or(function dtextFunc1(){return compareToken(function dtextFunc2(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=90||94<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsDtext)())}function domainLiteral(){return wrap("domain-literal",and(invis(opt(cfws)),literal("["),star(and(opt(fws),dtext)),opt(fws),literal("]"),invis(opt(cfws)))())}function domain(){return wrap("domain",function domainCheckTLD(){var result=or(obsDomain,dotAtom,domainLiteral)();if(opts.rejectTLD){if(result&&result.semantic&&result.semantic.indexOf(".")<0){return null}}if(result){result.semantic=result.semantic.replace(/\s+/g,"")}return result}())}function addrSpec(){return wrap("addr-spec",and(localPart,literal("@"),domain)())}function fromSpec(){return wrap("from",or(mailboxList,addressList)())}function senderSpec(){return wrap("sender",or(mailbox,address)())}function replyToSpec(){return wrap("reply-to",addressList())}function obsNoWsCtl(){return opts.strict?null:wrap("obs-NO-WS-CTL",compareToken(function(tok){var code=tok.charCodeAt(0);return 1<=code&&code<=8||(11===code||12===code)||14<=code&&code<=31||127===code}))}function obsCtext(){return opts.strict?null:wrap("obs-ctext",obsNoWsCtl())}function obsQtext(){return opts.strict?null:wrap("obs-qtext",obsNoWsCtl())}function obsQP(){return opts.strict?null:wrap("obs-qp",and(literal("\\"),or(literal("\0"),obsNoWsCtl,lf,cr))())}function obsPhrase(){if(opts.strict)return null;return opts.atInDisplayName?wrap("obs-phrase",and(word,star(or(word,literal("."),literal("@"),colwsp(cfws))))()):wrap("obs-phrase",and(word,star(or(word,literal("."),colwsp(cfws))))())}function obsFws(){return opts.strict?null:wrap("obs-FWS",star(and(invis(opt(crlf)),wsp),1)())}function obsAngleAddr(){return opts.strict?null:wrap("obs-angle-addr",and(invis(opt(cfws)),literal("<"),obsRoute,addrSpec,literal(">"),invis(opt(cfws)))())}function obsRoute(){return opts.strict?null:wrap("obs-route",and(obsDomainList,literal(":"))())}function obsDomainList(){return opts.strict?null:wrap("obs-domain-list",and(star(or(invis(cfws),literal(","))),literal("@"),domain,star(and(literal(","),invis(opt(cfws)),opt(and(literal("@"),domain)))))())}function obsMboxList(){return opts.strict?null:wrap("obs-mbox-list",and(star(and(invis(opt(cfws)),literal(","))),mailbox,star(and(literal(","),opt(and(mailbox,invis(cfws))))))())}function obsAddrList(){return opts.strict?null:wrap("obs-addr-list",and(star(and(invis(opt(cfws)),literal(","))),address,star(and(literal(","),opt(and(address,invis(cfws))))))())}function obsGroupList(){return opts.strict?null:wrap("obs-group-list",and(star(and(invis(opt(cfws)),literal(",")),1),invis(opt(cfws)))())}function obsLocalPart(){return opts.strict?null:wrap("obs-local-part",and(word,star(and(literal("."),word)))())}function obsDomain(){return opts.strict?null:wrap("obs-domain",and(atom,star(and(literal("."),atom)))())}function obsDtext(){return opts.strict?null:wrap("obs-dtext",or(obsNoWsCtl,quotedPair)())}function findNode(name,root){var i,stack,node;if(root===null||root===undefined){return null}stack=[root];while(stack.length>0){node=stack.pop();if(node.name===name){return node}for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}return null}function findAllNodes(name,root){var i,stack,node,result;if(root===null||root===undefined){return null}stack=[root];result=[];while(stack.length>0){node=stack.pop();if(node.name===name){result.push(node)}for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}return result}function findAllNodesNoChildren(names,root){var i,stack,node,result,namesLookup;if(root===null||root===undefined){return null}stack=[root];result=[];namesLookup={};for(i=0;i0){node=stack.pop();if(node.name in namesLookup){result.push(node)}else{for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}}return result}function giveResult(ast){var addresses,groupsAndMailboxes,i,groupOrMailbox,result;if(ast===null){return null}addresses=[];groupsAndMailboxes=findAllNodesNoChildren(["group","mailbox"],ast);for(i=0;i1){return null}return result.addresses&&result.addresses[0]}var parseString,pos,len,parsed,startProduction;opts=handleOpts(opts,{});if(opts===null){return null}parseString=opts.input;startProduction={address:address,"address-list":addressList,"angle-addr":angleAddr,from:fromSpec,group:group,mailbox:mailbox,"mailbox-list":mailboxList,"reply-to":replyToSpec,sender:senderSpec}[opts.startAt]||addressList;if(!opts.strict){initialize();opts.strict=true;parsed=startProduction(parseString);if(opts.partial||!inStr()){return giveResult(parsed)}opts.strict=false}initialize();parsed=startProduction(parseString);if(!opts.partial&&inStr()){return null}return giveResult(parsed)}function parseOneAddressSimple(opts){return parse5322(handleOpts(opts,{oneResult:true,rfc6532:true,simple:true,startAt:"address-list"}))}function parseAddressListSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"address-list"}))}function parseFromSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"from"}))}function parseSenderSimple(opts){return parse5322(handleOpts(opts,{oneResult:true,rfc6532:true,simple:true,startAt:"sender"}))}function parseReplyToSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"reply-to"}))}function handleOpts(opts,defs){function isString(str){return Object.prototype.toString.call(str)==="[object String]"}function isObject(o){return o===Object(o)}function isNullUndef(o){return o===null||o===undefined}var defaults,o;if(isString(opts)){opts={input:opts}}else if(!isObject(opts)){return null}if(!isString(opts.input)){return null}if(!defs){return null}defaults={oneResult:false,partial:false,rejectTLD:false,rfc6532:false,simple:false,startAt:"address-list",strict:false,atInDisplayName:false};for(o in defaults){if(isNullUndef(opts[o])){opts[o]=!isNullUndef(defs[o])?defs[o]:defaults[o]}}return opts}parse5322.parseOneAddress=parseOneAddressSimple;parse5322.parseAddressList=parseAddressListSimple;parse5322.parseFrom=parseFromSimple;parse5322.parseSender=parseSenderSimple;parse5322.parseReplyTo=parseReplyToSimple;if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=parse5322}else{global.emailAddresses=parse5322}})(this); diff --git a/live2d/node_modules/email-addresses/package.json b/live2d/node_modules/email-addresses/package.json new file mode 100644 index 0000000..fe61a0e --- /dev/null +++ b/live2d/node_modules/email-addresses/package.json @@ -0,0 +1,30 @@ +{ + "version": "3.1.0", + "name": "email-addresses", + "description": "An email address parser based on rfc5322", + "keywords": [ + "email address", + "parser", + "rfc5322", + "5322" + ], + "homepage": "https://github.com/jackbearheart/email-addresses", + "author": "Jack Bearheart ", + "repository": { + "type": "git", + "url": "https://github.com/jackbearheart/email-addresses.git" + }, + "directories": { + "lib": "./lib" + }, + "main": "./lib/email-addresses.js", + "devDependencies": { + "libxmljs": "~0.19.7", + "tap": "^14.8.2" + }, + "scripts": { + "test": "tap ./test" + }, + "license": "MIT", + "typings": "./lib/email-addresses.d.ts" +} diff --git a/live2d/node_modules/email-addresses/test/email-addresses.js b/live2d/node_modules/email-addresses/test/email-addresses.js new file mode 100644 index 0000000..ad127e4 --- /dev/null +++ b/live2d/node_modules/email-addresses/test/email-addresses.js @@ -0,0 +1,369 @@ + +var test = require("tap").test; + +var addrs = require("../lib/email-addresses"); + + +test("simple one address function", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("ABC < a@b.c>") || {}; + t.notOk(result.node, "has no ast information"); + t.equal(result.address, "a@b.c", "full address, semantic only"); + t.equal(result.name, "ABC", "display name"); + t.equal(result.local, "a", "local part"); + t.equal(result.domain, "b.c", "domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b.c, d@e.f"), null, "address list > null"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "RFC 6532 (Unicode support) is enabled by default"); + t.equal(result.parts.local.semantic, "Françoise Lefèvre"); + + result = fxn("First Last "); + t.equal(result.name, "First Last", + "whitespace is not removed from display names without quotes"); + + result = fxn(" First Last "); + t.equal(result.name, "First Last", + "whitespace in names is collapsed"); + + t.end(); +}); + +test("address with @ in the name", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + result = fxn({input: "ABC@abc (comment) < a@b.c>", atInDisplayName: true }) || {}; + t.equal(result.name, "ABC@abc", "display name"); + t.end(); +}); + +test("address with comments", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + result = fxn("ABC (comment) < a@b.c>" ) || {}; + t.equal(result.name, "ABC", "display name"); + t.equal(result.comments, '(comment)'); + t.end(); +}); + +test("simple address list function", function (t) { + var fxn, result; + fxn = addrs.parseAddressList; + + result = fxn("\"A B C\" < a@b.c>, d@e") || [{}, {}]; + t.notOk(result[0].node, "has no ast information"); + t.equal(result[0].address, "a@b.c", "full address, semantic only"); + t.equal(result[0].name, "A B C", "display name"); + t.equal(result[0].local, "a", "local part"); + t.equal(result[0].domain, "b.c", "domain"); + + t.notOk(result[1].node, "has no ast information"); + t.equal(result[1].address, "d@e", "second address"); + t.equal(result[1].name, null, "second display name"); + t.equal(result[1].local, "d", "second local part"); + t.equal(result[1].domain, "e", "second domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b.c").length, 1, "single address > ok"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "RFC 6532 (Unicode support) is enabled by default"); + + t.end(); +}); + +test("rfc5322 parser", function (t) { + var fxn, result; + fxn = addrs; + + result = fxn("\"A B C\" < a@b.c>, d@e") || {}; + t.ok(result.ast, "has an ast"); + t.ok(result.addresses.length, "has the addresses"); + + result = result.addresses; + t.ok(result[0].node, "has link to node in ast"); + t.equal(result[0].address, "a@b.c", "full address, semantic only"); + t.equal(result[0].name, "A B C", "display name"); + t.equal(result[0].local, "a", "local part"); + t.equal(result[0].domain, "b.c", "domain"); + + t.ok(result[1].node, "has link to node in ast"); + t.equal(result[1].address, "d@e", "second address"); + t.equal(result[1].name, null, "second display name"); + t.equal(result[1].local, "d", "second local part"); + t.equal(result[1].domain, "e", "second domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b bogus"), null, "not all input is an email list > null"); + + result = fxn({ input: "a@b bogus", partial: true }); + t.ok(result, "can obtain partial results if at beginning of string"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.notOk(result, "extended ascii characters are invalid according to RFC 5322"); + + result = fxn({ input: "\"Françoise Lefèvre\"@example.com", rfc6532: true }); + t.ok(result, "but extended ascii is allowed starting with RFC 6532"); + + t.end(); +}); + +test("display-name semantic interpretation", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + function check(s, comment, expected) { + t.equal(fxn(s).name, expected || "First Last", comment); + } + + check( + "First", + "single basic name is ok", + "First"); + + check( + "First Last", + "no extra whitespace is ok"); + + check( + " First Last ", + "single whitespace at beginning and end is removed"); + + check( + "First Last", + "whitespace in the middle is collapsed"); + + check( + " First Last ", + "extra whitespace everywhere is collapsed"); + + check( + " First Middle Last ", + "extra whitespace everywhere is collapsed, with more than 2 names", + "First Middle Last"); + + check( + "\tFirst \t Last\t", + "extra whitespace everywhere is collapsed with a mix of tabs and spaces"); + + check( + "\"First Last\"", + "surrounding quotes are not semantic"); + + check( + " \t \"First Last\" ", + "surrounding quotes are not semantic and whitespace is collapsed"); + + check( + " \t \"First \\\"The\t\tNickname\\\" Last\" ", + "surrounding quotes are not semantic, but inner quotes are, and whitespace is collapsed", + "First \"The Nickname\" Last"); + + t.end(); +}); + +test("address semantic interpretation", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + function check(s, comment, expected) { + t.equal(fxn(s).address, expected || "foo@bar.com", comment); + } + + check( + "foo@bar.com", + "plain address is ok"); + + check( + " foo@bar.com ", + "plain address with whitespace at beginning and end"); + + check( + "foo @bar.com", + "plain address with whitespace left of @ sign"); + + check( + "foo@ bar.com", + "plain address with whitespace right of @ sign"); + + // Technically, we should also be able to handle removing CFWS in + // a dot-atom (or more importantly, obs-domain), but I don't think anyone cares. + + check( + "\t foo\t\t@ \t bar.com \t ", + "plain address with whitespace everywhere"); + + check( + "Bob <\t foo\t\t@ \t bar.com \t >", + "angle-addr with whitespace everywhere"); + + check( + "\"foo\"@bar.com", + "plain address with quoted-string local-part"); + + check( + "\"foo baz\"@bar.com", + "plain address with quoted-string local-part including spaces" + + " (Note: This is a confusing situation for 'semantic' local-parts, and" + + " in this case we don't return a valid address. Don't use this. Just" + + " take the raw tokens used for the address if you always want it to be equivalent.)", + "foo baz@bar.com"); + + t.end(); +}); + +test("unicode support", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "extended ascii characters are allowed"); + + result = fxn("杨孝宇 "); + t.ok(result, "unicode support includes chinese characters (display-name, no quoted string)"); + + result = fxn("\"杨孝宇\" "); + t.ok(result, "unicode support includes chinese characters (display-name, quoted-string)"); + + t.end(); +}); + +test("rejectTLD option", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn({ input: "foo@bar.com", rejectTLD: false }); + t.ok(result, "a simple address is ok (rejectTLD false)"); + + result = fxn({ input: "foo@bar.com", rejectTLD: true }); + t.ok(result, "a simple address is ok (rejectTLD true)"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: false }); + t.ok(result, "a more complicated address is ok (rejectTLD false)"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: true }); + t.ok(result, "a more complicated address is ok (rejectTLD true)"); + + result = fxn({ input: "foo@bar", rejectTLD: false }); + t.ok(result, "an address with a TLD for its domain is allowed by rfc 5322"); + + result = fxn({ input: "foo@bar", rejectTLD: true }); + t.notOk(result, "an address with a TLD for its domain is rejected when the option is set"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: false }); + t.ok(result, "a more complicated address with a TLD for its domain is allowed by rfc 5322"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: true }); + t.notOk(result, "a more complicated address with a TLD for its domain is rejected when the option is set"); + + result = fxn({ input: "jack@", rejectTLD: true }); + t.notOk(result, "no domain is ok with rejectTLD set"); + + t.end(); +}); + +test("dots in unquoted display-names", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("H.P. Lovecraft "); + t.ok(result, "dots in the middle of an unquoted display-name with spaces (obs-phrase production)"); + + result = fxn("Hmm Yes Info. "); + t.ok(result, "dots to end an unquoted display-name (obs-phrase production)"); + + result = fxn("bar.net "); + t.ok(result, "dots in the middle of an unquoted display-name without spaces (obs-phrase production)"); + + result = fxn({ input: "H.P. Lovecraft ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + result = fxn({ input: "Hmm Yes Info. ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + result = fxn({ input: "bar.net ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + t.end(); +}); + +test("rfc6854 - from", function (t) { + var fxn, result; + fxn = addrs.parseFrom; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for From:"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[0].addresses.length, 2, "Extract group addresses"); + t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1"); + t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1") + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" "); + t.ok(result, "Group and mailbox"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[1].name, "Foo", "Second address name"); + t.equal(result[1].local, "foo", "Second address local"); + t.equal(result[1].domain, "example.com", "Second address domain"); + + t.end(); +}); + +test("rfc6854 - sender", function (t) { + var fxn, result; + fxn = addrs.parseSender; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for Sender:"); + t.equal(result.length, undefined, "Result is not an array"); + t.equal(result.name, "Managing Partners", "Result has name"); + t.equal(result.local, undefined, "Result has no local part"); + t.equal(result.addresses.length, 2, "Result has two addresses"); + t.equal(result.addresses[0].address, "ben@example.com", "Result first address match"); + t.equal(result.addresses[1].address, "carol@example.com", "Result first address match"); + + t.end(); +}); + +test("rfc6854 - reply-to", function (t) { + var fxn, result; + fxn = addrs.parseReplyTo; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for Reply-To:"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[0].addresses.length, 2, "Extract group addresses"); + t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1"); + t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1") + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" "); + t.ok(result, "Group and mailbox"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[1].name, "Foo", "Second address name"); + t.equal(result[1].local, "foo", "Second address local"); + t.equal(result[1].domain, "example.com", "Second address domain"); + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" , Group2:alice@example.com;"); + t.ok(result, "Group, mailbox, group"); + t.equal(result[0].name, "Managing Partners", "First: group name"); + t.equal(result[0].addresses[0].address, "ben@example.com"); + t.equal(result[0].addresses[1].address, "carol@example.com"); + t.equal(result[1].name, "Foo", "Second: address name"); + t.equal(result[2].name, "Group2", "Third: group name"); + + t.end(); +}); + +test("whitespace in domain", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn('":sysmail"@ Some-Group. Some-Org'); + t.ok(result, "spaces in domain parses ok"); + t.equal(result.domain, "Some-Group.Some-Org", "domain parsing strips whitespace"); + + t.end(); +}) diff --git a/live2d/node_modules/email-addresses/test/is_email.js b/live2d/node_modules/email-addresses/test/is_email.js new file mode 100644 index 0000000..8cd422f --- /dev/null +++ b/live2d/node_modules/email-addresses/test/is_email.js @@ -0,0 +1,87 @@ +var fs = require("fs"), + libxmljs = require("libxmljs"), + test = require("tap").test; + +var addrs = require("../lib/email-addresses"); + +var TESTS_FILE = "tests.xml", + TESTS_FILE_ENCODING = "utf8"; + +var ISEMAIL_ERR = "ISEMAIL_ERR", + ISEMAIL_ERR_DOMAINHYPHENSTART = "ISEMAIL_ERR_DOMAINHYPHENSTART", + ISEMAIL_ERR_DOMAINHYPHENEND = "ISEMAIL_ERR_DOMAINHYPHENEND"; + + +function isEmailTest(t, data) { + var nodes = getNodes(data, "//test"); + nodes.forEach(function (node) { + var id = getAttr(node, "id"), + address = getChildValue(node, "address"), + diagnosis = getChildValue(node, "diagnosis"); + + var result = addrs(convertAddress(address)), + ast = null; + if (result !== null) { + ast = result.addresses[0].node; + } + + var isValid = ast !== null, + expectedToBeValid = shouldParse(diagnosis); + + t.equal(isValid, expectedToBeValid, + "[test " + id + "] address: " + address + ", expects: " + expectedToBeValid); + }); + t.end(); +} + +function shouldParse(diagnosis) { + var isOk = !startsWith(diagnosis, ISEMAIL_ERR) || + // is_email considers address with a domain beginning + // or ending with "-" to be incorrect because they are not + // valid domains, but we are only concerned with rfc5322. + // From rfc5322's perspective, this is OK. + diagnosis === ISEMAIL_ERR_DOMAINHYPHENSTART || + diagnosis === ISEMAIL_ERR_DOMAINHYPHENEND; + return isOk; +} + +// the is_email tests encode control characters +// in the U+2400 block for display purposes +function convertAddress(s) { + var chars = []; + for (var i = 0; i < s.length; i += 1) { + var code = s.charCodeAt(i); + if (code >= 0x2400) { + code -= 0x2400; + } + chars.push(String.fromCharCode(code)); + } + return chars.join(''); +} + +function getChildValue(parent, nodeName) { + return parent.find(nodeName)[0].text(); +} + +function getAttr(node, attrName) { + return node.attr(attrName).value(); +} + +function getNodes(xml, xpath) { + var doc = libxmljs.parseXml(xml); + return doc.find(xpath); +} + +function startsWith(s, t) { + return s.substring(0, t.length) === t; +} + +test("isemail tests", function (t) { + fs.readFile(TESTS_FILE, TESTS_FILE_ENCODING, function (err, data) { + if (err) { + t.end(); + return console.error(err); + } + isEmailTest(t, data); + }); +}); diff --git a/live2d/node_modules/email-addresses/test/tests.xml b/live2d/node_modules/email-addresses/test/tests.xml new file mode 100644 index 0000000..72dde83 --- /dev/null +++ b/live2d/node_modules/email-addresses/test/tests.xml @@ -0,0 +1,1253 @@ + + + + + +

New test set

+

This test set is designed to replace and extend the coverage of the original set but with fewer tests.

+

Thanks to Michael Rushton (michael@squiloople.com) for starting this work and contributing tests 1-100

+
+ +
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ + + +
test
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@
+ ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@io
+ io. currently has an MX-record (Feb 2011). Some DNS setups seem to find it, some don't. If you don't see the MX for io. then try setting your DNS server to 8.8.8.8 (the Google DNS server) + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@io
+ io. currently has an MX-record (Feb 2011) + ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@nominet.org.uk
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@about.museum
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@e.com
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.a
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test.test@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
.test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_START + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test.@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_END + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test..iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_CONSECUTIVEDOTS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test_exa-mple.com
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
!#$%&`*+/=?^`{|}~@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test\@test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
123@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@123.com
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.123
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLDNUMERIC + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@255.255.255.255
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLDNUMERIC + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklmn@iana.org
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm.com
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LABEL_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@mason-dixon.com
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@-iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENSTART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana-.com
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENEND + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@c--n.com
+ c--n.com currently has an MX-record (May 2011) + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.co-uk
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@.iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_START + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org.
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_END + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana..com
+ ISEMAIL_ERR + ISEMAIL_ERR_CONSECUTIVEDOTS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hij
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hijk
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAIN_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
""@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"""@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\a"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\""@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\\"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_QS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test"text"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test""test"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"."test"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_LOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test\ test"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test".test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_LOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test␀"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QTEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test\␀"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghj"@iana.org
+ Quotes are still part of the length restriction + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Dominic Sayers + http://isemail.info +
+ +
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefg\h"@iana.org
+ Quoted pair is still part of the length restriction + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Dominic Sayers + http://isemail.info +
+ +
test@[255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@a[255.255.255.255]
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255.256]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[1111:2222:3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:888G]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_BADCHAR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_IPV6DEPRECATED + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555::8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_MAXGRPS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6::3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONSTRT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:::3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111::4444:5555::8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_2X2XCOLON + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:::]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444::255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_MAXGRPS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_2X2XCOLON + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONSTRT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test @iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@ iana .com
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test . test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
␍␊ test@iana.org
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
␍␊ ␍␊ test@iana.org
+ FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) + ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
((comment)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment(comment))test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test(comment)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_CFWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)[255.255.255.255]
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstu
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org␊
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@xn--hxajbheg2az3al.xn--jxalpdlp
+ A valid IDN from ICANN's
IDN TLD evaluation gateway + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ + + +
xn--test@iana.org
+ RFC 3490: "unless the + email standards are revised to invite the use of IDNA for local + parts, a domain label that holds the local part of an email address + SHOULD NOT begin with the ACE prefix, and even if it does, it is to + be interpreted literally as a local part that happens to begin with + the ACE prefix" + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Dominic Sayers + http://isemail.info +
+ +
test@iana.org-
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENEND + Dominic Sayers + http://isemail.info +
+ +
"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Dominic Sayers + http://isemail.info +
+ +
(test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@(iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@[1.2.3.4
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDDOMLIT + Dominic Sayers + http://isemail.info +
+ +
"test\"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Dominic Sayers + http://isemail.info +
+ +
(comment\)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(comment\)
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(comment\
+ ISEMAIL_ERR + ISEMAIL_ERR_BACKSLASHEND + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322]-domain-literal]
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_DOMLIT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-[domain-literal]
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_DTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\␇-domain-literal]
+ obs-dtext and obs-qp + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\␉-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\]-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal\]
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDDOMLIT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal\
+ ISEMAIL_ERR + ISEMAIL_ERR_BACKSLASHEND + Dominic Sayers + http://isemail.info +
+ +
test@[RFC 5322 domain literal]
+ Spaces are FWS in a domain literal + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal] (comment)
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
test@.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
""@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
()test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CTEXT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
␍test@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
"␍test"@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
(␍)test@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(␍)
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
␊test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"␊"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\␊"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
(␊)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_CTEXT + Dominic Sayers + http://isemail.info +
+ +
␇@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
test@␇.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
"␇"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\␇"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
(␇)test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CTEXT + Dominic Sayers + http://isemail.info +
+ +
␍␊test@iana.org
+ Not FWS because no actual white space + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊ ␍␊test@iana.org
+ Not obs-FWS because there must be white space on each "fold" + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊test@iana.org
+ Not FWS because no white space after the fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊ test@iana.org
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
␍␊ ␍␊test@iana.org
+ Not FWS because no white space after the second fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊␍␊test@iana.org
+ Not FWS because no white space after either fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
␍␊␍␊ test@iana.org
+ Not FWS because no white space after the first fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊ ␍␊
+ FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) + ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊
+ Not FWS because no actual white space + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊ ␍␊
+ Not obs-FWS because there must be white space on each "fold" + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊
+ Not FWS because no white space after the fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊ ␍␊
+ Not FWS because no white space after the second fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊␍␊
+ Not FWS because no white space after either fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊␍␊
+ Not FWS because no white space after the first fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@[IPv6:1::2:]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONEND + Dominic Sayers + http://isemail.info +
+ +
"test\©"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QPAIR + Dominic Sayers + http://isemail.info +
+ +
test@iana/icann.org
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAIN + Dominic Sayers + http://isemail.info +
+ +
test.(comment)test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_COMMENT + Dominic Sayers + http://isemail.info +
+ +
test@org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLD + Dominic Sayers + http://isemail.info +
+ +
test@test.com
+ test.com has an A-record but not an MX-record + ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_MX_RECORD + Dominic Sayers + http://isemail.info +
+ +
test@nic.no
+ nic.no currently has no MX-records or A-records (Feb 2011). If you are seeing an A-record for nic.io then try setting your DNS server to 8.8.8.8 (the Google DNS server) - your DNS server may be faking an A-record (OpenDNS does this, for instance). + ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Dominic Sayers + http://isemail.info +
+ diff --git a/live2d/node_modules/es-define-property/.eslintrc b/live2d/node_modules/es-define-property/.eslintrc new file mode 100644 index 0000000..46f3b12 --- /dev/null +++ b/live2d/node_modules/es-define-property/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/live2d/node_modules/es-define-property/.github/FUNDING.yml b/live2d/node_modules/es-define-property/.github/FUNDING.yml new file mode 100644 index 0000000..4445451 --- /dev/null +++ b/live2d/node_modules/es-define-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-define-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/live2d/node_modules/es-define-property/.nycrc b/live2d/node_modules/es-define-property/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/es-define-property/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/es-define-property/CHANGELOG.md b/live2d/node_modules/es-define-property/CHANGELOG.md new file mode 100644 index 0000000..4dce2ec --- /dev/null +++ b/live2d/node_modules/es-define-property/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-02-12 + +### Commits + +- Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480) +- Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50) +- npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e) +- Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856) diff --git a/live2d/node_modules/es-define-property/LICENSE b/live2d/node_modules/es-define-property/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/live2d/node_modules/es-define-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +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. diff --git a/live2d/node_modules/es-define-property/README.md b/live2d/node_modules/es-define-property/README.md new file mode 100644 index 0000000..9b291bd --- /dev/null +++ b/live2d/node_modules/es-define-property/README.md @@ -0,0 +1,49 @@ +# es-define-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.defineProperty`, but not IE 8's broken one. + +## Example + +```js +const assert = require('assert'); + +const $defineProperty = require('es-define-property'); + +if ($defineProperty) { + assert.equal($defineProperty, Object.defineProperty); +} else if (Object.defineProperty) { + assert.equal($defineProperty, false, 'this is IE 8'); +} else { + assert.equal($defineProperty, false, 'this is an ES3 engine'); +} +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-define-property +[npm-version-svg]: https://versionbadg.es/ljharb/es-define-property.svg +[deps-svg]: https://david-dm.org/ljharb/es-define-property.svg +[deps-url]: https://david-dm.org/ljharb/es-define-property +[dev-deps-svg]: https://david-dm.org/ljharb/es-define-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-define-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-define-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-define-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-define-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-define-property +[codecov-image]: https://codecov.io/gh/ljharb/es-define-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-define-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-define-property +[actions-url]: https://github.com/ljharb/es-define-property/actions diff --git a/live2d/node_modules/es-define-property/index.d.ts b/live2d/node_modules/es-define-property/index.d.ts new file mode 100644 index 0000000..6012247 --- /dev/null +++ b/live2d/node_modules/es-define-property/index.d.ts @@ -0,0 +1,3 @@ +declare const defineProperty: false | typeof Object.defineProperty; + +export = defineProperty; \ No newline at end of file diff --git a/live2d/node_modules/es-define-property/index.js b/live2d/node_modules/es-define-property/index.js new file mode 100644 index 0000000..f32737d --- /dev/null +++ b/live2d/node_modules/es-define-property/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +/** @type {import('.')} */ +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false; +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = false; + } +} + +module.exports = $defineProperty; diff --git a/live2d/node_modules/es-define-property/package.json b/live2d/node_modules/es-define-property/package.json new file mode 100644 index 0000000..45bc90f --- /dev/null +++ b/live2d/node_modules/es-define-property/package.json @@ -0,0 +1,81 @@ +{ + "name": "es-define-property", + "version": "1.0.0", + "description": "`Object.defineProperty`, but not IE 8's broken one.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-define-property.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "object", + "define", + "property", + "defineProperty", + "Object.defineProperty" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-define-property/issues" + }, + "homepage": "https://github.com/ljharb/es-define-property#readme", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "gopd": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/live2d/node_modules/es-define-property/test/index.js b/live2d/node_modules/es-define-property/test/index.js new file mode 100644 index 0000000..dbc054e --- /dev/null +++ b/live2d/node_modules/es-define-property/test/index.js @@ -0,0 +1,55 @@ +'use strict'; + +var $defineProperty = require('../'); + +var test = require('tape'); +var gOPD = require('gopd'); + +test('defineProperty: supported', { skip: !$defineProperty }, function (t) { + t.plan(4); + + t.equal(typeof $defineProperty, 'function', 'defineProperty is supported'); + if ($defineProperty && gOPD) { // this `if` check is just to shut TS up + var o = { a: 1 }; + + $defineProperty(o, 'b', { enumerable: true, value: 2 }); + t.deepEqual( + gOPD(o, 'b'), + { + configurable: false, + enumerable: true, + value: 2, + writable: false + }, + 'property descriptor is as expected' + ); + + $defineProperty(o, 'c', { enumerable: false, value: 3, writable: true }); + t.deepEqual( + gOPD(o, 'c'), + { + configurable: false, + enumerable: false, + value: 3, + writable: true + }, + 'property descriptor is as expected' + ); + } + + t.equal($defineProperty, Object.defineProperty, 'defineProperty is Object.defineProperty'); + + t.end(); +}); + +test('defineProperty: not supported', { skip: !!$defineProperty }, function (t) { + t.notOk($defineProperty, 'defineProperty is not supported'); + + t.match( + typeof $defineProperty, + /^(?:undefined|boolean)$/, + '`typeof defineProperty` is `undefined` or `boolean`' + ); + + t.end(); +}); diff --git a/live2d/node_modules/es-define-property/tsconfig.json b/live2d/node_modules/es-define-property/tsconfig.json new file mode 100644 index 0000000..fdfa155 --- /dev/null +++ b/live2d/node_modules/es-define-property/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/live2d/node_modules/es-errors/.eslintrc b/live2d/node_modules/es-errors/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/live2d/node_modules/es-errors/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/live2d/node_modules/es-errors/.github/FUNDING.yml b/live2d/node_modules/es-errors/.github/FUNDING.yml new file mode 100644 index 0000000..f1b8805 --- /dev/null +++ b/live2d/node_modules/es-errors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-errors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/live2d/node_modules/es-errors/CHANGELOG.md b/live2d/node_modules/es-errors/CHANGELOG.md new file mode 100644 index 0000000..204a9e9 --- /dev/null +++ b/live2d/node_modules/es-errors/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.3.0](https://github.com/ljharb/es-errors/compare/v1.2.1...v1.3.0) - 2024-02-05 + +### Commits + +- [New] add `EvalError` and `URIError` [`1927627`](https://github.com/ljharb/es-errors/commit/1927627ba68cb6c829d307231376c967db53acdf) + +## [v1.2.1](https://github.com/ljharb/es-errors/compare/v1.2.0...v1.2.1) - 2024-02-04 + +### Commits + +- [Fix] add missing `exports` entry [`5bb5f28`](https://github.com/ljharb/es-errors/commit/5bb5f280f98922701109d6ebb82eea2257cecc7e) + +## [v1.2.0](https://github.com/ljharb/es-errors/compare/v1.1.0...v1.2.0) - 2024-02-04 + +### Commits + +- [New] add `ReferenceError` [`6d8cf5b`](https://github.com/ljharb/es-errors/commit/6d8cf5bbb6f3f598d02cf6f30e468ba2caa8e143) + +## [v1.1.0](https://github.com/ljharb/es-errors/compare/v1.0.0...v1.1.0) - 2024-02-04 + +### Commits + +- [New] add base Error [`2983ab6`](https://github.com/ljharb/es-errors/commit/2983ab65f7bc5441276cb021dc3aa03c78881698) + +## v1.0.0 - 2024-02-03 + +### Commits + +- Initial implementation, tests, readme, type [`8f47631`](https://github.com/ljharb/es-errors/commit/8f476317e9ad76f40ad648081829b1a1a3a1288b) +- Initial commit [`ea5d099`](https://github.com/ljharb/es-errors/commit/ea5d099ef18e550509ab9e2be000526afd81c385) +- npm init [`6f5ebf9`](https://github.com/ljharb/es-errors/commit/6f5ebf9cead474dadd72b9e63dad315820a089ae) +- Only apps should have lockfiles [`e1a0aeb`](https://github.com/ljharb/es-errors/commit/e1a0aeb7b80f5cfc56be54d6b2100e915d47def8) +- [meta] add `sideEffects` flag [`a9c7d46`](https://github.com/ljharb/es-errors/commit/a9c7d460a492f1d8a241c836bc25a322a19cc043) diff --git a/live2d/node_modules/es-errors/LICENSE b/live2d/node_modules/es-errors/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/live2d/node_modules/es-errors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +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. diff --git a/live2d/node_modules/es-errors/README.md b/live2d/node_modules/es-errors/README.md new file mode 100644 index 0000000..8dbfacf --- /dev/null +++ b/live2d/node_modules/es-errors/README.md @@ -0,0 +1,55 @@ +# es-errors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A simple cache for a few of the JS Error constructors. + +## Example + +```js +const assert = require('assert'); + +const Base = require('es-errors'); +const Eval = require('es-errors/eval'); +const Range = require('es-errors/range'); +const Ref = require('es-errors/ref'); +const Syntax = require('es-errors/syntax'); +const Type = require('es-errors/type'); +const URI = require('es-errors/uri'); + +assert.equal(Base, Error); +assert.equal(Eval, EvalError); +assert.equal(Range, RangeError); +assert.equal(Ref, ReferenceError); +assert.equal(Syntax, SyntaxError); +assert.equal(Type, TypeError); +assert.equal(URI, URIError); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-errors +[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg +[deps-svg]: https://david-dm.org/ljharb/es-errors.svg +[deps-url]: https://david-dm.org/ljharb/es-errors +[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-errors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-errors +[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors +[actions-url]: https://github.com/ljharb/es-errors/actions diff --git a/live2d/node_modules/es-errors/eval.d.ts b/live2d/node_modules/es-errors/eval.d.ts new file mode 100644 index 0000000..e4210e0 --- /dev/null +++ b/live2d/node_modules/es-errors/eval.d.ts @@ -0,0 +1,3 @@ +declare const EvalError: EvalErrorConstructor; + +export = EvalError; diff --git a/live2d/node_modules/es-errors/eval.js b/live2d/node_modules/es-errors/eval.js new file mode 100644 index 0000000..725ccb6 --- /dev/null +++ b/live2d/node_modules/es-errors/eval.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./eval')} */ +module.exports = EvalError; diff --git a/live2d/node_modules/es-errors/index.d.ts b/live2d/node_modules/es-errors/index.d.ts new file mode 100644 index 0000000..69bdbc9 --- /dev/null +++ b/live2d/node_modules/es-errors/index.d.ts @@ -0,0 +1,3 @@ +declare const Error: ErrorConstructor; + +export = Error; diff --git a/live2d/node_modules/es-errors/index.js b/live2d/node_modules/es-errors/index.js new file mode 100644 index 0000000..cc0c521 --- /dev/null +++ b/live2d/node_modules/es-errors/index.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('.')} */ +module.exports = Error; diff --git a/live2d/node_modules/es-errors/package.json b/live2d/node_modules/es-errors/package.json new file mode 100644 index 0000000..ff8c2a5 --- /dev/null +++ b/live2d/node_modules/es-errors/package.json @@ -0,0 +1,80 @@ +{ + "name": "es-errors", + "version": "1.3.0", + "description": "A simple cache for a few of the JS Error constructors.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./eval": "./eval.js", + "./range": "./range.js", + "./ref": "./ref.js", + "./syntax": "./syntax.js", + "./type": "./type.js", + "./uri": "./uri.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-errors.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "error", + "typeerror", + "syntaxerror", + "rangeerror" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-errors/issues" + }, + "homepage": "https://github.com/ljharb/es-errors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/live2d/node_modules/es-errors/range.d.ts b/live2d/node_modules/es-errors/range.d.ts new file mode 100644 index 0000000..3a12e86 --- /dev/null +++ b/live2d/node_modules/es-errors/range.d.ts @@ -0,0 +1,3 @@ +declare const RangeError: RangeErrorConstructor; + +export = RangeError; diff --git a/live2d/node_modules/es-errors/range.js b/live2d/node_modules/es-errors/range.js new file mode 100644 index 0000000..2044fe0 --- /dev/null +++ b/live2d/node_modules/es-errors/range.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./range')} */ +module.exports = RangeError; diff --git a/live2d/node_modules/es-errors/ref.d.ts b/live2d/node_modules/es-errors/ref.d.ts new file mode 100644 index 0000000..a13107e --- /dev/null +++ b/live2d/node_modules/es-errors/ref.d.ts @@ -0,0 +1,3 @@ +declare const ReferenceError: ReferenceErrorConstructor; + +export = ReferenceError; diff --git a/live2d/node_modules/es-errors/ref.js b/live2d/node_modules/es-errors/ref.js new file mode 100644 index 0000000..d7c430f --- /dev/null +++ b/live2d/node_modules/es-errors/ref.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./ref')} */ +module.exports = ReferenceError; diff --git a/live2d/node_modules/es-errors/syntax.d.ts b/live2d/node_modules/es-errors/syntax.d.ts new file mode 100644 index 0000000..6a0c53c --- /dev/null +++ b/live2d/node_modules/es-errors/syntax.d.ts @@ -0,0 +1,3 @@ +declare const SyntaxError: SyntaxErrorConstructor; + +export = SyntaxError; diff --git a/live2d/node_modules/es-errors/syntax.js b/live2d/node_modules/es-errors/syntax.js new file mode 100644 index 0000000..5f5fdde --- /dev/null +++ b/live2d/node_modules/es-errors/syntax.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./syntax')} */ +module.exports = SyntaxError; diff --git a/live2d/node_modules/es-errors/test/index.js b/live2d/node_modules/es-errors/test/index.js new file mode 100644 index 0000000..1ff0277 --- /dev/null +++ b/live2d/node_modules/es-errors/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); + +var E = require('../'); +var R = require('../range'); +var Ref = require('../ref'); +var S = require('../syntax'); +var T = require('../type'); + +test('errors', function (t) { + t.equal(E, Error); + t.equal(R, RangeError); + t.equal(Ref, ReferenceError); + t.equal(S, SyntaxError); + t.equal(T, TypeError); + + t.end(); +}); diff --git a/live2d/node_modules/es-errors/tsconfig.json b/live2d/node_modules/es-errors/tsconfig.json new file mode 100644 index 0000000..99dfeb6 --- /dev/null +++ b/live2d/node_modules/es-errors/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + ], +} diff --git a/live2d/node_modules/es-errors/type.d.ts b/live2d/node_modules/es-errors/type.d.ts new file mode 100644 index 0000000..576fb51 --- /dev/null +++ b/live2d/node_modules/es-errors/type.d.ts @@ -0,0 +1,3 @@ +declare const TypeError: TypeErrorConstructor + +export = TypeError; diff --git a/live2d/node_modules/es-errors/type.js b/live2d/node_modules/es-errors/type.js new file mode 100644 index 0000000..9769e44 --- /dev/null +++ b/live2d/node_modules/es-errors/type.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./type')} */ +module.exports = TypeError; diff --git a/live2d/node_modules/es-errors/uri.d.ts b/live2d/node_modules/es-errors/uri.d.ts new file mode 100644 index 0000000..c3261c9 --- /dev/null +++ b/live2d/node_modules/es-errors/uri.d.ts @@ -0,0 +1,3 @@ +declare const URIError: URIErrorConstructor; + +export = URIError; diff --git a/live2d/node_modules/es-errors/uri.js b/live2d/node_modules/es-errors/uri.js new file mode 100644 index 0000000..e9cd1c7 --- /dev/null +++ b/live2d/node_modules/es-errors/uri.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./uri')} */ +module.exports = URIError; diff --git a/live2d/node_modules/escape-string-regexp/index.js b/live2d/node_modules/escape-string-regexp/index.js new file mode 100644 index 0000000..7834bf9 --- /dev/null +++ b/live2d/node_modules/escape-string-regexp/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; diff --git a/live2d/node_modules/escape-string-regexp/license b/live2d/node_modules/escape-string-regexp/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/escape-string-regexp/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/escape-string-regexp/package.json b/live2d/node_modules/escape-string-regexp/package.json new file mode 100644 index 0000000..f307df3 --- /dev/null +++ b/live2d/node_modules/escape-string-regexp/package.json @@ -0,0 +1,41 @@ +{ + "name": "escape-string-regexp", + "version": "1.0.5", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": "sindresorhus/escape-string-regexp", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)" + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "escape", + "regex", + "regexp", + "re", + "regular", + "expression", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/live2d/node_modules/escape-string-regexp/readme.md b/live2d/node_modules/escape-string-regexp/readme.md new file mode 100644 index 0000000..87ac82d --- /dev/null +++ b/live2d/node_modules/escape-string-regexp/readme.md @@ -0,0 +1,27 @@ +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +``` +$ npm install --save escape-string-regexp +``` + + +## Usage + +```js +const escapeStringRegexp = require('escape-string-regexp'); + +const escapedString = escapeStringRegexp('how much $ for a unicorn?'); +//=> 'how much \$ for a unicorn\?' + +new RegExp(escapedString); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/live2d/node_modules/eventemitter3/LICENSE b/live2d/node_modules/eventemitter3/LICENSE new file mode 100644 index 0000000..abcbd54 --- /dev/null +++ b/live2d/node_modules/eventemitter3/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Arnout Kazemier + +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. diff --git a/live2d/node_modules/eventemitter3/README.md b/live2d/node_modules/eventemitter3/README.md new file mode 100644 index 0000000..6ce142d --- /dev/null +++ b/live2d/node_modules/eventemitter3/README.md @@ -0,0 +1,92 @@ +# EventEmitter3 + +[![Version npm](https://img.shields.io/npm/v/eventemitter3.svg?style=flat-square)](https://www.npmjs.com/package/eventemitter3)[![Build Status](https://img.shields.io/travis/primus/eventemitter3/master.svg?style=flat-square)](https://travis-ci.org/primus/eventemitter3)[![Dependencies](https://img.shields.io/david/primus/eventemitter3.svg?style=flat-square)](https://david-dm.org/primus/eventemitter3)[![Coverage Status](https://img.shields.io/coveralls/primus/eventemitter3/master.svg?style=flat-square)](https://coveralls.io/r/primus/eventemitter3?branch=master)[![IRC channel](https://img.shields.io/badge/IRC-irc.freenode.net%23primus-00a8ff.svg?style=flat-square)](https://webchat.freenode.net/?channels=primus) + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/eventemitter3.svg)](https://saucelabs.com/u/eventemitter3) + +EventEmitter3 is a high performance EventEmitter. It has been micro-optimized +for various of code paths making this, one of, if not the fastest EventEmitter +available for Node.js and browsers. The module is API compatible with the +EventEmitter that ships by default with Node.js but there are some slight +differences: + +- Domain support has been removed. +- We do not `throw` an error when you emit an `error` event and nobody is + listening. +- The `newListener` and `removeListener` events have been removed as they + are useful only in some uncommon use-cases. +- The `setMaxListeners`, `getMaxListeners`, `prependListener` and + `prependOnceListener` methods are not available. +- Support for custom context for events so there is no need to use `fn.bind`. +- The `removeListener` method removes all matching listeners, not only the + first. + +It's a drop in replacement for existing EventEmitters, but just faster. Free +performance, who wouldn't want that? The EventEmitter is written in EcmaScript 3 +so it will work in the oldest browsers and node versions that you need to +support. + +## Installation + +```bash +$ npm install --save eventemitter3 +``` + +## CDN + +Recommended CDN: + +```text +https://unpkg.com/eventemitter3@latest/umd/eventemitter3.min.js +``` + +## Usage + +After installation the only thing you need to do is require the module: + +```js +var EventEmitter = require('eventemitter3'); +``` + +And you're ready to create your own EventEmitter instances. For the API +documentation, please follow the official Node.js documentation: + +http://nodejs.org/api/events.html + +### Contextual emits + +We've upgraded the API of the `EventEmitter.on`, `EventEmitter.once` and +`EventEmitter.removeListener` to accept an extra argument which is the `context` +or `this` value that should be set for the emitted events. This means you no +longer have the overhead of an event that required `fn.bind` in order to get a +custom `this` value. + +```js +var EE = new EventEmitter() + , context = { foo: 'bar' }; + +function emitted() { + console.log(this === context); // true +} + +EE.once('event-name', emitted, context); +EE.on('another-event', emitted, context); +EE.removeListener('another-event', emitted, context); +``` + +### Tests and benchmarks + +This module is well tested. You can run: + +- `npm test` to run the tests under Node.js. +- `npm run test-browser` to run the tests in real browsers via Sauce Labs. + +We also have a set of benchmarks to compare EventEmitter3 with some available +alternatives. To run the benchmarks run `npm run benchmark`. + +Tests and benchmarks are not included in the npm package. If you want to play +with them you have to clone the GitHub repository. + +## License + +[MIT](LICENSE) diff --git a/live2d/node_modules/eventemitter3/index.d.ts b/live2d/node_modules/eventemitter3/index.d.ts new file mode 100644 index 0000000..2f86f20 --- /dev/null +++ b/live2d/node_modules/eventemitter3/index.d.ts @@ -0,0 +1,64 @@ +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + */ +declare class EventEmitter { + static prefixed: string | boolean; + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + */ + eventNames(): Array; + + /** + * Return the listeners registered for a given event. + */ + listeners(event: EventTypes): Array; + + /** + * Return the number of listeners listening to a given event. + */ + listenerCount(event: EventTypes): number; + + /** + * Calls each of the listeners registered for a given event. + */ + emit(event: EventTypes, ...args: Array): boolean; + + /** + * Add a listener for a given event. + */ + on(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; + addListener(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; + + /** + * Add a one-time listener for a given event. + */ + once(event: EventTypes, fn: EventEmitter.ListenerFn, context?: any): this; + + /** + * Remove the listeners of a given event. + */ + removeListener(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this; + off(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: boolean): this; + + /** + * Remove all listeners, or those of the specified event. + */ + removeAllListeners(event?: EventTypes): this; +} + +declare namespace EventEmitter { + export interface ListenerFn { + (...args: Array): void; + } + + export interface EventEmitterStatic { + new(): EventEmitter; + } + + export const EventEmitter: EventEmitterStatic; +} + +export = EventEmitter; diff --git a/live2d/node_modules/eventemitter3/index.js b/live2d/node_modules/eventemitter3/index.js new file mode 100644 index 0000000..6ea485c --- /dev/null +++ b/live2d/node_modules/eventemitter3/index.js @@ -0,0 +1,336 @@ +'use strict'; + +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. +// +if ('undefined' !== typeof module) { + module.exports = EventEmitter; +} diff --git a/live2d/node_modules/eventemitter3/package.json b/live2d/node_modules/eventemitter3/package.json new file mode 100644 index 0000000..a14e63c --- /dev/null +++ b/live2d/node_modules/eventemitter3/package.json @@ -0,0 +1,56 @@ +{ + "name": "eventemitter3", + "version": "3.1.2", + "description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.", + "main": "index.js", + "typings": "index.d.ts", + "scripts": { + "browserify": "rm -rf umd && mkdir umd && browserify index.js -s EventEmitter3 -o umd/eventemitter3.js", + "minify": "uglifyjs umd/eventemitter3.js --source-map -cm -o umd/eventemitter3.min.js", + "benchmark": "find benchmarks/run -name '*.js' -exec benchmarks/start.sh {} \\;", + "test": "nyc --reporter=html --reporter=text mocha test/test.js", + "prepublishOnly": "npm run browserify && npm run minify", + "test-browser": "node test/browser.js" + }, + "files": [ + "index.js", + "index.d.ts", + "umd" + ], + "repository": { + "type": "git", + "url": "git://github.com/primus/eventemitter3.git" + }, + "keywords": [ + "EventEmitter", + "EventEmitter2", + "EventEmitter3", + "Events", + "addEventListener", + "addListener", + "emit", + "emits", + "emitter", + "event", + "once", + "pub/sub", + "publish", + "reactor", + "subscribe" + ], + "author": "Arnout Kazemier", + "license": "MIT", + "bugs": { + "url": "https://github.com/primus/eventemitter3/issues" + }, + "devDependencies": { + "assume": "~2.2.0", + "browserify": "~16.2.0", + "mocha": "~6.1.0", + "nyc": "~14.0.0", + "pre-commit": "~1.2.0", + "sauce-browsers": "~2.0.0", + "sauce-test": "~1.3.3", + "uglify-js": "~3.5.0" + } +} diff --git a/live2d/node_modules/eventemitter3/umd/eventemitter3.js b/live2d/node_modules/eventemitter3/umd/eventemitter3.js new file mode 100644 index 0000000..888fcb8 --- /dev/null +++ b/live2d/node_modules/eventemitter3/umd/eventemitter3.js @@ -0,0 +1,340 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.EventEmitter3 = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i (/[<>:"\/\\|?*\x00-\x1F]/g); +module.exports.windowsNames = () => (/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i); diff --git a/live2d/node_modules/filename-reserved-regex/license b/live2d/node_modules/filename-reserved-regex/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/filename-reserved-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/filename-reserved-regex/package.json b/live2d/node_modules/filename-reserved-regex/package.json new file mode 100644 index 0000000..37074a0 --- /dev/null +++ b/live2d/node_modules/filename-reserved-regex/package.json @@ -0,0 +1,36 @@ +{ + "name": "filename-reserved-regex", + "version": "2.0.0", + "description": "Regular expression for matching reserved filename characters", + "license": "MIT", + "repository": "sindresorhus/filename-reserved-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "re", + "regex", + "regexp", + "filename", + "reserved", + "illegal" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/live2d/node_modules/filename-reserved-regex/readme.md b/live2d/node_modules/filename-reserved-regex/readme.md new file mode 100644 index 0000000..91641b5 --- /dev/null +++ b/live2d/node_modules/filename-reserved-regex/readme.md @@ -0,0 +1,49 @@ +# filename-reserved-regex [![Build Status](https://travis-ci.org/sindresorhus/filename-reserved-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/filename-reserved-regex) + +> Regular expression for matching reserved filename characters + +On Unix-like systems `/` is reserved and [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) as well as non-printable characters `\x00-\x1F` on Windows. + + +## Install + +``` +$ npm install --save filename-reserved-regex +``` + + +## Usage + +```js +const filenameReservedRegex = require('filename-reserved-regex'); + +filenameReservedRegex().test('foo/bar'); +//=> true + +filenameReservedRegex().test('foo-bar'); +//=> false + +'foo/bar'.replace(filenameReservedRegex(), '!'); +//=> 'foo!bar' + +filenameReservedRegex.windowsNames().test('aux'); +//=> true +``` + +## API + +### filenameReservedRegex() + +Returns a regex that matches all invalid characters. + +### filenameReservedRegex.windowsNames() + +Returns a exact-match case-insensitive regex that matches invalid Windows +filenames. These include `CON`, `PRN`, `AUX`, `NUL`, `COM1`, `COM2`, `COM3`, `COM4`, `COM5`, +`COM6`, `COM7`, `COM8`, `COM9`, `LPT1`, `LPT2`, `LPT3`, `LPT4`, `LPT5`, `LPT6`, `LPT7`, `LPT8` +and `LPT9`. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/filenamify/filenamify-path.d.ts b/live2d/node_modules/filenamify/filenamify-path.d.ts new file mode 100644 index 0000000..2346602 --- /dev/null +++ b/live2d/node_modules/filenamify/filenamify-path.d.ts @@ -0,0 +1,8 @@ +import filenamify = require('./filenamify'); + +/** +Convert the filename in a path a valid filename and return the augmented path. +*/ +declare const filenamifyPath: (path: string, options?: filenamify.Options) => string; + +export = filenamifyPath; diff --git a/live2d/node_modules/filenamify/filenamify-path.js b/live2d/node_modules/filenamify/filenamify-path.js new file mode 100644 index 0000000..359c119 --- /dev/null +++ b/live2d/node_modules/filenamify/filenamify-path.js @@ -0,0 +1,10 @@ +'use strict'; +const path = require('path'); +const filenamify = require('./filenamify'); + +const filenamifyPath = (filePath, options) => { + filePath = path.resolve(filePath); + return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); +}; + +module.exports = filenamifyPath; diff --git a/live2d/node_modules/filenamify/filenamify.d.ts b/live2d/node_modules/filenamify/filenamify.d.ts new file mode 100644 index 0000000..cc17d11 --- /dev/null +++ b/live2d/node_modules/filenamify/filenamify.d.ts @@ -0,0 +1,39 @@ +declare namespace filenamify { + interface Options { + /** + String to use as replacement for reserved filename characters. + + Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` + + @default '!' + */ + readonly replacement?: string; + + /** + Truncate the filename to the given length. + + Systems generally allow up to 255 characters, but we default to 100 for usability reasons. + + @default 100 + */ + readonly maxLength?: number; + } +} + +/** +Convert a string to a valid filename. + +@example +``` +import filenamify = require('filenamify'); + +filenamify(''); +//=> 'foo!bar' + +filenamify('foo:"bar"', {replacement: '🐴'}); +//=> 'foo🐴bar' +``` +*/ +declare const filenamify: (string: string, options?: filenamify.Options) => string; + +export = filenamify; diff --git a/live2d/node_modules/filenamify/filenamify.js b/live2d/node_modules/filenamify/filenamify.js new file mode 100644 index 0000000..a548430 --- /dev/null +++ b/live2d/node_modules/filenamify/filenamify.js @@ -0,0 +1,40 @@ +'use strict'; +const trimRepeated = require('trim-repeated'); +const filenameReservedRegex = require('filename-reserved-regex'); +const stripOuter = require('strip-outer'); + +// Doesn't make sense to have longer filenames +const MAX_FILENAME_LENGTH = 100; + +const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex +const reRelativePath = /^\.+/; +const reTrailingPeriods = /\.+$/; + +const filenamify = (string, options = {}) => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + const replacement = options.replacement === undefined ? '!' : options.replacement; + + if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { + throw new Error('Replacement string cannot contain reserved filename characters'); + } + + string = string.replace(filenameReservedRegex(), replacement); + string = string.replace(reControlChars, replacement); + string = string.replace(reRelativePath, replacement); + string = string.replace(reTrailingPeriods, ''); + + if (replacement.length > 0) { + string = trimRepeated(string, replacement); + string = string.length > 1 ? stripOuter(string, replacement) : string; + } + + string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string; + string = string.slice(0, typeof options.maxLength === 'number' ? options.maxLength : MAX_FILENAME_LENGTH); + + return string; +}; + +module.exports = filenamify; diff --git a/live2d/node_modules/filenamify/index.d.ts b/live2d/node_modules/filenamify/index.d.ts new file mode 100644 index 0000000..4aea46f --- /dev/null +++ b/live2d/node_modules/filenamify/index.d.ts @@ -0,0 +1,24 @@ +import filenamify = require('./filenamify'); +import filenamifyPath = require('./filenamify-path'); + +declare const filenamifyCombined: { + /** + Convert a string to a valid filename. + + @example + ``` + import filenamify = require('filenamify'); + + filenamify(''); + //=> 'foo!bar' + + filenamify('foo:"bar"', {replacement: '🐴'}); + //=> 'foo🐴bar' + ``` + */ + (string: string, options?: filenamify.Options): string; + + path: typeof filenamifyPath; +}; + +export = filenamifyCombined; diff --git a/live2d/node_modules/filenamify/index.js b/live2d/node_modules/filenamify/index.js new file mode 100644 index 0000000..260bbd1 --- /dev/null +++ b/live2d/node_modules/filenamify/index.js @@ -0,0 +1,8 @@ +'use strict'; +const filenamify = require('./filenamify'); +const filenamifyPath = require('./filenamify-path'); + +const filenamifyCombined = filenamify; +filenamifyCombined.path = filenamifyPath; + +module.exports = filenamify; diff --git a/live2d/node_modules/filenamify/license b/live2d/node_modules/filenamify/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/live2d/node_modules/filenamify/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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. diff --git a/live2d/node_modules/filenamify/package.json b/live2d/node_modules/filenamify/package.json new file mode 100644 index 0000000..9b22083 --- /dev/null +++ b/live2d/node_modules/filenamify/package.json @@ -0,0 +1,54 @@ +{ + "name": "filenamify", + "version": "4.3.0", + "description": "Convert a string to a valid safe filename", + "license": "MIT", + "repository": "sindresorhus/filenamify", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "filenamify-path.d.ts", + "filenamify-path.js", + "filenamify.d.ts", + "filenamify.js", + "index.d.ts", + "index.js" + ], + "exports": { + ".": "./index.js", + "./browser": "./filenamify.js" + }, + "keywords": [ + "filename", + "safe", + "sanitize", + "file", + "name", + "string", + "path", + "filepath", + "convert", + "valid", + "dirname" + ], + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/live2d/node_modules/filenamify/readme.md b/live2d/node_modules/filenamify/readme.md new file mode 100644 index 0000000..3b0d747 --- /dev/null +++ b/live2d/node_modules/filenamify/readme.md @@ -0,0 +1,74 @@ +# filenamify + +> Convert a string to a valid safe filename + +On Unix-like systems, `/` is reserved. On Windows, [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) along with trailing periods are reserved. + +## Install + +``` +$ npm install filenamify +``` + +## Usage + +```js +const filenamify = require('filenamify'); + +filenamify(''); +//=> 'foo!bar' + +filenamify('foo:"bar"', {replacement: '🐴'}); +//=> 'foo🐴bar' +``` + +## API + +### filenamify(string, options?) + +Convert a string to a valid filename. + +### filenamify.path(path, options?) + +Convert the filename in a path a valid filename and return the augmented path. + +#### options + +Type: `object` + +##### replacement + +Type: `string`\ +Default: `'!'` + +String to use as replacement for reserved filename characters. + +Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` + +##### maxLength + +Type: `number`\ +Default: `100` + +Truncate the filename to the given length. + +Systems generally allow up to 255 characters, but we default to 100 for usability reasons. + +## Browser-only import + +You can also import `filenamify/browser`, which only imports `filenamify` and not `filenamify.path`, which relies on `path` being available or polyfilled. Importing `filenamify` this way is therefore useful when it is shipped using `webpack` or similar tools, and if `filenamify.path` is not needed. + +```js +const filenamify = require('filenamify/browser'); + +filenamify(''); +//=> 'foo!bar' +``` + +## Related + +- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module +- [filenamify-url](https://github.com/sindresorhus/filenamify-url) - Convert a URL to a valid filename +- [valid-filename](https://github.com/sindresorhus/valid-filename) - Check if a string is a valid filename +- [unused-filename](https://github.com/sindresorhus/unused-filename) - Get a unused filename by appending a number if it exists +- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string diff --git a/live2d/node_modules/find-cache-dir/index.js b/live2d/node_modules/find-cache-dir/index.js new file mode 100644 index 0000000..4786590 --- /dev/null +++ b/live2d/node_modules/find-cache-dir/index.js @@ -0,0 +1,67 @@ +'use strict'; +const path = require('path'); +const fs = require('fs'); +const commonDir = require('commondir'); +const pkgDir = require('pkg-dir'); +const makeDir = require('make-dir'); + +const {env, cwd} = process; + +const isWritable = path => { + try { + fs.accessSync(path, fs.constants.W_OK); + return true; + } catch (_) { + return false; + } +}; + +function useDirectory(directory, options) { + if (options.create) { + makeDir.sync(directory); + } + + if (options.thunk) { + return (...arguments_) => path.join(directory, ...arguments_); + } + + return directory; +} + +function getNodeModuleDirectory(directory) { + const nodeModules = path.join(directory, 'node_modules'); + + if ( + !isWritable(nodeModules) && + (fs.existsSync(nodeModules) || !isWritable(path.join(directory))) + ) { + return; + } + + return nodeModules; +} + +module.exports = (options = {}) => { + if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) { + return useDirectory(path.join(env.CACHE_DIR, options.name), options); + } + + let {cwd: directory = cwd()} = options; + + if (options.files) { + directory = commonDir(directory, options.files); + } + + directory = pkgDir.sync(directory); + + if (!directory) { + return; + } + + const nodeModules = getNodeModuleDirectory(directory); + if (!nodeModules) { + return undefined; + } + + return useDirectory(path.join(directory, 'node_modules', '.cache', options.name), options); +}; diff --git a/live2d/node_modules/find-cache-dir/license b/live2d/node_modules/find-cache-dir/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/live2d/node_modules/find-cache-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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. diff --git a/live2d/node_modules/find-cache-dir/package.json b/live2d/node_modules/find-cache-dir/package.json new file mode 100644 index 0000000..4ca187a --- /dev/null +++ b/live2d/node_modules/find-cache-dir/package.json @@ -0,0 +1,44 @@ +{ + "name": "find-cache-dir", + "version": "3.3.2", + "description": "Finds the common standard cache directory", + "license": "MIT", + "repository": "avajs/find-cache-dir", + "funding": "https://github.com/avajs/find-cache-dir?sponsor=1", + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "cache", + "directory", + "dir", + "caching", + "find", + "search" + ], + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.9", + "del": "^4.0.0", + "nyc": "^15.0.0", + "tempy": "^0.4.0", + "xo": "^0.25.3" + }, + "nyc": { + "reporter": [ + "lcov", + "text" + ] + } +} diff --git a/live2d/node_modules/find-cache-dir/readme.md b/live2d/node_modules/find-cache-dir/readme.md new file mode 100644 index 0000000..3bc03a8 --- /dev/null +++ b/live2d/node_modules/find-cache-dir/readme.md @@ -0,0 +1,123 @@ +# find-cache-dir [![Coverage Status](https://codecov.io/gh/avajs/find-cache-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/avajs/find-cache-dir/branch/master) + +> Finds the common standard cache directory + +The [`nyc`](https://github.com/istanbuljs/nyc) and [`AVA`](https://ava.li) projects decided to standardize on a common directory structure for storing cache information: + +```sh +# nyc +./node_modules/.cache/nyc + +# ava +./node_modules/.cache/ava + +# your-module +./node_modules/.cache/your-module +``` + +This module makes it easy to correctly locate the cache directory according to this shared spec. If this pattern becomes ubiquitous, clearing the cache for multiple dependencies becomes easy and consistent: + +``` +rm -rf ./node_modules/.cache +``` + +If you decide to adopt this pattern, please file a PR adding your name to the list of adopters below. + +## Install + +``` +$ npm install find-cache-dir +``` + +## Usage + +```js +const findCacheDir = require('find-cache-dir'); + +findCacheDir({name: 'unicorns'}); +//=> '/user/path/node-modules/.cache/unicorns' +``` + +## API + +### findCacheDir(options?) + +Finds the cache directory using the supplied options. The algorithm checks for the `CACHE_DIR` environmental variable and uses it if it is not set to `true`, `false`, `1` or `0`. If one is not found, it tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable. + +#### options + +Type: `object` + +##### name + +*Required*\ +Type: `string` + +Should be the same as your project name in `package.json`. + +##### files + +Type: `string[] | string` + +An array of files that will be searched for a common parent directory. This common parent directory will be used in lieu of the `cwd` option below. + +##### cwd + +Type: `string`\ +Default `process.cwd()` + +Directory to start searching for a `package.json` from. + +##### create + +Type: `boolean`\ +Default `false` + +If `true`, the directory will be created synchronously before returning. + +##### thunk + +Type: `boolean`\ +Default `false` + +If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`. + +```js +const thunk = findCacheDir({name: 'foo', thunk: true}); + +thunk(); +//=> '/some/path/node_modules/.cache/foo' + +thunk('bar.js') +//=> '/some/path/node_modules/.cache/foo/bar.js' + +thunk('baz', 'quz.js') +//=> '/some/path/node_modules/.cache/foo/baz/quz.js' +``` + +This is helpful for actually putting actual files in the cache! + +## Tips + +- To test modules using `find-cache-dir`, set the `CACHE_DIR` environment variable to temporarily override the directory that is resolved. + +## Adopters + +- [`ava`](https://avajs.dev) +- [`nyc`](https://github.com/istanbuljs/nyc) +- [`storybook`](https://github.com/storybookjs/storybook) +- [`babel-loader`](https://github.com/babel/babel-loader) +- [`eslint-loader`](https://github.com/MoOx/eslint-loader) +- [More…](https://www.npmjs.com/browse/depended/find-cache-dir) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/live2d/node_modules/find-up/index.d.ts b/live2d/node_modules/find-up/index.d.ts new file mode 100644 index 0000000..41e3192 --- /dev/null +++ b/live2d/node_modules/find-up/index.d.ts @@ -0,0 +1,137 @@ +import {Options as LocatePathOptions} from 'locate-path'; + +declare const stop: unique symbol; + +declare namespace findUp { + interface Options extends LocatePathOptions {} + + type StopSymbol = typeof stop; + + type Match = string | StopSymbol | undefined; +} + +declare const findUp: { + /** + Find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // ├── unicorn.png + // └── foo + // └── bar + // ├── baz + // └── example.js + + // example.js + import findUp = require('find-up'); + + (async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + })(); + ``` + */ + (name: string | string[], options?: findUp.Options): Promise; + + /** + Find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + (async () => { + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + })(); + ``` + */ + (matcher: (directory: string) => (findUp.Match | Promise), options?: findUp.Options): Promise; + + sync: { + /** + Synchronously find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + */ + (name: string | string[], options?: findUp.Options): string | undefined; + + /** + Synchronously find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + console.log(findUp.sync(directory => { + const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + ``` + */ + (matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined; + + /** + Synchronously check if a path exists. + + @param path - Path to the file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png')); + //=> true + ``` + */ + exists(path: string): boolean; + } + + /** + Check if a path exists. + + @param path - Path to a file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + (async () => { + console.log(await findUp.exists('/Users/sindresorhus/unicorn.png')); + //=> true + })(); + ``` + */ + exists(path: string): Promise; + + /** + Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`. + */ + readonly stop: findUp.StopSymbol; +}; + +export = findUp; diff --git a/live2d/node_modules/find-up/index.js b/live2d/node_modules/find-up/index.js new file mode 100644 index 0000000..ce564e5 --- /dev/null +++ b/live2d/node_modules/find-up/index.js @@ -0,0 +1,89 @@ +'use strict'; +const path = require('path'); +const locatePath = require('locate-path'); +const pathExists = require('path-exists'); + +const stop = Symbol('findUp.stop'); + +module.exports = async (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = async locateOptions => { + if (typeof name !== 'function') { + return locatePath(paths, locateOptions); + } + + const foundPath = await name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line no-await-in-loop + const foundPath = await runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.sync = (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = locateOptions => { + if (typeof name !== 'function') { + return locatePath.sync(paths, locateOptions); + } + + const foundPath = name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath.sync([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + const foundPath = runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.exists = pathExists; + +module.exports.sync.exists = pathExists.sync; + +module.exports.stop = stop; diff --git a/live2d/node_modules/find-up/license b/live2d/node_modules/find-up/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/live2d/node_modules/find-up/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/find-up/package.json b/live2d/node_modules/find-up/package.json new file mode 100644 index 0000000..cd50281 --- /dev/null +++ b/live2d/node_modules/find-up/package.json @@ -0,0 +1,53 @@ +{ + "name": "find-up", + "version": "4.1.0", + "description": "Find a file or directory by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "devDependencies": { + "ava": "^2.1.0", + "is-path-inside": "^2.1.0", + "tempy": "^0.3.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + } +} diff --git a/live2d/node_modules/find-up/readme.md b/live2d/node_modules/find-up/readme.md new file mode 100644 index 0000000..d6a21e5 --- /dev/null +++ b/live2d/node_modules/find-up/readme.md @@ -0,0 +1,156 @@ +# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) + +> Find a file or directory by walking up parent directories + + +## Install + +``` +$ npm install find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +`example.js` + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' +})(); +``` + + +## API + +### findUp(name, options?) +### findUp(matcher, options?) + +Returns a `Promise` for either the path or `undefined` if it couldn't be found. + +### findUp([...name], options?) + +Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found. + +### findUp.sync(name, options?) +### findUp.sync(matcher, options?) + +Returns a path or `undefined` if it couldn't be found. + +### findUp.sync([...name], options?) + +Returns the first path found (by respecting the order of the array) or `undefined` if none could be found. + +#### name + +Type: `string` + +Name of the file or directory to find. + +#### matcher + +Type: `Function` + +A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases. + +When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path. + +#### options + +Type: `object` + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + +##### type + +Type: `string`
+Default: `'file'`
+Values: `'file'` `'directory'` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### findUp.exists(path) + +Returns a `Promise` of whether the path exists. + +### findUp.sync.exists(path) + +Returns a `boolean` of whether the path exists. + +#### path + +Type: `string` + +Path to a file or directory. + +### findUp.stop + +A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem. + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + await findUp(directory => { + return path.basename(directory) === 'work' ? findUp.stop : 'logo.png'; + }); +})(); +``` + + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package +- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path + + +--- + +
+ + Get professional support for 'find-up' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/live2d/node_modules/fs-extra/CHANGELOG.md b/live2d/node_modules/fs-extra/CHANGELOG.md new file mode 100644 index 0000000..3049b45 --- /dev/null +++ b/live2d/node_modules/fs-extra/CHANGELOG.md @@ -0,0 +1,864 @@ +8.1.0 / 2019-06-28 +------------------ + +- Add support for promisified `fs.realpath.native` in Node v9.2+ ([#650](https://github.com/jprichardson/node-fs-extra/issues/650), [#682](https://github.com/jprichardson/node-fs-extra/pull/682)) +- Update `graceful-fs` dependency ([#700](https://github.com/jprichardson/node-fs-extra/pull/700)) +- Use `graceful-fs` everywhere ([#700](https://github.com/jprichardson/node-fs-extra/pull/700)) + +8.0.1 / 2019-05-13 +------------------ + +- Fix bug `Maximum call stack size exceeded` error in `util/stat` ([#679](https://github.com/jprichardson/node-fs-extra/pull/679)) + +8.0.0 / 2019-05-11 +------------------ + +**NOTE:** Node.js v6 support is deprecated, and will be dropped in the next major release. + +- Use `renameSync()` under the hood in `moveSync()` +- Fix bug with bind-mounted directories in `copy*()` ([#613](https://github.com/jprichardson/node-fs-extra/issues/613), [#618](https://github.com/jprichardson/node-fs-extra/pull/618)) +- Fix bug in `move()` with case-insensitive file systems +- Use `fs.stat()`'s `bigint` option in `copy*()` & `move*()` where possible ([#657](https://github.com/jprichardson/node-fs-extra/issues/657)) + +7.0.1 / 2018-11-07 +------------------ + +- Fix `removeSync()` on Windows, in some cases, it would error out with `ENOTEMPTY` ([#646](https://github.com/jprichardson/node-fs-extra/pull/646)) +- Document `mode` option for `ensureDir*()` ([#587](https://github.com/jprichardson/node-fs-extra/pull/587)) +- Don't include documentation files in npm package tarball ([#642](https://github.com/jprichardson/node-fs-extra/issues/642), [#643](https://github.com/jprichardson/node-fs-extra/pull/643)) + +7.0.0 / 2018-07-16 +------------------ + +- **BREAKING:** Refine `copy*()` handling of symlinks to properly detect symlinks that point to the same file. ([#582](https://github.com/jprichardson/node-fs-extra/pull/582)) +- Fix bug with copying write-protected directories ([#600](https://github.com/jprichardson/node-fs-extra/pull/600)) +- Universalify `fs.lchmod()` ([#596](https://github.com/jprichardson/node-fs-extra/pull/596)) +- Add `engines` field to `package.json` ([#580](https://github.com/jprichardson/node-fs-extra/pull/580)) + +6.0.1 / 2018-05-09 +------------------ + +- Fix `fs.promises` `ExperimentalWarning` on Node v10.1.0 ([#578](https://github.com/jprichardson/node-fs-extra/pull/578)) + +6.0.0 / 2018-05-01 +------------------ + +- Drop support for Node.js versions 4, 5, & 7 ([#564](https://github.com/jprichardson/node-fs-extra/pull/564)) +- Rewrite `move` to use `fs.rename` where possible ([#549](https://github.com/jprichardson/node-fs-extra/pull/549)) +- Don't convert relative paths to absolute paths for `filter` ([#554](https://github.com/jprichardson/node-fs-extra/pull/554)) +- `copy*`'s behavior when `preserveTimestamps` is `false` has been OS-dependent since 5.0.0, but that's now explicitly noted in the docs ([#563](https://github.com/jprichardson/node-fs-extra/pull/563)) +- Fix subdirectory detection for `copy*` & `move*` ([#541](https://github.com/jprichardson/node-fs-extra/pull/541)) +- Handle case-insensitive paths correctly in `copy*` ([#568](https://github.com/jprichardson/node-fs-extra/pull/568)) + +5.0.0 / 2017-12-11 +------------------ + +Significant refactor of `copy()` & `copySync()`, including breaking changes. No changes to other functions in this release. + +Huge thanks to **[@manidlou](https://github.com/manidlou)** for doing most of the work on this release. + +- The `filter` option can no longer be a RegExp (must be a function). This was deprecated since fs-extra v1.0.0. [#512](https://github.com/jprichardson/node-fs-extra/pull/512) +- `copy()`'s `filter` option can now be a function that returns a Promise. [#518](https://github.com/jprichardson/node-fs-extra/pull/518) +- `copy()` & `copySync()` now use `fs.copyFile()`/`fs.copyFileSync()` in environments that support it (currently Node 8.5.0+). Older Node versions still get the old implementation. [#505](https://github.com/jprichardson/node-fs-extra/pull/505) +- Don't allow copying a directory into itself. [#83](https://github.com/jprichardson/node-fs-extra/issues/83) +- Handle copying between identical files. [#198](https://github.com/jprichardson/node-fs-extra/issues/198) +- Error out when copying an empty folder to a path that already exists. [#464](https://github.com/jprichardson/node-fs-extra/issues/464) +- Don't create `dest`'s parent if the `filter` function aborts the `copy()` operation. [#517](https://github.com/jprichardson/node-fs-extra/pull/517) +- Fix `writeStream` not being closed if there was an error in `copy()`. [#516](https://github.com/jprichardson/node-fs-extra/pull/516) + +4.0.3 / 2017-12-05 +------------------ + +- Fix wrong `chmod` values in `fs.remove()` [#501](https://github.com/jprichardson/node-fs-extra/pull/501) +- Fix `TypeError` on systems that don't have some `fs` operations like `lchown` [#520](https://github.com/jprichardson/node-fs-extra/pull/520) + +4.0.2 / 2017-09-12 +------------------ + +- Added `EOL` option to `writeJson*` & `outputJson*` (via upgrade to jsonfile v4) +- Added promise support to [`fs.copyFile()`](https://nodejs.org/api/fs.html#fs_fs_copyfile_src_dest_flags_callback) in Node 8.5+ +- Added `.js` extension to `main` field in `package.json` for better tooling compatibility. [#485](https://github.com/jprichardson/node-fs-extra/pull/485) + +4.0.1 / 2017-07-31 +------------------ + +### Fixed + +- Previously, `ensureFile()` & `ensureFileSync()` would do nothing if the path was a directory. Now, they error out for consistency with `ensureDir()`. [#465](https://github.com/jprichardson/node-fs-extra/issues/465), [#466](https://github.com/jprichardson/node-fs-extra/pull/466), [#470](https://github.com/jprichardson/node-fs-extra/issues/470) + +4.0.0 / 2017-07-14 +------------------ + +### Changed + +- **BREAKING:** The promisified versions of `fs.read()` & `fs.write()` now return objects. See [the docs](docs/fs-read-write.md) for details. [#436](https://github.com/jprichardson/node-fs-extra/issues/436), [#449](https://github.com/jprichardson/node-fs-extra/pull/449) +- `fs.move()` now errors out when destination is a subdirectory of source. [#458](https://github.com/jprichardson/node-fs-extra/pull/458) +- Applied upstream fixes from `rimraf` to `fs.remove()` & `fs.removeSync()`. [#459](https://github.com/jprichardson/node-fs-extra/pull/459) + +### Fixed + +- Got `fs.outputJSONSync()` working again; it was broken due to refactoring. [#428](https://github.com/jprichardson/node-fs-extra/pull/428) + +Also clarified the docs in a few places. + +3.0.1 / 2017-05-04 +------------------ + +- Fix bug in `move()` & `moveSync()` when source and destination are the same, and source does not exist. [#415](https://github.com/jprichardson/node-fs-extra/pull/415) + +3.0.0 / 2017-04-27 +------------------ + +### Added + +- **BREAKING:** Added Promise support. All asynchronous native fs methods and fs-extra methods now return a promise if the callback is not passed. [#403](https://github.com/jprichardson/node-fs-extra/pull/403) +- `pathExists()`, a replacement for the deprecated `fs.exists`. `pathExists` has a normal error-first callback signature. Also added `pathExistsSync`, an alias to `fs.existsSync`, for completeness. [#406](https://github.com/jprichardson/node-fs-extra/pull/406) + +### Removed + +- **BREAKING:** Removed support for setting the default spaces for `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()`. This was undocumented. [#402](https://github.com/jprichardson/node-fs-extra/pull/402) + +### Changed + +- Upgraded jsonfile dependency to v3.0.0: + - **BREAKING:** Changed behavior of `throws` option for `readJsonSync()`; now does not throw filesystem errors when `throws` is `false`. +- **BREAKING:** `writeJson()`, `writeJsonSync()`, `outputJson()`, & `outputJsonSync()` now output minified JSON by default for consistency with `JSON.stringify()`; set the `spaces` option to `2` to override this new behavior. [#402](https://github.com/jprichardson/node-fs-extra/pull/402) +- Use `Buffer.allocUnsafe()` instead of `new Buffer()` in environments that support it. [#394](https://github.com/jprichardson/node-fs-extra/pull/394) + +### Fixed + +- `removeSync()` silently failed on Windows in some cases. Now throws an `EBUSY` error. [#408](https://github.com/jprichardson/node-fs-extra/pull/408) + +2.1.2 / 2017-03-16 +------------------ + +### Fixed + +- Weird windows bug that resulted in `ensureDir()`'s callback being called twice in some cases. This bug may have also affected `remove()`. See [#392](https://github.com/jprichardson/node-fs-extra/issues/392), [#393](https://github.com/jprichardson/node-fs-extra/pull/393) + +2.1.1 / 2017-03-15 +------------------ + +### Fixed + +- Reverted [`5597bd`](https://github.com/jprichardson/node-fs-extra/commit/5597bd5b67f7d060f5f5bf26e9635be48330f5d7), this broke compatibility with Node.js versions v4+ but less than `v4.5.0`. +- Remove `Buffer.alloc()` usage in `moveSync()`. + +2.1.0 / 2017-03-15 +------------------ + +Thanks to [Mani Maghsoudlou (@manidlou)](https://github.com/manidlou) & [Jan Peer Stöcklmair (@JPeer264)](https://github.com/JPeer264) for their extraordinary help with this release! + +### Added +- `moveSync()` See [#309], [#381](https://github.com/jprichardson/node-fs-extra/pull/381). ([@manidlou](https://github.com/manidlou)) +- `copy()` and `copySync()`'s `filter` option now gets the destination path passed as the second parameter. [#366](https://github.com/jprichardson/node-fs-extra/pull/366) ([@manidlou](https://github.com/manidlou)) + +### Changed +- Use `Buffer.alloc()` instead of deprecated `new Buffer()` in `copySync()`. [#380](https://github.com/jprichardson/node-fs-extra/pull/380) ([@manidlou](https://github.com/manidlou)) +- Refactored entire codebase to use ES6 features supported by Node.js v4+ [#355](https://github.com/jprichardson/node-fs-extra/issues/355). [(@JPeer264)](https://github.com/JPeer264) +- Refactored docs. ([@manidlou](https://github.com/manidlou)) + +### Fixed + +- `move()` shouldn't error out when source and dest are the same. [#377](https://github.com/jprichardson/node-fs-extra/issues/377), [#378](https://github.com/jprichardson/node-fs-extra/pull/378) ([@jdalton](https://github.com/jdalton)) + +2.0.0 / 2017-01-16 +------------------ + +### Removed +- **BREAKING:** Removed support for Node `v0.12`. The Node foundation stopped officially supporting it +on Jan 1st, 2017. +- **BREAKING:** Remove `walk()` and `walkSync()`. `walkSync()` was only part of `fs-extra` for a little +over two months. Use [klaw](https://github.com/jprichardson/node-klaw) instead of `walk()`, in fact, `walk()` was just +an alias to klaw. For `walkSync()` use [klaw-sync](https://github.com/mawni/node-klaw-sync). See: [#338], [#339] + +### Changed +- **BREAKING:** Renamed `clobber` to `overwrite`. This affects `copy()`, `copySync()`, and `move()`. [#330], [#333] +- Moved docs, to `docs/`. [#340] + +### Fixed +- Apply filters to directories in `copySync()` like in `copy()`. [#324] +- A specific condition when disk is under heavy use, `copy()` can fail. [#326] + + +1.0.0 / 2016-11-01 +------------------ + +After five years of development, we finally have reach the 1.0.0 milestone! Big thanks goes +to [Ryan Zim](https://github.com/RyanZim) for leading the charge on this release! + +### Added +- `walkSync()` + +### Changed +- **BREAKING**: dropped Node v0.10 support. +- disabled `rimaf` globbing, wasn't used. [#280] +- deprecate `copy()/copySync()` option `filter` if it's a `RegExp`. `filter` should now be a function. +- inline `rimraf`. This is temporary and was done because `rimraf` depended upon the beefy `glob` which `fs-extra` does not use. [#300] + +### Fixed +- bug fix proper closing of file handle on `utimesMillis()` [#271] +- proper escaping of files with dollar signs [#291] +- `copySync()` failed if user didn't own file. [#199], [#301] + + +0.30.0 / 2016-04-28 +------------------- +- Brought back Node v0.10 support. I didn't realize there was still demand. Official support will end **2016-10-01**. + +0.29.0 / 2016-04-27 +------------------- +- **BREAKING**: removed support for Node v0.10. If you still want to use Node v0.10, everything should work except for `ensureLink()/ensureSymlink()`. Node v0.12 is still supported but will be dropped in the near future as well. + +0.28.0 / 2016-04-17 +------------------- +- **BREAKING**: removed `createOutputStream()`. Use https://www.npmjs.com/package/create-output-stream. See: [#192][#192] +- `mkdirs()/mkdirsSync()` check for invalid win32 path chars. See: [#209][#209], [#237][#237] +- `mkdirs()/mkdirsSync()` if drive not mounted, error. See: [#93][#93] + +0.27.0 / 2016-04-15 +------------------- +- add `dereference` option to `copySync()`. [#235][#235] + +0.26.7 / 2016-03-16 +------------------- +- fixed `copy()` if source and dest are the same. [#230][#230] + +0.26.6 / 2016-03-15 +------------------- +- fixed if `emptyDir()` does not have a callback: [#229][#229] + +0.26.5 / 2016-01-27 +------------------- +- `copy()` with two arguments (w/o callback) was broken. See: [#215][#215] + +0.26.4 / 2016-01-05 +------------------- +- `copySync()` made `preserveTimestamps` default consistent with `copy()` which is `false`. See: [#208][#208] + +0.26.3 / 2015-12-17 +------------------- +- fixed `copy()` hangup in copying blockDevice / characterDevice / `/dev/null`. See: [#193][#193] + +0.26.2 / 2015-11-02 +------------------- +- fixed `outputJson{Sync}()` spacing adherence to `fs.spaces` + +0.26.1 / 2015-11-02 +------------------- +- fixed `copySync()` when `clogger=true` and the destination is read only. See: [#190][#190] + +0.26.0 / 2015-10-25 +------------------- +- extracted the `walk()` function into its own module [`klaw`](https://github.com/jprichardson/node-klaw). + +0.25.0 / 2015-10-24 +------------------- +- now has a file walker `walk()` + +0.24.0 / 2015-08-28 +------------------- +- removed alias `delete()` and `deleteSync()`. See: [#171][#171] + +0.23.1 / 2015-08-07 +------------------- +- Better handling of errors for `move()` when moving across devices. [#170][#170] +- `ensureSymlink()` and `ensureLink()` should not throw errors if link exists. [#169][#169] + +0.23.0 / 2015-08-06 +------------------- +- added `ensureLink{Sync}()` and `ensureSymlink{Sync}()`. See: [#165][#165] + +0.22.1 / 2015-07-09 +------------------- +- Prevent calling `hasMillisResSync()` on module load. See: [#149][#149]. +Fixes regression that was introduced in `0.21.0`. + +0.22.0 / 2015-07-09 +------------------- +- preserve permissions / ownership in `copy()`. See: [#54][#54] + +0.21.0 / 2015-07-04 +------------------- +- add option to preserve timestamps in `copy()` and `copySync()`. See: [#141][#141] +- updated `graceful-fs@3.x` to `4.x`. This brings in features from `amazing-graceful-fs` (much cleaner code / less hacks) + +0.20.1 / 2015-06-23 +------------------- +- fixed regression caused by latest jsonfile update: See: https://github.com/jprichardson/node-jsonfile/issues/26 + +0.20.0 / 2015-06-19 +------------------- +- removed `jsonfile` aliases with `File` in the name, they weren't documented and probably weren't in use e.g. +this package had both `fs.readJsonFile` and `fs.readJson` that were aliases to each other, now use `fs.readJson`. +- preliminary walker created. Intentionally not documented. If you use it, it will almost certainly change and break your code. +- started moving tests inline +- upgraded to `jsonfile@2.1.0`, can now pass JSON revivers/replacers to `readJson()`, `writeJson()`, `outputJson()` + +0.19.0 / 2015-06-08 +------------------- +- `fs.copy()` had support for Node v0.8, dropped support + +0.18.4 / 2015-05-22 +------------------- +- fixed license field according to this: [#136][#136] and https://github.com/npm/npm/releases/tag/v2.10.0 + +0.18.3 / 2015-05-08 +------------------- +- bugfix: handle `EEXIST` when clobbering on some Linux systems. [#134][#134] + +0.18.2 / 2015-04-17 +------------------- +- bugfix: allow `F_OK` ([#120][#120]) + +0.18.1 / 2015-04-15 +------------------- +- improved windows support for `move()` a bit. https://github.com/jprichardson/node-fs-extra/commit/92838980f25dc2ee4ec46b43ee14d3c4a1d30c1b +- fixed a lot of tests for Windows (appveyor) + +0.18.0 / 2015-03-31 +------------------- +- added `emptyDir()` and `emptyDirSync()` + +0.17.0 / 2015-03-28 +------------------- +- `copySync` added `clobber` option (before always would clobber, now if `clobber` is `false` it throws an error if the destination exists). +**Only works with files at the moment.** +- `createOutputStream()` added. See: [#118][#118] + +0.16.5 / 2015-03-08 +------------------- +- fixed `fs.move` when `clobber` is `true` and destination is a directory, it should clobber. [#114][#114] + +0.16.4 / 2015-03-01 +------------------- +- `fs.mkdirs` fix infinite loop on Windows. See: See https://github.com/substack/node-mkdirp/pull/74 and https://github.com/substack/node-mkdirp/issues/66 + +0.16.3 / 2015-01-28 +------------------- +- reverted https://github.com/jprichardson/node-fs-extra/commit/1ee77c8a805eba5b99382a2591ff99667847c9c9 + + +0.16.2 / 2015-01-28 +------------------- +- fixed `fs.copy` for Node v0.8 (support is temporary and will be removed in the near future) + +0.16.1 / 2015-01-28 +------------------- +- if `setImmediate` is not available, fall back to `process.nextTick` + +0.16.0 / 2015-01-28 +------------------- +- bugfix `fs.move()` into itself. Closes [#104] +- bugfix `fs.move()` moving directory across device. Closes [#108] +- added coveralls support +- bugfix: nasty multiple callback `fs.copy()` bug. Closes [#98] +- misc fs.copy code cleanups + +0.15.0 / 2015-01-21 +------------------- +- dropped `ncp`, imported code in +- because of previous, now supports `io.js` +- `graceful-fs` is now a dependency + +0.14.0 / 2015-01-05 +------------------- +- changed `copy`/`copySync` from `fs.copy(src, dest, [filters], callback)` to `fs.copy(src, dest, [options], callback)` [#100][#100] +- removed mockfs tests for mkdirp (this may be temporary, but was getting in the way of other tests) + +0.13.0 / 2014-12-10 +------------------- +- removed `touch` and `touchSync` methods (they didn't handle permissions like UNIX touch) +- updated `"ncp": "^0.6.0"` to `"ncp": "^1.0.1"` +- imported `mkdirp` => `minimist` and `mkdirp` are no longer dependences, should now appease people who wanted `mkdirp` to be `--use_strict` safe. See [#59]([#59][#59]) + +0.12.0 / 2014-09-22 +------------------- +- copy symlinks in `copySync()` [#85][#85] + +0.11.1 / 2014-09-02 +------------------- +- bugfix `copySync()` preserve file permissions [#80][#80] + +0.11.0 / 2014-08-11 +------------------- +- upgraded `"ncp": "^0.5.1"` to `"ncp": "^0.6.0"` +- upgrade `jsonfile": "^1.2.0"` to `jsonfile": "^2.0.0"` => on write, json files now have `\n` at end. Also adds `options.throws` to `readJsonSync()` +see https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options for more details. + +0.10.0 / 2014-06-29 +------------------ +* bugfix: upgaded `"jsonfile": "~1.1.0"` to `"jsonfile": "^1.2.0"`, bumped minor because of `jsonfile` dep change +from `~` to `^`. [#67] + +0.9.1 / 2014-05-22 +------------------ +* removed Node.js `0.8.x` support, `0.9.0` was published moments ago and should have been done there + +0.9.0 / 2014-05-22 +------------------ +* upgraded `ncp` from `~0.4.2` to `^0.5.1`, [#58] +* upgraded `rimraf` from `~2.2.6` to `^2.2.8` +* upgraded `mkdirp` from `0.3.x` to `^0.5.0` +* added methods `ensureFile()`, `ensureFileSync()` +* added methods `ensureDir()`, `ensureDirSync()` [#31] +* added `move()` method. From: https://github.com/andrewrk/node-mv + + +0.8.1 / 2013-10-24 +------------------ +* copy failed to return an error to the callback if a file doesn't exist (ulikoehler [#38], [#39]) + +0.8.0 / 2013-10-14 +------------------ +* `filter` implemented on `copy()` and `copySync()`. (Srirangan / [#36]) + +0.7.1 / 2013-10-12 +------------------ +* `copySync()` implemented (Srirangan / [#33]) +* updated to the latest `jsonfile` version `1.1.0` which gives `options` params for the JSON methods. Closes [#32] + +0.7.0 / 2013-10-07 +------------------ +* update readme conventions +* `copy()` now works if destination directory does not exist. Closes [#29] + +0.6.4 / 2013-09-05 +------------------ +* changed `homepage` field in package.json to remove NPM warning + +0.6.3 / 2013-06-28 +------------------ +* changed JSON spacing default from `4` to `2` to follow Node conventions +* updated `jsonfile` dep +* updated `rimraf` dep + +0.6.2 / 2013-06-28 +------------------ +* added .npmignore, [#25] + +0.6.1 / 2013-05-14 +------------------ +* modified for `strict` mode, closes [#24] +* added `outputJson()/outputJsonSync()`, closes [#23] + +0.6.0 / 2013-03-18 +------------------ +* removed node 0.6 support +* added node 0.10 support +* upgraded to latest `ncp` and `rimraf`. +* optional `graceful-fs` support. Closes [#17] + + +0.5.0 / 2013-02-03 +------------------ +* Removed `readTextFile`. +* Renamed `readJSONFile` to `readJSON` and `readJson`, same with write. +* Restructured documentation a bit. Added roadmap. + +0.4.0 / 2013-01-28 +------------------ +* Set default spaces in `jsonfile` from 4 to 2. +* Updated `testutil` deps for tests. +* Renamed `touch()` to `createFile()` +* Added `outputFile()` and `outputFileSync()` +* Changed creation of testing diretories so the /tmp dir is not littered. +* Added `readTextFile()` and `readTextFileSync()`. + +0.3.2 / 2012-11-01 +------------------ +* Added `touch()` and `touchSync()` methods. + +0.3.1 / 2012-10-11 +------------------ +* Fixed some stray globals. + +0.3.0 / 2012-10-09 +------------------ +* Removed all CoffeeScript from tests. +* Renamed `mkdir` to `mkdirs`/`mkdirp`. + +0.2.1 / 2012-09-11 +------------------ +* Updated `rimraf` dep. + +0.2.0 / 2012-09-10 +------------------ +* Rewrote module into JavaScript. (Must still rewrite tests into JavaScript) +* Added all methods of [jsonfile](https://github.com/jprichardson/node-jsonfile) +* Added Travis-CI. + +0.1.3 / 2012-08-13 +------------------ +* Added method `readJSONFile`. + +0.1.2 / 2012-06-15 +------------------ +* Bug fix: `deleteSync()` didn't exist. +* Verified Node v0.8 compatibility. + +0.1.1 / 2012-06-15 +------------------ +* Fixed bug in `remove()`/`delete()` that wouldn't execute the function if a callback wasn't passed. + +0.1.0 / 2012-05-31 +------------------ +* Renamed `copyFile()` to `copy()`. `copy()` can now copy directories (recursively) too. +* Renamed `rmrf()` to `remove()`. +* `remove()` aliased with `delete()`. +* Added `mkdirp` capabilities. Named: `mkdir()`. Hides Node.js native `mkdir()`. +* Instead of exporting the native `fs` module with new functions, I now copy over the native methods to a new object and export that instead. + +0.0.4 / 2012-03-14 +------------------ +* Removed CoffeeScript dependency + +0.0.3 / 2012-01-11 +------------------ +* Added methods rmrf and rmrfSync +* Moved tests from Jasmine to Mocha + + +[#344]: https://github.com/jprichardson/node-fs-extra/issues/344 "Licence Year" +[#343]: https://github.com/jprichardson/node-fs-extra/pull/343 "Add klaw-sync link to readme" +[#342]: https://github.com/jprichardson/node-fs-extra/pull/342 "allow preserveTimestamps when use move" +[#341]: https://github.com/jprichardson/node-fs-extra/issues/341 "mkdirp(path.dirname(dest) in move() logic needs cleaning up [question]" +[#340]: https://github.com/jprichardson/node-fs-extra/pull/340 "Move docs to seperate docs folder [documentation]" +[#339]: https://github.com/jprichardson/node-fs-extra/pull/339 "Remove walk() & walkSync() [feature-walk]" +[#338]: https://github.com/jprichardson/node-fs-extra/issues/338 "Remove walk() and walkSync() [feature-walk]" +[#337]: https://github.com/jprichardson/node-fs-extra/issues/337 "copy doesn't return a yieldable value" +[#336]: https://github.com/jprichardson/node-fs-extra/pull/336 "Docs enhanced walk sync [documentation, feature-walk]" +[#335]: https://github.com/jprichardson/node-fs-extra/pull/335 "Refactor move() tests [feature-move]" +[#334]: https://github.com/jprichardson/node-fs-extra/pull/334 "Cleanup lib/move/index.js [feature-move]" +[#333]: https://github.com/jprichardson/node-fs-extra/pull/333 "Rename clobber to overwrite [feature-copy, feature-move]" +[#332]: https://github.com/jprichardson/node-fs-extra/pull/332 "BREAKING: Drop Node v0.12 & io.js support" +[#331]: https://github.com/jprichardson/node-fs-extra/issues/331 "Add support for chmodr [enhancement, future]" +[#330]: https://github.com/jprichardson/node-fs-extra/pull/330 "BREAKING: Do not error when copy destination exists & clobber: false [feature-copy]" +[#329]: https://github.com/jprichardson/node-fs-extra/issues/329 "Does .walk() scale to large directories? [question]" +[#328]: https://github.com/jprichardson/node-fs-extra/issues/328 "Copying files corrupts [feature-copy, needs-confirmed]" +[#327]: https://github.com/jprichardson/node-fs-extra/pull/327 "Use writeStream 'finish' event instead of 'close' [bug, feature-copy]" +[#326]: https://github.com/jprichardson/node-fs-extra/issues/326 "fs.copy fails with chmod error when disk under heavy use [bug, feature-copy]" +[#325]: https://github.com/jprichardson/node-fs-extra/issues/325 "ensureDir is difficult to promisify [enhancement]" +[#324]: https://github.com/jprichardson/node-fs-extra/pull/324 "copySync() should apply filter to directories like copy() [bug, feature-copy]" +[#323]: https://github.com/jprichardson/node-fs-extra/issues/323 "Support for `dest` being a directory when using `copy*()`?" +[#322]: https://github.com/jprichardson/node-fs-extra/pull/322 "Add fs-promise as fs-extra-promise alternative" +[#321]: https://github.com/jprichardson/node-fs-extra/issues/321 "fs.copy() with clobber set to false return EEXIST error [feature-copy]" +[#320]: https://github.com/jprichardson/node-fs-extra/issues/320 "fs.copySync: Error: EPERM: operation not permitted, unlink " +[#319]: https://github.com/jprichardson/node-fs-extra/issues/319 "Create directory if not exists" +[#318]: https://github.com/jprichardson/node-fs-extra/issues/318 "Support glob patterns [enhancement, future]" +[#317]: https://github.com/jprichardson/node-fs-extra/pull/317 "Adding copy sync test for src file without write perms" +[#316]: https://github.com/jprichardson/node-fs-extra/pull/316 "Remove move()'s broken limit option [feature-move]" +[#315]: https://github.com/jprichardson/node-fs-extra/pull/315 "Fix move clobber tests to work around graceful-fs bug." +[#314]: https://github.com/jprichardson/node-fs-extra/issues/314 "move() limit option [documentation, enhancement, feature-move]" +[#313]: https://github.com/jprichardson/node-fs-extra/pull/313 "Test that remove() ignores glob characters." +[#312]: https://github.com/jprichardson/node-fs-extra/pull/312 "Enhance walkSync() to return items with path and stats [feature-walk]" +[#311]: https://github.com/jprichardson/node-fs-extra/issues/311 "move() not work when dest name not provided [feature-move]" +[#310]: https://github.com/jprichardson/node-fs-extra/issues/310 "Edit walkSync to return items like what walk emits [documentation, enhancement, feature-walk]" +[#309]: https://github.com/jprichardson/node-fs-extra/issues/309 "moveSync support [enhancement, feature-move]" +[#308]: https://github.com/jprichardson/node-fs-extra/pull/308 "Fix incorrect anchor link" +[#307]: https://github.com/jprichardson/node-fs-extra/pull/307 "Fix coverage" +[#306]: https://github.com/jprichardson/node-fs-extra/pull/306 "Update devDeps, fix lint error" +[#305]: https://github.com/jprichardson/node-fs-extra/pull/305 "Re-add Coveralls" +[#304]: https://github.com/jprichardson/node-fs-extra/pull/304 "Remove path-is-absolute [enhancement]" +[#303]: https://github.com/jprichardson/node-fs-extra/pull/303 "Document copySync filter inconsistency [documentation, feature-copy]" +[#302]: https://github.com/jprichardson/node-fs-extra/pull/302 "fix(console): depreciated -> deprecated" +[#301]: https://github.com/jprichardson/node-fs-extra/pull/301 "Remove chmod call from copySync [feature-copy]" +[#300]: https://github.com/jprichardson/node-fs-extra/pull/300 "Inline Rimraf [enhancement, feature-move, feature-remove]" +[#299]: https://github.com/jprichardson/node-fs-extra/pull/299 "Warn when filter is a RegExp [feature-copy]" +[#298]: https://github.com/jprichardson/node-fs-extra/issues/298 "API Docs [documentation]" +[#297]: https://github.com/jprichardson/node-fs-extra/pull/297 "Warn about using preserveTimestamps on 32-bit node" +[#296]: https://github.com/jprichardson/node-fs-extra/pull/296 "Improve EEXIST error message for copySync [enhancement]" +[#295]: https://github.com/jprichardson/node-fs-extra/pull/295 "Depreciate using regular expressions for copy's filter option [documentation]" +[#294]: https://github.com/jprichardson/node-fs-extra/pull/294 "BREAKING: Refactor lib/copy/ncp.js [feature-copy]" +[#293]: https://github.com/jprichardson/node-fs-extra/pull/293 "Update CI configs" +[#292]: https://github.com/jprichardson/node-fs-extra/issues/292 "Rewrite lib/copy/ncp.js [enhancement, feature-copy]" +[#291]: https://github.com/jprichardson/node-fs-extra/pull/291 "Escape '$' in replacement string for async file copying" +[#290]: https://github.com/jprichardson/node-fs-extra/issues/290 "Exclude files pattern while copying using copy.config.js [question]" +[#289]: https://github.com/jprichardson/node-fs-extra/pull/289 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" +[#288]: https://github.com/jprichardson/node-fs-extra/pull/288 "(Closes #271) lib/util/utimes: properly close file descriptors in the event of an error" +[#287]: https://github.com/jprichardson/node-fs-extra/issues/287 "emptyDir() callback arguments are inconsistent [enhancement, feature-remove]" +[#286]: https://github.com/jprichardson/node-fs-extra/pull/286 "Added walkSync function" +[#285]: https://github.com/jprichardson/node-fs-extra/issues/285 "CITGM test failing on s390" +[#284]: https://github.com/jprichardson/node-fs-extra/issues/284 "outputFile method is missing a check to determine if existing item is a folder or not" +[#283]: https://github.com/jprichardson/node-fs-extra/pull/283 "Apply filter also on directories and symlinks for copySync()" +[#282]: https://github.com/jprichardson/node-fs-extra/pull/282 "Apply filter also on directories and symlinks for copySync()" +[#281]: https://github.com/jprichardson/node-fs-extra/issues/281 "remove function executes 'successfully' but doesn't do anything?" +[#280]: https://github.com/jprichardson/node-fs-extra/pull/280 "Disable rimraf globbing" +[#279]: https://github.com/jprichardson/node-fs-extra/issues/279 "Some code is vendored instead of included [awaiting-reply]" +[#278]: https://github.com/jprichardson/node-fs-extra/issues/278 "copy() does not preserve file/directory ownership" +[#277]: https://github.com/jprichardson/node-fs-extra/pull/277 "Mention defaults for clobber and dereference options" +[#276]: https://github.com/jprichardson/node-fs-extra/issues/276 "Cannot connect to Shared Folder [awaiting-reply]" +[#275]: https://github.com/jprichardson/node-fs-extra/issues/275 "EMFILE, too many open files on Mac OS with JSON API" +[#274]: https://github.com/jprichardson/node-fs-extra/issues/274 "Use with memory-fs? [enhancement, future]" +[#273]: https://github.com/jprichardson/node-fs-extra/pull/273 "tests: rename `remote.test.js` to `remove.test.js`" +[#272]: https://github.com/jprichardson/node-fs-extra/issues/272 "Copy clobber flag never err even when true [bug, feature-copy]" +[#271]: https://github.com/jprichardson/node-fs-extra/issues/271 "Unclosed file handle on futimes error" +[#270]: https://github.com/jprichardson/node-fs-extra/issues/270 "copy not working as desired on Windows [feature-copy, platform-windows]" +[#269]: https://github.com/jprichardson/node-fs-extra/issues/269 "Copying with preserveTimeStamps: true is inaccurate using 32bit node [feature-copy]" +[#268]: https://github.com/jprichardson/node-fs-extra/pull/268 "port fix for mkdirp issue #111" +[#267]: https://github.com/jprichardson/node-fs-extra/issues/267 "WARN deprecated wrench@1.5.9: wrench.js is deprecated!" +[#266]: https://github.com/jprichardson/node-fs-extra/issues/266 "fs-extra" +[#265]: https://github.com/jprichardson/node-fs-extra/issues/265 "Link the `fs.stat fs.exists` etc. methods for replace the `fs` module forever?" +[#264]: https://github.com/jprichardson/node-fs-extra/issues/264 "Renaming a file using move fails when a file inside is open (at least on windows) [wont-fix]" +[#263]: https://github.com/jprichardson/node-fs-extra/issues/263 "ENOSYS: function not implemented, link [needs-confirmed]" +[#262]: https://github.com/jprichardson/node-fs-extra/issues/262 "Add .exists() and .existsSync()" +[#261]: https://github.com/jprichardson/node-fs-extra/issues/261 "Cannot read property 'prototype' of undefined" +[#260]: https://github.com/jprichardson/node-fs-extra/pull/260 "use more specific path for method require" +[#259]: https://github.com/jprichardson/node-fs-extra/issues/259 "Feature Request: isEmpty" +[#258]: https://github.com/jprichardson/node-fs-extra/issues/258 "copy files does not preserve file timestamp" +[#257]: https://github.com/jprichardson/node-fs-extra/issues/257 "Copying a file on windows fails" +[#256]: https://github.com/jprichardson/node-fs-extra/pull/256 "Updated Readme " +[#255]: https://github.com/jprichardson/node-fs-extra/issues/255 "Update rimraf required version" +[#254]: https://github.com/jprichardson/node-fs-extra/issues/254 "request for readTree, readTreeSync, walkSync method" +[#253]: https://github.com/jprichardson/node-fs-extra/issues/253 "outputFile does not touch mtime when file exists" +[#252]: https://github.com/jprichardson/node-fs-extra/pull/252 "Fixing problem when copying file with no write permission" +[#251]: https://github.com/jprichardson/node-fs-extra/issues/251 "Just wanted to say thank you" +[#250]: https://github.com/jprichardson/node-fs-extra/issues/250 "`fs.remove()` not removing files (works with `rm -rf`)" +[#249]: https://github.com/jprichardson/node-fs-extra/issues/249 "Just a Question ... Remove Servers" +[#248]: https://github.com/jprichardson/node-fs-extra/issues/248 "Allow option to not preserve permissions for copy" +[#247]: https://github.com/jprichardson/node-fs-extra/issues/247 "Add TypeScript typing directly in the fs-extra package" +[#246]: https://github.com/jprichardson/node-fs-extra/issues/246 "fse.remove() && fse.removeSync() don't throw error on ENOENT file" +[#245]: https://github.com/jprichardson/node-fs-extra/issues/245 "filter for empty dir [enhancement]" +[#244]: https://github.com/jprichardson/node-fs-extra/issues/244 "copySync doesn't apply the filter to directories" +[#243]: https://github.com/jprichardson/node-fs-extra/issues/243 "Can I request fs.walk() to be synchronous?" +[#242]: https://github.com/jprichardson/node-fs-extra/issues/242 "Accidentally truncates file names ending with $$ [bug, feature-copy]" +[#241]: https://github.com/jprichardson/node-fs-extra/pull/241 "Remove link to createOutputStream" +[#240]: https://github.com/jprichardson/node-fs-extra/issues/240 "walkSync request" +[#239]: https://github.com/jprichardson/node-fs-extra/issues/239 "Depreciate regular expressions for copy's filter [documentation, feature-copy]" +[#238]: https://github.com/jprichardson/node-fs-extra/issues/238 "Can't write to files while in a worker thread." +[#237]: https://github.com/jprichardson/node-fs-extra/issues/237 ".ensureDir(..) fails silently when passed an invalid path..." +[#236]: https://github.com/jprichardson/node-fs-extra/issues/236 "[Removed] Filed under wrong repo" +[#235]: https://github.com/jprichardson/node-fs-extra/pull/235 "Adds symlink dereference option to `fse.copySync` (#191)" +[#234]: https://github.com/jprichardson/node-fs-extra/issues/234 "ensureDirSync fails silent when EACCES: permission denied on travis-ci" +[#233]: https://github.com/jprichardson/node-fs-extra/issues/233 "please make sure the first argument in callback is error object [feature-copy]" +[#232]: https://github.com/jprichardson/node-fs-extra/issues/232 "Copy a folder content to its child folder. " +[#231]: https://github.com/jprichardson/node-fs-extra/issues/231 "Adding read/write/output functions for YAML" +[#230]: https://github.com/jprichardson/node-fs-extra/pull/230 "throw error if src and dest are the same to avoid zeroing out + test" +[#229]: https://github.com/jprichardson/node-fs-extra/pull/229 "fix 'TypeError: callback is not a function' in emptyDir" +[#228]: https://github.com/jprichardson/node-fs-extra/pull/228 "Throw error when target is empty so file is not accidentally zeroed out" +[#227]: https://github.com/jprichardson/node-fs-extra/issues/227 "Uncatchable errors when there are invalid arguments [feature-move]" +[#226]: https://github.com/jprichardson/node-fs-extra/issues/226 "Moving to the current directory" +[#225]: https://github.com/jprichardson/node-fs-extra/issues/225 "EBUSY: resource busy or locked, unlink" +[#224]: https://github.com/jprichardson/node-fs-extra/issues/224 "fse.copy ENOENT error" +[#223]: https://github.com/jprichardson/node-fs-extra/issues/223 "Suspicious behavior of fs.existsSync" +[#222]: https://github.com/jprichardson/node-fs-extra/pull/222 "A clearer description of emtpyDir function" +[#221]: https://github.com/jprichardson/node-fs-extra/pull/221 "Update README.md" +[#220]: https://github.com/jprichardson/node-fs-extra/pull/220 "Non-breaking feature: add option 'passStats' to copy methods." +[#219]: https://github.com/jprichardson/node-fs-extra/pull/219 "Add closing parenthesis in copySync example" +[#218]: https://github.com/jprichardson/node-fs-extra/pull/218 "fix #187 #70 options.filter bug" +[#217]: https://github.com/jprichardson/node-fs-extra/pull/217 "fix #187 #70 options.filter bug" +[#216]: https://github.com/jprichardson/node-fs-extra/pull/216 "fix #187 #70 options.filter bug" +[#215]: https://github.com/jprichardson/node-fs-extra/pull/215 "fse.copy throws error when only src and dest provided [bug, documentation, feature-copy]" +[#214]: https://github.com/jprichardson/node-fs-extra/pull/214 "Fixing copySync anchor tag" +[#213]: https://github.com/jprichardson/node-fs-extra/issues/213 "Merge extfs with this repo" +[#212]: https://github.com/jprichardson/node-fs-extra/pull/212 "Update year to 2016 in README.md and LICENSE" +[#211]: https://github.com/jprichardson/node-fs-extra/issues/211 "Not copying all files" +[#210]: https://github.com/jprichardson/node-fs-extra/issues/210 "copy/copySync behave differently when copying a symbolic file [bug, documentation, feature-copy]" +[#209]: https://github.com/jprichardson/node-fs-extra/issues/209 "In Windows invalid directory name causes infinite loop in ensureDir(). [bug]" +[#208]: https://github.com/jprichardson/node-fs-extra/pull/208 "fix options.preserveTimestamps to false in copy-sync by default [feature-copy]" +[#207]: https://github.com/jprichardson/node-fs-extra/issues/207 "Add `compare` suite of functions" +[#206]: https://github.com/jprichardson/node-fs-extra/issues/206 "outputFileSync" +[#205]: https://github.com/jprichardson/node-fs-extra/issues/205 "fix documents about copy/copySync [documentation, feature-copy]" +[#204]: https://github.com/jprichardson/node-fs-extra/pull/204 "allow copy of block and character device files" +[#203]: https://github.com/jprichardson/node-fs-extra/issues/203 "copy method's argument options couldn't be undefined [bug, feature-copy]" +[#202]: https://github.com/jprichardson/node-fs-extra/issues/202 "why there is not a walkSync method?" +[#201]: https://github.com/jprichardson/node-fs-extra/issues/201 "clobber for directories [feature-copy, future]" +[#200]: https://github.com/jprichardson/node-fs-extra/issues/200 "'copySync' doesn't work in sync" +[#199]: https://github.com/jprichardson/node-fs-extra/issues/199 "fs.copySync fails if user does not own file [bug, feature-copy]" +[#198]: https://github.com/jprichardson/node-fs-extra/issues/198 "handle copying between identical files [feature-copy]" +[#197]: https://github.com/jprichardson/node-fs-extra/issues/197 "Missing documentation for `outputFile` `options` 3rd parameter [documentation]" +[#196]: https://github.com/jprichardson/node-fs-extra/issues/196 "copy filter: async function and/or function called with `fs.stat` result [future]" +[#195]: https://github.com/jprichardson/node-fs-extra/issues/195 "How to override with outputFile?" +[#194]: https://github.com/jprichardson/node-fs-extra/pull/194 "allow ensureFile(Sync) to provide data to be written to created file" +[#193]: https://github.com/jprichardson/node-fs-extra/issues/193 "`fs.copy` fails silently if source file is /dev/null [bug, feature-copy]" +[#192]: https://github.com/jprichardson/node-fs-extra/issues/192 "Remove fs.createOutputStream()" +[#191]: https://github.com/jprichardson/node-fs-extra/issues/191 "How to copy symlinks to target as normal folders [feature-copy]" +[#190]: https://github.com/jprichardson/node-fs-extra/pull/190 "copySync to overwrite destination file if readonly and clobber true" +[#189]: https://github.com/jprichardson/node-fs-extra/pull/189 "move.test fix to support CRLF on Windows" +[#188]: https://github.com/jprichardson/node-fs-extra/issues/188 "move.test failing on windows platform" +[#187]: https://github.com/jprichardson/node-fs-extra/issues/187 "Not filter each file, stops on first false [feature-copy]" +[#186]: https://github.com/jprichardson/node-fs-extra/issues/186 "Do you need a .size() function in this module? [future]" +[#185]: https://github.com/jprichardson/node-fs-extra/issues/185 "Doesn't work on NodeJS v4.x" +[#184]: https://github.com/jprichardson/node-fs-extra/issues/184 "CLI equivalent for fs-extra" +[#183]: https://github.com/jprichardson/node-fs-extra/issues/183 "with clobber true, copy and copySync behave differently if destination file is read only [bug, feature-copy]" +[#182]: https://github.com/jprichardson/node-fs-extra/issues/182 "ensureDir(dir, callback) second callback parameter not specified" +[#181]: https://github.com/jprichardson/node-fs-extra/issues/181 "Add ability to remove file securely [enhancement, wont-fix]" +[#180]: https://github.com/jprichardson/node-fs-extra/issues/180 "Filter option doesn't work the same way in copy and copySync [bug, feature-copy]" +[#179]: https://github.com/jprichardson/node-fs-extra/issues/179 "Include opendir" +[#178]: https://github.com/jprichardson/node-fs-extra/issues/178 "ENOTEMPTY is thrown on removeSync " +[#177]: https://github.com/jprichardson/node-fs-extra/issues/177 "fix `remove()` wildcards (introduced by rimraf) [feature-remove]" +[#176]: https://github.com/jprichardson/node-fs-extra/issues/176 "createOutputStream doesn't emit 'end' event" +[#175]: https://github.com/jprichardson/node-fs-extra/issues/175 "[Feature Request].moveSync support [feature-move, future]" +[#174]: https://github.com/jprichardson/node-fs-extra/pull/174 "Fix copy formatting and document options.filter" +[#173]: https://github.com/jprichardson/node-fs-extra/issues/173 "Feature Request: writeJson should mkdirs" +[#172]: https://github.com/jprichardson/node-fs-extra/issues/172 "rename `clobber` flags to `overwrite`" +[#171]: https://github.com/jprichardson/node-fs-extra/issues/171 "remove unnecessary aliases" +[#170]: https://github.com/jprichardson/node-fs-extra/pull/170 "More robust handling of errors moving across virtual drives" +[#169]: https://github.com/jprichardson/node-fs-extra/pull/169 "suppress ensureLink & ensureSymlink dest exists error" +[#168]: https://github.com/jprichardson/node-fs-extra/pull/168 "suppress ensurelink dest exists error" +[#167]: https://github.com/jprichardson/node-fs-extra/pull/167 "Adds basic (string, buffer) support for ensureFile content [future]" +[#166]: https://github.com/jprichardson/node-fs-extra/pull/166 "Adds basic (string, buffer) support for ensureFile content" +[#165]: https://github.com/jprichardson/node-fs-extra/pull/165 "ensure for link & symlink" +[#164]: https://github.com/jprichardson/node-fs-extra/issues/164 "Feature Request: ensureFile to take optional argument for file content" +[#163]: https://github.com/jprichardson/node-fs-extra/issues/163 "ouputJson not formatted out of the box [bug]" +[#162]: https://github.com/jprichardson/node-fs-extra/pull/162 "ensure symlink & link" +[#161]: https://github.com/jprichardson/node-fs-extra/pull/161 "ensure symlink & link" +[#160]: https://github.com/jprichardson/node-fs-extra/pull/160 "ensure symlink & link" +[#159]: https://github.com/jprichardson/node-fs-extra/pull/159 "ensure symlink & link" +[#158]: https://github.com/jprichardson/node-fs-extra/issues/158 "Feature Request: ensureLink and ensureSymlink methods" +[#157]: https://github.com/jprichardson/node-fs-extra/issues/157 "writeJson isn't formatted" +[#156]: https://github.com/jprichardson/node-fs-extra/issues/156 "Promise.promisifyAll doesn't work for some methods" +[#155]: https://github.com/jprichardson/node-fs-extra/issues/155 "Readme" +[#154]: https://github.com/jprichardson/node-fs-extra/issues/154 "/tmp/millis-test-sync" +[#153]: https://github.com/jprichardson/node-fs-extra/pull/153 "Make preserveTimes also work on read-only files. Closes #152" +[#152]: https://github.com/jprichardson/node-fs-extra/issues/152 "fs.copy fails for read-only files with preserveTimestamp=true [feature-copy]" +[#151]: https://github.com/jprichardson/node-fs-extra/issues/151 "TOC does not work correctly on npm [documentation]" +[#150]: https://github.com/jprichardson/node-fs-extra/issues/150 "Remove test file fixtures, create with code." +[#149]: https://github.com/jprichardson/node-fs-extra/issues/149 "/tmp/millis-test-sync" +[#148]: https://github.com/jprichardson/node-fs-extra/issues/148 "split out `Sync` methods in documentation" +[#147]: https://github.com/jprichardson/node-fs-extra/issues/147 "Adding rmdirIfEmpty" +[#146]: https://github.com/jprichardson/node-fs-extra/pull/146 "ensure test.js works" +[#145]: https://github.com/jprichardson/node-fs-extra/issues/145 "Add `fs.exists` and `fs.existsSync` if it doesn't exist." +[#144]: https://github.com/jprichardson/node-fs-extra/issues/144 "tests failing" +[#143]: https://github.com/jprichardson/node-fs-extra/issues/143 "update graceful-fs" +[#142]: https://github.com/jprichardson/node-fs-extra/issues/142 "PrependFile Feature" +[#141]: https://github.com/jprichardson/node-fs-extra/pull/141 "Add option to preserve timestamps" +[#140]: https://github.com/jprichardson/node-fs-extra/issues/140 "Json file reading fails with 'utf8'" +[#139]: https://github.com/jprichardson/node-fs-extra/pull/139 "Preserve file timestamp on copy. Closes #138" +[#138]: https://github.com/jprichardson/node-fs-extra/issues/138 "Preserve timestamps on copying files" +[#137]: https://github.com/jprichardson/node-fs-extra/issues/137 "outputFile/outputJson: Unexpected end of input" +[#136]: https://github.com/jprichardson/node-fs-extra/pull/136 "Update license attribute" +[#135]: https://github.com/jprichardson/node-fs-extra/issues/135 "emptyDir throws Error if no callback is provided" +[#134]: https://github.com/jprichardson/node-fs-extra/pull/134 "Handle EEXIST error when clobbering dir" +[#133]: https://github.com/jprichardson/node-fs-extra/pull/133 "Travis runs with `sudo: false`" +[#132]: https://github.com/jprichardson/node-fs-extra/pull/132 "isDirectory method" +[#131]: https://github.com/jprichardson/node-fs-extra/issues/131 "copySync is not working iojs 1.8.4 on linux [feature-copy]" +[#130]: https://github.com/jprichardson/node-fs-extra/pull/130 "Please review additional features." +[#129]: https://github.com/jprichardson/node-fs-extra/pull/129 "can you review this feature?" +[#128]: https://github.com/jprichardson/node-fs-extra/issues/128 "fsExtra.move(filepath, newPath) broken;" +[#127]: https://github.com/jprichardson/node-fs-extra/issues/127 "consider using fs.access to remove deprecated warnings for fs.exists" +[#126]: https://github.com/jprichardson/node-fs-extra/issues/126 " TypeError: Object # has no method 'access'" +[#125]: https://github.com/jprichardson/node-fs-extra/issues/125 "Question: What do the *Sync function do different from non-sync" +[#124]: https://github.com/jprichardson/node-fs-extra/issues/124 "move with clobber option 'ENOTEMPTY'" +[#123]: https://github.com/jprichardson/node-fs-extra/issues/123 "Only copy the content of a directory" +[#122]: https://github.com/jprichardson/node-fs-extra/pull/122 "Update section links in README to match current section ids." +[#121]: https://github.com/jprichardson/node-fs-extra/issues/121 "emptyDir is undefined" +[#120]: https://github.com/jprichardson/node-fs-extra/issues/120 "usage bug caused by shallow cloning methods of 'graceful-fs'" +[#119]: https://github.com/jprichardson/node-fs-extra/issues/119 "mkdirs and ensureDir never invoke callback and consume CPU indefinitely if provided a path with invalid characters on Windows" +[#118]: https://github.com/jprichardson/node-fs-extra/pull/118 "createOutputStream" +[#117]: https://github.com/jprichardson/node-fs-extra/pull/117 "Fixed issue with slash separated paths on windows" +[#116]: https://github.com/jprichardson/node-fs-extra/issues/116 "copySync can only copy directories not files [documentation, feature-copy]" +[#115]: https://github.com/jprichardson/node-fs-extra/issues/115 ".Copy & .CopySync [feature-copy]" +[#114]: https://github.com/jprichardson/node-fs-extra/issues/114 "Fails to move (rename) directory to non-empty directory even with clobber: true" +[#113]: https://github.com/jprichardson/node-fs-extra/issues/113 "fs.copy seems to callback early if the destination file already exists" +[#112]: https://github.com/jprichardson/node-fs-extra/pull/112 "Copying a file into an existing directory" +[#111]: https://github.com/jprichardson/node-fs-extra/pull/111 "Moving a file into an existing directory " +[#110]: https://github.com/jprichardson/node-fs-extra/pull/110 "Moving a file into an existing directory" +[#109]: https://github.com/jprichardson/node-fs-extra/issues/109 "fs.move across windows drives fails" +[#108]: https://github.com/jprichardson/node-fs-extra/issues/108 "fse.move directories across multiple devices doesn't work" +[#107]: https://github.com/jprichardson/node-fs-extra/pull/107 "Check if dest path is an existing dir and copy or move source in it" +[#106]: https://github.com/jprichardson/node-fs-extra/issues/106 "fse.copySync crashes while copying across devices D: [feature-copy]" +[#105]: https://github.com/jprichardson/node-fs-extra/issues/105 "fs.copy hangs on iojs" +[#104]: https://github.com/jprichardson/node-fs-extra/issues/104 "fse.move deletes folders [bug]" +[#103]: https://github.com/jprichardson/node-fs-extra/issues/103 "Error: EMFILE with copy" +[#102]: https://github.com/jprichardson/node-fs-extra/issues/102 "touch / touchSync was removed ?" +[#101]: https://github.com/jprichardson/node-fs-extra/issues/101 "fs-extra promisified" +[#100]: https://github.com/jprichardson/node-fs-extra/pull/100 "copy: options object or filter to pass to ncp" +[#99]: https://github.com/jprichardson/node-fs-extra/issues/99 "ensureDir() modes [future]" +[#98]: https://github.com/jprichardson/node-fs-extra/issues/98 "fs.copy() incorrect async behavior [bug]" +[#97]: https://github.com/jprichardson/node-fs-extra/pull/97 "use path.join; fix copySync bug" +[#96]: https://github.com/jprichardson/node-fs-extra/issues/96 "destFolderExists in copySync is always undefined." +[#95]: https://github.com/jprichardson/node-fs-extra/pull/95 "Using graceful-ncp instead of ncp" +[#94]: https://github.com/jprichardson/node-fs-extra/issues/94 "Error: EEXIST, file already exists '../mkdirp/bin/cmd.js' on fs.copySync() [enhancement, feature-copy]" +[#93]: https://github.com/jprichardson/node-fs-extra/issues/93 "Confusing error if drive not mounted [enhancement]" +[#92]: https://github.com/jprichardson/node-fs-extra/issues/92 "Problems with Bluebird" +[#91]: https://github.com/jprichardson/node-fs-extra/issues/91 "fs.copySync('/test', '/haha') is different with 'cp -r /test /haha' [enhancement]" +[#90]: https://github.com/jprichardson/node-fs-extra/issues/90 "Folder creation and file copy is Happening in 64 bit machine but not in 32 bit machine" +[#89]: https://github.com/jprichardson/node-fs-extra/issues/89 "Error: EEXIST using fs-extra's fs.copy to copy a directory on Windows" +[#88]: https://github.com/jprichardson/node-fs-extra/issues/88 "Stacking those libraries" +[#87]: https://github.com/jprichardson/node-fs-extra/issues/87 "createWriteStream + outputFile = ?" +[#86]: https://github.com/jprichardson/node-fs-extra/issues/86 "no moveSync?" +[#85]: https://github.com/jprichardson/node-fs-extra/pull/85 "Copy symlinks in copySync" +[#84]: https://github.com/jprichardson/node-fs-extra/issues/84 "Push latest version to npm ?" +[#83]: https://github.com/jprichardson/node-fs-extra/issues/83 "Prevent copying a directory into itself [feature-copy]" +[#82]: https://github.com/jprichardson/node-fs-extra/pull/82 "README updates for move" +[#81]: https://github.com/jprichardson/node-fs-extra/issues/81 "fd leak after fs.move" +[#80]: https://github.com/jprichardson/node-fs-extra/pull/80 "Preserve file mode in copySync" +[#79]: https://github.com/jprichardson/node-fs-extra/issues/79 "fs.copy only .html file empty" +[#78]: https://github.com/jprichardson/node-fs-extra/pull/78 "copySync was not applying filters to directories" +[#77]: https://github.com/jprichardson/node-fs-extra/issues/77 "Create README reference to bluebird" +[#76]: https://github.com/jprichardson/node-fs-extra/issues/76 "Create README reference to typescript" +[#75]: https://github.com/jprichardson/node-fs-extra/issues/75 "add glob as a dep? [question]" +[#74]: https://github.com/jprichardson/node-fs-extra/pull/74 "including new emptydir module" +[#73]: https://github.com/jprichardson/node-fs-extra/pull/73 "add dependency status in readme" +[#72]: https://github.com/jprichardson/node-fs-extra/pull/72 "Use svg instead of png to get better image quality" +[#71]: https://github.com/jprichardson/node-fs-extra/issues/71 "fse.copy not working on Windows 7 x64 OS, but, copySync does work" +[#70]: https://github.com/jprichardson/node-fs-extra/issues/70 "Not filter each file, stops on first false [bug]" +[#69]: https://github.com/jprichardson/node-fs-extra/issues/69 "How to check if folder exist and read the folder name" +[#68]: https://github.com/jprichardson/node-fs-extra/issues/68 "consider flag to readJsonSync (throw false) [enhancement]" +[#67]: https://github.com/jprichardson/node-fs-extra/issues/67 "docs for readJson incorrectly states that is accepts options" +[#66]: https://github.com/jprichardson/node-fs-extra/issues/66 "ENAMETOOLONG" +[#65]: https://github.com/jprichardson/node-fs-extra/issues/65 "exclude filter in fs.copy" +[#64]: https://github.com/jprichardson/node-fs-extra/issues/64 "Announce: mfs - monitor your fs-extra calls" +[#63]: https://github.com/jprichardson/node-fs-extra/issues/63 "Walk" +[#62]: https://github.com/jprichardson/node-fs-extra/issues/62 "npm install fs-extra doesn't work" +[#61]: https://github.com/jprichardson/node-fs-extra/issues/61 "No longer supports node 0.8 due to use of `^` in package.json dependencies" +[#60]: https://github.com/jprichardson/node-fs-extra/issues/60 "chmod & chown for mkdirs" +[#59]: https://github.com/jprichardson/node-fs-extra/issues/59 "Consider including mkdirp and making fs-extra '--use_strict' safe [question]" +[#58]: https://github.com/jprichardson/node-fs-extra/issues/58 "Stack trace not included in fs.copy error" +[#57]: https://github.com/jprichardson/node-fs-extra/issues/57 "Possible to include wildcards in delete?" +[#56]: https://github.com/jprichardson/node-fs-extra/issues/56 "Crash when have no access to write to destination file in copy " +[#55]: https://github.com/jprichardson/node-fs-extra/issues/55 "Is it possible to have any console output similar to Grunt copy module?" +[#54]: https://github.com/jprichardson/node-fs-extra/issues/54 "`copy` does not preserve file ownership and permissons" +[#53]: https://github.com/jprichardson/node-fs-extra/issues/53 "outputFile() - ability to write data in appending mode" +[#52]: https://github.com/jprichardson/node-fs-extra/pull/52 "This fixes (what I think) is a bug in copySync" +[#51]: https://github.com/jprichardson/node-fs-extra/pull/51 "Add a Bitdeli Badge to README" +[#50]: https://github.com/jprichardson/node-fs-extra/issues/50 "Replace mechanism in createFile" +[#49]: https://github.com/jprichardson/node-fs-extra/pull/49 "update rimraf to v2.2.6" +[#48]: https://github.com/jprichardson/node-fs-extra/issues/48 "fs.copy issue [bug]" +[#47]: https://github.com/jprichardson/node-fs-extra/issues/47 "Bug in copy - callback called on readStream 'close' - Fixed in ncp 0.5.0" +[#46]: https://github.com/jprichardson/node-fs-extra/pull/46 "update copyright year" +[#45]: https://github.com/jprichardson/node-fs-extra/pull/45 "Added note about fse.outputFile() being the one that overwrites" +[#44]: https://github.com/jprichardson/node-fs-extra/pull/44 "Proposal: Stream support" +[#43]: https://github.com/jprichardson/node-fs-extra/issues/43 "Better error reporting " +[#42]: https://github.com/jprichardson/node-fs-extra/issues/42 "Performance issue?" +[#41]: https://github.com/jprichardson/node-fs-extra/pull/41 "There does seem to be a synchronous version now" +[#40]: https://github.com/jprichardson/node-fs-extra/issues/40 "fs.copy throw unexplained error ENOENT, utime " +[#39]: https://github.com/jprichardson/node-fs-extra/pull/39 "Added regression test for copy() return callback on error" +[#38]: https://github.com/jprichardson/node-fs-extra/pull/38 "Return err in copy() fstat cb, because stat could be undefined or null" +[#37]: https://github.com/jprichardson/node-fs-extra/issues/37 "Maybe include a line reader? [enhancement, question]" +[#36]: https://github.com/jprichardson/node-fs-extra/pull/36 "`filter` parameter `fs.copy` and `fs.copySync`" +[#35]: https://github.com/jprichardson/node-fs-extra/pull/35 "`filter` parameter `fs.copy` and `fs.copySync` " +[#34]: https://github.com/jprichardson/node-fs-extra/issues/34 "update docs to include options for JSON methods [enhancement]" +[#33]: https://github.com/jprichardson/node-fs-extra/pull/33 "fs_extra.copySync" +[#32]: https://github.com/jprichardson/node-fs-extra/issues/32 "update to latest jsonfile [enhancement]" +[#31]: https://github.com/jprichardson/node-fs-extra/issues/31 "Add ensure methods [enhancement]" +[#30]: https://github.com/jprichardson/node-fs-extra/issues/30 "update package.json optional dep `graceful-fs`" +[#29]: https://github.com/jprichardson/node-fs-extra/issues/29 "Copy failing if dest directory doesn't exist. Is this intended?" +[#28]: https://github.com/jprichardson/node-fs-extra/issues/28 "homepage field must be a string url. Deleted." +[#27]: https://github.com/jprichardson/node-fs-extra/issues/27 "Update Readme" +[#26]: https://github.com/jprichardson/node-fs-extra/issues/26 "Add readdir recursive method. [enhancement]" +[#25]: https://github.com/jprichardson/node-fs-extra/pull/25 "adding an `.npmignore` file" +[#24]: https://github.com/jprichardson/node-fs-extra/issues/24 "[bug] cannot run in strict mode [bug]" +[#23]: https://github.com/jprichardson/node-fs-extra/issues/23 "`writeJSON()` should create parent directories" +[#22]: https://github.com/jprichardson/node-fs-extra/pull/22 "Add a limit option to mkdirs()" +[#21]: https://github.com/jprichardson/node-fs-extra/issues/21 "touch() in 0.10.0" +[#20]: https://github.com/jprichardson/node-fs-extra/issues/20 "fs.remove yields callback before directory is really deleted" +[#19]: https://github.com/jprichardson/node-fs-extra/issues/19 "fs.copy err is empty array" +[#18]: https://github.com/jprichardson/node-fs-extra/pull/18 "Exposed copyFile Function" +[#17]: https://github.com/jprichardson/node-fs-extra/issues/17 "Use `require('graceful-fs')` if found instead of `require('fs')`" +[#16]: https://github.com/jprichardson/node-fs-extra/pull/16 "Update README.md" +[#15]: https://github.com/jprichardson/node-fs-extra/issues/15 "Implement cp -r but sync aka copySync. [enhancement]" +[#14]: https://github.com/jprichardson/node-fs-extra/issues/14 "fs.mkdirSync is broken in 0.3.1" +[#13]: https://github.com/jprichardson/node-fs-extra/issues/13 "Thoughts on including a directory tree / file watcher? [enhancement, question]" +[#12]: https://github.com/jprichardson/node-fs-extra/issues/12 "copyFile & copyFileSync are global" +[#11]: https://github.com/jprichardson/node-fs-extra/issues/11 "Thoughts on including a file walker? [enhancement, question]" +[#10]: https://github.com/jprichardson/node-fs-extra/issues/10 "move / moveFile API [enhancement]" +[#9]: https://github.com/jprichardson/node-fs-extra/issues/9 "don't import normal fs stuff into fs-extra" +[#8]: https://github.com/jprichardson/node-fs-extra/pull/8 "Update rimraf to latest version" +[#6]: https://github.com/jprichardson/node-fs-extra/issues/6 "Remove CoffeeScript development dependency" +[#5]: https://github.com/jprichardson/node-fs-extra/issues/5 "comments on naming" +[#4]: https://github.com/jprichardson/node-fs-extra/issues/4 "version bump to 0.2" +[#3]: https://github.com/jprichardson/node-fs-extra/pull/3 "Hi! I fixed some code for you!" +[#2]: https://github.com/jprichardson/node-fs-extra/issues/2 "Merge with fs.extra and mkdirp" +[#1]: https://github.com/jprichardson/node-fs-extra/issues/1 "file-extra npm !exist" diff --git a/live2d/node_modules/fs-extra/LICENSE b/live2d/node_modules/fs-extra/LICENSE new file mode 100644 index 0000000..93546df --- /dev/null +++ b/live2d/node_modules/fs-extra/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2017 JP Richardson + +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. diff --git a/live2d/node_modules/fs-extra/README.md b/live2d/node_modules/fs-extra/README.md new file mode 100644 index 0000000..070a5e7 --- /dev/null +++ b/live2d/node_modules/fs-extra/README.md @@ -0,0 +1,261 @@ +Node.js: fs-extra +================= + +`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`. + +[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![License](https://img.shields.io/npm/l/express.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE) +[![build status](https://img.shields.io/travis/jprichardson/node-fs-extra/master.svg)](http://travis-ci.org/jprichardson/node-fs-extra) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-fs-extra/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-fs-extra/branch/master) +[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![Coverage Status](https://img.shields.io/coveralls/github/jprichardson/node-fs-extra/master.svg)](https://coveralls.io/github/jprichardson/node-fs-extra) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) + +Why? +---- + +I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects. + + + + +Installation +------------ + + npm install fs-extra + + + +Usage +----- + +`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed. + +You don't ever need to include the original `fs` module again: + +```js +const fs = require('fs') // this is no longer necessary +``` + +you can now do this: + +```js +const fs = require('fs-extra') +``` + +or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want +to name your `fs` variable `fse` like so: + +```js +const fse = require('fs-extra') +``` + +you can also keep both, but it's redundant: + +```js +const fs = require('fs') +const fse = require('fs-extra') +``` + +Sync vs Async vs Async/Await +------------- +Most methods are async by default. All async methods will return a promise if the callback isn't passed. + +Sync methods on the other hand will throw if an error occurs. + +Also Async/Await will throw an error if one occurs. + +Example: + +```js +const fs = require('fs-extra') + +// Async with promises: +fs.copy('/tmp/myfile', '/tmp/mynewfile') + .then(() => console.log('success!')) + .catch(err => console.error(err)) + +// Async with callbacks: +fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { + if (err) return console.error(err) + console.log('success!') +}) + +// Sync: +try { + fs.copySync('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') +} catch (err) { + console.error(err) +} + +// Async/Await: +async function copyFiles () { + try { + await fs.copy('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') + } catch (err) { + console.error(err) + } +} + +copyFiles() +``` + + +Methods +------- + +### Async + +- [copy](docs/copy.md) +- [emptyDir](docs/emptyDir.md) +- [ensureFile](docs/ensureFile.md) +- [ensureDir](docs/ensureDir.md) +- [ensureLink](docs/ensureLink.md) +- [ensureSymlink](docs/ensureSymlink.md) +- [mkdirp](docs/ensureDir.md) +- [mkdirs](docs/ensureDir.md) +- [move](docs/move.md) +- [outputFile](docs/outputFile.md) +- [outputJson](docs/outputJson.md) +- [pathExists](docs/pathExists.md) +- [readJson](docs/readJson.md) +- [remove](docs/remove.md) +- [writeJson](docs/writeJson.md) + +### Sync + +- [copySync](docs/copy-sync.md) +- [emptyDirSync](docs/emptyDir-sync.md) +- [ensureFileSync](docs/ensureFile-sync.md) +- [ensureDirSync](docs/ensureDir-sync.md) +- [ensureLinkSync](docs/ensureLink-sync.md) +- [ensureSymlinkSync](docs/ensureSymlink-sync.md) +- [mkdirpSync](docs/ensureDir-sync.md) +- [mkdirsSync](docs/ensureDir-sync.md) +- [moveSync](docs/move-sync.md) +- [outputFileSync](docs/outputFile-sync.md) +- [outputJsonSync](docs/outputJson-sync.md) +- [pathExistsSync](docs/pathExists-sync.md) +- [readJsonSync](docs/readJson-sync.md) +- [removeSync](docs/remove-sync.md) +- [writeJsonSync](docs/writeJson-sync.md) + + +**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()` & `fs.write()`](docs/fs-read-write.md) + +### What happened to `walk()` and `walkSync()`? + +They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync). + + +Third Party +----------- + + +### TypeScript + +If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra + + +### File / Directory Watching + +If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar). + +### Obtain Filesystem (Devices, Partitions) Information + +[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system. + +### Misc. + +- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug). +- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls. + + + +Hacking on fs-extra +------------------- + +Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project +uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you, +you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +What's needed? +- First, take a look at existing issues. Those are probably going to be where the priority lies. +- More tests for edge cases. Specifically on different platforms. There can never be enough tests. +- Improve test coverage. See coveralls output for more info. + +Note: If you make any big changes, **you should definitely file an issue for discussion first.** + +### Running the Test Suite + +fs-extra contains hundreds of tests. + +- `npm run lint`: runs the linter ([standard](http://standardjs.com/)) +- `npm run unit`: runs the unit tests +- `npm test`: runs both the linter and the tests + + +### Windows + +If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's +because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's +account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 +However, I didn't have much luck doing this. + +Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows. +I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command: + + net use z: "\\vmware-host\Shared Folders" + +I can then navigate to my `fs-extra` directory and run the tests. + + +Naming +------ + +I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here: + +* https://github.com/jprichardson/node-fs-extra/issues/2 +* https://github.com/flatiron/utile/issues/11 +* https://github.com/ryanmcgrath/wrench-js/issues/29 +* https://github.com/substack/node-mkdirp/issues/17 + +First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes. + +For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc. + +We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`? + +My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too. + +So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`. + + +Credit +------ + +`fs-extra` wouldn't be possible without using the modules from the following authors: + +- [Isaac Shlueter](https://github.com/isaacs) +- [Charlie McConnel](https://github.com/avianflu) +- [James Halliday](https://github.com/substack) +- [Andrew Kelley](https://github.com/andrewrk) + + + + +License +------- + +Licensed under MIT + +Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson) + +[1]: http://nodejs.org/docs/latest/api/fs.html + + +[jsonfile]: https://github.com/jprichardson/node-jsonfile diff --git a/live2d/node_modules/fs-extra/lib/copy-sync/copy-sync.js b/live2d/node_modules/fs-extra/lib/copy-sync/copy-sync.js new file mode 100644 index 0000000..f2831b3 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/copy-sync/copy-sync.js @@ -0,0 +1,164 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirpSync = require('../mkdirs').mkdirsSync +const utimesSync = require('../util/utimes.js').utimesMillisSync +const stat = require('../util/stat') + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy') + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} + +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirpSync(destParent) + return startCopy(destStat, src, dest, opts) +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + if (typeof fs.copyFileSync === 'function') { + fs.copyFileSync(src, dest) + fs.chmodSync(dest, srcStat.mode) + if (opts.preserveTimestamps) { + return utimesSync(dest, srcStat.atime, srcStat.mtime) + } + return + } + return copyFileFallback(srcStat, src, dest, opts) +} + +function copyFileFallback (srcStat, src, dest, opts) { + const BUF_LENGTH = 64 * 1024 + const _buff = require('../util/buffer')(BUF_LENGTH) + + const fdr = fs.openSync(src, 'r') + const fdw = fs.openSync(dest, 'w', srcStat.mode) + let pos = 0 + + while (pos < srcStat.size) { + const bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos) + fs.writeSync(fdw, _buff, 0, bytesRead) + pos += bytesRead + } + + if (opts.preserveTimestamps) fs.futimesSync(fdw, srcStat.atime, srcStat.mtime) + + fs.closeSync(fdr) + fs.closeSync(fdw) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts) + if (destStat && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcStat, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return fs.chmodSync(dest, srcStat.mode) +} + +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy') + return startCopy(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync diff --git a/live2d/node_modules/fs-extra/lib/copy-sync/index.js b/live2d/node_modules/fs-extra/lib/copy-sync/index.js new file mode 100644 index 0000000..65945ae --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/copy-sync/index.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = { + copySync: require('./copy-sync') +} diff --git a/live2d/node_modules/fs-extra/lib/copy/copy.js b/live2d/node_modules/fs-extra/lib/copy/copy.js new file mode 100644 index 0000000..411fc64 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/copy/copy.js @@ -0,0 +1,212 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirp = require('../mkdirs').mkdirs +const pathExists = require('../path-exists').pathExists +const utimes = require('../util/utimes').utimesMillis +const stat = require('../util/stat') + +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } + + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n + see https://github.com/jprichardson/node-fs-extra/issues/269`) + } + + stat.checkPaths(src, dest, 'copy', (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) +} + +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return startCopy(destStat, src, dest, opts, cb) + mkdirp(destParent, err => { + if (err) return cb(err) + return startCopy(destStat, src, dest, opts, cb) + }) + }) +} + +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} + +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} + +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + }) +} + +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} + +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} + +function copyFile (srcStat, src, dest, opts, cb) { + if (typeof fs.copyFile === 'function') { + return fs.copyFile(src, dest, err => { + if (err) return cb(err) + return setDestModeAndTimestamps(srcStat, dest, opts, cb) + }) + } + return copyFileFallback(srcStat, src, dest, opts, cb) +} + +function copyFileFallback (srcStat, src, dest, opts, cb) { + const rs = fs.createReadStream(src) + rs.on('error', err => cb(err)).once('open', () => { + const ws = fs.createWriteStream(dest, { mode: srcStat.mode }) + ws.on('error', err => cb(err)) + .on('open', () => rs.pipe(ws)) + .once('close', () => setDestModeAndTimestamps(srcStat, dest, opts, cb)) + }) +} + +function setDestModeAndTimestamps (srcStat, dest, opts, cb) { + fs.chmod(dest, srcStat.mode, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) { + return utimes(dest, srcStat.atime, srcStat.mtime, cb) + } + return cb() + }) +} + +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat, src, dest, opts, cb) + if (destStat && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + return copyDir(src, dest, opts, cb) +} + +function mkDirAndCopy (srcStat, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return fs.chmod(dest, srcStat.mode, cb) + }) + }) +} + +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} + +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} + +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} + +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} + +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} + +module.exports = copy diff --git a/live2d/node_modules/fs-extra/lib/copy/index.js b/live2d/node_modules/fs-extra/lib/copy/index.js new file mode 100644 index 0000000..b7e4f7f --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/copy/index.js @@ -0,0 +1,6 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + copy: u(require('./copy')) +} diff --git a/live2d/node_modules/fs-extra/lib/empty/index.js b/live2d/node_modules/fs-extra/lib/empty/index.js new file mode 100644 index 0000000..204d53b --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/empty/index.js @@ -0,0 +1,48 @@ +'use strict' + +const u = require('universalify').fromCallback +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const remove = require('../remove') + +const emptyDir = u(function emptyDir (dir, callback) { + callback = callback || function () {} + fs.readdir(dir, (err, items) => { + if (err) return mkdir.mkdirs(dir, callback) + + items = items.map(item => path.join(dir, item)) + + deleteItem() + + function deleteItem () { + const item = items.pop() + if (!item) return callback() + remove.remove(item, err => { + if (err) return callback(err) + deleteItem() + }) + } + }) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch (err) { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/file.js b/live2d/node_modules/fs-extra/lib/ensure/file.js new file mode 100644 index 0000000..67eed30 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/file.js @@ -0,0 +1,49 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } + + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeFile() + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + }) + }) +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch (e) {} + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/index.js b/live2d/node_modules/fs-extra/lib/ensure/index.js new file mode 100644 index 0000000..c1f67b7 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/index.js @@ -0,0 +1,23 @@ +'use strict' + +const file = require('./file') +const link = require('./link') +const symlink = require('./symlink') + +module.exports = { + // file + createFile: file.createFile, + createFileSync: file.createFileSync, + ensureFile: file.createFile, + ensureFileSync: file.createFileSync, + // link + createLink: link.createLink, + createLinkSync: link.createLinkSync, + ensureLink: link.createLink, + ensureLinkSync: link.createLinkSync, + // symlink + createSymlink: symlink.createSymlink, + createSymlinkSync: symlink.createSymlinkSync, + ensureSymlink: symlink.createSymlink, + ensureSymlinkSync: symlink.createSymlinkSync +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/link.js b/live2d/node_modules/fs-extra/lib/ensure/link.js new file mode 100644 index 0000000..2cd4196 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/link.js @@ -0,0 +1,61 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } + + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} + +function createLinkSync (srcpath, dstpath) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + try { + fs.lstatSync(srcpath) + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/symlink-paths.js b/live2d/node_modules/fs-extra/lib/ensure/symlink-paths.js new file mode 100644 index 0000000..24e7e1c --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/symlink-paths.js @@ -0,0 +1,99 @@ +'use strict' + +const path = require('path') +const fs = require('graceful-fs') +const pathExists = require('../path-exists').pathExists + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + 'toCwd': relativeToDst, + 'toDst': srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': srcpath + } + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + exists = fs.existsSync(relativeToDst) + if (exists) { + return { + 'toCwd': relativeToDst, + 'toDst': srcpath + } + } else { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('relative srcpath does not exist') + return { + 'toCwd': srcpath, + 'toDst': path.relative(dstdir, srcpath) + } + } + } +} + +module.exports = { + symlinkPaths, + symlinkPathsSync +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/symlink-type.js b/live2d/node_modules/fs-extra/lib/ensure/symlink-type.js new file mode 100644 index 0000000..4f8787c --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/symlink-type.js @@ -0,0 +1,31 @@ +'use strict' + +const fs = require('graceful-fs') + +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} + +function symlinkTypeSync (srcpath, type) { + let stats + + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch (e) { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +module.exports = { + symlinkType, + symlinkTypeSync +} diff --git a/live2d/node_modules/fs-extra/lib/ensure/symlink.js b/live2d/node_modules/fs-extra/lib/ensure/symlink.js new file mode 100644 index 0000000..fe68b79 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/ensure/symlink.js @@ -0,0 +1,63 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const _mkdirs = require('../mkdirs') +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync + +const _symlinkPaths = require('./symlink-paths') +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + +const _symlinkType = require('./symlink-type') +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync + +const pathExists = require('../path-exists').pathExists + +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + + pathExists(dstpath, (err, destinationExists) => { + if (err) return callback(err) + if (destinationExists) return callback(null) + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) + }) +} + +function createSymlinkSync (srcpath, dstpath, type) { + const destinationExists = fs.existsSync(dstpath) + if (destinationExists) return undefined + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} diff --git a/live2d/node_modules/fs-extra/lib/fs/index.js b/live2d/node_modules/fs-extra/lib/fs/index.js new file mode 100644 index 0000000..a7b2292 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/fs/index.js @@ -0,0 +1,109 @@ +'use strict' +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = require('universalify').fromCallback +const fs = require('graceful-fs') + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'lchmod', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.copyFile was added in Node.js v8.5.0 + // fs.mkdtemp was added in Node.js v5.10.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export all keys: +Object.keys(fs).forEach(key => { + if (key === 'promises') { + // fs.promises is a getter property that triggers ExperimentalWarning + // Don't re-export it here, the getter is defined in "lib/index.js" + return + } + exports[key] = fs[key] +}) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read() & fs.write need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// fs.realpath.native only available in Node v9.2+ +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} diff --git a/live2d/node_modules/fs-extra/lib/index.js b/live2d/node_modules/fs-extra/lib/index.js new file mode 100644 index 0000000..40e37b1 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/index.js @@ -0,0 +1,28 @@ +'use strict' + +module.exports = Object.assign( + {}, + // Export promiseified graceful-fs: + require('./fs'), + // Export extra methods: + require('./copy-sync'), + require('./copy'), + require('./empty'), + require('./ensure'), + require('./json'), + require('./mkdirs'), + require('./move-sync'), + require('./move'), + require('./output'), + require('./path-exists'), + require('./remove') +) + +// Export fs.promises as a getter property so that we don't trigger +// ExperimentalWarning before fs.promises is actually accessed. +const fs = require('fs') +if (Object.getOwnPropertyDescriptor(fs, 'promises')) { + Object.defineProperty(module.exports, 'promises', { + get () { return fs.promises } + }) +} diff --git a/live2d/node_modules/fs-extra/lib/json/index.js b/live2d/node_modules/fs-extra/lib/json/index.js new file mode 100644 index 0000000..bae68d4 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/json/index.js @@ -0,0 +1,16 @@ +'use strict' + +const u = require('universalify').fromCallback +const jsonFile = require('./jsonfile') + +jsonFile.outputJson = u(require('./output-json')) +jsonFile.outputJsonSync = require('./output-json-sync') +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile diff --git a/live2d/node_modules/fs-extra/lib/json/jsonfile.js b/live2d/node_modules/fs-extra/lib/json/jsonfile.js new file mode 100644 index 0000000..59cdb3e --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/json/jsonfile.js @@ -0,0 +1,12 @@ +'use strict' + +const u = require('universalify').fromCallback +const jsonFile = require('jsonfile') + +module.exports = { + // jsonfile exports + readJson: u(jsonFile.readFile), + readJsonSync: jsonFile.readFileSync, + writeJson: u(jsonFile.writeFile), + writeJsonSync: jsonFile.writeFileSync +} diff --git a/live2d/node_modules/fs-extra/lib/json/output-json-sync.js b/live2d/node_modules/fs-extra/lib/json/output-json-sync.js new file mode 100644 index 0000000..6f76710 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/json/output-json-sync.js @@ -0,0 +1,18 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const jsonFile = require('./jsonfile') + +function outputJsonSync (file, data, options) { + const dir = path.dirname(file) + + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir) + } + + jsonFile.writeJsonSync(file, data, options) +} + +module.exports = outputJsonSync diff --git a/live2d/node_modules/fs-extra/lib/json/output-json.js b/live2d/node_modules/fs-extra/lib/json/output-json.js new file mode 100644 index 0000000..d45edb8 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/json/output-json.js @@ -0,0 +1,27 @@ +'use strict' + +const path = require('path') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists +const jsonFile = require('./jsonfile') + +function outputJson (file, data, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } + + const dir = path.dirname(file) + + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return jsonFile.writeJson(file, data, options, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + jsonFile.writeJson(file, data, options, callback) + }) + }) +} + +module.exports = outputJson diff --git a/live2d/node_modules/fs-extra/lib/mkdirs/index.js b/live2d/node_modules/fs-extra/lib/mkdirs/index.js new file mode 100644 index 0000000..d6e7e5b --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/mkdirs/index.js @@ -0,0 +1,14 @@ +'use strict' +const u = require('universalify').fromCallback +const mkdirs = u(require('./mkdirs')) +const mkdirsSync = require('./mkdirs-sync') + +module.exports = { + mkdirs, + mkdirsSync, + // alias + mkdirp: mkdirs, + mkdirpSync: mkdirsSync, + ensureDir: mkdirs, + ensureDirSync: mkdirsSync +} diff --git a/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js b/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js new file mode 100644 index 0000000..a34acb9 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js @@ -0,0 +1,54 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const invalidWin32Path = require('./win32').invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirsSync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } + + let mode = opts.mode + const xfs = opts.fs || fs + + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + throw errInval + } + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + p = path.resolve(p) + + try { + xfs.mkdirSync(p, mode) + made = made || p + } catch (err0) { + if (err0.code === 'ENOENT') { + if (path.dirname(p) === p) throw err0 + made = mkdirsSync(path.dirname(p), opts, made) + mkdirsSync(p, opts, made) + } else { + // In the case of any other error, just see if there's a dir there + // already. If so, then hooray! If not, then something is borked. + let stat + try { + stat = xfs.statSync(p) + } catch (err1) { + throw err0 + } + if (!stat.isDirectory()) throw err0 + } + } + + return made +} + +module.exports = mkdirsSync diff --git a/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs.js b/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs.js new file mode 100644 index 0000000..1897533 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/mkdirs/mkdirs.js @@ -0,0 +1,63 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const invalidWin32Path = require('./win32').invalidWin32Path + +const o777 = parseInt('0777', 8) + +function mkdirs (p, opts, callback, made) { + if (typeof opts === 'function') { + callback = opts + opts = {} + } else if (!opts || typeof opts !== 'object') { + opts = { mode: opts } + } + + if (process.platform === 'win32' && invalidWin32Path(p)) { + const errInval = new Error(p + ' contains invalid WIN32 path characters.') + errInval.code = 'EINVAL' + return callback(errInval) + } + + let mode = opts.mode + const xfs = opts.fs || fs + + if (mode === undefined) { + mode = o777 & (~process.umask()) + } + if (!made) made = null + + callback = callback || function () {} + p = path.resolve(p) + + xfs.mkdir(p, mode, er => { + if (!er) { + made = made || p + return callback(null, made) + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return callback(er) + mkdirs(path.dirname(p), opts, (er, made) => { + if (er) callback(er, made) + else mkdirs(p, opts, callback, made) + }) + break + + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, (er2, stat) => { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) callback(er, made) + else callback(null, made) + }) + break + } + }) +} + +module.exports = mkdirs diff --git a/live2d/node_modules/fs-extra/lib/mkdirs/win32.js b/live2d/node_modules/fs-extra/lib/mkdirs/win32.js new file mode 100644 index 0000000..99b3920 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/mkdirs/win32.js @@ -0,0 +1,25 @@ +'use strict' + +const path = require('path') + +// get drive on windows +function getRootPath (p) { + p = path.normalize(path.resolve(p)).split(path.sep) + if (p.length > 0) return p[0] + return null +} + +// http://stackoverflow.com/a/62888/10333 contains more accurate +// TODO: expand to include the rest +const INVALID_PATH_CHARS = /[<>:"|?*]/ + +function invalidWin32Path (p) { + const rp = getRootPath(p) + p = p.replace(rp, '') + return INVALID_PATH_CHARS.test(p) +} + +module.exports = { + getRootPath, + invalidWin32Path +} diff --git a/live2d/node_modules/fs-extra/lib/move-sync/index.js b/live2d/node_modules/fs-extra/lib/move-sync/index.js new file mode 100644 index 0000000..af90b06 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/move-sync/index.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = { + moveSync: require('./move-sync') +} diff --git a/live2d/node_modules/fs-extra/lib/move-sync/move-sync.js b/live2d/node_modules/fs-extra/lib/move-sync/move-sync.js new file mode 100644 index 0000000..20f910c --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/move-sync/move-sync.js @@ -0,0 +1,47 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copySync = require('../copy-sync').copySync +const removeSync = require('../remove').removeSync +const mkdirpSync = require('../mkdirs').mkdirpSync +const stat = require('../util/stat') + +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat } = stat.checkPathsSync(src, dest, 'move') + stat.checkParentPathsSync(src, srcStat, dest, 'move') + mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite) +} + +function doRename (src, dest, overwrite) { + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} + +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} + +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} + +module.exports = moveSync diff --git a/live2d/node_modules/fs-extra/lib/move/index.js b/live2d/node_modules/fs-extra/lib/move/index.js new file mode 100644 index 0000000..3785345 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/move/index.js @@ -0,0 +1,6 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + move: u(require('./move')) +} diff --git a/live2d/node_modules/fs-extra/lib/move/move.js b/live2d/node_modules/fs-extra/lib/move/move.js new file mode 100644 index 0000000..fa3ea61 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/move/move.js @@ -0,0 +1,65 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copy = require('../copy').copy +const remove = require('../remove').remove +const mkdirp = require('../mkdirs').mkdirp +const pathExists = require('../path-exists').pathExists +const stat = require('../util/stat') + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + const overwrite = opts.overwrite || opts.clobber || false + + stat.checkPaths(src, dest, 'move', (err, stats) => { + if (err) return cb(err) + const { srcStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, cb) + }) + }) + }) +} + +function doRename (src, dest, overwrite, cb) { + if (overwrite) { + return remove(dest, err => { + if (err) return cb(err) + return rename(src, dest, overwrite, cb) + }) + } + pathExists(dest, (err, destExists) => { + if (err) return cb(err) + if (destExists) return cb(new Error('dest already exists.')) + return rename(src, dest, overwrite, cb) + }) +} + +function rename (src, dest, overwrite, cb) { + fs.rename(src, dest, err => { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} + +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} + +module.exports = move diff --git a/live2d/node_modules/fs-extra/lib/output/index.js b/live2d/node_modules/fs-extra/lib/output/index.js new file mode 100644 index 0000000..92297ca --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/output/index.js @@ -0,0 +1,40 @@ +'use strict' + +const u = require('universalify').fromCallback +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } + + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + + fs.writeFile(file, data, encoding, callback) + }) + }) +} + +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} + +module.exports = { + outputFile: u(outputFile), + outputFileSync +} diff --git a/live2d/node_modules/fs-extra/lib/path-exists/index.js b/live2d/node_modules/fs-extra/lib/path-exists/index.js new file mode 100644 index 0000000..ddd9bc7 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/path-exists/index.js @@ -0,0 +1,12 @@ +'use strict' +const u = require('universalify').fromPromise +const fs = require('../fs') + +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} + +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} diff --git a/live2d/node_modules/fs-extra/lib/remove/index.js b/live2d/node_modules/fs-extra/lib/remove/index.js new file mode 100644 index 0000000..cee5340 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/remove/index.js @@ -0,0 +1,9 @@ +'use strict' + +const u = require('universalify').fromCallback +const rimraf = require('./rimraf') + +module.exports = { + remove: u(rimraf), + removeSync: rimraf.sync +} diff --git a/live2d/node_modules/fs-extra/lib/remove/rimraf.js b/live2d/node_modules/fs-extra/lib/remove/rimraf.js new file mode 100644 index 0000000..f287e4e --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/remove/rimraf.js @@ -0,0 +1,314 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const assert = require('assert') + +const isWindows = (process.platform === 'win32') + +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 +} + +function rimraf (p, options, cb) { + let busyTries = 0 + + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } + + // already gone + if (er.code === 'ENOENT') er = null + } + + cb(er) + }) +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } + + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } + + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) { + assert(er instanceof Error) + } + + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) +} + +function fixWinEPERMSync (p, options, er) { + let stats + + assert(p) + assert(options) + if (er) { + assert(er instanceof Error) + } + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } + + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } + + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) +} + +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) return cb(er) + + let n = files.length + let errState + + if (n === 0) return options.rmdir(p, cb) + + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st + + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } + + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) { + assert(originalEr instanceof Error) + } + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch (er) { } + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} + +module.exports = rimraf +rimraf.sync = rimrafSync diff --git a/live2d/node_modules/fs-extra/lib/util/buffer.js b/live2d/node_modules/fs-extra/lib/util/buffer.js new file mode 100644 index 0000000..dabf288 --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/util/buffer.js @@ -0,0 +1,12 @@ +'use strict' +/* eslint-disable node/no-deprecated-api */ +module.exports = function (size) { + if (typeof Buffer.allocUnsafe === 'function') { + try { + return Buffer.allocUnsafe(size) + } catch (e) { + return new Buffer(size) + } + } + return new Buffer(size) +} diff --git a/live2d/node_modules/fs-extra/lib/util/stat.js b/live2d/node_modules/fs-extra/lib/util/stat.js new file mode 100644 index 0000000..350cb9f --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/util/stat.js @@ -0,0 +1,172 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') + +const NODE_VERSION_MAJOR_WITH_BIGINT = 10 +const NODE_VERSION_MINOR_WITH_BIGINT = 5 +const NODE_VERSION_PATCH_WITH_BIGINT = 0 +const nodeVersion = process.versions.node.split('.') +const nodeVersionMajor = Number.parseInt(nodeVersion[0], 10) +const nodeVersionMinor = Number.parseInt(nodeVersion[1], 10) +const nodeVersionPatch = Number.parseInt(nodeVersion[2], 10) + +function nodeSupportsBigInt () { + if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) { + return true + } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) { + if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) { + return true + } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) { + if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) { + return true + } + } + } + return false +} + +function getStats (src, dest, cb) { + if (nodeSupportsBigInt()) { + fs.stat(src, { bigint: true }, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } else { + fs.stat(src, (err, srcStat) => { + if (err) return cb(err) + fs.stat(dest, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb(null, { srcStat, destStat: null }) + return cb(err) + } + return cb(null, { srcStat, destStat }) + }) + }) + } +} + +function getStatsSync (src, dest) { + let srcStat, destStat + if (nodeSupportsBigInt()) { + srcStat = fs.statSync(src, { bigint: true }) + } else { + srcStat = fs.statSync(src) + } + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(dest, { bigint: true }) + } else { + destStat = fs.statSync(dest) + } + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } +} + +function checkPaths (src, dest, funcName, cb) { + getStats(src, dest, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) + }) +} + +function checkPathsSync (src, dest, funcName) { + const { srcStat, destStat } = getStatsSync(src, dest) + if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} + +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +function checkParentPaths (src, srcStat, dest, funcName, cb) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() + if (nodeSupportsBigInt()) { + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } else { + fs.stat(destParent, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) + } +} + +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + if (nodeSupportsBigInt()) { + destStat = fs.statSync(destParent, { bigint: true }) + } else { + destStat = fs.statSync(destParent) + } + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} + +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} + +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} + +module.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir +} diff --git a/live2d/node_modules/fs-extra/lib/util/utimes.js b/live2d/node_modules/fs-extra/lib/util/utimes.js new file mode 100644 index 0000000..8916a1b --- /dev/null +++ b/live2d/node_modules/fs-extra/lib/util/utimes.js @@ -0,0 +1,79 @@ +'use strict' + +const fs = require('graceful-fs') +const os = require('os') +const path = require('path') + +// HFS, ext{2,3}, FAT do not, Node.js v0.10 does not +function hasMillisResSync () { + let tmpfile = path.join('millis-test-sync' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFileSync(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141') + const fd = fs.openSync(tmpfile, 'r+') + fs.futimesSync(fd, d, d) + fs.closeSync(fd) + return fs.statSync(tmpfile).mtime > 1435410243000 +} + +function hasMillisRes (callback) { + let tmpfile = path.join('millis-test' + Date.now().toString() + Math.random().toString().slice(2)) + tmpfile = path.join(os.tmpdir(), tmpfile) + + // 550 millis past UNIX epoch + const d = new Date(1435410243862) + fs.writeFile(tmpfile, 'https://github.com/jprichardson/node-fs-extra/pull/141', err => { + if (err) return callback(err) + fs.open(tmpfile, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, d, d, err => { + if (err) return callback(err) + fs.close(fd, err => { + if (err) return callback(err) + fs.stat(tmpfile, (err, stats) => { + if (err) return callback(err) + callback(null, stats.mtime > 1435410243000) + }) + }) + }) + }) + }) +} + +function timeRemoveMillis (timestamp) { + if (typeof timestamp === 'number') { + return Math.floor(timestamp / 1000) * 1000 + } else if (timestamp instanceof Date) { + return new Date(Math.floor(timestamp.getTime() / 1000) * 1000) + } else { + throw new Error('fs-extra: timeRemoveMillis() unknown parameter type') + } +} + +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + fs.open(path, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, atime, mtime, futimesErr => { + fs.close(fd, closeErr => { + if (callback) callback(futimesErr || closeErr) + }) + }) + }) +} + +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + hasMillisRes, + hasMillisResSync, + timeRemoveMillis, + utimesMillis, + utimesMillisSync +} diff --git a/live2d/node_modules/fs-extra/package.json b/live2d/node_modules/fs-extra/package.json new file mode 100644 index 0000000..559d88b --- /dev/null +++ b/live2d/node_modules/fs-extra/package.json @@ -0,0 +1,69 @@ +{ + "name": "fs-extra", + "version": "8.1.0", + "description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.", + "engines": { + "node": ">=6 <7 || >=8" + }, + "homepage": "https://github.com/jprichardson/node-fs-extra", + "repository": { + "type": "git", + "url": "https://github.com/jprichardson/node-fs-extra" + }, + "keywords": [ + "fs", + "file", + "file system", + "copy", + "directory", + "extra", + "mkdirp", + "mkdir", + "mkdirs", + "recursive", + "json", + "read", + "write", + "extra", + "delete", + "remove", + "touch", + "create", + "text", + "output", + "move" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "devDependencies": { + "coveralls": "^3.0.0", + "istanbul": "^0.4.5", + "klaw": "^2.1.1", + "klaw-sync": "^3.0.2", + "minimist": "^1.1.1", + "mocha": "^5.0.5", + "proxyquire": "^2.0.1", + "read-dir-files": "^0.1.1", + "semver": "^5.3.0", + "standard": "^12.0.1" + }, + "main": "./lib/index.js", + "files": [ + "lib/", + "!lib/**/__tests__/" + ], + "scripts": { + "full-ci": "npm run lint && npm run coverage", + "coverage": "istanbul cover -i 'lib/**' -x '**/__tests__/**' test.js", + "coveralls": "coveralls < coverage/lcov.info", + "lint": "standard", + "test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha", + "test": "npm run lint && npm run unit", + "unit": "node test.js" + } +} diff --git a/live2d/node_modules/fs.realpath/LICENSE b/live2d/node_modules/fs.realpath/LICENSE new file mode 100644 index 0000000..5bd884c --- /dev/null +++ b/live2d/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + Copyright Joyent, Inc. and other Node 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. diff --git a/live2d/node_modules/fs.realpath/README.md b/live2d/node_modules/fs.realpath/README.md new file mode 100644 index 0000000..a42ceac --- /dev/null +++ b/live2d/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/live2d/node_modules/fs.realpath/index.js b/live2d/node_modules/fs.realpath/index.js new file mode 100644 index 0000000..b09c7c7 --- /dev/null +++ b/live2d/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/live2d/node_modules/fs.realpath/old.js b/live2d/node_modules/fs.realpath/old.js new file mode 100644 index 0000000..b40305e --- /dev/null +++ b/live2d/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// Copyright Joyent, Inc. and other Node 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. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/live2d/node_modules/fs.realpath/package.json b/live2d/node_modules/fs.realpath/package.json new file mode 100644 index 0000000..3edc57d --- /dev/null +++ b/live2d/node_modules/fs.realpath/package.json @@ -0,0 +1,26 @@ +{ + "name": "fs.realpath", + "version": "1.0.0", + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "test": "tap test/*.js --cov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "files": [ + "old.js", + "index.js" + ] +} diff --git a/live2d/node_modules/function-bind/.eslintrc b/live2d/node_modules/function-bind/.eslintrc new file mode 100644 index 0000000..71a054f --- /dev/null +++ b/live2d/node_modules/function-bind/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "indent": [2, 4], + "no-new-func": [1], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + "strict": [0] + }, + }, + ], +} diff --git a/live2d/node_modules/function-bind/.github/FUNDING.yml b/live2d/node_modules/function-bind/.github/FUNDING.yml new file mode 100644 index 0000000..7448219 --- /dev/null +++ b/live2d/node_modules/function-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/function-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/function-bind/.github/SECURITY.md b/live2d/node_modules/function-bind/.github/SECURITY.md new file mode 100644 index 0000000..82e4285 --- /dev/null +++ b/live2d/node_modules/function-bind/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/live2d/node_modules/function-bind/.nycrc b/live2d/node_modules/function-bind/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/live2d/node_modules/function-bind/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/function-bind/CHANGELOG.md b/live2d/node_modules/function-bind/CHANGELOG.md new file mode 100644 index 0000000..f9e6cc0 --- /dev/null +++ b/live2d/node_modules/function-bind/CHANGELOG.md @@ -0,0 +1,136 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.2](https://github.com/ljharb/function-bind/compare/v1.1.1...v1.1.2) - 2023-10-12 + +### Merged + +- Point to the correct file [`#16`](https://github.com/ljharb/function-bind/pull/16) + +### Commits + +- [Tests] migrate tests to Github Actions [`4f8b57c`](https://github.com/ljharb/function-bind/commit/4f8b57c02f2011fe9ae353d5e74e8745f0988af8) +- [Tests] remove `jscs` [`90eb2ed`](https://github.com/ljharb/function-bind/commit/90eb2edbeefd5b76cd6c3a482ea3454db169b31f) +- [meta] update `.gitignore` [`53fcdc3`](https://github.com/ljharb/function-bind/commit/53fcdc371cd66634d6e9b71c836a50f437e89fed) +- [Tests] up to `node` `v11.10`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`; use `nvm install-latest-npm`; run audit script in tests [`1fe8f6e`](https://github.com/ljharb/function-bind/commit/1fe8f6e9aed0dfa8d8b3cdbd00c7f5ea0cd2b36e) +- [meta] add `auto-changelog` [`1921fcb`](https://github.com/ljharb/function-bind/commit/1921fcb5b416b63ffc4acad051b6aad5722f777d) +- [Robustness] remove runtime dependency on all builtins except `.apply` [`f743e61`](https://github.com/ljharb/function-bind/commit/f743e61aa6bb2360358c04d4884c9db853d118b7) +- Docs: enable badges; update wording [`503cb12`](https://github.com/ljharb/function-bind/commit/503cb12d998b5f91822776c73332c7adcd6355dd) +- [readme] update badges [`290c5db`](https://github.com/ljharb/function-bind/commit/290c5dbbbda7264efaeb886552a374b869a4bb48) +- [Tests] switch to nyc for coverage [`ea360ba`](https://github.com/ljharb/function-bind/commit/ea360ba907fc2601ed18d01a3827fa2d3533cdf8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`cae5e9e`](https://github.com/ljharb/function-bind/commit/cae5e9e07a5578dc6df26c03ee22851ce05b943c) +- [meta] add `funding` field; create FUNDING.yml [`c9f4274`](https://github.com/ljharb/function-bind/commit/c9f4274aa80ea3aae9657a3938fdba41a3b04ca6) +- [Tests] fix eslint errors from #15 [`f69aaa2`](https://github.com/ljharb/function-bind/commit/f69aaa2beb2fdab4415bfb885760a699d0b9c964) +- [actions] fix permissions [`99a0cd9`](https://github.com/ljharb/function-bind/commit/99a0cd9f3b5bac223a0d572f081834cd73314be7) +- [meta] use `npmignore` to autogenerate an npmignore file [`f03b524`](https://github.com/ljharb/function-bind/commit/f03b524ca91f75a109a5d062f029122c86ecd1ae) +- [Dev Deps] update `@ljharb/eslint‑config`, `eslint`, `tape` [`7af9300`](https://github.com/ljharb/function-bind/commit/7af930023ae2ce7645489532821e4fbbcd7a2280) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`64a9127`](https://github.com/ljharb/function-bind/commit/64a9127ab0bd331b93d6572eaf6e9971967fc08c) +- [Tests] use `aud` instead of `npm audit` [`e75069c`](https://github.com/ljharb/function-bind/commit/e75069c50010a8fcce2a9ce2324934c35fdb4386) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`d03555c`](https://github.com/ljharb/function-bind/commit/d03555ca59dea3b71ce710045e4303b9e2619e28) +- [meta] add `safe-publish-latest` [`9c8f809`](https://github.com/ljharb/function-bind/commit/9c8f8092aed027d7e80c94f517aa892385b64f09) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`baf6893`](https://github.com/ljharb/function-bind/commit/baf6893e27f5b59abe88bc1995e6f6ed1e527397) +- [meta] create SECURITY.md [`4db1779`](https://github.com/ljharb/function-bind/commit/4db17799f1f28ae294cb95e0081ca2b591c3911b) +- [Tests] add `npm run audit` [`c8b38ec`](https://github.com/ljharb/function-bind/commit/c8b38ec40ed3f85dabdee40ed4148f1748375bc2) +- Revert "Point to the correct file" [`05cdf0f`](https://github.com/ljharb/function-bind/commit/05cdf0fa205c6a3c5ba40bbedd1dfa9874f915c9) + +## [v1.1.1](https://github.com/ljharb/function-bind/compare/v1.1.0...v1.1.1) - 2017-08-28 + +### Commits + +- [Tests] up to `node` `v8`; newer npm breaks on older node; fix scripts [`817f7d2`](https://github.com/ljharb/function-bind/commit/817f7d28470fdbff8ef608d4d565dd4d1430bc5e) +- [Dev Deps] update `eslint`, `jscs`, `tape`, `@ljharb/eslint-config` [`854288b`](https://github.com/ljharb/function-bind/commit/854288b1b6f5c555f89aceb9eff1152510262084) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`83e639f`](https://github.com/ljharb/function-bind/commit/83e639ff74e6cd6921285bccec22c1bcf72311bd) +- Only apps should have lockfiles [`5ed97f5`](https://github.com/ljharb/function-bind/commit/5ed97f51235c17774e0832e122abda0f3229c908) +- Use a SPDX-compliant “license” field. [`5feefea`](https://github.com/ljharb/function-bind/commit/5feefea0dc0193993e83e5df01ded424403a5381) + +## [v1.1.0](https://github.com/ljharb/function-bind/compare/v1.0.2...v1.1.0) - 2016-02-14 + +### Commits + +- Update `eslint`, `tape`; use my personal shared `eslint` config [`9c9062a`](https://github.com/ljharb/function-bind/commit/9c9062abbe9dd70b59ea2c3a3c3a81f29b457097) +- Add `npm run eslint` [`dd96c56`](https://github.com/ljharb/function-bind/commit/dd96c56720034a3c1ffee10b8a59a6f7c53e24ad) +- [New] return the native `bind` when available. [`82186e0`](https://github.com/ljharb/function-bind/commit/82186e03d73e580f95ff167e03f3582bed90ed72) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a3dd767`](https://github.com/ljharb/function-bind/commit/a3dd76720c795cb7f4586b0544efabf8aa107b8b) +- Update `eslint` [`3dae2f7`](https://github.com/ljharb/function-bind/commit/3dae2f7423de30a2d20313ddb1edc19660142fe9) +- Update `tape`, `covert`, `jscs` [`a181eee`](https://github.com/ljharb/function-bind/commit/a181eee0cfa24eb229c6e843a971f36e060a2f6a) +- [Tests] up to `node` `v5.6`, `v4.3` [`964929a`](https://github.com/ljharb/function-bind/commit/964929a6a4ddb36fb128de2bcc20af5e4f22e1ed) +- Test up to `io.js` `v2.1` [`2be7310`](https://github.com/ljharb/function-bind/commit/2be7310f2f74886a7124ca925be411117d41d5ea) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`45f3d68`](https://github.com/ljharb/function-bind/commit/45f3d6865c6ca93726abcef54febe009087af101) +- [Dev Deps] update `tape`, `jscs` [`6e1340d`](https://github.com/ljharb/function-bind/commit/6e1340d94642deaecad3e717825db641af4f8b1f) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`d9bad2b`](https://github.com/ljharb/function-bind/commit/d9bad2b778b1b3a6dd2876087b88b3acf319f8cc) +- Update `eslint` [`935590c`](https://github.com/ljharb/function-bind/commit/935590caa024ab356102e4858e8fc315b2ccc446) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`8c9a1ef`](https://github.com/ljharb/function-bind/commit/8c9a1efd848e5167887aa8501857a0940a480c57) +- Test on `io.js` `v2.2` [`9a3a38c`](https://github.com/ljharb/function-bind/commit/9a3a38c92013aed6e108666e7bd40969b84ac86e) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`69afc26`](https://github.com/ljharb/function-bind/commit/69afc2617405b147dd2a8d8ae73ca9e9283f18b4) +- [Dev Deps] Update `tape`, `eslint` [`36c1be0`](https://github.com/ljharb/function-bind/commit/36c1be0ab12b45fe5df6b0fdb01a5d5137fd0115) +- Update `tape`, `jscs` [`98d8303`](https://github.com/ljharb/function-bind/commit/98d8303cd5ca1c6b8f985469f86b0d44d7d45f6e) +- Update `jscs` [`9633a4e`](https://github.com/ljharb/function-bind/commit/9633a4e9fbf82051c240855166e468ba8ba0846f) +- Update `tape`, `jscs` [`c80ef0f`](https://github.com/ljharb/function-bind/commit/c80ef0f46efc9791e76fa50de4414092ac147831) +- Test up to `io.js` `v3.0` [`7e2c853`](https://github.com/ljharb/function-bind/commit/7e2c8537d52ab9cf5a655755561d8917684c0df4) +- Test on `io.js` `v2.4` [`5a199a2`](https://github.com/ljharb/function-bind/commit/5a199a27ba46795ba5eaf0845d07d4b8232895c9) +- Test on `io.js` `v2.3` [`a511b88`](https://github.com/ljharb/function-bind/commit/a511b8896de0bddf3b56862daa416c701f4d0453) +- Fixing a typo from 822b4e1938db02dc9584aa434fd3a45cb20caf43 [`732d6b6`](https://github.com/ljharb/function-bind/commit/732d6b63a9b33b45230e630dbcac7a10855d3266) +- Update `jscs` [`da52a48`](https://github.com/ljharb/function-bind/commit/da52a4886c06d6490f46ae30b15e4163ba08905d) +- Lock covert to v1.0.0. [`d6150fd`](https://github.com/ljharb/function-bind/commit/d6150fda1e6f486718ebdeff823333d9e48e7430) + +## [v1.0.2](https://github.com/ljharb/function-bind/compare/v1.0.1...v1.0.2) - 2014-10-04 + +## [v1.0.1](https://github.com/ljharb/function-bind/compare/v1.0.0...v1.0.1) - 2014-10-03 + +### Merged + +- make CI build faster [`#3`](https://github.com/ljharb/function-bind/pull/3) + +### Commits + +- Using my standard jscs.json [`d8ee94c`](https://github.com/ljharb/function-bind/commit/d8ee94c993eff0a84cf5744fe6a29627f5cffa1a) +- Adding `npm run lint` [`7571ab7`](https://github.com/ljharb/function-bind/commit/7571ab7dfdbd99b25a1dbb2d232622bd6f4f9c10) +- Using consistent indentation [`e91a1b1`](https://github.com/ljharb/function-bind/commit/e91a1b13a61e99ec1e530e299b55508f74218a95) +- Updating jscs [`7e17892`](https://github.com/ljharb/function-bind/commit/7e1789284bc629bc9c1547a61c9b227bbd8c7a65) +- Using consistent quotes [`c50b57f`](https://github.com/ljharb/function-bind/commit/c50b57fcd1c5ec38320979c837006069ebe02b77) +- Adding keywords [`cb94631`](https://github.com/ljharb/function-bind/commit/cb946314eed35f21186a25fb42fc118772f9ee00) +- Directly export a function expression instead of using a declaration, and relying on hoisting. [`5a33c5f`](https://github.com/ljharb/function-bind/commit/5a33c5f45642de180e0d207110bf7d1843ceb87c) +- Naming npm URL and badge in README; use SVG [`2aef8fc`](https://github.com/ljharb/function-bind/commit/2aef8fcb79d54e63a58ae557c4e60949e05d5e16) +- Naming deps URLs in README [`04228d7`](https://github.com/ljharb/function-bind/commit/04228d766670ee45ca24e98345c1f6a7621065b5) +- Naming travis-ci URLs in README; using SVG [`62c810c`](https://github.com/ljharb/function-bind/commit/62c810c2f54ced956cd4d4ab7b793055addfe36e) +- Make sure functions are invoked correctly (also passing coverage tests) [`2b289b4`](https://github.com/ljharb/function-bind/commit/2b289b4dfbf037ffcfa4dc95eb540f6165e9e43a) +- Removing the strict mode pragmas; they make tests fail. [`1aa701d`](https://github.com/ljharb/function-bind/commit/1aa701d199ddc3782476e8f7eef82679be97b845) +- Adding myself as a contributor [`85fd57b`](https://github.com/ljharb/function-bind/commit/85fd57b0860e5a7af42de9a287f3f265fc6d72fc) +- Adding strict mode pragmas [`915b08e`](https://github.com/ljharb/function-bind/commit/915b08e084c86a722eafe7245e21db74aa21ca4c) +- Adding devDeps URLs to README [`4ccc731`](https://github.com/ljharb/function-bind/commit/4ccc73112c1769859e4ca3076caf4086b3cba2cd) +- Fixing the description. [`a7a472c`](https://github.com/ljharb/function-bind/commit/a7a472cf649af515c635cf560fc478fbe48999c8) +- Using a function expression instead of a function declaration. [`b5d3e4e`](https://github.com/ljharb/function-bind/commit/b5d3e4ea6aaffc63888953eeb1fbc7ff45f1fa14) +- Updating tape [`f086be6`](https://github.com/ljharb/function-bind/commit/f086be6029fb56dde61a258c1340600fa174d1e0) +- Updating jscs [`5f9bdb3`](https://github.com/ljharb/function-bind/commit/5f9bdb375ab13ba48f30852aab94029520c54d71) +- Updating jscs [`9b409ba`](https://github.com/ljharb/function-bind/commit/9b409ba6118e23395a4e5d83ef39152aab9d3bfc) +- Run coverage as part of tests. [`8e1b6d4`](https://github.com/ljharb/function-bind/commit/8e1b6d459f047d1bd4fee814e01247c984c80bd0) +- Run linter as part of tests [`c1ca83f`](https://github.com/ljharb/function-bind/commit/c1ca83f832df94587d09e621beba682fabfaa987) +- Updating covert [`701e837`](https://github.com/ljharb/function-bind/commit/701e83774b57b4d3ef631e1948143f43a72f4bb9) + +## [v1.0.0](https://github.com/ljharb/function-bind/compare/v0.2.0...v1.0.0) - 2014-08-09 + +### Commits + +- Make sure old and unstable nodes don't fail Travis [`27adca3`](https://github.com/ljharb/function-bind/commit/27adca34a4ab6ad67b6dfde43942a1b103ce4d75) +- Fixing an issue when the bound function is called as a constructor in ES3. [`e20122d`](https://github.com/ljharb/function-bind/commit/e20122d267d92ce553859b280cbbea5d27c07731) +- Adding `npm run coverage` [`a2e29c4`](https://github.com/ljharb/function-bind/commit/a2e29c4ecaef9e2f6cd1603e868c139073375502) +- Updating tape [`b741168`](https://github.com/ljharb/function-bind/commit/b741168b12b235b1717ff696087645526b69213c) +- Upgrading tape [`63631a0`](https://github.com/ljharb/function-bind/commit/63631a04c7fbe97cc2fa61829cc27246d6986f74) +- Updating tape [`363cb46`](https://github.com/ljharb/function-bind/commit/363cb46dafb23cb3e347729a22f9448051d78464) + +## v0.2.0 - 2014-03-23 + +### Commits + +- Updating test coverage to match es5-shim. [`aa94d44`](https://github.com/ljharb/function-bind/commit/aa94d44b8f9d7f69f10e060db7709aa7a694e5d4) +- initial [`942ee07`](https://github.com/ljharb/function-bind/commit/942ee07e94e542d91798137bc4b80b926137e066) +- Setting the bound function's length properly. [`079f46a`](https://github.com/ljharb/function-bind/commit/079f46a2d3515b7c0b308c2c13fceb641f97ca25) +- Ensuring that some older browsers will throw when given a regex. [`36ac55b`](https://github.com/ljharb/function-bind/commit/36ac55b87f460d4330253c92870aa26fbfe8227f) +- Removing npm scripts that don't have dependencies [`9d2be60`](https://github.com/ljharb/function-bind/commit/9d2be600002cb8bc8606f8f3585ad3e05868c750) +- Updating tape [`297a4ac`](https://github.com/ljharb/function-bind/commit/297a4acc5464db381940aafb194d1c88f4e678f3) +- Skipping length tests for now. [`d9891ea`](https://github.com/ljharb/function-bind/commit/d9891ea4d2aaffa69f408339cdd61ff740f70565) +- don't take my tea [`dccd930`](https://github.com/ljharb/function-bind/commit/dccd930bfd60ea10cb178d28c97550c3bc8c1e07) diff --git a/live2d/node_modules/function-bind/LICENSE b/live2d/node_modules/function-bind/LICENSE new file mode 100644 index 0000000..62d6d23 --- /dev/null +++ b/live2d/node_modules/function-bind/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Raynos. + +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. + diff --git a/live2d/node_modules/function-bind/README.md b/live2d/node_modules/function-bind/README.md new file mode 100644 index 0000000..814c20b --- /dev/null +++ b/live2d/node_modules/function-bind/README.md @@ -0,0 +1,46 @@ +# function-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] + +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Implementation of function.prototype.bind + +Old versions of phantomjs, Internet Explorer < 9, and node < 0.6 don't support `Function.prototype.bind`. + +## Example + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + +[package-url]: https://npmjs.org/package/function-bind +[npm-version-svg]: https://versionbadg.es/Raynos/function-bind.svg +[deps-svg]: https://david-dm.org/Raynos/function-bind.svg +[deps-url]: https://david-dm.org/Raynos/function-bind +[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/function-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/function-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/function-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=function-bind +[codecov-image]: https://codecov.io/gh/Raynos/function-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/Raynos/function-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/Raynos/function-bind +[actions-url]: https://github.com/Raynos/function-bind/actions diff --git a/live2d/node_modules/function-bind/implementation.js b/live2d/node_modules/function-bind/implementation.js new file mode 100644 index 0000000..fd4384c --- /dev/null +++ b/live2d/node_modules/function-bind/implementation.js @@ -0,0 +1,84 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/live2d/node_modules/function-bind/index.js b/live2d/node_modules/function-bind/index.js new file mode 100644 index 0000000..3bb6b96 --- /dev/null +++ b/live2d/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/live2d/node_modules/function-bind/package.json b/live2d/node_modules/function-bind/package.json new file mode 100644 index 0000000..6185963 --- /dev/null +++ b/live2d/node_modules/function-bind/package.json @@ -0,0 +1,87 @@ +{ + "name": "function-bind", + "version": "1.1.2", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": { + "type": "git", + "url": "https://github.com/Raynos/function-bind.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.3", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.1" + }, + "license": "MIT", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepack": "npmignore --auto --commentLines=autogenerated", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/live2d/node_modules/function-bind/test/.eslintrc b/live2d/node_modules/function-bind/test/.eslintrc new file mode 100644 index 0000000..8a56d5b --- /dev/null +++ b/live2d/node_modules/function-bind/test/.eslintrc @@ -0,0 +1,9 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": 0, + "no-magic-numbers": 0, + } +} diff --git a/live2d/node_modules/function-bind/test/index.js b/live2d/node_modules/function-bind/test/index.js new file mode 100644 index 0000000..2edecce --- /dev/null +++ b/live2d/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/live2d/node_modules/get-intrinsic/.eslintrc b/live2d/node_modules/get-intrinsic/.eslintrc new file mode 100644 index 0000000..8376636 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/.eslintrc @@ -0,0 +1,38 @@ +{ + "root": true, + + "extends": "@ljharb", + + "env": { + "es6": true, + "es2017": true, + "es2020": true, + "es2021": true, + "es2022": true, + }, + + "rules": { + "array-bracket-newline": 0, + "complexity": 0, + "eqeqeq": [2, "allow-null"], + "func-name-matching": 0, + "id-length": 0, + "max-lines": 0, + "max-lines-per-function": [2, 90], + "max-params": [2, 4], + "max-statements": 0, + "max-statements-per-line": [2, { "max": 2 }], + "multiline-comment-style": 0, + "no-magic-numbers": 0, + "sort-keys": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "new-cap": 0, + }, + }, + ], +} diff --git a/live2d/node_modules/get-intrinsic/.github/FUNDING.yml b/live2d/node_modules/get-intrinsic/.github/FUNDING.yml new file mode 100644 index 0000000..8e8da0d --- /dev/null +++ b/live2d/node_modules/get-intrinsic/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/get-intrinsic +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/get-intrinsic/.nycrc b/live2d/node_modules/get-intrinsic/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/get-intrinsic/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/get-intrinsic/CHANGELOG.md b/live2d/node_modules/get-intrinsic/CHANGELOG.md new file mode 100644 index 0000000..96d5397 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/CHANGELOG.md @@ -0,0 +1,143 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.4](https://github.com/ljharb/get-intrinsic/compare/v1.2.3...v1.2.4) - 2024-02-05 + +### Commits + +- [Refactor] use all 7 <+ ES6 Errors from `es-errors` [`bcac811`](https://github.com/ljharb/get-intrinsic/commit/bcac811abdc1c982e12abf848a410d6aae148d14) + +## [v1.2.3](https://github.com/ljharb/get-intrinsic/compare/v1.2.2...v1.2.3) - 2024-02-03 + +### Commits + +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`f11db9c`](https://github.com/ljharb/get-intrinsic/commit/f11db9c4fb97d87bbd53d3c73ac6b3db3613ad3b) +- [Dev Deps] update `aud`, `es-abstract`, `mock-property`, `npmignore` [`b7ac7d1`](https://github.com/ljharb/get-intrinsic/commit/b7ac7d1616fefb03877b1aed0c8f8d61aad32b6c) +- [meta] simplify `exports` [`faa0cc6`](https://github.com/ljharb/get-intrinsic/commit/faa0cc618e2830ffb51a8202490b0c215d965cbc) +- [meta] add missing `engines.node` [`774dd0b`](https://github.com/ljharb/get-intrinsic/commit/774dd0b3e8f741c3f05a6322d124d6087f146af1) +- [Dev Deps] update `tape` [`5828e8e`](https://github.com/ljharb/get-intrinsic/commit/5828e8e4a04e69312e87a36c0ea39428a7a4c3d8) +- [Robustness] use null objects for lookups [`eb9a11f`](https://github.com/ljharb/get-intrinsic/commit/eb9a11fa9eb3e13b193fcc05a7fb814341b1a7b7) +- [meta] add `sideEffects` flag [`89bcc7a`](https://github.com/ljharb/get-intrinsic/commit/89bcc7a42e19bf07b7c21e3094d5ab177109e6d2) + +## [v1.2.2](https://github.com/ljharb/get-intrinsic/compare/v1.2.1...v1.2.2) - 2023-10-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `call-bind`, `es-abstract`, `mock-property`, `object-inspect`, `tape` [`f51bcf2`](https://github.com/ljharb/get-intrinsic/commit/f51bcf26412d58d17ce17c91c9afd0ad271f0762) +- [Refactor] use `hasown` instead of `has` [`18d14b7`](https://github.com/ljharb/get-intrinsic/commit/18d14b799bea6b5765e1cec91890830cbcdb0587) +- [Deps] update `function-bind` [`6e109c8`](https://github.com/ljharb/get-intrinsic/commit/6e109c81e03804cc5e7824fb64353cdc3d8ee2c7) + +## [v1.2.1](https://github.com/ljharb/get-intrinsic/compare/v1.2.0...v1.2.1) - 2023-05-13 + +### Commits + +- [Fix] avoid a crash in envs without `__proto__` [`7bad8d0`](https://github.com/ljharb/get-intrinsic/commit/7bad8d061bf8721733b58b73a2565af2b6756b64) +- [Dev Deps] update `es-abstract` [`c60e6b7`](https://github.com/ljharb/get-intrinsic/commit/c60e6b7b4cf9660c7f27ed970970fd55fac48dc5) + +## [v1.2.0](https://github.com/ljharb/get-intrinsic/compare/v1.1.3...v1.2.0) - 2023-01-19 + +### Commits + +- [actions] update checkout action [`ca6b12f`](https://github.com/ljharb/get-intrinsic/commit/ca6b12f31eaacea4ea3b055e744cd61623385ffb) +- [Dev Deps] update `@ljharb/eslint-config`, `es-abstract`, `object-inspect`, `tape` [`41a3727`](https://github.com/ljharb/get-intrinsic/commit/41a3727d0026fa04273ae216a5f8e12eefd72da8) +- [Fix] ensure `Error.prototype` is undeniable [`c511e97`](https://github.com/ljharb/get-intrinsic/commit/c511e97ae99c764c4524b540dee7a70757af8da3) +- [Dev Deps] update `aud`, `es-abstract`, `tape` [`1bef8a8`](https://github.com/ljharb/get-intrinsic/commit/1bef8a8fd439ebb80863199b6189199e0851ac67) +- [Dev Deps] update `aud`, `es-abstract` [`0d41f16`](https://github.com/ljharb/get-intrinsic/commit/0d41f16bcd500bc28b7bfc98043ebf61ea081c26) +- [New] add `BigInt64Array` and `BigUint64Array` [`a6cca25`](https://github.com/ljharb/get-intrinsic/commit/a6cca25f29635889b7e9bd669baf9e04be90e48c) +- [Tests] use `gopd` [`ecf7722`](https://github.com/ljharb/get-intrinsic/commit/ecf7722240d15cfd16edda06acf63359c10fb9bd) + +## [v1.1.3](https://github.com/ljharb/get-intrinsic/compare/v1.1.2...v1.1.3) - 2022-09-12 + +### Commits + +- [Dev Deps] update `es-abstract`, `es-value-fixtures`, `tape` [`07ff291`](https://github.com/ljharb/get-intrinsic/commit/07ff291816406ebe5a12d7f16965bde0942dd688) +- [Fix] properly check for % signs [`50ac176`](https://github.com/ljharb/get-intrinsic/commit/50ac1760fe99c227e64eabde76e9c0e44cd881b5) + +## [v1.1.2](https://github.com/ljharb/get-intrinsic/compare/v1.1.1...v1.1.2) - 2022-06-08 + +### Fixed + +- [Fix] properly validate against extra % signs [`#16`](https://github.com/ljharb/get-intrinsic/issues/16) + +### Commits + +- [actions] reuse common workflows [`0972547`](https://github.com/ljharb/get-intrinsic/commit/0972547efd0abc863fe4c445a6ca7eb4f8c6901d) +- [meta] use `npmignore` to autogenerate an npmignore file [`5ba0b51`](https://github.com/ljharb/get-intrinsic/commit/5ba0b51d8d8d4f1c31d426d74abc0770fd106bad) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`c364492`](https://github.com/ljharb/get-intrinsic/commit/c364492af4af51333e6f81c0bf21fd3d602c3661) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `es-abstract`, `object-inspect`, `tape` [`dc04dad`](https://github.com/ljharb/get-intrinsic/commit/dc04dad86f6e5608775a2640cb0db5927ae29ed9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es-abstract`, `object-inspect`, `safe-publish-latest`, `tape` [`1c14059`](https://github.com/ljharb/get-intrinsic/commit/1c1405984e86dd2dc9366c15d8a0294a96a146a5) +- [Tests] use `mock-property` [`b396ef0`](https://github.com/ljharb/get-intrinsic/commit/b396ef05bb73b1d699811abd64b0d9b97997fdda) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c2c758d`](https://github.com/ljharb/get-intrinsic/commit/c2c758d3b90af4fef0a76910d8d3c292ec8d1d3e) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-abstract`, `es-value-fixtures`, `object-inspect`, `tape` [`29e3c09`](https://github.com/ljharb/get-intrinsic/commit/29e3c091c2bf3e17099969847e8729d0e46896de) +- [actions] update codecov uploader [`8cbc141`](https://github.com/ljharb/get-intrinsic/commit/8cbc1418940d7a8941f3a7985cbc4ac095c5e13d) +- [Dev Deps] update `@ljharb/eslint-config`, `es-abstract`, `es-value-fixtures`, `object-inspect`, `tape` [`10b6f5c`](https://github.com/ljharb/get-intrinsic/commit/10b6f5c02593fb3680c581d696ac124e30652932) +- [readme] add github actions/codecov badges [`4e25400`](https://github.com/ljharb/get-intrinsic/commit/4e25400d9f51ae9eb059cbe22d9144e70ea214e8) +- [Tests] use `for-each` instead of `foreach` [`c05b957`](https://github.com/ljharb/get-intrinsic/commit/c05b957ad9a7bc7721af7cc9e9be1edbfe057496) +- [Dev Deps] update `es-abstract` [`29b05ae`](https://github.com/ljharb/get-intrinsic/commit/29b05aec3e7330e9ad0b8e0f685a9112c20cdd97) +- [meta] use `prepublishOnly` script for npm 7+ [`95c285d`](https://github.com/ljharb/get-intrinsic/commit/95c285da810516057d3bbfa871176031af38f05d) +- [Deps] update `has-symbols` [`593cb4f`](https://github.com/ljharb/get-intrinsic/commit/593cb4fb38e7922e40e42c183f45274b636424cd) +- [readme] fix repo URLs [`1c8305b`](https://github.com/ljharb/get-intrinsic/commit/1c8305b5365827c9b6fc785434aac0e1328ff2f5) +- [Deps] update `has-symbols` [`c7138b6`](https://github.com/ljharb/get-intrinsic/commit/c7138b6c6d73132d859471fb8c13304e1e7c8b20) +- [Dev Deps] remove unused `has-bigints` [`bd63aff`](https://github.com/ljharb/get-intrinsic/commit/bd63aff6ad8f3a986c557fcda2914187bdaab359) + +## [v1.1.1](https://github.com/ljharb/get-intrinsic/compare/v1.1.0...v1.1.1) - 2021-02-03 + +### Fixed + +- [meta] export `./package.json` [`#9`](https://github.com/ljharb/get-intrinsic/issues/9) + +### Commits + +- [readme] flesh out the readme; use `evalmd` [`d12f12c`](https://github.com/ljharb/get-intrinsic/commit/d12f12c15345a0a0772cc65a7c64369529abd614) +- [eslint] set up proper globals config [`5a8c098`](https://github.com/ljharb/get-intrinsic/commit/5a8c0984e3319d1ac0e64b102f8ec18b64e79f36) +- [Dev Deps] update `eslint` [`7b9a5c0`](https://github.com/ljharb/get-intrinsic/commit/7b9a5c0d31a90ca1a1234181c74988fb046701cd) + +## [v1.1.0](https://github.com/ljharb/get-intrinsic/compare/v1.0.2...v1.1.0) - 2021-01-25 + +### Fixed + +- [Refactor] delay `Function` eval until syntax-derived values are requested [`#3`](https://github.com/ljharb/get-intrinsic/issues/3) + +### Commits + +- [Tests] migrate tests to Github Actions [`2ab762b`](https://github.com/ljharb/get-intrinsic/commit/2ab762b48164aea8af37a40ba105bbc8246ab8c4) +- [meta] do not publish github action workflow files [`5e7108e`](https://github.com/ljharb/get-intrinsic/commit/5e7108e4768b244d48d9567ba4f8a6cab9c65b8e) +- [Tests] add some coverage [`01ac7a8`](https://github.com/ljharb/get-intrinsic/commit/01ac7a87ac29738567e8524cd8c9e026b1fa8cb3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `call-bind`, `es-abstract`, `tape`; add `call-bind` [`911b672`](https://github.com/ljharb/get-intrinsic/commit/911b672fbffae433a96924c6ce013585e425f4b7) +- [Refactor] rearrange evalled constructors a bit [`7e7e4bf`](https://github.com/ljharb/get-intrinsic/commit/7e7e4bf583f3799c8ac1c6c5e10d2cb553957347) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`0199968`](https://github.com/ljharb/get-intrinsic/commit/01999687a263ffce0a3cb011dfbcb761754aedbc) + +## [v1.0.2](https://github.com/ljharb/get-intrinsic/compare/v1.0.1...v1.0.2) - 2020-12-17 + +### Commits + +- [Fix] Throw for non‑existent intrinsics [`68f873b`](https://github.com/ljharb/get-intrinsic/commit/68f873b013c732a05ad6f5fc54f697e55515461b) +- [Fix] Throw for non‑existent segments in the intrinsic path [`8325dee`](https://github.com/ljharb/get-intrinsic/commit/8325deee43128f3654d3399aa9591741ebe17b21) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-bigints`, `object-inspect` [`0c227a7`](https://github.com/ljharb/get-intrinsic/commit/0c227a7d8b629166f25715fd242553892e458525) +- [meta] do not lint coverage output [`70d2419`](https://github.com/ljharb/get-intrinsic/commit/70d24199b620043cd9110fc5f426d214ebe21dc9) + +## [v1.0.1](https://github.com/ljharb/get-intrinsic/compare/v1.0.0...v1.0.1) - 2020-10-30 + +### Commits + +- [Tests] gather coverage data on every job [`d1d280d`](https://github.com/ljharb/get-intrinsic/commit/d1d280dec714e3f0519cc877dbcb193057d9cac6) +- [Fix] add missing dependencies [`5031771`](https://github.com/ljharb/get-intrinsic/commit/5031771bb1095b38be88ce7c41d5de88718e432e) +- [Tests] use `es-value-fixtures` [`af48765`](https://github.com/ljharb/get-intrinsic/commit/af48765a23c5323fb0b6b38dbf00eb5099c7bebc) + +## v1.0.0 - 2020-10-29 + +### Commits + +- Implementation [`bbce57c`](https://github.com/ljharb/get-intrinsic/commit/bbce57c6f33d05b2d8d3efa273ceeb3ee01127bb) +- Tests [`17b4f0d`](https://github.com/ljharb/get-intrinsic/commit/17b4f0d56dea6b4059b56fc30ef3ee4d9500ebc2) +- Initial commit [`3153294`](https://github.com/ljharb/get-intrinsic/commit/31532948de363b0a27dd9fd4649e7b7028ec4b44) +- npm init [`fb326c4`](https://github.com/ljharb/get-intrinsic/commit/fb326c4d2817c8419ec31de1295f06bb268a7902) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`48862fb`](https://github.com/ljharb/get-intrinsic/commit/48862fb2508c8f6a57968e6d08b7c883afc9d550) +- [meta] add `auto-changelog` [`5f28ad0`](https://github.com/ljharb/get-intrinsic/commit/5f28ad019e060a353d8028f9f2591a9cc93074a1) +- [meta] add "funding"; create `FUNDING.yml` [`c2bbdde`](https://github.com/ljharb/get-intrinsic/commit/c2bbddeba73a875be61484ee4680b129a6d4e0a1) +- [Tests] add `npm run lint` [`0a84b98`](https://github.com/ljharb/get-intrinsic/commit/0a84b98b22b7cf7a748666f705b0003a493c35fd) +- Only apps should have lockfiles [`9586c75`](https://github.com/ljharb/get-intrinsic/commit/9586c75866c1ee678e4d5d4dbbdef6997e511b05) diff --git a/live2d/node_modules/get-intrinsic/LICENSE b/live2d/node_modules/get-intrinsic/LICENSE new file mode 100644 index 0000000..48f05d0 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +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. diff --git a/live2d/node_modules/get-intrinsic/README.md b/live2d/node_modules/get-intrinsic/README.md new file mode 100644 index 0000000..3aa0bba --- /dev/null +++ b/live2d/node_modules/get-intrinsic/README.md @@ -0,0 +1,71 @@ +# get-intrinsic [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Get and robustly cache all JS language-level intrinsics at first require time. + +See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference. + +## Example + +```js +var GetIntrinsic = require('get-intrinsic'); +var assert = require('assert'); + +// static methods +assert.equal(GetIntrinsic('%Math.pow%'), Math.pow); +assert.equal(Math.pow(2, 3), 8); +assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); +delete Math.pow; +assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); + +// instance methods +var arr = [1]; +assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push); +assert.deepEqual(arr, [1]); + +arr.push(2); +assert.deepEqual(arr, [1, 2]); + +GetIntrinsic('%Array.prototype.push%').call(arr, 3); +assert.deepEqual(arr, [1, 2, 3]); + +delete Array.prototype.push; +GetIntrinsic('%Array.prototype.push%').call(arr, 4); +assert.deepEqual(arr, [1, 2, 3, 4]); + +// missing features +delete JSON.parse; // to simulate a real intrinsic that is missing in the environment +assert.throws(() => GetIntrinsic('%JSON.parse%')); +assert.equal(undefined, GetIntrinsic('%JSON.parse%', true)); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/get-intrinsic +[npm-version-svg]: https://versionbadg.es/ljharb/get-intrinsic.svg +[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg +[deps-url]: https://david-dm.org/ljharb/get-intrinsic +[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg +[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic +[codecov-image]: https://codecov.io/gh/ljharb/get-intrinsic/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/get-intrinsic/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/get-intrinsic +[actions-url]: https://github.com/ljharb/get-intrinsic/actions diff --git a/live2d/node_modules/get-intrinsic/index.js b/live2d/node_modules/get-intrinsic/index.js new file mode 100644 index 0000000..c25e2c4 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/index.js @@ -0,0 +1,359 @@ +'use strict'; + +var undefined; + +var $Error = require('es-errors'); +var $EvalError = require('es-errors/eval'); +var $RangeError = require('es-errors/range'); +var $ReferenceError = require('es-errors/ref'); +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); +var $URIError = require('es-errors/uri'); + +var $Function = Function; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); +var hasProto = require('has-proto')(); + +var getProto = Object.getPrototypeOf || ( + hasProto + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto + : null +); + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + __proto__: null, + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': $Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': $EvalError, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': $RangeError, + '%ReferenceError%': $ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': $URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet +}; + +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen && getProto) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + __proto__: null, + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'] +}; + +var bind = require('function-bind'); +var hasOwn = require('hasown'); +var $concat = bind.call(Function.call, Array.prototype.concat); +var $spliceApply = bind.call(Function.apply, Array.prototype.splice); +var $replace = bind.call(Function.call, String.prototype.replace); +var $strSlice = bind.call(Function.call, String.prototype.slice); +var $exec = bind.call(Function.call, RegExp.prototype.exec); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; diff --git a/live2d/node_modules/get-intrinsic/package.json b/live2d/node_modules/get-intrinsic/package.json new file mode 100644 index 0000000..568dff9 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/package.json @@ -0,0 +1,93 @@ +{ + "name": "get-intrinsic", + "version": "1.2.4", + "description": "Get and robustly cache all JS language-level intrinsics at first require time", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/get-intrinsic.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "intrinsic", + "getintrinsic", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/get-intrinsic/issues" + }, + "homepage": "https://github.com/ljharb/get-intrinsic#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.5", + "es-abstract": "^1.22.3", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "make-async-function": "^1.0.0", + "make-async-generator-function": "^1.0.0", + "make-generator-function": "^2.0.0", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "testling": { + "files": "test/GetIntrinsic.js" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/live2d/node_modules/get-intrinsic/test/GetIntrinsic.js b/live2d/node_modules/get-intrinsic/test/GetIntrinsic.js new file mode 100644 index 0000000..1cc08e0 --- /dev/null +++ b/live2d/node_modules/get-intrinsic/test/GetIntrinsic.js @@ -0,0 +1,274 @@ +'use strict'; + +var GetIntrinsic = require('../'); + +var test = require('tape'); +var forEach = require('for-each'); +var debug = require('object-inspect'); +var generatorFns = require('make-generator-function')(); +var asyncFns = require('make-async-function').list(); +var asyncGenFns = require('make-async-generator-function')(); +var mockProperty = require('mock-property'); + +var callBound = require('call-bind/callBound'); +var v = require('es-value-fixtures'); +var $gOPD = require('gopd'); +var DefinePropertyOrThrow = require('es-abstract/2021/DefinePropertyOrThrow'); + +var $isProto = callBound('%Object.prototype.isPrototypeOf%'); + +test('export', function (t) { + t.equal(typeof GetIntrinsic, 'function', 'it is a function'); + t.equal(GetIntrinsic.length, 2, 'function has length of 2'); + + t.end(); +}); + +test('throws', function (t) { + t['throws']( + function () { GetIntrinsic('not an intrinsic'); }, + SyntaxError, + 'nonexistent intrinsic throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic(''); }, + TypeError, + 'empty string intrinsic throws a type error' + ); + + t['throws']( + function () { GetIntrinsic('.'); }, + SyntaxError, + '"just a dot" intrinsic throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic('%String'); }, + SyntaxError, + 'Leading % without trailing % throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic('String%'); }, + SyntaxError, + 'Trailing % without leading % throws a syntax error' + ); + + t['throws']( + function () { GetIntrinsic("String['prototype]"); }, + SyntaxError, + 'Dynamic property access is disallowed for intrinsics (unterminated string)' + ); + + t['throws']( + function () { GetIntrinsic('%Proxy.prototype.undefined%'); }, + TypeError, + "Throws when middle part doesn't exist (%Proxy.prototype.undefined%)" + ); + + t['throws']( + function () { GetIntrinsic('%Array.prototype%garbage%'); }, + SyntaxError, + 'Throws with extra percent signs' + ); + + t['throws']( + function () { GetIntrinsic('%Array.prototype%push%'); }, + SyntaxError, + 'Throws with extra percent signs, even on an existing intrinsic' + ); + + forEach(v.nonStrings, function (nonString) { + t['throws']( + function () { GetIntrinsic(nonString); }, + TypeError, + debug(nonString) + ' is not a String' + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + t['throws']( + function () { GetIntrinsic('%', nonBoolean); }, + TypeError, + debug(nonBoolean) + ' is not a Boolean' + ); + }); + + forEach([ + 'toString', + 'propertyIsEnumerable', + 'hasOwnProperty' + ], function (objectProtoMember) { + t['throws']( + function () { GetIntrinsic(objectProtoMember); }, + SyntaxError, + debug(objectProtoMember) + ' is not an intrinsic' + ); + }); + + t.end(); +}); + +test('base intrinsics', function (t) { + t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object'); + t.equal(GetIntrinsic('Object'), Object, 'Object yields Object'); + t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array'); + t.equal(GetIntrinsic('Array'), Array, 'Array yields Array'); + + t.end(); +}); + +test('dotted paths', function (t) { + t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString'); + t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString'); + t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push'); + t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push'); + + test('underscore paths are aliases for dotted paths', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { + var original = GetIntrinsic('%ObjProto_toString%'); + + forEach([ + '%Object.prototype.toString%', + 'Object.prototype.toString', + '%ObjectPrototype.toString%', + 'ObjectPrototype.toString', + '%ObjProto_toString%', + 'ObjProto_toString' + ], function (name) { + DefinePropertyOrThrow(Object.prototype, 'toString', { + '[[Value]]': function toString() { + return original.apply(this, arguments); + } + }); + st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString'); + }); + + DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': original }); + st.end(); + }); + + test('dotted paths cache', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { + var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%'); + + forEach([ + '%Object.prototype.propertyIsEnumerable%', + 'Object.prototype.propertyIsEnumerable', + '%ObjectPrototype.propertyIsEnumerable%', + 'ObjectPrototype.propertyIsEnumerable' + ], function (name) { + var restore = mockProperty(Object.prototype, 'propertyIsEnumerable', { + value: function propertyIsEnumerable() { + return original.apply(this, arguments); + } + }); + st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable'); + + restore(); + }); + + st.end(); + }); + + test('dotted path reports correct error', function (st) { + st['throws'](function () { + GetIntrinsic('%NonExistentIntrinsic.prototype.property%'); + }, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%'); + + st['throws'](function () { + GetIntrinsic('%NonExistentIntrinsicPrototype.property%'); + }, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%'); + + st.end(); + }); + + t.end(); +}); + +test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) { + var actual = $gOPD(Map.prototype, 'size'); + t.ok(actual, 'Map.prototype.size has a descriptor'); + t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function'); + t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it'); + t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it'); + + t.end(); +}); + +test('generator functions', { skip: !generatorFns.length }, function (t) { + var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%'); + var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%'); + var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%'); + + forEach(generatorFns, function (genFn) { + var fnName = genFn.name; + fnName = fnName ? "'" + fnName + "'" : 'genFn'; + + t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%'); + t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName); + t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype'); + }); + + t.end(); +}); + +test('async functions', { skip: !asyncFns.length }, function (t) { + var $AsyncFunction = GetIntrinsic('%AsyncFunction%'); + var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%'); + + forEach(asyncFns, function (asyncFn) { + var fnName = asyncFn.name; + fnName = fnName ? "'" + fnName + "'" : 'asyncFn'; + + t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%'); + t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName); + }); + + t.end(); +}); + +test('async generator functions', { skip: asyncGenFns.length === 0 }, function (t) { + var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%'); + var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%'); + var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%'); + + forEach(asyncGenFns, function (asyncGenFn) { + var fnName = asyncGenFn.name; + fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn'; + + t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%'); + t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName); + t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype'); + }); + + t.end(); +}); + +test('%ThrowTypeError%', function (t) { + var $ThrowTypeError = GetIntrinsic('%ThrowTypeError%'); + + t.equal(typeof $ThrowTypeError, 'function', 'is a function'); + t['throws']( + $ThrowTypeError, + TypeError, + '%ThrowTypeError% throws a TypeError' + ); + + t.end(); +}); + +test('allowMissing', { skip: asyncGenFns.length > 0 }, function (t) { + t['throws']( + function () { GetIntrinsic('%AsyncGeneratorPrototype%'); }, + TypeError, + 'throws when missing' + ); + + t.equal( + GetIntrinsic('%AsyncGeneratorPrototype%', true), + undefined, + 'does not throw when allowMissing' + ); + + t.end(); +}); diff --git a/live2d/node_modules/gh-pages/LICENSE b/live2d/node_modules/gh-pages/LICENSE new file mode 100644 index 0000000..44ab001 --- /dev/null +++ b/live2d/node_modules/gh-pages/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2014 Tim Schaub + +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. diff --git a/live2d/node_modules/gh-pages/bin/gh-pages-clean.js b/live2d/node_modules/gh-pages/bin/gh-pages-clean.js new file mode 100755 index 0000000..42ee06a --- /dev/null +++ b/live2d/node_modules/gh-pages/bin/gh-pages-clean.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +const ghpages = require('../lib/index.js'); + +function main() { + ghpages.clean(); +} + +if (require.main === module) { + main(); +} + +module.exports = main; diff --git a/live2d/node_modules/gh-pages/bin/gh-pages.js b/live2d/node_modules/gh-pages/bin/gh-pages.js new file mode 100755 index 0000000..98fb8ec --- /dev/null +++ b/live2d/node_modules/gh-pages/bin/gh-pages.js @@ -0,0 +1,143 @@ +#!/usr/bin/env node + +const ghpages = require('../lib/index.js'); +const program = require('commander'); +const path = require('path'); +const pkg = require('../package.json'); +const addr = require('email-addresses'); + +function publish(config) { + return new Promise((resolve, reject) => { + const basePath = path.resolve(process.cwd(), program.dist); + ghpages.publish(basePath, config, (err) => { + if (err) { + return reject(err); + } + resolve(); + }); + }); +} + +function main(args) { + return Promise.resolve().then(() => { + program + .version(pkg.version) + .option('-d, --dist ', 'Base directory for all source files') + .option( + '-s, --src ', + 'Pattern used to select which files to publish', + ghpages.defaults.src + ) + .option( + '-b, --branch ', + 'Name of the branch you are pushing to', + ghpages.defaults.branch + ) + .option( + '-e, --dest ', + 'Target directory within the destination branch (relative to the root)', + ghpages.defaults.dest + ) + .option('-a, --add', 'Only add, and never remove existing files') + .option('-x, --silent', 'Do not output the repository url') + .option( + '-m, --message ', + 'commit message', + ghpages.defaults.message + ) + .option('-g, --tag ', 'add tag to commit') + .option('--git ', 'Path to git executable', ghpages.defaults.git) + .option('-t, --dotfiles', 'Include dotfiles') + .option('-r, --repo ', 'URL of the repository you are pushing to') + .option('-p, --depth ', 'depth for clone', ghpages.defaults.depth) + .option( + '-o, --remote ', + 'The name of the remote', + ghpages.defaults.remote + ) + .option( + '-u, --user
', + 'The name and email of the user (defaults to the git config). Format is "Your Name ".' + ) + .option( + '-v, --remove ', + 'Remove files that match the given pattern ' + + '(ignored if used together with --add).', + ghpages.defaults.remove + ) + .option('-n, --no-push', 'Commit only (with no push)') + .option( + '-f, --no-history', + 'Push force new commit without parent history' + ) + .option( + '--before-add ', + 'Execute the function exported by before "git add"' + ) + .parse(args); + + let user; + if (program.user) { + const parts = addr.parseOneAddress(program.user); + if (!parts) { + throw new Error( + `Could not parse name and email from user option "${program.user}" ` + + '(format should be "Your Name ")' + ); + } + user = {name: parts.name, email: parts.address}; + } + let beforeAdd; + if (program.beforeAdd) { + const m = require(require.resolve(program.beforeAdd, { + paths: [process.cwd()], + })); + + if (typeof m === 'function') { + beforeAdd = m; + } else if (typeof m === 'object' && typeof m.default === 'function') { + beforeAdd = m.default; + } else { + throw new Error( + `Could not find function to execute before adding files in ` + + `"${program.beforeAdd}".\n ` + ); + } + } + + const config = { + repo: program.repo, + silent: !!program.silent, + branch: program.branch, + src: program.src, + dest: program.dest, + message: program.message, + tag: program.tag, + git: program.git, + depth: program.depth, + dotfiles: !!program.dotfiles, + add: !!program.add, + remove: program.remove, + remote: program.remote, + push: !!program.push, + history: !!program.history, + user: user, + beforeAdd: beforeAdd, + }; + + return publish(config); + }); +} + +if (require.main === module) { + main(process.argv) + .then(() => { + process.stdout.write('Published\n'); + }) + .catch((err) => { + process.stderr.write(`${err.message}\n`, () => process.exit(1)); + }); +} + +module.exports = main; +exports = module.exports; diff --git a/live2d/node_modules/gh-pages/lib/git.js b/live2d/node_modules/gh-pages/lib/git.js new file mode 100644 index 0000000..5f31f83 --- /dev/null +++ b/live2d/node_modules/gh-pages/lib/git.js @@ -0,0 +1,279 @@ +const cp = require('child_process'); +const fs = require('fs-extra'); +const path = require('path'); +const util = require('util'); + +/** + * @function Object() { [native code] } + * @param {number} code Error code. + * @param {string} message Error message. + */ +function ProcessError(code, message) { + const callee = arguments.callee; + Error.apply(this, [message]); + Error.captureStackTrace(this, callee); + this.code = code; + this.message = message; + this.name = callee.name; +} +util.inherits(ProcessError, Error); + +/** + * Util function for handling spawned processes as promises. + * @param {string} exe Executable. + * @param {Array} args Arguments. + * @param {string} cwd Working directory. + * @return {Promise} A promise. + */ +function spawn(exe, args, cwd) { + return new Promise((resolve, reject) => { + const child = cp.spawn(exe, args, {cwd: cwd || process.cwd()}); + const buffer = []; + child.stderr.on('data', (chunk) => { + buffer.push(chunk.toString()); + }); + child.stdout.on('data', (chunk) => { + buffer.push(chunk.toString()); + }); + child.on('close', (code) => { + const output = buffer.join(''); + if (code) { + const msg = output || 'Process failed: ' + code; + reject(new ProcessError(code, msg)); + } else { + resolve(output); + } + }); + }); +} + +/** + * Create an object for executing git commands. + * @param {string} cwd Repository directory. + * @param {string} cmd Git executable (full path if not already on path). + * @function Object() { [native code] } + */ +function Git(cwd, cmd) { + this.cwd = cwd; + this.cmd = cmd || 'git'; + this.output = ''; +} + +/** + * Execute an arbitrary git command. + * @param {Array} args Arguments (e.g. ['remote', 'update']). + * @return {Promise} A promise. The promise will be resolved with this instance + * or rejected with an error. + */ +Git.prototype.exec = function (...args) { + return spawn(this.cmd, [...args], this.cwd).then((output) => { + this.output = output; + return this; + }); +}; + +/** + * Initialize repository. + * @return {Promise} A promise. + */ +Git.prototype.init = function () { + return this.exec('init'); +}; + +/** + * Clean up unversioned files. + * @return {Promise} A promise. + */ +Git.prototype.clean = function () { + return this.exec('clean', '-f', '-d'); +}; + +/** + * Hard reset to remote/branch + * @param {string} remote Remote alias. + * @param {string} branch Branch name. + * @return {Promise} A promise. + */ +Git.prototype.reset = function (remote, branch) { + return this.exec('reset', '--hard', remote + '/' + branch); +}; + +/** + * Fetch from a remote. + * @param {string} remote Remote alias. + * @return {Promise} A promise. + */ +Git.prototype.fetch = function (remote) { + return this.exec('fetch', remote); +}; + +/** + * Checkout a branch (create an orphan if it doesn't exist on the remote). + * @param {string} remote Remote alias. + * @param {string} branch Branch name. + * @return {Promise} A promise. + */ +Git.prototype.checkout = function (remote, branch) { + const treeish = remote + '/' + branch; + return this.exec('ls-remote', '--exit-code', '.', treeish).then( + () => { + // branch exists on remote, hard reset + return this.exec('checkout', branch) + .then(() => this.clean()) + .then(() => this.reset(remote, branch)); + }, + (error) => { + if (error instanceof ProcessError && error.code === 2) { + // branch doesn't exist, create an orphan + return this.exec('checkout', '--orphan', branch); + } else { + // unhandled error + throw error; + } + } + ); +}; + +/** + * Remove all unversioned files. + * @param {string | Array} files Files argument. + * @return {Promise} A promise. + */ +Git.prototype.rm = function (files) { + if (!Array.isArray(files)) { + files = [files]; + } + return this.exec('rm', '--ignore-unmatch', '-r', '-f', ...files); +}; + +/** + * Add files. + * @param {string | Array} files Files argument. + * @return {Promise} A promise. + */ +Git.prototype.add = function (files) { + if (!Array.isArray(files)) { + files = [files]; + } + return this.exec('add', ...files); +}; + +/** + * Commit (if there are any changes). + * @param {string} message Commit message. + * @return {Promise} A promise. + */ +Git.prototype.commit = function (message) { + return this.exec('diff-index', '--quiet', 'HEAD').catch(() => + this.exec('commit', '-m', message) + ); +}; + +/** + * Add tag + * @param {string} name Name of tag. + * @return {Promise} A promise. + */ +Git.prototype.tag = function (name) { + return this.exec('tag', name); +}; + +/** + * Push a branch. + * @param {string} remote Remote alias. + * @param {string} branch Branch name. + * @param {boolean} force Force push. + * @return {Promise} A promise. + */ +Git.prototype.push = function (remote, branch, force) { + const args = ['push', '--tags', remote, branch]; + if (force) { + args.push('--force'); + } + return this.exec.apply(this, args); +}; + +/** + * Get the URL for a remote. + * @param {string} remote Remote alias. + * @return {Promise} A promise for the remote URL. + */ +Git.prototype.getRemoteUrl = function (remote) { + return this.exec('config', '--get', 'remote.' + remote + '.url') + .then((git) => { + const repo = git.output && git.output.split(/[\n\r]/).shift(); + if (repo) { + return repo; + } else { + throw new Error( + 'Failed to get repo URL from options or current directory.' + ); + } + }) + .catch((err) => { + throw new Error( + 'Failed to get remote.' + + remote + + '.url (task must either be ' + + 'run in a git repository with a configured ' + + remote + + ' remote ' + + 'or must be configured with the "repo" option).' + ); + }); +}; + +/** + * Delete ref to remove branch history + * @param {string} branch The branch name. + * @return {Promise} A promise. The promise will be resolved with this instance + * or rejected with an error. + */ +Git.prototype.deleteRef = function (branch) { + return this.exec('update-ref', '-d', 'refs/heads/' + branch); +}; + +/** + * Clone a repo into the given dir if it doesn't already exist. + * @param {string} repo Repository URL. + * @param {string} dir Target directory. + * @param {string} branch Branch name. + * @param {options} options All options. + * @return {Promise} A promise. + */ +Git.clone = function clone(repo, dir, branch, options) { + return fs.exists(dir).then((exists) => { + if (exists) { + return Promise.resolve(new Git(dir, options.git)); + } else { + return fs.mkdirp(path.dirname(path.resolve(dir))).then(() => { + const args = [ + 'clone', + repo, + dir, + '--branch', + branch, + '--single-branch', + '--origin', + options.remote, + '--depth', + options.depth, + ]; + return spawn(options.git, args) + .catch((err) => { + // try again without branch or depth options + return spawn(options.git, [ + 'clone', + repo, + dir, + '--origin', + options.remote, + ]); + }) + .then(() => new Git(dir, options.git)); + }); + } + }); +}; + +module.exports = Git; diff --git a/live2d/node_modules/gh-pages/lib/index.js b/live2d/node_modules/gh-pages/lib/index.js new file mode 100644 index 0000000..0e1312f --- /dev/null +++ b/live2d/node_modules/gh-pages/lib/index.js @@ -0,0 +1,256 @@ +const findCacheDir = require('find-cache-dir'); +const Git = require('./git.js'); +const filenamify = require('filenamify'); +const copy = require('./util.js').copy; +const getUser = require('./util.js').getUser; +const fs = require('fs-extra'); +const globby = require('globby'); +const path = require('path'); +const util = require('util'); + +const log = util.debuglog('gh-pages'); + +/** + * Get the cache directory. + * @param {string} [optPath] Optional path. + * @return {string} The full path to the cache directory. + */ +function getCacheDir(optPath) { + const dir = findCacheDir({name: 'gh-pages'}); + if (!optPath) { + return dir; + } + + return path.join(dir, filenamify(optPath)); +} +exports.getCacheDir = getCacheDir; + +function getRepo(options) { + if (options.repo) { + return Promise.resolve(options.repo); + } else { + const git = new Git(process.cwd(), options.git); + return git.getRemoteUrl(options.remote); + } +} + +exports.defaults = { + dest: '.', + add: false, + git: 'git', + depth: 1, + dotfiles: false, + branch: 'gh-pages', + remote: 'origin', + src: '**/*', + remove: '.', + push: true, + history: true, + message: 'Updates', + silent: false, +}; + +/** + * Push a git branch to a remote (pushes gh-pages by default). + * @param {string} basePath The base path. + * @param {Object} config Publish options. + * @param {Function} callback Callback. + * @return {Promise} A promise. + */ +exports.publish = function publish(basePath, config, callback) { + if (typeof config === 'function') { + callback = config; + config = {}; + } + + const options = Object.assign({}, exports.defaults, config); + + // For backward compatibility before fixing #334 + if (options.only) { + options.remove = options.only; + } + + if (!callback) { + callback = function (err) { + if (err) { + log(err.message); + } + }; + } + + function done(err) { + try { + callback(err); + } catch (err2) { + log('Publish callback threw: %s', err2.message); + } + } + + try { + if (!fs.statSync(basePath).isDirectory()) { + done(new Error('The "base" option must be an existing directory')); + return; + } + } catch (err) { + done(err); + return; + } + + const files = globby + .sync(options.src, { + cwd: basePath, + dot: options.dotfiles, + }) + .filter((file) => { + return !fs.statSync(path.join(basePath, file)).isDirectory(); + }); + + if (!Array.isArray(files) || files.length === 0) { + done( + new Error('The pattern in the "src" property didn\'t match any files.') + ); + return; + } + + let repoUrl; + let userPromise; + if (options.user) { + userPromise = Promise.resolve(options.user); + } else { + userPromise = getUser(); + } + return userPromise.then((user) => + getRepo(options) + .then((repo) => { + repoUrl = repo; + const clone = getCacheDir(repo); + log('Cloning %s into %s', repo, clone); + return Git.clone(repo, clone, options.branch, options); + }) + .then((git) => { + return git.getRemoteUrl(options.remote).then((url) => { + if (url !== repoUrl) { + const message = + 'Remote url mismatch. Got "' + + url + + '" ' + + 'but expected "' + + repoUrl + + '" in ' + + git.cwd + + '. Try running the `gh-pages-clean` script first.'; + throw new Error(message); + } + return git; + }); + }) + .then((git) => { + // only required if someone mucks with the checkout between builds + log('Cleaning'); + return git.clean(); + }) + .then((git) => { + log('Fetching %s', options.remote); + return git.fetch(options.remote); + }) + .then((git) => { + log('Checking out %s/%s ', options.remote, options.branch); + return git.checkout(options.remote, options.branch); + }) + .then((git) => { + if (!options.history) { + return git.deleteRef(options.branch); + } else { + return git; + } + }) + .then((git) => { + if (options.add) { + return git; + } + + log('Removing files'); + const files = globby + .sync(options.remove, { + cwd: path.join(git.cwd, options.dest), + }) + .map((file) => path.join(options.dest, file)); + if (files.length > 0) { + return git.rm(files); + } else { + return git; + } + }) + .then((git) => { + log('Copying files'); + return copy(files, basePath, path.join(git.cwd, options.dest)).then( + function () { + return git; + } + ); + }) + .then((git) => { + return Promise.resolve( + options.beforeAdd && options.beforeAdd(git) + ).then(() => git); + }) + .then((git) => { + log('Adding all'); + return git.add('.'); + }) + .then((git) => { + if (!user) { + return git; + } + return git.exec('config', 'user.email', user.email).then(() => { + if (!user.name) { + return git; + } + return git.exec('config', 'user.name', user.name); + }); + }) + .then((git) => { + log('Committing'); + return git.commit(options.message); + }) + .then((git) => { + if (options.tag) { + log('Tagging'); + return git.tag(options.tag).catch((error) => { + // tagging failed probably because this tag alredy exists + log(error); + log('Tagging failed, continuing'); + return git; + }); + } else { + return git; + } + }) + .then((git) => { + if (options.push) { + log('Pushing'); + return git.push(options.remote, options.branch, !options.history); + } else { + return git; + } + }) + .then( + () => done(), + (error) => { + if (options.silent) { + error = new Error( + 'Unspecified error (run without silent option for detail)' + ); + } + done(error); + } + ) + ); +}; + +/** + * Clean the cache directory. + */ +exports.clean = function clean() { + fs.removeSync(getCacheDir()); +}; diff --git a/live2d/node_modules/gh-pages/lib/util.js b/live2d/node_modules/gh-pages/lib/util.js new file mode 100644 index 0000000..24d5710 --- /dev/null +++ b/live2d/node_modules/gh-pages/lib/util.js @@ -0,0 +1,173 @@ +const path = require('path'); +const Git = require('./git.js'); +const async = require('async'); +const fs = require('fs-extra'); + +/** + * Generate a list of unique directory paths given a list of file paths. + * @param {Array} files List of file paths. + * @return {Array} List of directory paths. + */ +function uniqueDirs(files) { + const dirs = {}; + files.forEach((filepath) => { + const parts = path.dirname(filepath).split(path.sep); + let partial = parts[0] || '/'; + dirs[partial] = true; + for (let i = 1, ii = parts.length; i < ii; ++i) { + partial = path.join(partial, parts[i]); + dirs[partial] = true; + } + }); + return Object.keys(dirs); +} +exports.uniqueDirs = uniqueDirs; + +/** + * Sort function for paths. Sorter paths come first. Paths of equal length are + * sorted alphanumerically in path segment order. + * @param {string} a First path. + * @param {string} b Second path. + * @return {number} Comparison. + */ +function byShortPath(a, b) { + const aParts = a.split(path.sep); + const bParts = b.split(path.sep); + const aLength = aParts.length; + const bLength = bParts.length; + let cmp = 0; + if (aLength < bLength) { + cmp = -1; + } else if (aLength > bLength) { + cmp = 1; + } else { + let aPart, bPart; + for (let i = 0; i < aLength; ++i) { + aPart = aParts[i]; + bPart = bParts[i]; + if (aPart < bPart) { + cmp = -1; + break; + } else if (aPart > bPart) { + cmp = 1; + break; + } + } + } + return cmp; +} +exports.byShortPath = byShortPath; + +/** + * Generate a list of directories to create given a list of file paths. + * @param {Array} files List of file paths. + * @return {Array} List of directory paths ordered by path length. + */ +function dirsToCreate(files) { + return uniqueDirs(files).sort(byShortPath); +} +exports.dirsToCreate = dirsToCreate; + +/** + * Copy a file. + * @param {Object} obj Object with src and dest properties. + * @param {function(Error)} callback Callback + */ +function copyFile(obj, callback) { + let called = false; + function done(err) { + if (!called) { + called = true; + callback(err); + } + } + + const read = fs.createReadStream(obj.src); + read.on('error', (err) => { + done(err); + }); + + const write = fs.createWriteStream(obj.dest); + write.on('error', (err) => { + done(err); + }); + write.on('close', () => { + done(); + }); + + read.pipe(write); +} +exports.copyFile = copyFile; + +/** + * Make directory, ignoring errors if directory already exists. + * @param {string} path Directory path. + * @param {function(Error)} callback Callback. + */ +function makeDir(path, callback) { + fs.mkdir(path, (err) => { + if (err) { + // check if directory exists + fs.stat(path, (err2, stat) => { + if (err2 || !stat.isDirectory()) { + callback(err); + } else { + callback(); + } + }); + } else { + callback(); + } + }); +} + +/** + * Copy a list of files. + * @param {Array} files Files to copy. + * @param {string} base Base directory. + * @param {string} dest Destination directory. + * @return {Promise} A promise. + */ +exports.copy = function (files, base, dest) { + return new Promise((resolve, reject) => { + const pairs = []; + const destFiles = []; + files.forEach((file) => { + const src = path.resolve(base, file); + const relative = path.relative(base, src); + const target = path.join(dest, relative); + pairs.push({ + src: src, + dest: target, + }); + destFiles.push(target); + }); + + async.eachSeries(dirsToCreate(destFiles), makeDir, (err) => { + if (err) { + return reject(err); + } + async.each(pairs, copyFile, (err) => { + if (err) { + return reject(err); + } else { + return resolve(); + } + }); + }); + }); +}; + +exports.getUser = function (cwd) { + return Promise.all([ + new Git(cwd).exec('config', 'user.name'), + new Git(cwd).exec('config', 'user.email'), + ]) + .then((results) => { + return {name: results[0].output.trim(), email: results[1].output.trim()}; + }) + .catch((err) => { + // git config exits with 1 if name or email is not set + return null; + }); +}; diff --git a/live2d/node_modules/gh-pages/package.json b/live2d/node_modules/gh-pages/package.json new file mode 100644 index 0000000..4531a5e --- /dev/null +++ b/live2d/node_modules/gh-pages/package.json @@ -0,0 +1,64 @@ +{ + "name": "gh-pages", + "version": "4.0.0", + "description": "Publish to a gh-pages branch on GitHub (or any other branch on any other remote)", + "keywords": [ + "git", + "gh-pages", + "github" + ], + "author": { + "name": "Tim Schaub", + "url": "http://tschaub.net/" + }, + "license": "MIT", + "homepage": "https://github.com/tschaub/gh-pages", + "repository": { + "type": "git", + "url": "git://github.com/tschaub/gh-pages.git" + }, + "bugs": { + "url": "https://github.com/tschaub/gh-pages/issues" + }, + "main": "lib/index.js", + "scripts": { + "lint": "eslint lib test bin plugin.js", + "pretest": "npm run lint", + "test": "mocha --recursive test" + }, + "files": [ + "lib", + "bin" + ], + "engines": { + "node": ">=10" + }, + "dependencies": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^8.1.0", + "globby": "^6.1.0" + }, + "devDependencies": { + "chai": "^4.3.6", + "dir-compare": "^1.8.0", + "eslint": "^8.15.0", + "eslint-config-tschaub": "^14.0.0", + "mocha": "^10.0.0", + "sinon": "^14.0.0", + "tmp": "^0.2.1" + }, + "bin": { + "gh-pages": "bin/gh-pages.js", + "gh-pages-clean": "bin/gh-pages-clean.js" + }, + "eslintConfig": { + "extends": "tschaub", + "rules": { + "jsdoc/check-examples": "off" + } + } +} diff --git a/live2d/node_modules/gh-pages/readme.md b/live2d/node_modules/gh-pages/readme.md new file mode 100644 index 0000000..6cdb9de --- /dev/null +++ b/live2d/node_modules/gh-pages/readme.md @@ -0,0 +1,437 @@ + +# gh-pages + +Publish files to a `gh-pages` branch on GitHub (or any other branch anywhere else). + +## Getting Started + +```shell +npm install gh-pages --save-dev +``` + +This module requires Git >= 1.9 and Node >= 12. + +## Basic Usage + +```js +var ghpages = require('gh-pages'); + +ghpages.publish('dist', function(err) {}); +``` + + +## `publish` + +```js +ghpages.publish(dir, callback); +// or... +ghpages.publish(dir, options, callback); +``` + +Calling this function will create a temporary clone of the current repository, create a `gh-pages` branch if one doesn't already exist, copy over all files from the base path, or only those that match patterns from the optional `src` configuration, commit all changes, and push to the `origin` remote. + +If a `gh-pages` branch already exists, it will be updated with all commits from the remote before adding any commits from the provided `src` files. + +**Note** that any files in the `gh-pages` branch that are *not* in the `src` files **will be removed**. See the [`add` option](#optionsadd) if you don't want any of the existing files removed. + + +### `dir` +* type: `string` + +The base directory for all source files (those listed in the `src` config property). + +Example use: + +```js +/** + * Given the following directory structure: + * + * dist/ + * index.html + * js/ + * site.js + * + * The usage below will create a `gh-pages` branch that looks like this: + * + * index.html + * js/ + * site.js + * + */ +ghpages.publish('dist', callback); +``` + + +### Options + +The default options work for simple cases. The options described below let you push to alternate branches, customize your commit messages, and more. + + +#### options.src + * type: `string|Array` + * default: `'**/*'` + +The [minimatch](https://github.com/isaacs/minimatch) pattern or array of patterns used to select which files should be published. + + +#### options.branch + * type: `string` + * default: `'gh-pages'` + * `-b | --branch ` + +The name of the branch you'll be pushing to. The default uses GitHub's `gh-pages` branch, but this can be configured to push to any branch on any remote. + +Example use of the `branch` option: + +```js +/** + * This task pushes to the `master` branch of the configured `repo`. + */ +ghpages.publish('dist', { + branch: 'master', + repo: 'https://example.com/other/repo.git' +}, callback); +``` + + +#### options.dest + * type: `string` + * default: `'.'` + +The destination folder within the destination branch. By default, all files are published to the root of the repository. + +Example use of the `dest` option: + +```js +/** + * Place content in the static/project subdirectory of the target + * branch. + */ +ghpages.publish('dist', { + dest: 'static/project' +}, callback); +``` + +#### options.dotfiles + * type: `boolean` + * default: `false` + +Include dotfiles. By default, files starting with `.` are ignored unless they are explicitly provided in the `src` array. If you want to also include dotfiles that otherwise match your `src` patterns, set `dotfiles: true` in your options. + +Example use of the `dotfiles` option: + +```js +/** + * The usage below will push dotfiles (directories and files) + * that otherwise match the `src` pattern. + */ +ghpages.publish('dist', {dotfiles: true}, callback); +``` + + +#### options.add + * type: `boolean` + * default: `false` + +Only add, and never remove existing files. By default, existing files in the target branch are removed before adding the ones from your `src` config. If you want the task to add new `src` files but leave existing ones untouched, set `add: true` in your options. + +Example use of the `add` option: + +```js +/** + * The usage below will only add files to the `gh-pages` branch, never removing + * any existing files (even if they don't exist in the `src` config). + */ +ghpages.publish('dist', {add: true}, callback); +``` + + +#### options.repo + * type: `string` + * default: url for the origin remote of the current dir (assumes a git repository) + * `-r | --repo ` + +By default, `gh-pages` assumes that the current working directory is a git repository, and that you want to push changes to the `origin` remote. + +If instead your script is not in a git repository, or if you want to push to another repository, you can provide the repository URL in the `repo` option. + +Example use of the `repo` option: + +```js +/** + * If the current directory is not a clone of the repository you want to work + * with, set the URL for the repository in the `repo` option. This usage will + * push all files in the `src` config to the `gh-pages` branch of the `repo`. + */ +ghpages.publish('dist', { + repo: 'https://example.com/other/repo.git' +}, callback); +``` + + +#### options.remote + * type: `string` + * default: `'origin'` + +The name of the remote you'll be pushing to. The default is your `'origin'` remote, but this can be configured to push to any remote. + +Example use of the `remote` option: + +```js +/** + * This task pushes to the `gh-pages` branch of of your `upstream` remote. + */ +ghpages.publish('dist', { + remote: 'upstream' +}, callback); +``` + + +#### options.tag + * type: `string` + * default: `''` + +Create a tag after committing changes on the target branch. By default, no tag is created. To create a tag, provide the tag name as the option value. + + +#### options.message + * type: `string` + * default: `'Updates'` + +The commit message for all commits. + +Example use of the `message` option: + +```js +/** + * This adds commits with a custom message. + */ +ghpages.publish('dist', { + message: 'Auto-generated commit' +}, callback); +``` + + +#### options.user + * type: `Object` + * default: `null` + +If you are running the `gh-pages` task in a repository without a `user.name` or `user.email` git config properties (or on a machine without these global config properties), you must provide user info before git allows you to commit. The `options.user` object accepts `name` and `email` string values to identify the committer. + +Example use of the `user` option: + +```js +ghpages.publish('dist', { + user: { + name: 'Joe Code', + email: 'coder@example.com' + } +}, callback); +``` + +#### options.remove + * type: `string` + * default: `'.'` + +Removes files that match the given pattern (Ignored if used together with +`--add`). By default, `gh-pages` removes everything inside the target branch +auto-generated directory before copying the new files from `dir`. + +Example use of the `remove` option: + +```js +ghpages.publish('dist', { + remove: "*.json" +}, callback); +``` + + +#### options.push + * type: `boolean` + * default: `true` + +Push branch to remote. To commit only (with no push) set to `false`. + +Example use of the `push` option: + +```js +ghpages.publish('dist', {push: false}, callback); +``` + + +#### options.history + * type: `boolean` + * default: `true` + +Push force new commit without parent history. + +Example use of the `history` option: + +```js +ghpages.publish('dist', {history: false}, callback); +``` + + +#### options.silent + * type: `boolean` + * default: `false` + +Avoid showing repository URLs or other information in errors. + +Example use of the `silent` option: + +```js +/** + * This configuration will avoid logging the GH_TOKEN if there is an error. + */ +ghpages.publish('dist', { + repo: 'https://' + process.env.GH_TOKEN + '@github.com/user/private-repo.git', + silent: true +}, callback); +``` + + +#### options.beforeAdd + * type: `function` + * default: `null` + +Custom callback that is executed right before `git add`. + +The CLI expects a file exporting the beforeAdd function + +```bash +gh-pages --before-add ./cleanup.js +``` + +Example use of the `beforeAdd` option: + +```js +/** + * beforeAdd makes most sense when `add` option is active + * Assuming we want to keep everything on the gh-pages branch + * but remove just `some-outdated-file.txt` + */ +ghpages.publish('dist', { + add: true, + async beforeAdd(git) { + return git.rm('./some-outdated-file.txt'); + } +}, callback); +``` + + +#### options.git + * type: `string` + * default: `'git'` + +Your `git` executable. + +Example use of the `git` option: + +```js +/** + * If `git` is not on your path, provide the path as shown below. + */ +ghpages.publish('dist', { + git: '/path/to/git' +}, callback); +``` + +## Command Line Utility + +Installing the package creates a `gh-pages` command line utility. Run `gh-pages --help` to see a list of supported options. + +With a local install of `gh-pages`, you can set up a package script with something like the following: + +```shell +"scripts": { + "deploy": "gh-pages -d dist" +} +``` + +And then to publish everything from your `dist` folder to your `gh-pages` branch, you'd run this: + +```shell +npm run deploy +``` + +## Debugging + +To get additional output from the `gh-pages` script, set `NODE_DEBUG=gh-pages`. For example: + +```shell +NODE_DEBUG=gh-pages npm run deploy +``` + +## Dependencies + +Note that this plugin requires Git 1.9 or higher (because it uses the `--exit-code` option for `git ls-remote`). If you'd like to see this working with earlier versions of Git, please [open an issue](https://github.com/tschaub/gh-pages/issues). + +![Test Status](https://github.com/tschaub/gh-pages/workflows/Test/badge.svg) + +## Tips + +### when get error `branch already exists` +``` +{ ProcessError: fatal: A branch named 'gh-pages' already exists. + + at ChildProcess. (~/node_modules/gh-pages/lib/git.js:42:16) + at ChildProcess.emit (events.js:180:13) + at maybeClose (internal/child_process.js:936:16) + at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) + code: 128, + message: 'fatal: A branch named \'gh-pages\' already exists.\n', + name: 'ProcessError' } + ``` + +The `gh-pages` module writes temporary files to a `node_modules/.cache/gh-pages` directory. The location of this directory can be customized by setting the `CACHE_DIR` environment variable. + +If `gh-pages` fails, you may find that you need to manually clean up the cache directory. To remove the cache directory, run `node_modules/gh-pages/bin/gh-pages-clean` or remove `node_modules/.cache/gh-pages`. + +### Deploying to github pages with custom domain + +Modify the deployment line to your deploy script if you use custom domain. This will prevent the deployment from removing the domain settings in GitHub. + +``` +echo 'your_cutom_domain.online' > ./build/CNAME && gh-pages -d build" +``` + +### Deploying with GitHub Actions + +In order to deploy with GitHub Actions, you will need to define a user and set the git repository for the process. See the example step below + +```yaml +- name: Deploy with gh-pages + run: | + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + npx gh-pages -d build -u "github-actions-bot " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +The `secrets.GITHUB_TOKEN` is provided automatically as part of the GitHub Action and does not require any further configuration, but simply needs to be passed in as an environmental variable to the step. `GITHUB_REPOSITORY` is the owner and repository name and is also passed in automatically, but does not need to be added to the `env` list. + +See [Issue #345](https://github.com/tschaub/gh-pages/issues/345) for more information + +#### Deploying with GitHub Actions and a named script + +If you are using a named script in the `package.json` file to deploy, you will need to ensure you pass the variables properly to the wrapped `gh-pages` script. Given the `package.json` script below: + +```json +"scripts": { + "deploy": "gh-pages -d build" +} +``` + +You will need to utilize the `--` option to pass any additional arguments: + +```yaml +- name: Deploy with gh-pages + run: | + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + npm run deploy -- -u "github-actions-bot " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +See [Pull Request #368](https://github.com/tschaub/gh-pages/pull/368) for more information. diff --git a/live2d/node_modules/glob/LICENSE b/live2d/node_modules/glob/LICENSE new file mode 100644 index 0000000..42ca266 --- /dev/null +++ b/live2d/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. + +## Glob Logo + +Glob's logo created by Tanya Brassie , licensed +under a Creative Commons Attribution-ShareAlike 4.0 International License +https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/live2d/node_modules/glob/README.md b/live2d/node_modules/glob/README.md new file mode 100644 index 0000000..83f0c83 --- /dev/null +++ b/live2d/node_modules/glob/README.md @@ -0,0 +1,378 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![a fun cartoon logo made of glob characters](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. +* `fs` File-system object with Node's `fs` API. By default, the built-in + `fs` module will be used. Set to a volume provided by a library like + `memfs` to avoid using the "real" file-system. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/live2d/node_modules/glob/common.js b/live2d/node_modules/glob/common.js new file mode 100644 index 0000000..424c46e --- /dev/null +++ b/live2d/node_modules/glob/common.js @@ -0,0 +1,238 @@ +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var fs = require("fs") +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasort (a, b) { + return a.localeCompare(b, 'en') +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + self.fs = options.fs || fs + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + // always treat \ in patterns as escapes, not path separators + options.allowWindowsEscape = false + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/live2d/node_modules/glob/glob.js b/live2d/node_modules/glob/glob.js new file mode 100644 index 0000000..37a4d7e --- /dev/null +++ b/live2d/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + self.fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + self.fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + self.fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return self.fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/live2d/node_modules/glob/package.json b/live2d/node_modules/glob/package.json new file mode 100644 index 0000000..5940b64 --- /dev/null +++ b/live2d/node_modules/glob/package.json @@ -0,0 +1,55 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "glob", + "description": "a little globber", + "version": "7.2.3", + "publishConfig": { + "tag": "v7-legacy" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "memfs": "^3.2.0", + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^15.0.6", + "tick": "0.0.6" + }, + "tap": { + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "jobs": 1 + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "node benchclean.js" + }, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/live2d/node_modules/glob/sync.js b/live2d/node_modules/glob/sync.js new file mode 100644 index 0000000..2c4f480 --- /dev/null +++ b/live2d/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert.ok(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = this.fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/live2d/node_modules/globby/index.js b/live2d/node_modules/globby/index.js new file mode 100644 index 0000000..587a0fd --- /dev/null +++ b/live2d/node_modules/globby/index.js @@ -0,0 +1,88 @@ +'use strict'; +var Promise = require('pinkie-promise'); +var arrayUnion = require('array-union'); +var objectAssign = require('object-assign'); +var glob = require('glob'); +var pify = require('pify'); + +var globP = pify(glob, Promise).bind(glob); + +function isNegative(pattern) { + return pattern[0] === '!'; +} + +function isString(value) { + return typeof value === 'string'; +} + +function assertPatternsInput(patterns) { + if (!patterns.every(isString)) { + throw new TypeError('patterns must be a string or an array of strings'); + } +} + +function generateGlobTasks(patterns, opts) { + patterns = [].concat(patterns); + assertPatternsInput(patterns); + + var globTasks = []; + + opts = objectAssign({ + cache: Object.create(null), + statCache: Object.create(null), + realpathCache: Object.create(null), + symlinks: Object.create(null), + ignore: [] + }, opts); + + patterns.forEach(function (pattern, i) { + if (isNegative(pattern)) { + return; + } + + var ignore = patterns.slice(i).filter(isNegative).map(function (pattern) { + return pattern.slice(1); + }); + + globTasks.push({ + pattern: pattern, + opts: objectAssign({}, opts, { + ignore: opts.ignore.concat(ignore) + }) + }); + }); + + return globTasks; +} + +module.exports = function (patterns, opts) { + var globTasks; + + try { + globTasks = generateGlobTasks(patterns, opts); + } catch (err) { + return Promise.reject(err); + } + + return Promise.all(globTasks.map(function (task) { + return globP(task.pattern, task.opts); + })).then(function (paths) { + return arrayUnion.apply(null, paths); + }); +}; + +module.exports.sync = function (patterns, opts) { + var globTasks = generateGlobTasks(patterns, opts); + + return globTasks.reduce(function (matches, task) { + return arrayUnion(matches, glob.sync(task.pattern, task.opts)); + }, []); +}; + +module.exports.generateGlobTasks = generateGlobTasks; + +module.exports.hasMagic = function (patterns, opts) { + return [].concat(patterns).some(function (pattern) { + return glob.hasMagic(pattern, opts); + }); +}; diff --git a/live2d/node_modules/globby/license b/live2d/node_modules/globby/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/globby/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/globby/package.json b/live2d/node_modules/globby/package.json new file mode 100644 index 0000000..9251488 --- /dev/null +++ b/live2d/node_modules/globby/package.json @@ -0,0 +1,69 @@ +{ + "name": "globby", + "version": "6.1.0", + "description": "Extends `glob` with support for multiple patterns and exposes a Promise API", + "license": "MIT", + "repository": "sindresorhus/globby", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "bench": "npm update glob-stream && matcha bench.js", + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "all", + "array", + "directories", + "dirs", + "expand", + "files", + "filesystem", + "filter", + "find", + "fnmatch", + "folders", + "fs", + "glob", + "globbing", + "globs", + "gulpfriendly", + "match", + "matcher", + "minimatch", + "multi", + "multiple", + "paths", + "pattern", + "patterns", + "traverse", + "util", + "utility", + "wildcard", + "wildcards", + "promise" + ], + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "glob-stream": "gulpjs/glob-stream#master", + "globby": "sindresorhus/globby#master", + "matcha": "^0.7.0", + "rimraf": "^2.2.8", + "xo": "^0.16.0" + } +} diff --git a/live2d/node_modules/globby/readme.md b/live2d/node_modules/globby/readme.md new file mode 100644 index 0000000..e10a488 --- /dev/null +++ b/live2d/node_modules/globby/readme.md @@ -0,0 +1,88 @@ +# globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby) + +> Extends [glob](https://github.com/isaacs/node-glob) with support for multiple patterns and exposes a Promise API + + +## Install + +``` +$ npm install --save globby +``` + + +## Usage + +``` +├── unicorn +├── cake +└── rainbow +``` + +```js +const globby = require('globby'); + +globby(['*', '!cake']).then(paths => { + console.log(paths); + //=> ['unicorn', 'rainbow'] +}); +``` + + +## API + +### globby(patterns, [options]) + +Returns a Promise for an array of matching paths. + +### globby.sync(patterns, [options]) + +Returns an array of matching paths. + +### globby.generateGlobTasks(patterns, [options]) + +Returns an array of objects in the format `{ pattern: string, opts: Object }`, which can be passed as arguments to [`node-glob`](https://github.com/isaacs/node-glob). This is useful for other globbing-related packages. + +Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration. + +### globby.hasMagic(patterns, [options]) + +Returns a `boolean` of whether there are any special glob characters in the `patterns`. + +Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, then that is considered magical, unless `nobrace: true` is set. + +#### patterns + +Type: `string` `Array` + +See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage). + +#### options + +Type: `Object` + +See the `node-glob` [options](https://github.com/isaacs/node-glob#options). + + +## Globbing patterns + +Just a quick overview. + +- `*` matches any number of characters, but not `/` +- `?` matches a single character, but not `/` +- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part +- `{}` allows for a comma-separated list of "or" expressions +- `!` at the beginning of a pattern will negate the match + +[Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/master/test.js) + + +## Related + +- [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem +- [glob-stream](https://github.com/wearefractal/glob-stream) - Streaming alternative +- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/gopd/.eslintrc b/live2d/node_modules/gopd/.eslintrc new file mode 100644 index 0000000..e2550c0 --- /dev/null +++ b/live2d/node_modules/gopd/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-style": [2, "declaration"], + "id-length": 0, + "multiline-comment-style": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/live2d/node_modules/gopd/.github/FUNDING.yml b/live2d/node_modules/gopd/.github/FUNDING.yml new file mode 100644 index 0000000..94a44a8 --- /dev/null +++ b/live2d/node_modules/gopd/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/gopd +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/gopd/CHANGELOG.md b/live2d/node_modules/gopd/CHANGELOG.md new file mode 100644 index 0000000..f111eb1 --- /dev/null +++ b/live2d/node_modules/gopd/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01 + +### Commits + +- [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f) + +## v1.0.0 - 2022-11-01 + +### Commits + +- Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea) +- Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe) +- [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119) +- npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582) +- [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709) +- [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002) +- [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb) +- Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b) diff --git a/live2d/node_modules/gopd/LICENSE b/live2d/node_modules/gopd/LICENSE new file mode 100644 index 0000000..6abfe14 --- /dev/null +++ b/live2d/node_modules/gopd/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jordan Harband + +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. diff --git a/live2d/node_modules/gopd/README.md b/live2d/node_modules/gopd/README.md new file mode 100644 index 0000000..784e56a --- /dev/null +++ b/live2d/node_modules/gopd/README.md @@ -0,0 +1,40 @@ +# gopd [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation. + +## Usage + +```javascript +var gOPD = require('gopd'); +var assert = require('assert'); + +if (gOPD) { + assert.equal(typeof gOPD, 'function', 'descriptors supported'); + // use gOPD like Object.getOwnPropertyDescriptor here +} else { + assert.ok(!gOPD, 'descriptors not supported'); +} +``` + +[package-url]: https://npmjs.org/package/gopd +[npm-version-svg]: https://versionbadg.es/ljharb/gopd.svg +[deps-svg]: https://david-dm.org/ljharb/gopd.svg +[deps-url]: https://david-dm.org/ljharb/gopd +[dev-deps-svg]: https://david-dm.org/ljharb/gopd/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/gopd#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/gopd.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/gopd.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/gopd.svg +[downloads-url]: https://npm-stat.com/charts.html?package=gopd +[codecov-image]: https://codecov.io/gh/ljharb/gopd/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/gopd/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/gopd +[actions-url]: https://github.com/ljharb/gopd/actions diff --git a/live2d/node_modules/gopd/index.js b/live2d/node_modules/gopd/index.js new file mode 100644 index 0000000..fb6d3bb --- /dev/null +++ b/live2d/node_modules/gopd/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; diff --git a/live2d/node_modules/gopd/package.json b/live2d/node_modules/gopd/package.json new file mode 100644 index 0000000..d5e1fa4 --- /dev/null +++ b/live2d/node_modules/gopd/package.json @@ -0,0 +1,71 @@ +{ + "name": "gopd", + "version": "1.0.1", + "description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/gopd.git" + }, + "keywords": [ + "ecmascript", + "javascript", + "getownpropertydescriptor", + "property", + "descriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/gopd/issues" + }, + "homepage": "https://github.com/ljharb/gopd#readme", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.1", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/live2d/node_modules/gopd/test/index.js b/live2d/node_modules/gopd/test/index.js new file mode 100644 index 0000000..0376bfb --- /dev/null +++ b/live2d/node_modules/gopd/test/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var test = require('tape'); +var gOPD = require('../'); + +test('gOPD', function (t) { + t.test('supported', { skip: !gOPD }, function (st) { + st.equal(typeof gOPD, 'function', 'is a function'); + + var obj = { x: 1 }; + st.ok('x' in obj, 'property exists'); + + var desc = gOPD(obj, 'x'); + st.deepEqual( + desc, + { + configurable: true, + enumerable: true, + value: 1, + writable: true + }, + 'descriptor is as expected' + ); + + st.end(); + }); + + t.test('not supported', { skip: gOPD }, function (st) { + st.notOk(gOPD, 'is falsy'); + + st.end(); + }); + + t.end(); +}); diff --git a/live2d/node_modules/graceful-fs/LICENSE b/live2d/node_modules/graceful-fs/LICENSE new file mode 100644 index 0000000..e906a25 --- /dev/null +++ b/live2d/node_modules/graceful-fs/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. diff --git a/live2d/node_modules/graceful-fs/README.md b/live2d/node_modules/graceful-fs/README.md new file mode 100644 index 0000000..82d6e4d --- /dev/null +++ b/live2d/node_modules/graceful-fs/README.md @@ -0,0 +1,143 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over [fs module](https://nodejs.org/api/fs.html) + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. + +## USAGE + +```javascript +// use just like fs +var fs = require('graceful-fs') + +// now go and do stuff with it... +fs.readFile('some-file-or-whatever', (err, data) => { + // Do stuff here. +}) +``` + +## Sync methods + +This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync +methods. If you use sync methods which open file descriptors then you are +responsible for dealing with any errors. + +This is a known limitation, not a bug. + +## Global Patching + +If you want to patch the global fs module (or any other fs-like +module) you can do this: + +```javascript +// Make sure to read the caveat below. +var realFs = require('fs') +var gracefulFs = require('graceful-fs') +gracefulFs.gracefulify(realFs) +``` + +This should only ever be done at the top-level application layer, in +order to delay on EMFILE errors from any fs-using dependencies. You +should **not** do this in a library, because it can cause unexpected +delays in other parts of the program. + +## Changes + +This module is fairly stable at this point, and used by a lot of +things. That being said, because it implements a subtle behavior +change in a core part of the node API, even modest changes can be +extremely breaking, and the versioning is thus biased towards +bumping the major when in doubt. + +The main change between major versions has been switching between +providing a fully-patched `fs` module vs monkey-patching the node core +builtin, and the approach by which a non-monkey-patched `fs` was +created. + +The goal is to trade `EMFILE` errors for slower fs operations. So, if +you try to open a zillion files, rather than crashing, `open` +operations will be queued up and wait for something else to `close`. + +There are advantages to each approach. Monkey-patching the fs means +that no `EMFILE` errors can possibly occur anywhere in your +application, because everything is using the same core `fs` module, +which is patched. However, it can also obviously cause undesirable +side-effects, especially if the module is loaded multiple times. + +Implementing a separate-but-identical patched `fs` module is more +surgical (and doesn't run the risk of patching multiple times), but +also imposes the challenge of keeping in sync with the core module. + +The current approach loads the `fs` module, and then creates a +lookalike object that has all the same methods, except a few that are +patched. It is safe to use in all versions of Node from 0.8 through +7.0. + +### v4 + +* Do not monkey-patch the fs module. This module may now be used as a + drop-in dep, and users can opt into monkey-patching the fs builtin + if their app requires it. + +### v3 + +* Monkey-patch fs, because the eval approach no longer works on recent + node. +* fixed possible type-error throw if rename fails on windows +* verify that we *never* get EMFILE errors +* Ignore ENOSYS from chmod/chown +* clarify that graceful-fs must be used as a drop-in + +### v2.1.0 + +* Use eval rather than monkey-patching fs. +* readdir: Always sort the results +* win32: requeue a file if error has an OK status + +### v2.0 + +* A return to monkey patching +* wrap process.cwd + +### v1.1 + +* wrap readFile +* Wrap fs.writeFile. +* readdir protection +* Don't clobber the fs builtin +* Handle fs.read EAGAIN errors by trying again +* Expose the curOpen counter +* No-op lchown/lchmod if not implemented +* fs.rename patch only for win32 +* Patch fs.rename to handle AV software on Windows +* Close #4 Chown should not fail on einval or eperm if non-root +* Fix isaacs/fstream#1 Only wrap fs one time +* Fix #3 Start at 1024 max files, then back off on EMFILE +* lutimes that doens't blow up on Linux +* A full on-rewrite using a queue instead of just swallowing the EMFILE error +* Wrap Read/Write streams as well + +### 1.0 + +* Update engines for node 0.6 +* Be lstat-graceful on Windows +* first diff --git a/live2d/node_modules/graceful-fs/clone.js b/live2d/node_modules/graceful-fs/clone.js new file mode 100644 index 0000000..dff3cc8 --- /dev/null +++ b/live2d/node_modules/graceful-fs/clone.js @@ -0,0 +1,23 @@ +'use strict' + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} diff --git a/live2d/node_modules/graceful-fs/graceful-fs.js b/live2d/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 0000000..8d5b89e --- /dev/null +++ b/live2d/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,448 @@ +var fs = require('fs') +var polyfills = require('./polyfills.js') +var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + +var util = require('util') + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + + return go$readdir(path, options, cb) + + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + } + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} diff --git a/live2d/node_modules/graceful-fs/legacy-streams.js b/live2d/node_modules/graceful-fs/legacy-streams.js new file mode 100644 index 0000000..d617b50 --- /dev/null +++ b/live2d/node_modules/graceful-fs/legacy-streams.js @@ -0,0 +1,118 @@ +var Stream = require('stream').Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} diff --git a/live2d/node_modules/graceful-fs/package.json b/live2d/node_modules/graceful-fs/package.json new file mode 100644 index 0000000..87babf0 --- /dev/null +++ b/live2d/node_modules/graceful-fs/package.json @@ -0,0 +1,53 @@ +{ + "name": "graceful-fs", + "description": "A drop-in replacement for fs, making various improvements.", + "version": "4.2.11", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-graceful-fs" + }, + "main": "graceful-fs.js", + "directories": { + "test": "test" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "nyc --silent node test.js | tap -c -", + "posttest": "nyc report" + }, + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "devDependencies": { + "import-fresh": "^2.0.0", + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^16.3.4" + }, + "files": [ + "fs.js", + "graceful-fs.js", + "legacy-streams.js", + "polyfills.js", + "clone.js" + ], + "tap": { + "reporter": "classic" + } +} diff --git a/live2d/node_modules/graceful-fs/polyfills.js b/live2d/node_modules/graceful-fs/polyfills.js new file mode 100644 index 0000000..453f1a9 --- /dev/null +++ b/live2d/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,355 @@ +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (fs.chown && !fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else if (fs.futimes) { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} diff --git a/live2d/node_modules/has-property-descriptors/.eslintrc b/live2d/node_modules/has-property-descriptors/.eslintrc new file mode 100644 index 0000000..2fcc002 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": ["GetIntrinsic"], + }], + }, +} diff --git a/live2d/node_modules/has-property-descriptors/.github/FUNDING.yml b/live2d/node_modules/has-property-descriptors/.github/FUNDING.yml new file mode 100644 index 0000000..817aacf --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-property-descriptors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/has-property-descriptors/.nycrc b/live2d/node_modules/has-property-descriptors/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/has-property-descriptors/CHANGELOG.md b/live2d/node_modules/has-property-descriptors/CHANGELOG.md new file mode 100644 index 0000000..19c8a95 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/CHANGELOG.md @@ -0,0 +1,35 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.1...v1.0.2) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`f93a8c8`](https://github.com/inspect-js/has-property-descriptors/commit/f93a8c85eba70cbceab500f2619fb5cce73a1805) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`42b0c9d`](https://github.com/inspect-js/has-property-descriptors/commit/42b0c9d1c23e747755f0f2924923c418ea34a9ee) +- [Deps] update `get-intrinsic` [`35e9b46`](https://github.com/inspect-js/has-property-descriptors/commit/35e9b46a7f14331bf0de98b644dd803676746037) + +## [v1.0.1](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.0...v1.0.1) - 2023-10-20 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`5bbf4da`](https://github.com/inspect-js/has-property-descriptors/commit/5bbf4dae1b58950d87bb3af508bee7513e640868) +- [actions] update rebase action to use reusable workflow [`3a5585b`](https://github.com/inspect-js/has-property-descriptors/commit/3a5585bf74988f71a8f59e67a07d594e62c51fd8) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e5c1212`](https://github.com/inspect-js/has-property-descriptors/commit/e5c1212048a8fda549794c47863724ca60b89cae) +- [Dev Deps] update `aud`, `tape` [`e942917`](https://github.com/inspect-js/has-property-descriptors/commit/e942917b6c2f7c090d5623048989cf20d0834ebf) +- [Deps] update `get-intrinsic` [`f4a44ec`](https://github.com/inspect-js/has-property-descriptors/commit/f4a44ec6d94146fa6c550d3c15c31a2062c83ef4) +- [Deps] update `get-intrinsic` [`eeb275b`](https://github.com/inspect-js/has-property-descriptors/commit/eeb275b473e5d72ca843b61ca25cfcb06a5d4300) + +## v1.0.0 - 2022-04-14 + +### Commits + +- Initial implementation, tests [`303559f`](https://github.com/inspect-js/has-property-descriptors/commit/303559f2a72dfe7111573a1aec475ed4a184c35a) +- Initial commit [`3a7ca2d`](https://github.com/inspect-js/has-property-descriptors/commit/3a7ca2dc49f1fff0279a28bb16265e7615e14749) +- read me [`dd73dce`](https://github.com/inspect-js/has-property-descriptors/commit/dd73dce09d89d0f7a4a6e3b1e562a506f979a767) +- npm init [`c1e6557`](https://github.com/inspect-js/has-property-descriptors/commit/c1e655779de632d68cb944c50da6b71bcb7b8c85) +- Only apps should have lockfiles [`e72f7c6`](https://github.com/inspect-js/has-property-descriptors/commit/e72f7c68de534b2d273ee665f8b18d4ecc7f70b0) diff --git a/live2d/node_modules/has-property-descriptors/LICENSE b/live2d/node_modules/has-property-descriptors/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +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. diff --git a/live2d/node_modules/has-property-descriptors/README.md b/live2d/node_modules/has-property-descriptors/README.md new file mode 100644 index 0000000..d81fbd9 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/README.md @@ -0,0 +1,43 @@ +# has-property-descriptors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD. + +## Example + +```js +var hasPropertyDescriptors = require('has-property-descriptors'); +var assert = require('assert'); + +assert.equal(hasPropertyDescriptors(), true); // will be `false` in IE 6-8, and ES5 engines + +// Arrays can not have their length `[[Defined]]` in some engines +assert.equal(hasPropertyDescriptors.hasArrayLengthDefineBug(), false); // will be `true` in Firefox 4-22, and node v0.6 +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-property-descriptors +[npm-version-svg]: https://versionbadg.es/inspect-js/has-property-descriptors.svg +[deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors.svg +[deps-url]: https://david-dm.org/inspect-js/has-property-descriptors +[dev-deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-property-descriptors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-property-descriptors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-property-descriptors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-property-descriptors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-property-descriptors +[codecov-image]: https://codecov.io/gh/inspect-js/has-property-descriptors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-property-descriptors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-property-descriptors +[actions-url]: https://github.com/inspect-js/has-property-descriptors/actions diff --git a/live2d/node_modules/has-property-descriptors/index.js b/live2d/node_modules/has-property-descriptors/index.js new file mode 100644 index 0000000..0480437 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + return !!$defineProperty; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!$defineProperty) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; diff --git a/live2d/node_modules/has-property-descriptors/package.json b/live2d/node_modules/has-property-descriptors/package.json new file mode 100644 index 0000000..7e70218 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/package.json @@ -0,0 +1,77 @@ +{ + "name": "has-property-descriptors", + "version": "1.0.2", + "description": "Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-property-descriptors.git" + }, + "keywords": [ + "property", + "descriptors", + "has", + "environment", + "env", + "defineProperty", + "getOwnPropertyDescriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-property-descriptors/issues" + }, + "homepage": "https://github.com/inspect-js/has-property-descriptors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/live2d/node_modules/has-property-descriptors/test/index.js b/live2d/node_modules/has-property-descriptors/test/index.js new file mode 100644 index 0000000..7f02bd3 --- /dev/null +++ b/live2d/node_modules/has-property-descriptors/test/index.js @@ -0,0 +1,57 @@ +'use strict'; + +var test = require('tape'); + +var hasPropertyDescriptors = require('../'); + +var sentinel = {}; + +test('hasPropertyDescriptors', function (t) { + t.equal(typeof hasPropertyDescriptors, 'function', 'is a function'); + t.equal(typeof hasPropertyDescriptors.hasArrayLengthDefineBug, 'function', '`hasArrayLengthDefineBug` property is a function'); + + var yes = hasPropertyDescriptors(); + t.test('property descriptors', { skip: !yes }, function (st) { + var o = { a: sentinel }; + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: true, + value: sentinel, + writable: true + }, + 'has expected property descriptor' + ); + + Object.defineProperty(o, 'a', { enumerable: false, writable: false }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: false, + value: sentinel, + writable: false + }, + 'has expected property descriptor after [[Define]]' + ); + + st.end(); + }); + + var arrayBug = hasPropertyDescriptors.hasArrayLengthDefineBug(); + t.test('defining array lengths', { skip: !yes || arrayBug }, function (st) { + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + st.equal(arr.length, 3, 'array starts with length 3'); + + Object.defineProperty(arr, 'length', { value: 5 }); + + st.equal(arr.length, 5, 'array ends with length 5'); + + st.end(); + }); + + t.end(); +}); diff --git a/live2d/node_modules/has-proto/.eslintrc b/live2d/node_modules/has-proto/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/live2d/node_modules/has-proto/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/live2d/node_modules/has-proto/.github/FUNDING.yml b/live2d/node_modules/has-proto/.github/FUNDING.yml new file mode 100644 index 0000000..613705c --- /dev/null +++ b/live2d/node_modules/has-proto/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-proto +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/has-proto/CHANGELOG.md b/live2d/node_modules/has-proto/CHANGELOG.md new file mode 100644 index 0000000..6690f28 --- /dev/null +++ b/live2d/node_modules/has-proto/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/has-proto/compare/v1.0.2...v1.0.3) - 2024-02-19 + +### Commits + +- [types] add missing declaration file [`26ecade`](https://github.com/inspect-js/has-proto/commit/26ecade05d253bb5dc376945ee3186d1fbe334f8) + +## [v1.0.2](https://github.com/inspect-js/has-proto/compare/v1.0.1...v1.0.2) - 2024-02-19 + +### Commits + +- add types [`6435262`](https://github.com/inspect-js/has-proto/commit/64352626cf511c0276d5f4bb6be770a0bf0f8524) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`f16a5e4`](https://github.com/inspect-js/has-proto/commit/f16a5e4121651e551271419f9d60fdd3561fd82c) +- [Refactor] tiny cleanup [`d1f1a4b`](https://github.com/inspect-js/has-proto/commit/d1f1a4bdc135f115a10f148ce302676224534702) +- [meta] add `sideEffects` flag [`e7ab1a6`](https://github.com/inspect-js/has-proto/commit/e7ab1a6f153b3e80dee68d1748b71e46767a0531) + +## [v1.0.1](https://github.com/inspect-js/has-proto/compare/v1.0.0...v1.0.1) - 2022-12-21 + +### Commits + +- [meta] correct URLs and description [`ef34483`](https://github.com/inspect-js/has-proto/commit/ef34483ca0d35680f271b6b96e35526151b25dfc) +- [patch] add an additional criteria [`e81959e`](https://github.com/inspect-js/has-proto/commit/e81959ed7c7a77fbf459f00cb4ef824f1099497f) +- [Dev Deps] update `aud` [`2bec2c4`](https://github.com/inspect-js/has-proto/commit/2bec2c47b072b122ff5443fba0263f6dc649531f) + +## v1.0.0 - 2022-12-12 + +### Commits + +- Initial implementation, tests, readme [`6886fea`](https://github.com/inspect-js/has-proto/commit/6886fea578f67daf69a7920b2eb7637ea6ebb0bc) +- Initial commit [`99129c8`](https://github.com/inspect-js/has-proto/commit/99129c8f42471ac89cb681ba9cb9d52a583eb94f) +- npm init [`2844ad8`](https://github.com/inspect-js/has-proto/commit/2844ad8e75b84d66a46765b3bab9d2e8ea692e10) +- Only apps should have lockfiles [`c65bc5e`](https://github.com/inspect-js/has-proto/commit/c65bc5e40b9004463f7336d47c67245fb139a36a) diff --git a/live2d/node_modules/has-proto/LICENSE b/live2d/node_modules/has-proto/LICENSE new file mode 100644 index 0000000..2e7b9a3 --- /dev/null +++ b/live2d/node_modules/has-proto/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +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. diff --git a/live2d/node_modules/has-proto/README.md b/live2d/node_modules/has-proto/README.md new file mode 100644 index 0000000..1456765 --- /dev/null +++ b/live2d/node_modules/has-proto/README.md @@ -0,0 +1,38 @@ +# has-proto [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does this environment have the ability to set the [[Prototype]] of an object on creation with `__proto__`? + +## Example + +```js +var hasProto = require('has-proto'); +var assert = require('assert'); + +assert.equal(typeof hasProto(), 'boolean'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-proto +[npm-version-svg]: https://versionbadg.es/inspect-js/has-proto.svg +[deps-svg]: https://david-dm.org/inspect-js/has-proto.svg +[deps-url]: https://david-dm.org/inspect-js/has-proto +[dev-deps-svg]: https://david-dm.org/inspect-js/has-proto/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-proto#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-proto.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-proto.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-proto.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-proto +[codecov-image]: https://codecov.io/gh/inspect-js/has-proto/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-proto/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-proto +[actions-url]: https://github.com/inspect-js/has-proto/actions diff --git a/live2d/node_modules/has-proto/index.d.ts b/live2d/node_modules/has-proto/index.d.ts new file mode 100644 index 0000000..cfed695 --- /dev/null +++ b/live2d/node_modules/has-proto/index.d.ts @@ -0,0 +1,3 @@ +declare function hasProto(): boolean; + +export = hasProto; \ No newline at end of file diff --git a/live2d/node_modules/has-proto/index.js b/live2d/node_modules/has-proto/index.js new file mode 100644 index 0000000..d3c8a0a --- /dev/null +++ b/live2d/node_modules/has-proto/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var test = { + __proto__: null, + foo: {} +}; + +var $Object = Object; + +/** @type {import('.')} */ +module.exports = function hasProto() { + // @ts-expect-error: TS errors on an inherited property for some reason + return { __proto__: test }.foo === test.foo + && !(test instanceof $Object); +}; diff --git a/live2d/node_modules/has-proto/package.json b/live2d/node_modules/has-proto/package.json new file mode 100644 index 0000000..9d37e4e --- /dev/null +++ b/live2d/node_modules/has-proto/package.json @@ -0,0 +1,78 @@ +{ + "name": "has-proto", + "version": "1.0.3", + "description": "Does this environment have the ability to get the [[Prototype]] of an object on creation with `__proto__`?", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-proto.git" + }, + "keywords": [ + "prototype", + "proto", + "set", + "get", + "__proto__", + "getPrototypeOf", + "setPrototypeOf", + "has" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-proto/issues" + }, + "homepage": "https://github.com/inspect-js/has-proto#readme", + "testling": { + "files": "test/index.js" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/live2d/node_modules/has-proto/test/index.js b/live2d/node_modules/has-proto/test/index.js new file mode 100644 index 0000000..5da1a3a --- /dev/null +++ b/live2d/node_modules/has-proto/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); +var hasProto = require('../'); + +test('hasProto', function (t) { + var result = hasProto(); + t.equal(typeof result, 'boolean', 'returns a boolean (' + result + ')'); + + var obj = { __proto__: null }; + if (result) { + t.notOk('toString' in obj, 'null object lacks toString'); + } else { + t.ok('toString' in obj, 'without proto, null object has toString'); + t.equal(obj.__proto__, null); // eslint-disable-line no-proto + } + + t.end(); +}); diff --git a/live2d/node_modules/has-proto/tsconfig.json b/live2d/node_modules/has-proto/tsconfig.json new file mode 100644 index 0000000..2002ce5 --- /dev/null +++ b/live2d/node_modules/has-proto/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + //"skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/live2d/node_modules/has-symbols/.eslintrc b/live2d/node_modules/has-symbols/.eslintrc new file mode 100644 index 0000000..2d9a66a --- /dev/null +++ b/live2d/node_modules/has-symbols/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "multiline-comment-style": 0, + } +} diff --git a/live2d/node_modules/has-symbols/.github/FUNDING.yml b/live2d/node_modules/has-symbols/.github/FUNDING.yml new file mode 100644 index 0000000..04cf87e --- /dev/null +++ b/live2d/node_modules/has-symbols/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-symbols +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/has-symbols/.nycrc b/live2d/node_modules/has-symbols/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/has-symbols/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/has-symbols/CHANGELOG.md b/live2d/node_modules/has-symbols/CHANGELOG.md new file mode 100644 index 0000000..cd532a2 --- /dev/null +++ b/live2d/node_modules/has-symbols/CHANGELOG.md @@ -0,0 +1,75 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/has-symbols/compare/v1.0.2...v1.0.3) - 2022-03-01 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`518b28f`](https://github.com/inspect-js/has-symbols/commit/518b28f6c5a516cbccae30794e40aa9f738b1693) +- [meta] add `bugs` and `homepage` fields; reorder package.json [`c480b13`](https://github.com/inspect-js/has-symbols/commit/c480b13fd6802b557e1cef9749872cb5fdeef744) +- [actions] reuse common workflows [`01d0ee0`](https://github.com/inspect-js/has-symbols/commit/01d0ee0a8d97c0947f5edb73eb722027a77b2b07) +- [actions] update codecov uploader [`6424ebe`](https://github.com/inspect-js/has-symbols/commit/6424ebe86b2c9c7c3d2e9bd4413a4e4f168cb275) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`dfa7e7f`](https://github.com/inspect-js/has-symbols/commit/dfa7e7ff38b594645d8c8222aab895157fa7e282) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0c8d436`](https://github.com/inspect-js/has-symbols/commit/0c8d43685c45189cea9018191d4fd7eca91c9d02) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`9026554`](https://github.com/inspect-js/has-symbols/commit/902655442a1bf88e72b42345494ef0c60f5d36ab) +- [readme] add actions and codecov badges [`eaa9682`](https://github.com/inspect-js/has-symbols/commit/eaa9682f990f481d3acf7a1c7600bec36f7b3adc) +- [Dev Deps] update `eslint`, `tape` [`bc7a3ba`](https://github.com/inspect-js/has-symbols/commit/bc7a3ba46f27b7743f8a2579732d59d1b9ac791e) +- [Dev Deps] update `eslint`, `auto-changelog` [`0ace00a`](https://github.com/inspect-js/has-symbols/commit/0ace00af08a88cdd1e6ce0d60357d941c60c2d9f) +- [meta] use `prepublishOnly` script for npm 7+ [`093f72b`](https://github.com/inspect-js/has-symbols/commit/093f72bc2b0ed00c781f444922a5034257bf561d) +- [Tests] test on all 16 minors [`9b80d3d`](https://github.com/inspect-js/has-symbols/commit/9b80d3d9102529f04c20ec5b1fcc6e38426c6b03) + +## [v1.0.2](https://github.com/inspect-js/has-symbols/compare/v1.0.1...v1.0.2) - 2021-02-27 + +### Fixed + +- [Fix] use a universal way to get the original Symbol [`#11`](https://github.com/inspect-js/has-symbols/issues/11) + +### Commits + +- [Tests] migrate tests to Github Actions [`90ae798`](https://github.com/inspect-js/has-symbols/commit/90ae79820bdfe7bc703d67f5f3c5e205f98556d3) +- [meta] do not publish github action workflow files [`29e60a1`](https://github.com/inspect-js/has-symbols/commit/29e60a1b7c25c7f1acf7acff4a9320d0d10c49b4) +- [Tests] run `nyc` on all tests [`8476b91`](https://github.com/inspect-js/has-symbols/commit/8476b915650d360915abe2522505abf4b0e8f0ae) +- [readme] fix repo URLs, remove defunct badges [`126288e`](https://github.com/inspect-js/has-symbols/commit/126288ecc1797c0a40247a6b78bcb2e0bc5d7036) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `core-js`, `get-own-property-symbols` [`d84bdfa`](https://github.com/inspect-js/has-symbols/commit/d84bdfa48ac5188abbb4904b42614cd6c030940a) +- [Tests] fix linting errors [`0df3070`](https://github.com/inspect-js/has-symbols/commit/0df3070b981b6c9f2ee530c09189a7f5c6def839) +- [actions] add "Allow Edits" workflow [`1e6bc29`](https://github.com/inspect-js/has-symbols/commit/1e6bc29b188f32b9648657b07eda08504be5aa9c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`36cea2a`](https://github.com/inspect-js/has-symbols/commit/36cea2addd4e6ec435f35a2656b4e9ef82498e9b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1278338`](https://github.com/inspect-js/has-symbols/commit/127833801865fbc2cc8979beb9ca869c7bfe8222) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`1493254`](https://github.com/inspect-js/has-symbols/commit/1493254eda13db5fb8fc5e4a3e8324b3d196029d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js` [`b090bf2`](https://github.com/inspect-js/has-symbols/commit/b090bf214d3679a30edc1e2d729d466ab5183e1d) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4addb7a`](https://github.com/inspect-js/has-symbols/commit/4addb7ab4dc73f927ae99928d68817554fc21dc0) +- [Dev Deps] update `auto-changelog`, `tape` [`81d0baf`](https://github.com/inspect-js/has-symbols/commit/81d0baf3816096a89a8558e8043895f7a7d10d8b) +- [Dev Deps] update `auto-changelog`; add `aud` [`1a4e561`](https://github.com/inspect-js/has-symbols/commit/1a4e5612c25d91c3a03d509721d02630bc4fe3da) +- [readme] remove unused testling URLs [`3000941`](https://github.com/inspect-js/has-symbols/commit/3000941f958046e923ed8152edb1ef4a599e6fcc) +- [Tests] only audit prod deps [`692e974`](https://github.com/inspect-js/has-symbols/commit/692e9743c912410e9440207631a643a34b4741a1) +- [Dev Deps] update `@ljharb/eslint-config` [`51c946c`](https://github.com/inspect-js/has-symbols/commit/51c946c7f6baa793ec5390bb5a45cdce16b4ba76) + +## [v1.0.1](https://github.com/inspect-js/has-symbols/compare/v1.0.0...v1.0.1) - 2019-11-16 + +### Commits + +- [Tests] use shared travis-ci configs [`ce396c9`](https://github.com/inspect-js/has-symbols/commit/ce396c9419ff11c43d0da5d05cdbb79f7fb42229) +- [Tests] up to `node` `v12.4`, `v11.15`, `v10.15`, `v9.11`, `v8.15`, `v7.10`, `v6.17`, `v4.9`; use `nvm install-latest-npm` [`0690732`](https://github.com/inspect-js/has-symbols/commit/0690732801f47ab429f39ba1962f522d5c462d6b) +- [meta] add `auto-changelog` [`2163d0b`](https://github.com/inspect-js/has-symbols/commit/2163d0b7f36343076b8f947cd1667dd1750f26fc) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `safe-publish-latest`, `tape` [`8e0951f`](https://github.com/inspect-js/has-symbols/commit/8e0951f1a7a2e52068222b7bb73511761e6e4d9c) +- [actions] add automatic rebasing / merge commit blocking [`b09cdb7`](https://github.com/inspect-js/has-symbols/commit/b09cdb7cd7ee39e7a769878f56e2d6066f5ccd1d) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `core-js`, `get-own-property-symbols`, `tape` [`1dd42cd`](https://github.com/inspect-js/has-symbols/commit/1dd42cd86183ed0c50f99b1062345c458babca91) +- [meta] create FUNDING.yml [`aa57a17`](https://github.com/inspect-js/has-symbols/commit/aa57a17b19708906d1927f821ea8e73394d84ca4) +- Only apps should have lockfiles [`a2d8bea`](https://github.com/inspect-js/has-symbols/commit/a2d8bea23a97d15c09eaf60f5b107fcf9a4d57aa) +- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`9e96cb7`](https://github.com/inspect-js/has-symbols/commit/9e96cb783746cbed0c10ef78e599a8eaa7ebe193) +- [meta] add `funding` field [`a0b32cf`](https://github.com/inspect-js/has-symbols/commit/a0b32cf68e803f963c1639b6d47b0a9d6440bab0) +- [Dev Deps] update `safe-publish-latest` [`cb9f0a5`](https://github.com/inspect-js/has-symbols/commit/cb9f0a521a3a1790f1064d437edd33bb6c3d6af0) + +## v1.0.0 - 2016-09-19 + +### Commits + +- Tests. [`ecb6eb9`](https://github.com/inspect-js/has-symbols/commit/ecb6eb934e4883137f3f93b965ba5e0a98df430d) +- package.json [`88a337c`](https://github.com/inspect-js/has-symbols/commit/88a337cee0864a0da35f5d19e69ff0ef0150e46a) +- Initial commit [`42e1e55`](https://github.com/inspect-js/has-symbols/commit/42e1e5502536a2b8ac529c9443984acd14836b1c) +- Initial implementation. [`33f5cc6`](https://github.com/inspect-js/has-symbols/commit/33f5cc6cdff86e2194b081ee842bfdc63caf43fb) +- read me [`01f1170`](https://github.com/inspect-js/has-symbols/commit/01f1170188ff7cb1558aa297f6ba5b516c6d7b0c) diff --git a/live2d/node_modules/has-symbols/LICENSE b/live2d/node_modules/has-symbols/LICENSE new file mode 100644 index 0000000..df31cbf --- /dev/null +++ b/live2d/node_modules/has-symbols/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Jordan Harband + +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. diff --git a/live2d/node_modules/has-symbols/README.md b/live2d/node_modules/has-symbols/README.md new file mode 100644 index 0000000..33905f0 --- /dev/null +++ b/live2d/node_modules/has-symbols/README.md @@ -0,0 +1,46 @@ +# has-symbols [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Determine if the JS environment has Symbol support. Supports spec, or shams. + +## Example + +```js +var hasSymbols = require('has-symbols'); + +hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable. + +var hasSymbolsKinda = require('has-symbols/shams'); +hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec. +``` + +## Supported Symbol shams + - get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols) + - core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js) + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/has-symbols +[2]: https://versionbadg.es/inspect-js/has-symbols.svg +[5]: https://david-dm.org/inspect-js/has-symbols.svg +[6]: https://david-dm.org/inspect-js/has-symbols +[7]: https://david-dm.org/inspect-js/has-symbols/dev-status.svg +[8]: https://david-dm.org/inspect-js/has-symbols#info=devDependencies +[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-symbols.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-symbols.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-symbols +[codecov-image]: https://codecov.io/gh/inspect-js/has-symbols/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-symbols/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-symbols +[actions-url]: https://github.com/inspect-js/has-symbols/actions diff --git a/live2d/node_modules/has-symbols/index.js b/live2d/node_modules/has-symbols/index.js new file mode 100644 index 0000000..17044fa --- /dev/null +++ b/live2d/node_modules/has-symbols/index.js @@ -0,0 +1,13 @@ +'use strict'; + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; diff --git a/live2d/node_modules/has-symbols/package.json b/live2d/node_modules/has-symbols/package.json new file mode 100644 index 0000000..fe7004a --- /dev/null +++ b/live2d/node_modules/has-symbols/package.json @@ -0,0 +1,101 @@ +{ + "name": "has-symbols", + "version": "1.0.3", + "description": "Determine if the JS environment has Symbol support. Supports spec, or shams.", + "main": "index.js", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", + "test:stock": "nyc node test", + "test:staging": "nyc node --harmony --es-staging test", + "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", + "test:shams:corejs": "nyc node test/shams/core-js.js", + "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git://github.com/inspect-js/has-symbols.git" + }, + "keywords": [ + "Symbol", + "symbols", + "typeof", + "sham", + "polyfill", + "native", + "core-js", + "ES6" + ], + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/has-symbols/issues" + }, + "homepage": "https://github.com/ljharb/has-symbols#readme", + "devDependencies": { + "@ljharb/eslint-config": "^20.2.3", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "core-js": "^2.6.12", + "eslint": "=8.8.0", + "get-own-property-symbols": "^0.9.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.5.2" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "iexplore/6.0..latest", + "firefox/3.0..6.0", + "firefox/15.0..latest", + "firefox/nightly", + "chrome/4.0..10.0", + "chrome/20.0..latest", + "chrome/canary", + "opera/10.0..latest", + "opera/next", + "safari/4.0..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2" + ] + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "greenkeeper": { + "ignore": [ + "core-js" + ] + } +} diff --git a/live2d/node_modules/has-symbols/shams.js b/live2d/node_modules/has-symbols/shams.js new file mode 100644 index 0000000..1285210 --- /dev/null +++ b/live2d/node_modules/has-symbols/shams.js @@ -0,0 +1,42 @@ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; diff --git a/live2d/node_modules/has-symbols/test/index.js b/live2d/node_modules/has-symbols/test/index.js new file mode 100644 index 0000000..352129c --- /dev/null +++ b/live2d/node_modules/has-symbols/test/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var test = require('tape'); +var hasSymbols = require('../'); +var runSymbolTests = require('./tests'); + +test('interface', function (t) { + t.equal(typeof hasSymbols, 'function', 'is a function'); + t.equal(typeof hasSymbols(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('Symbols are supported', { skip: !hasSymbols() }, function (t) { + runSymbolTests(t); + t.end(); +}); + +test('Symbols are not supported', { skip: hasSymbols() }, function (t) { + t.equal(typeof Symbol, 'undefined', 'global Symbol is undefined'); + t.equal(typeof Object.getOwnPropertySymbols, 'undefined', 'Object.getOwnPropertySymbols does not exist'); + t.end(); +}); diff --git a/live2d/node_modules/has-symbols/test/shams/core-js.js b/live2d/node_modules/has-symbols/test/shams/core-js.js new file mode 100644 index 0000000..df5365c --- /dev/null +++ b/live2d/node_modules/has-symbols/test/shams/core-js.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + require('core-js/fn/symbol'); + require('core-js/fn/symbol/to-string-tag'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/live2d/node_modules/has-symbols/test/shams/get-own-property-symbols.js b/live2d/node_modules/has-symbols/test/shams/get-own-property-symbols.js new file mode 100644 index 0000000..9191b24 --- /dev/null +++ b/live2d/node_modules/has-symbols/test/shams/get-own-property-symbols.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbols = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling'); + + require('get-own-property-symbols'); + + require('../tests')(t); + + var hasSymbolsAfter = hasSymbols(); + t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/live2d/node_modules/has-symbols/test/tests.js b/live2d/node_modules/has-symbols/test/tests.js new file mode 100644 index 0000000..89edd12 --- /dev/null +++ b/live2d/node_modules/has-symbols/test/tests.js @@ -0,0 +1,56 @@ +'use strict'; + +// eslint-disable-next-line consistent-return +module.exports = function runSymbolTests(t) { + t.equal(typeof Symbol, 'function', 'global Symbol is a function'); + + if (typeof Symbol !== 'function') { return false; } + + t.notEqual(Symbol(), Symbol(), 'two symbols are not equal'); + + /* + t.equal( + Symbol.prototype.toString.call(Symbol('foo')), + Symbol.prototype.toString.call(Symbol('foo')), + 'two symbols with the same description stringify the same' + ); + */ + + /* + var foo = Symbol('foo'); + + t.notEqual( + String(foo), + String(Symbol('bar')), + 'two symbols with different descriptions do not stringify the same' + ); + */ + + t.equal(typeof Symbol.prototype.toString, 'function', 'Symbol#toString is a function'); + // t.equal(String(foo), Symbol.prototype.toString.call(foo), 'Symbol#toString equals String of the same symbol'); + + t.equal(typeof Object.getOwnPropertySymbols, 'function', 'Object.getOwnPropertySymbols is a function'); + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + t.notEqual(typeof sym, 'string', 'Symbol is not a string'); + t.equal(Object.prototype.toString.call(sym), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + t.equal(Object.prototype.toString.call(symObj), '[object Symbol]', 'symbol primitive Object#toStrings properly'); + + var symVal = 42; + obj[sym] = symVal; + // eslint-disable-next-line no-restricted-syntax + for (sym in obj) { t.fail('symbol property key was found in for..in of object'); } + + t.deepEqual(Object.keys(obj), [], 'no enumerable own keys on symbol-valued object'); + t.deepEqual(Object.getOwnPropertyNames(obj), [], 'no own names on symbol-valued object'); + t.deepEqual(Object.getOwnPropertySymbols(obj), [sym], 'one own symbol on symbol-valued object'); + t.equal(Object.prototype.propertyIsEnumerable.call(obj, sym), true, 'symbol is enumerable'); + t.deepEqual(Object.getOwnPropertyDescriptor(obj, sym), { + configurable: true, + enumerable: true, + value: 42, + writable: true + }, 'property descriptor is correct'); +}; diff --git a/live2d/node_modules/hasown/.eslintrc b/live2d/node_modules/hasown/.eslintrc new file mode 100644 index 0000000..3b5d9e9 --- /dev/null +++ b/live2d/node_modules/hasown/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/live2d/node_modules/hasown/.github/FUNDING.yml b/live2d/node_modules/hasown/.github/FUNDING.yml new file mode 100644 index 0000000..d68c8b7 --- /dev/null +++ b/live2d/node_modules/hasown/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/hasown +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/live2d/node_modules/hasown/.nycrc b/live2d/node_modules/hasown/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/live2d/node_modules/hasown/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/hasown/CHANGELOG.md b/live2d/node_modules/hasown/CHANGELOG.md new file mode 100644 index 0000000..2b0a980 --- /dev/null +++ b/live2d/node_modules/hasown/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.2](https://github.com/inspect-js/hasOwn/compare/v2.0.1...v2.0.2) - 2024-03-10 + +### Commits + +- [types] use shared config [`68e9d4d`](https://github.com/inspect-js/hasOwn/commit/68e9d4dab6facb4f05f02c6baea94a3f2a4e44b2) +- [actions] remove redundant finisher; use reusable workflow [`241a68e`](https://github.com/inspect-js/hasOwn/commit/241a68e13ea1fe52bec5ba7f74144befc31fae7b) +- [Tests] increase coverage [`4125c0d`](https://github.com/inspect-js/hasOwn/commit/4125c0d6121db56ae30e38346dfb0c000b04f0a7) +- [Tests] skip `npm ls` in old node due to TS [`01b9282`](https://github.com/inspect-js/hasOwn/commit/01b92822f9971dea031eafdd14767df41d61c202) +- [types] improve predicate type [`d340f85`](https://github.com/inspect-js/hasOwn/commit/d340f85ce02e286ef61096cbbb6697081d40a12b) +- [Dev Deps] update `tape` [`70089fc`](https://github.com/inspect-js/hasOwn/commit/70089fcf544e64acc024cbe60f5a9b00acad86de) +- [Tests] use `@arethetypeswrong/cli` [`50b272c`](https://github.com/inspect-js/hasOwn/commit/50b272c829f40d053a3dd91c9796e0ac0b2af084) + +## [v2.0.1](https://github.com/inspect-js/hasOwn/compare/v2.0.0...v2.0.1) - 2024-02-10 + +### Commits + +- [types] use a handwritten d.ts file; fix exported type [`012b989`](https://github.com/inspect-js/hasOwn/commit/012b9898ccf91dc441e2ebf594ff70270a5fda58) +- [Dev Deps] update `@types/function-bind`, `@types/mock-property`, `@types/tape`, `aud`, `mock-property`, `npmignore`, `tape`, `typescript` [`977a56f`](https://github.com/inspect-js/hasOwn/commit/977a56f51a1f8b20566f3c471612137894644025) +- [meta] add `sideEffects` flag [`3a60b7b`](https://github.com/inspect-js/hasOwn/commit/3a60b7bf42fccd8c605e5f145a6fcc83b13cb46f) + +## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19 + +### Commits + +- revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4) +- [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458) +- Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215) + +## v1.0.1 - 2023-10-10 + +### Commits + +- Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62) diff --git a/live2d/node_modules/hasown/LICENSE b/live2d/node_modules/hasown/LICENSE new file mode 100644 index 0000000..0314929 --- /dev/null +++ b/live2d/node_modules/hasown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and 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. diff --git a/live2d/node_modules/hasown/README.md b/live2d/node_modules/hasown/README.md new file mode 100644 index 0000000..f759b8a --- /dev/null +++ b/live2d/node_modules/hasown/README.md @@ -0,0 +1,40 @@ +# hasown [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A robust, ES3 compatible, "has own property" predicate. + +## Example + +```js +const assert = require('assert'); +const hasOwn = require('hasown'); + +assert.equal(hasOwn({}, 'toString'), false); +assert.equal(hasOwn([], 'length'), true); +assert.equal(hasOwn({ a: 42 }, 'a'), true); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/hasown +[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg +[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg +[deps-url]: https://david-dm.org/inspect-js/hasOwn +[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/hasown.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/hasown.svg +[downloads-url]: https://npm-stat.com/charts.html?package=hasown +[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn +[actions-url]: https://github.com/inspect-js/hasOwn/actions diff --git a/live2d/node_modules/hasown/index.d.ts b/live2d/node_modules/hasown/index.d.ts new file mode 100644 index 0000000..aafdf3b --- /dev/null +++ b/live2d/node_modules/hasown/index.d.ts @@ -0,0 +1,3 @@ +declare function hasOwn(o: O, p: K): o is O & Record; + +export = hasOwn; diff --git a/live2d/node_modules/hasown/index.js b/live2d/node_modules/hasown/index.js new file mode 100644 index 0000000..34e6059 --- /dev/null +++ b/live2d/node_modules/hasown/index.js @@ -0,0 +1,8 @@ +'use strict'; + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = require('function-bind'); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); diff --git a/live2d/node_modules/hasown/package.json b/live2d/node_modules/hasown/package.json new file mode 100644 index 0000000..8502e13 --- /dev/null +++ b/live2d/node_modules/hasown/package.json @@ -0,0 +1,92 @@ +{ + "name": "hasown", + "version": "2.0.2", + "description": "A robust, ES3 compatible, \"has own property\" predicate.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/hasOwn.git" + }, + "keywords": [ + "has", + "hasOwnProperty", + "hasOwn", + "has-own", + "own", + "has", + "property", + "in", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/hasOwn/issues" + }, + "homepage": "https://github.com/inspect-js/hasOwn#readme", + "dependencies": { + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.2.0", + "@types/function-bind": "^1.1.10", + "@types/mock-property": "^1.0.2", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/live2d/node_modules/hasown/tsconfig.json b/live2d/node_modules/hasown/tsconfig.json new file mode 100644 index 0000000..0930c56 --- /dev/null +++ b/live2d/node_modules/hasown/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} diff --git a/live2d/node_modules/inflight/LICENSE b/live2d/node_modules/inflight/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/live2d/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. diff --git a/live2d/node_modules/inflight/README.md b/live2d/node_modules/inflight/README.md new file mode 100644 index 0000000..6dc8929 --- /dev/null +++ b/live2d/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/live2d/node_modules/inflight/inflight.js b/live2d/node_modules/inflight/inflight.js new file mode 100644 index 0000000..48202b3 --- /dev/null +++ b/live2d/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/live2d/node_modules/inflight/package.json b/live2d/node_modules/inflight/package.json new file mode 100644 index 0000000..6084d35 --- /dev/null +++ b/live2d/node_modules/inflight/package.json @@ -0,0 +1,29 @@ +{ + "name": "inflight", + "version": "1.0.6", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "files": [ + "inflight.js" + ], + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.1.2" + }, + "scripts": { + "test": "tap test.js --100" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/inflight.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC" +} diff --git a/live2d/node_modules/inherits/LICENSE b/live2d/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/live2d/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. + diff --git a/live2d/node_modules/inherits/README.md b/live2d/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/live2d/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/live2d/node_modules/inherits/inherits.js b/live2d/node_modules/inherits/inherits.js new file mode 100644 index 0000000..f71f2d9 --- /dev/null +++ b/live2d/node_modules/inherits/inherits.js @@ -0,0 +1,9 @@ +try { + var util = require('util'); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = require('./inherits_browser.js'); +} diff --git a/live2d/node_modules/inherits/inherits_browser.js b/live2d/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..86bbb3d --- /dev/null +++ b/live2d/node_modules/inherits/inherits_browser.js @@ -0,0 +1,27 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} diff --git a/live2d/node_modules/inherits/package.json b/live2d/node_modules/inherits/package.json new file mode 100644 index 0000000..37b4366 --- /dev/null +++ b/live2d/node_modules/inherits/package.json @@ -0,0 +1,29 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.4", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": "git://github.com/isaacs/inherits", + "license": "ISC", + "scripts": { + "test": "tap" + }, + "devDependencies": { + "tap": "^14.2.4" + }, + "files": [ + "inherits.js", + "inherits_browser.js" + ] +} diff --git a/live2d/node_modules/jsonfile/CHANGELOG.md b/live2d/node_modules/jsonfile/CHANGELOG.md new file mode 100644 index 0000000..7718857 --- /dev/null +++ b/live2d/node_modules/jsonfile/CHANGELOG.md @@ -0,0 +1,145 @@ +4.0.0 / 2017-07-12 +------------------ + +- **BREAKING:** Remove global `spaces` option. +- **BREAKING:** Drop support for Node 0.10, 0.12, and io.js. +- Remove undocumented `passParsingErrors` option. +- Added `EOL` override option to `writeFile` when using `spaces`. [#89] + +3.0.1 / 2017-07-05 +------------------ + +- Fixed bug in `writeFile` when there was a serialization error & no callback was passed. In previous versions, an empty file would be written; now no file is written. + +3.0.0 / 2017-04-25 +------------------ + +- Changed behavior of `throws` option for `readFileSync`; now does not throw filesystem errors when `throws` is `false` + +2.4.0 / 2016-09-15 +------------------ +### Changed +- added optional support for `graceful-fs` [#62] + +2.3.1 / 2016-05-13 +------------------ +- fix to support BOM. [#45][#45] + +2.3.0 / 2016-04-16 +------------------ +- add `throws` to `readFile()`. See [#39][#39] +- add support for any arbitrary `fs` module. Useful with [mock-fs](https://www.npmjs.com/package/mock-fs) + +2.2.3 / 2015-10-14 +------------------ +- include file name in parse error. See: https://github.com/jprichardson/node-jsonfile/pull/34 + +2.2.2 / 2015-09-16 +------------------ +- split out tests into separate files +- fixed `throws` when set to `true` in `readFileSync()`. See: https://github.com/jprichardson/node-jsonfile/pull/33 + +2.2.1 / 2015-06-25 +------------------ +- fixed regression when passing in string as encoding for options in `writeFile()` and `writeFileSync()`. See: https://github.com/jprichardson/node-jsonfile/issues/28 + +2.2.0 / 2015-06-25 +------------------ +- added `options.spaces` to `writeFile()` and `writeFileSync()` + +2.1.2 / 2015-06-22 +------------------ +- fixed if passed `readFileSync(file, 'utf8')`. See: https://github.com/jprichardson/node-jsonfile/issues/25 + +2.1.1 / 2015-06-19 +------------------ +- fixed regressions if `null` is passed for options. See: https://github.com/jprichardson/node-jsonfile/issues/24 + +2.1.0 / 2015-06-19 +------------------ +- cleanup: JavaScript Standard Style, rename files, dropped terst for assert +- methods now support JSON revivers/replacers + +2.0.1 / 2015-05-24 +------------------ +- update license attribute https://github.com/jprichardson/node-jsonfile/pull/21 + +2.0.0 / 2014-07-28 +------------------ +* added `\n` to end of file on write. [#14](https://github.com/jprichardson/node-jsonfile/pull/14) +* added `options.throws` to `readFileSync()` +* dropped support for Node v0.8 + +1.2.0 / 2014-06-29 +------------------ +* removed semicolons +* bugfix: passed `options` to `fs.readFile` and `fs.readFileSync`. This technically changes behavior, but +changes it according to docs. [#12][#12] + +1.1.1 / 2013-11-11 +------------------ +* fixed catching of callback bug (ffissore / #5) + +1.1.0 / 2013-10-11 +------------------ +* added `options` param to methods, (seanodell / #4) + +1.0.1 / 2013-09-05 +------------------ +* removed `homepage` field from package.json to remove NPM warning + +1.0.0 / 2013-06-28 +------------------ +* added `.npmignore`, #1 +* changed spacing default from `4` to `2` to follow Node conventions + +0.0.1 / 2012-09-10 +------------------ +* Initial release. + +[#89]: https://github.com/jprichardson/node-jsonfile/pull/89 +[#45]: https://github.com/jprichardson/node-jsonfile/issues/45 "Reading of UTF8-encoded (w/ BOM) files fails" +[#44]: https://github.com/jprichardson/node-jsonfile/issues/44 "Extra characters in written file" +[#43]: https://github.com/jprichardson/node-jsonfile/issues/43 "Prettyfy json when written to file" +[#42]: https://github.com/jprichardson/node-jsonfile/pull/42 "Moved fs.readFileSync within the try/catch" +[#41]: https://github.com/jprichardson/node-jsonfile/issues/41 "Linux: Hidden file not working" +[#40]: https://github.com/jprichardson/node-jsonfile/issues/40 "autocreate folder doesn't work from Path-value" +[#39]: https://github.com/jprichardson/node-jsonfile/pull/39 "Add `throws` option for readFile (async)" +[#38]: https://github.com/jprichardson/node-jsonfile/pull/38 "Update README.md writeFile[Sync] signature" +[#37]: https://github.com/jprichardson/node-jsonfile/pull/37 "support append file" +[#36]: https://github.com/jprichardson/node-jsonfile/pull/36 "Add typescript definition file." +[#35]: https://github.com/jprichardson/node-jsonfile/pull/35 "Add typescript definition file." +[#34]: https://github.com/jprichardson/node-jsonfile/pull/34 "readFile JSON parse error includes filename" +[#33]: https://github.com/jprichardson/node-jsonfile/pull/33 "fix throw->throws typo in readFileSync()" +[#32]: https://github.com/jprichardson/node-jsonfile/issues/32 "readFile & readFileSync can possible have strip-comments as an option?" +[#31]: https://github.com/jprichardson/node-jsonfile/pull/31 "[Modify] Support string include is unicode escape string" +[#30]: https://github.com/jprichardson/node-jsonfile/issues/30 "How to use Jsonfile package in Meteor.js App?" +[#29]: https://github.com/jprichardson/node-jsonfile/issues/29 "writefile callback if no error?" +[#28]: https://github.com/jprichardson/node-jsonfile/issues/28 "writeFile options argument broken " +[#27]: https://github.com/jprichardson/node-jsonfile/pull/27 "Use svg instead of png to get better image quality" +[#26]: https://github.com/jprichardson/node-jsonfile/issues/26 "Breaking change to fs-extra" +[#25]: https://github.com/jprichardson/node-jsonfile/issues/25 "support string encoding param for read methods" +[#24]: https://github.com/jprichardson/node-jsonfile/issues/24 "readFile: Passing in null options with a callback throws an error" +[#23]: https://github.com/jprichardson/node-jsonfile/pull/23 "Add appendFile and appendFileSync" +[#22]: https://github.com/jprichardson/node-jsonfile/issues/22 "Default value for spaces in readme.md is outdated" +[#21]: https://github.com/jprichardson/node-jsonfile/pull/21 "Update license attribute" +[#20]: https://github.com/jprichardson/node-jsonfile/issues/20 "Add simple caching functionallity" +[#19]: https://github.com/jprichardson/node-jsonfile/pull/19 "Add appendFileSync method" +[#18]: https://github.com/jprichardson/node-jsonfile/issues/18 "Add updateFile and updateFileSync methods" +[#17]: https://github.com/jprichardson/node-jsonfile/issues/17 "seem read & write sync has sequentially problem" +[#16]: https://github.com/jprichardson/node-jsonfile/pull/16 "export spaces defaulted to null" +[#15]: https://github.com/jprichardson/node-jsonfile/issues/15 "`jsonfile.spaces` should default to `null`" +[#14]: https://github.com/jprichardson/node-jsonfile/pull/14 "Add EOL at EOF" +[#13]: https://github.com/jprichardson/node-jsonfile/issues/13 "Add a final newline" +[#12]: https://github.com/jprichardson/node-jsonfile/issues/12 "readFile doesn't accept options" +[#11]: https://github.com/jprichardson/node-jsonfile/pull/11 "Added try,catch to readFileSync" +[#10]: https://github.com/jprichardson/node-jsonfile/issues/10 "No output or error from writeFile" +[#9]: https://github.com/jprichardson/node-jsonfile/pull/9 "Change 'js' to 'jf' in example." +[#8]: https://github.com/jprichardson/node-jsonfile/pull/8 "Updated forgotten module.exports to me." +[#7]: https://github.com/jprichardson/node-jsonfile/pull/7 "Add file name in error message" +[#6]: https://github.com/jprichardson/node-jsonfile/pull/6 "Use graceful-fs when possible" +[#5]: https://github.com/jprichardson/node-jsonfile/pull/5 "Jsonfile doesn't behave nicely when used inside a test suite." +[#4]: https://github.com/jprichardson/node-jsonfile/pull/4 "Added options parameter to writeFile and writeFileSync" +[#3]: https://github.com/jprichardson/node-jsonfile/issues/3 "test2" +[#2]: https://github.com/jprichardson/node-jsonfile/issues/2 "homepage field must be a string url. Deleted." +[#1]: https://github.com/jprichardson/node-jsonfile/pull/1 "adding an `.npmignore` file" diff --git a/live2d/node_modules/jsonfile/LICENSE b/live2d/node_modules/jsonfile/LICENSE new file mode 100644 index 0000000..cb7e807 --- /dev/null +++ b/live2d/node_modules/jsonfile/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2012-2015, JP Richardson + +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. diff --git a/live2d/node_modules/jsonfile/README.md b/live2d/node_modules/jsonfile/README.md new file mode 100644 index 0000000..721685c --- /dev/null +++ b/live2d/node_modules/jsonfile/README.md @@ -0,0 +1,168 @@ +Node.js - jsonfile +================ + +Easily read/write JSON files. + +[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile) +[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.svg)](http://travis-ci.org/jprichardson/node-jsonfile) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master) + +Standard JavaScript + +Why? +---- + +Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying. + + + +Installation +------------ + + npm install --save jsonfile + + + +API +--- + +### readFile(filename, [options], callback) + +`options` (`object`, default `undefined`): Pass in any `fs.readFile` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). + - `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback. + If `false`, returns `null` for the object. + + +```js +var jsonfile = require('jsonfile') +var file = '/tmp/data.json' +jsonfile.readFile(file, function(err, obj) { + console.dir(obj) +}) +``` + + +### readFileSync(filename, [options]) + +`options` (`object`, default `undefined`): Pass in any `fs.readFileSync` options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). +- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object. + +```js +var jsonfile = require('jsonfile') +var file = '/tmp/data.json' + +console.dir(jsonfile.readFileSync(file)) +``` + + +### writeFile(filename, obj, [options], callback) + +`options`: Pass in any `fs.writeFile` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces` and override `EOL` string. + + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFile(file, obj, function (err) { + console.error(err) +}) +``` + +**formatting with spaces:** + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFile(file, obj, {spaces: 2}, function(err) { + console.error(err) +}) +``` + +**overriding EOL:** + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFile(file, obj, {spaces: 2, EOL: '\r\n'}, function(err) { + console.error(err) +}) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFile` option `{flag: 'a'}` to achieve this. + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/mayAlreadyExistedData.json' +var obj = {name: 'JP'} + +jsonfile.writeFile(file, obj, {flag: 'a'}, function (err) { + console.error(err) +}) +``` + +### writeFileSync(filename, obj, [options]) + +`options`: Pass in any `fs.writeFileSync` options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces` and override `EOL` string. + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFileSync(file, obj) +``` + +**formatting with spaces:** + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFileSync(file, obj, {spaces: 2}) +``` + +**overriding EOL:** + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/data.json' +var obj = {name: 'JP'} + +jsonfile.writeFileSync(file, obj, {spaces: 2, EOL: '\r\n'}) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFileSync` option `{flag: 'a'}` to achieve this. + +```js +var jsonfile = require('jsonfile') + +var file = '/tmp/mayAlreadyExistedData.json' +var obj = {name: 'JP'} + +jsonfile.writeFileSync(file, obj, {flag: 'a'}) +``` + +License +------- + +(MIT License) + +Copyright 2012-2016, JP Richardson diff --git a/live2d/node_modules/jsonfile/index.js b/live2d/node_modules/jsonfile/index.js new file mode 100644 index 0000000..d1e5827 --- /dev/null +++ b/live2d/node_modules/jsonfile/index.js @@ -0,0 +1,134 @@ +var _fs +try { + _fs = require('graceful-fs') +} catch (_) { + _fs = require('fs') +} + +function readFile (file, options, callback) { + if (callback == null) { + callback = options + options = {} + } + + if (typeof options === 'string') { + options = {encoding: options} + } + + options = options || {} + var fs = options.fs || _fs + + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws + } + + fs.readFile(file, options, function (err, data) { + if (err) return callback(err) + + data = stripBom(data) + + var obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err2) { + if (shouldThrow) { + err2.message = file + ': ' + err2.message + return callback(err2) + } else { + return callback(null, null) + } + } + + callback(null, obj) + }) +} + +function readFileSync (file, options) { + options = options || {} + if (typeof options === 'string') { + options = {encoding: options} + } + + var fs = options.fs || _fs + + var shouldThrow = true + if ('throws' in options) { + shouldThrow = options.throws + } + + try { + var content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = file + ': ' + err.message + throw err + } else { + return null + } + } +} + +function stringify (obj, options) { + var spaces + var EOL = '\n' + if (typeof options === 'object' && options !== null) { + if (options.spaces) { + spaces = options.spaces + } + if (options.EOL) { + EOL = options.EOL + } + } + + var str = JSON.stringify(obj, options ? options.replacer : null, spaces) + + return str.replace(/\n/g, EOL) + EOL +} + +function writeFile (file, obj, options, callback) { + if (callback == null) { + callback = options + options = {} + } + options = options || {} + var fs = options.fs || _fs + + var str = '' + try { + str = stringify(obj, options) + } catch (err) { + // Need to return whether a callback was passed or not + if (callback) callback(err, null) + return + } + + fs.writeFile(file, str, options, callback) +} + +function writeFileSync (file, obj, options) { + options = options || {} + var fs = options.fs || _fs + + var str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} + +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + content = content.replace(/^\uFEFF/, '') + return content +} + +var jsonfile = { + readFile: readFile, + readFileSync: readFileSync, + writeFile: writeFile, + writeFileSync: writeFileSync +} + +module.exports = jsonfile diff --git a/live2d/node_modules/jsonfile/package.json b/live2d/node_modules/jsonfile/package.json new file mode 100644 index 0000000..29e783f --- /dev/null +++ b/live2d/node_modules/jsonfile/package.json @@ -0,0 +1,37 @@ +{ + "name": "jsonfile", + "version": "4.0.0", + "description": "Easily read/write JSON files.", + "repository": { + "type": "git", + "url": "git@github.com:jprichardson/node-jsonfile.git" + }, + "keywords": [ + "read", + "write", + "file", + "json", + "fs", + "fs-extra" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": {}, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + }, + "devDependencies": { + "mocha": "2.x", + "rimraf": "^2.4.0", + "standard": "^10.0.3" + }, + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "lint": "standard", + "test": "npm run lint && npm run unit", + "unit": "mocha" + } +} diff --git a/live2d/node_modules/locate-path/index.d.ts b/live2d/node_modules/locate-path/index.d.ts new file mode 100644 index 0000000..fbde526 --- /dev/null +++ b/live2d/node_modules/locate-path/index.d.ts @@ -0,0 +1,83 @@ +declare namespace locatePath { + interface Options { + /** + Current working directory. + + @default process.cwd() + */ + readonly cwd?: string; + + /** + Type of path to match. + + @default 'file' + */ + readonly type?: 'file' | 'directory'; + + /** + Allow symbolic links to match if they point to the requested path type. + + @default true + */ + readonly allowSymlinks?: boolean; + } + + interface AsyncOptions extends Options { + /** + Number of concurrently pending promises. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `paths` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; + } +} + +declare const locatePath: { + /** + Get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + + @example + ``` + import locatePath = require('locate-path'); + + const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' + ]; + + (async () => { + console(await locatePath(files)); + //=> 'rainbow' + })(); + ``` + */ + (paths: Iterable, options?: locatePath.AsyncOptions): Promise< + string | undefined + >; + + /** + Synchronously get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + */ + sync( + paths: Iterable, + options?: locatePath.Options + ): string | undefined; +}; + +export = locatePath; diff --git a/live2d/node_modules/locate-path/index.js b/live2d/node_modules/locate-path/index.js new file mode 100644 index 0000000..4604bbf --- /dev/null +++ b/live2d/node_modules/locate-path/index.js @@ -0,0 +1,65 @@ +'use strict'; +const path = require('path'); +const fs = require('fs'); +const {promisify} = require('util'); +const pLocate = require('p-locate'); + +const fsStat = promisify(fs.stat); +const fsLStat = promisify(fs.lstat); + +const typeMappings = { + directory: 'isDirectory', + file: 'isFile' +}; + +function checkType({type}) { + if (type in typeMappings) { + return; + } + + throw new Error(`Invalid type specified: ${type}`); +} + +const matchType = (type, stat) => type === undefined || stat[typeMappings[type]](); + +module.exports = async (paths, options) => { + options = { + cwd: process.cwd(), + type: 'file', + allowSymlinks: true, + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fsStat : fsLStat; + + return pLocate(paths, async path_ => { + try { + const stat = await statFn(path.resolve(options.cwd, path_)); + return matchType(options.type, stat); + } catch (_) { + return false; + } + }, options); +}; + +module.exports.sync = (paths, options) => { + options = { + cwd: process.cwd(), + allowSymlinks: true, + type: 'file', + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; + + for (const path_ of paths) { + try { + const stat = statFn(path.resolve(options.cwd, path_)); + + if (matchType(options.type, stat)) { + return path_; + } + } catch (_) { + } + } +}; diff --git a/live2d/node_modules/locate-path/license b/live2d/node_modules/locate-path/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/live2d/node_modules/locate-path/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/locate-path/package.json b/live2d/node_modules/locate-path/package.json new file mode 100644 index 0000000..063b290 --- /dev/null +++ b/live2d/node_modules/locate-path/package.json @@ -0,0 +1,45 @@ +{ + "name": "locate-path", + "version": "5.0.0", + "description": "Get the first path that exists on disk of multiple paths", + "license": "MIT", + "repository": "sindresorhus/locate-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "locate", + "path", + "paths", + "file", + "files", + "exists", + "find", + "finder", + "search", + "searcher", + "array", + "iterable", + "iterator" + ], + "dependencies": { + "p-locate": "^4.1.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/live2d/node_modules/locate-path/readme.md b/live2d/node_modules/locate-path/readme.md new file mode 100644 index 0000000..2184c6f --- /dev/null +++ b/live2d/node_modules/locate-path/readme.md @@ -0,0 +1,122 @@ +# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) + +> Get the first path that exists on disk of multiple paths + + +## Install + +``` +$ npm install locate-path +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const locatePath = require('locate-path'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +(async () => { + console(await locatePath(files)); + //=> 'rainbow' +})(); +``` + + +## API + +### locatePath(paths, [options]) + +Returns a `Promise` for the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `paths` order when searching. + +Disable this to improve performance if you don't care about the order. + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Current working directory. + +##### type + +Type: `string`
+Default: `file`
+Values: `file` `directory` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### locatePath.sync(paths, [options]) + +Returns the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### cwd + +Same as above. + +##### type + +Same as above. + +##### allowSymlinks + +Same as above. + + +## Related + +- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/lodash/LICENSE b/live2d/node_modules/lodash/LICENSE new file mode 100644 index 0000000..77c42f1 --- /dev/null +++ b/live2d/node_modules/lodash/LICENSE @@ -0,0 +1,47 @@ +Copyright OpenJS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/live2d/node_modules/lodash/README.md b/live2d/node_modules/lodash/README.md new file mode 100644 index 0000000..3ab1a05 --- /dev/null +++ b/live2d/node_modules/lodash/README.md @@ -0,0 +1,39 @@ +# lodash v4.17.21 + +The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. + +## Installation + +Using npm: +```shell +$ npm i -g npm +$ npm i --save lodash +``` + +In Node.js: +```js +// Load the full build. +var _ = require('lodash'); +// Load the core build. +var _ = require('lodash/core'); +// Load the FP build for immutable auto-curried iteratee-first data-last methods. +var fp = require('lodash/fp'); + +// Load method categories. +var array = require('lodash/array'); +var object = require('lodash/fp/object'); + +// Cherry-pick methods for smaller browserify/rollup/webpack bundles. +var at = require('lodash/at'); +var curryN = require('lodash/fp/curryN'); +``` + +See the [package source](https://github.com/lodash/lodash/tree/4.17.21-npm) for more details. + +**Note:**
+Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. + +## Support + +Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.
+Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. diff --git a/live2d/node_modules/lodash/_DataView.js b/live2d/node_modules/lodash/_DataView.js new file mode 100644 index 0000000..ac2d57c --- /dev/null +++ b/live2d/node_modules/lodash/_DataView.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'); + +module.exports = DataView; diff --git a/live2d/node_modules/lodash/_Hash.js b/live2d/node_modules/lodash/_Hash.js new file mode 100644 index 0000000..b504fe3 --- /dev/null +++ b/live2d/node_modules/lodash/_Hash.js @@ -0,0 +1,32 @@ +var hashClear = require('./_hashClear'), + hashDelete = require('./_hashDelete'), + hashGet = require('./_hashGet'), + hashHas = require('./_hashHas'), + hashSet = require('./_hashSet'); + +/** + * 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; + +module.exports = Hash; diff --git a/live2d/node_modules/lodash/_LazyWrapper.js b/live2d/node_modules/lodash/_LazyWrapper.js new file mode 100644 index 0000000..81786c7 --- /dev/null +++ b/live2d/node_modules/lodash/_LazyWrapper.js @@ -0,0 +1,28 @@ +var baseCreate = require('./_baseCreate'), + baseLodash = require('./_baseLodash'); + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295; + +/** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ +function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; +} + +// Ensure `LazyWrapper` is an instance of `baseLodash`. +LazyWrapper.prototype = baseCreate(baseLodash.prototype); +LazyWrapper.prototype.constructor = LazyWrapper; + +module.exports = LazyWrapper; diff --git a/live2d/node_modules/lodash/_ListCache.js b/live2d/node_modules/lodash/_ListCache.js new file mode 100644 index 0000000..26895c3 --- /dev/null +++ b/live2d/node_modules/lodash/_ListCache.js @@ -0,0 +1,32 @@ +var listCacheClear = require('./_listCacheClear'), + listCacheDelete = require('./_listCacheDelete'), + listCacheGet = require('./_listCacheGet'), + listCacheHas = require('./_listCacheHas'), + listCacheSet = require('./_listCacheSet'); + +/** + * 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; + +module.exports = ListCache; diff --git a/live2d/node_modules/lodash/_LodashWrapper.js b/live2d/node_modules/lodash/_LodashWrapper.js new file mode 100644 index 0000000..c1e4d9d --- /dev/null +++ b/live2d/node_modules/lodash/_LodashWrapper.js @@ -0,0 +1,22 @@ +var baseCreate = require('./_baseCreate'), + baseLodash = require('./_baseLodash'); + +/** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ +function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; +} + +LodashWrapper.prototype = baseCreate(baseLodash.prototype); +LodashWrapper.prototype.constructor = LodashWrapper; + +module.exports = LodashWrapper; diff --git a/live2d/node_modules/lodash/_Map.js b/live2d/node_modules/lodash/_Map.js new file mode 100644 index 0000000..b73f29a --- /dev/null +++ b/live2d/node_modules/lodash/_Map.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'); + +module.exports = Map; diff --git a/live2d/node_modules/lodash/_MapCache.js b/live2d/node_modules/lodash/_MapCache.js new file mode 100644 index 0000000..4a4eea7 --- /dev/null +++ b/live2d/node_modules/lodash/_MapCache.js @@ -0,0 +1,32 @@ +var mapCacheClear = require('./_mapCacheClear'), + mapCacheDelete = require('./_mapCacheDelete'), + mapCacheGet = require('./_mapCacheGet'), + mapCacheHas = require('./_mapCacheHas'), + mapCacheSet = require('./_mapCacheSet'); + +/** + * 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; + +module.exports = MapCache; diff --git a/live2d/node_modules/lodash/_Promise.js b/live2d/node_modules/lodash/_Promise.js new file mode 100644 index 0000000..247b9e1 --- /dev/null +++ b/live2d/node_modules/lodash/_Promise.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Promise = getNative(root, 'Promise'); + +module.exports = Promise; diff --git a/live2d/node_modules/lodash/_Set.js b/live2d/node_modules/lodash/_Set.js new file mode 100644 index 0000000..b3c8dcb --- /dev/null +++ b/live2d/node_modules/lodash/_Set.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var Set = getNative(root, 'Set'); + +module.exports = Set; diff --git a/live2d/node_modules/lodash/_SetCache.js b/live2d/node_modules/lodash/_SetCache.js new file mode 100644 index 0000000..6468b06 --- /dev/null +++ b/live2d/node_modules/lodash/_SetCache.js @@ -0,0 +1,27 @@ +var MapCache = require('./_MapCache'), + setCacheAdd = require('./_setCacheAdd'), + setCacheHas = require('./_setCacheHas'); + +/** + * + * 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; + +module.exports = SetCache; diff --git a/live2d/node_modules/lodash/_Stack.js b/live2d/node_modules/lodash/_Stack.js new file mode 100644 index 0000000..80b2cf1 --- /dev/null +++ b/live2d/node_modules/lodash/_Stack.js @@ -0,0 +1,27 @@ +var ListCache = require('./_ListCache'), + stackClear = require('./_stackClear'), + stackDelete = require('./_stackDelete'), + stackGet = require('./_stackGet'), + stackHas = require('./_stackHas'), + stackSet = require('./_stackSet'); + +/** + * 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; + +module.exports = Stack; diff --git a/live2d/node_modules/lodash/_Symbol.js b/live2d/node_modules/lodash/_Symbol.js new file mode 100644 index 0000000..a013f7c --- /dev/null +++ b/live2d/node_modules/lodash/_Symbol.js @@ -0,0 +1,6 @@ +var root = require('./_root'); + +/** Built-in value references. */ +var Symbol = root.Symbol; + +module.exports = Symbol; diff --git a/live2d/node_modules/lodash/_Uint8Array.js b/live2d/node_modules/lodash/_Uint8Array.js new file mode 100644 index 0000000..2fb30e1 --- /dev/null +++ b/live2d/node_modules/lodash/_Uint8Array.js @@ -0,0 +1,6 @@ +var root = require('./_root'); + +/** Built-in value references. */ +var Uint8Array = root.Uint8Array; + +module.exports = Uint8Array; diff --git a/live2d/node_modules/lodash/_WeakMap.js b/live2d/node_modules/lodash/_WeakMap.js new file mode 100644 index 0000000..567f86c --- /dev/null +++ b/live2d/node_modules/lodash/_WeakMap.js @@ -0,0 +1,7 @@ +var getNative = require('./_getNative'), + root = require('./_root'); + +/* Built-in method references that are verified to be native. */ +var WeakMap = getNative(root, 'WeakMap'); + +module.exports = WeakMap; diff --git a/live2d/node_modules/lodash/_apply.js b/live2d/node_modules/lodash/_apply.js new file mode 100644 index 0000000..36436dd --- /dev/null +++ b/live2d/node_modules/lodash/_apply.js @@ -0,0 +1,21 @@ +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +module.exports = apply; diff --git a/live2d/node_modules/lodash/_arrayAggregator.js b/live2d/node_modules/lodash/_arrayAggregator.js new file mode 100644 index 0000000..d96c3ca --- /dev/null +++ b/live2d/node_modules/lodash/_arrayAggregator.js @@ -0,0 +1,22 @@ +/** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ +function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; +} + +module.exports = arrayAggregator; diff --git a/live2d/node_modules/lodash/_arrayEach.js b/live2d/node_modules/lodash/_arrayEach.js new file mode 100644 index 0000000..2c5f579 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayEach.js @@ -0,0 +1,22 @@ +/** + * 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; +} + +module.exports = arrayEach; diff --git a/live2d/node_modules/lodash/_arrayEachRight.js b/live2d/node_modules/lodash/_arrayEachRight.js new file mode 100644 index 0000000..976ca5c --- /dev/null +++ b/live2d/node_modules/lodash/_arrayEachRight.js @@ -0,0 +1,21 @@ +/** + * A specialized version of `_.forEachRight` 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 arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; +} + +module.exports = arrayEachRight; diff --git a/live2d/node_modules/lodash/_arrayEvery.js b/live2d/node_modules/lodash/_arrayEvery.js new file mode 100644 index 0000000..e26a918 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayEvery.js @@ -0,0 +1,23 @@ +/** + * A specialized version of `_.every` 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 all elements pass the predicate check, + * else `false`. + */ +function arrayEvery(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; +} + +module.exports = arrayEvery; diff --git a/live2d/node_modules/lodash/_arrayFilter.js b/live2d/node_modules/lodash/_arrayFilter.js new file mode 100644 index 0000000..75ea254 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayFilter.js @@ -0,0 +1,25 @@ +/** + * 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; +} + +module.exports = arrayFilter; diff --git a/live2d/node_modules/lodash/_arrayIncludes.js b/live2d/node_modules/lodash/_arrayIncludes.js new file mode 100644 index 0000000..3737a6d --- /dev/null +++ b/live2d/node_modules/lodash/_arrayIncludes.js @@ -0,0 +1,17 @@ +var baseIndexOf = require('./_baseIndexOf'); + +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; +} + +module.exports = arrayIncludes; diff --git a/live2d/node_modules/lodash/_arrayIncludesWith.js b/live2d/node_modules/lodash/_arrayIncludesWith.js new file mode 100644 index 0000000..235fd97 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayIncludesWith.js @@ -0,0 +1,22 @@ +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; +} + +module.exports = arrayIncludesWith; diff --git a/live2d/node_modules/lodash/_arrayLikeKeys.js b/live2d/node_modules/lodash/_arrayLikeKeys.js new file mode 100644 index 0000000..b2ec9ce --- /dev/null +++ b/live2d/node_modules/lodash/_arrayLikeKeys.js @@ -0,0 +1,49 @@ +var baseTimes = require('./_baseTimes'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isIndex = require('./_isIndex'), + isTypedArray = require('./isTypedArray'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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.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; +} + +module.exports = arrayLikeKeys; diff --git a/live2d/node_modules/lodash/_arrayMap.js b/live2d/node_modules/lodash/_arrayMap.js new file mode 100644 index 0000000..22b2246 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayMap.js @@ -0,0 +1,21 @@ +/** + * A specialized version of `_.map` 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 the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; diff --git a/live2d/node_modules/lodash/_arrayPush.js b/live2d/node_modules/lodash/_arrayPush.js new file mode 100644 index 0000000..7d742b3 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayPush.js @@ -0,0 +1,20 @@ +/** + * 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; +} + +module.exports = arrayPush; diff --git a/live2d/node_modules/lodash/_arrayReduce.js b/live2d/node_modules/lodash/_arrayReduce.js new file mode 100644 index 0000000..de8b79b --- /dev/null +++ b/live2d/node_modules/lodash/_arrayReduce.js @@ -0,0 +1,26 @@ +/** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} + +module.exports = arrayReduce; diff --git a/live2d/node_modules/lodash/_arrayReduceRight.js b/live2d/node_modules/lodash/_arrayReduceRight.js new file mode 100644 index 0000000..22d8976 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayReduceRight.js @@ -0,0 +1,24 @@ +/** + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; +} + +module.exports = arrayReduceRight; diff --git a/live2d/node_modules/lodash/_arraySample.js b/live2d/node_modules/lodash/_arraySample.js new file mode 100644 index 0000000..fcab010 --- /dev/null +++ b/live2d/node_modules/lodash/_arraySample.js @@ -0,0 +1,15 @@ +var baseRandom = require('./_baseRandom'); + +/** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ +function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; +} + +module.exports = arraySample; diff --git a/live2d/node_modules/lodash/_arraySampleSize.js b/live2d/node_modules/lodash/_arraySampleSize.js new file mode 100644 index 0000000..8c7e364 --- /dev/null +++ b/live2d/node_modules/lodash/_arraySampleSize.js @@ -0,0 +1,17 @@ +var baseClamp = require('./_baseClamp'), + copyArray = require('./_copyArray'), + shuffleSelf = require('./_shuffleSelf'); + +/** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ +function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); +} + +module.exports = arraySampleSize; diff --git a/live2d/node_modules/lodash/_arrayShuffle.js b/live2d/node_modules/lodash/_arrayShuffle.js new file mode 100644 index 0000000..46313a3 --- /dev/null +++ b/live2d/node_modules/lodash/_arrayShuffle.js @@ -0,0 +1,15 @@ +var copyArray = require('./_copyArray'), + shuffleSelf = require('./_shuffleSelf'); + +/** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ +function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); +} + +module.exports = arrayShuffle; diff --git a/live2d/node_modules/lodash/_arraySome.js b/live2d/node_modules/lodash/_arraySome.js new file mode 100644 index 0000000..6fd02fd --- /dev/null +++ b/live2d/node_modules/lodash/_arraySome.js @@ -0,0 +1,23 @@ +/** + * 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; +} + +module.exports = arraySome; diff --git a/live2d/node_modules/lodash/_asciiSize.js b/live2d/node_modules/lodash/_asciiSize.js new file mode 100644 index 0000000..11d29c3 --- /dev/null +++ b/live2d/node_modules/lodash/_asciiSize.js @@ -0,0 +1,12 @@ +var baseProperty = require('./_baseProperty'); + +/** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +var asciiSize = baseProperty('length'); + +module.exports = asciiSize; diff --git a/live2d/node_modules/lodash/_asciiToArray.js b/live2d/node_modules/lodash/_asciiToArray.js new file mode 100644 index 0000000..8e3dd5b --- /dev/null +++ b/live2d/node_modules/lodash/_asciiToArray.js @@ -0,0 +1,12 @@ +/** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function asciiToArray(string) { + return string.split(''); +} + +module.exports = asciiToArray; diff --git a/live2d/node_modules/lodash/_asciiWords.js b/live2d/node_modules/lodash/_asciiWords.js new file mode 100644 index 0000000..d765f0f --- /dev/null +++ b/live2d/node_modules/lodash/_asciiWords.js @@ -0,0 +1,15 @@ +/** Used to match words composed of alphanumeric characters. */ +var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + +/** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function asciiWords(string) { + return string.match(reAsciiWord) || []; +} + +module.exports = asciiWords; diff --git a/live2d/node_modules/lodash/_assignMergeValue.js b/live2d/node_modules/lodash/_assignMergeValue.js new file mode 100644 index 0000000..cb1185e --- /dev/null +++ b/live2d/node_modules/lodash/_assignMergeValue.js @@ -0,0 +1,20 @@ +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); + +/** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @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 assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +module.exports = assignMergeValue; diff --git a/live2d/node_modules/lodash/_assignValue.js b/live2d/node_modules/lodash/_assignValue.js new file mode 100644 index 0000000..4083957 --- /dev/null +++ b/live2d/node_modules/lodash/_assignValue.js @@ -0,0 +1,28 @@ +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } +} + +module.exports = assignValue; diff --git a/live2d/node_modules/lodash/_assocIndexOf.js b/live2d/node_modules/lodash/_assocIndexOf.js new file mode 100644 index 0000000..5b77a2b --- /dev/null +++ b/live2d/node_modules/lodash/_assocIndexOf.js @@ -0,0 +1,21 @@ +var eq = require('./eq'); + +/** + * 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; +} + +module.exports = assocIndexOf; diff --git a/live2d/node_modules/lodash/_baseAggregator.js b/live2d/node_modules/lodash/_baseAggregator.js new file mode 100644 index 0000000..4bc9e91 --- /dev/null +++ b/live2d/node_modules/lodash/_baseAggregator.js @@ -0,0 +1,21 @@ +var baseEach = require('./_baseEach'); + +/** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ +function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; +} + +module.exports = baseAggregator; diff --git a/live2d/node_modules/lodash/_baseAssign.js b/live2d/node_modules/lodash/_baseAssign.js new file mode 100644 index 0000000..e5c4a1a --- /dev/null +++ b/live2d/node_modules/lodash/_baseAssign.js @@ -0,0 +1,17 @@ +var copyObject = require('./_copyObject'), + keys = require('./keys'); + +/** + * 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); +} + +module.exports = baseAssign; diff --git a/live2d/node_modules/lodash/_baseAssignIn.js b/live2d/node_modules/lodash/_baseAssignIn.js new file mode 100644 index 0000000..6624f90 --- /dev/null +++ b/live2d/node_modules/lodash/_baseAssignIn.js @@ -0,0 +1,17 @@ +var copyObject = require('./_copyObject'), + keysIn = require('./keysIn'); + +/** + * 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); +} + +module.exports = baseAssignIn; diff --git a/live2d/node_modules/lodash/_baseAssignValue.js b/live2d/node_modules/lodash/_baseAssignValue.js new file mode 100644 index 0000000..d6f66ef --- /dev/null +++ b/live2d/node_modules/lodash/_baseAssignValue.js @@ -0,0 +1,25 @@ +var defineProperty = require('./_defineProperty'); + +/** + * 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) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +module.exports = baseAssignValue; diff --git a/live2d/node_modules/lodash/_baseAt.js b/live2d/node_modules/lodash/_baseAt.js new file mode 100644 index 0000000..90e4237 --- /dev/null +++ b/live2d/node_modules/lodash/_baseAt.js @@ -0,0 +1,23 @@ +var get = require('./get'); + +/** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ +function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined : get(object, paths[index]); + } + return result; +} + +module.exports = baseAt; diff --git a/live2d/node_modules/lodash/_baseClamp.js b/live2d/node_modules/lodash/_baseClamp.js new file mode 100644 index 0000000..a1c5692 --- /dev/null +++ b/live2d/node_modules/lodash/_baseClamp.js @@ -0,0 +1,22 @@ +/** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ +function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; +} + +module.exports = baseClamp; diff --git a/live2d/node_modules/lodash/_baseClone.js b/live2d/node_modules/lodash/_baseClone.js new file mode 100644 index 0000000..69f8705 --- /dev/null +++ b/live2d/node_modules/lodash/_baseClone.js @@ -0,0 +1,166 @@ +var Stack = require('./_Stack'), + arrayEach = require('./_arrayEach'), + assignValue = require('./_assignValue'), + baseAssign = require('./_baseAssign'), + baseAssignIn = require('./_baseAssignIn'), + cloneBuffer = require('./_cloneBuffer'), + copyArray = require('./_copyArray'), + copySymbols = require('./_copySymbols'), + copySymbolsIn = require('./_copySymbolsIn'), + getAllKeys = require('./_getAllKeys'), + getAllKeysIn = require('./_getAllKeysIn'), + getTag = require('./_getTag'), + initCloneArray = require('./_initCloneArray'), + initCloneByTag = require('./_initCloneByTag'), + initCloneObject = require('./_initCloneObject'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isMap = require('./isMap'), + isObject = require('./isObject'), + isSet = require('./isSet'), + keys = require('./keys'), + keysIn = require('./keysIn'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 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, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + 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(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; +} + +module.exports = baseClone; diff --git a/live2d/node_modules/lodash/_baseConforms.js b/live2d/node_modules/lodash/_baseConforms.js new file mode 100644 index 0000000..947e20d --- /dev/null +++ b/live2d/node_modules/lodash/_baseConforms.js @@ -0,0 +1,18 @@ +var baseConformsTo = require('./_baseConformsTo'), + keys = require('./keys'); + +/** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ +function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; +} + +module.exports = baseConforms; diff --git a/live2d/node_modules/lodash/_baseConformsTo.js b/live2d/node_modules/lodash/_baseConformsTo.js new file mode 100644 index 0000000..e449cb8 --- /dev/null +++ b/live2d/node_modules/lodash/_baseConformsTo.js @@ -0,0 +1,27 @@ +/** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ +function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; +} + +module.exports = baseConformsTo; diff --git a/live2d/node_modules/lodash/_baseCreate.js b/live2d/node_modules/lodash/_baseCreate.js new file mode 100644 index 0000000..ffa6a52 --- /dev/null +++ b/live2d/node_modules/lodash/_baseCreate.js @@ -0,0 +1,30 @@ +var isObject = require('./isObject'); + +/** 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; + }; +}()); + +module.exports = baseCreate; diff --git a/live2d/node_modules/lodash/_baseDelay.js b/live2d/node_modules/lodash/_baseDelay.js new file mode 100644 index 0000000..1486d69 --- /dev/null +++ b/live2d/node_modules/lodash/_baseDelay.js @@ -0,0 +1,21 @@ +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ +function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); +} + +module.exports = baseDelay; diff --git a/live2d/node_modules/lodash/_baseDifference.js b/live2d/node_modules/lodash/_baseDifference.js new file mode 100644 index 0000000..343ac19 --- /dev/null +++ b/live2d/node_modules/lodash/_baseDifference.js @@ -0,0 +1,67 @@ +var SetCache = require('./_SetCache'), + arrayIncludes = require('./_arrayIncludes'), + arrayIncludesWith = require('./_arrayIncludesWith'), + arrayMap = require('./_arrayMap'), + baseUnary = require('./_baseUnary'), + cacheHas = require('./_cacheHas'); + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ +function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; +} + +module.exports = baseDifference; diff --git a/live2d/node_modules/lodash/_baseEach.js b/live2d/node_modules/lodash/_baseEach.js new file mode 100644 index 0000000..512c067 --- /dev/null +++ b/live2d/node_modules/lodash/_baseEach.js @@ -0,0 +1,14 @@ +var baseForOwn = require('./_baseForOwn'), + createBaseEach = require('./_createBaseEach'); + +/** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ +var baseEach = createBaseEach(baseForOwn); + +module.exports = baseEach; diff --git a/live2d/node_modules/lodash/_baseEachRight.js b/live2d/node_modules/lodash/_baseEachRight.js new file mode 100644 index 0000000..0a8feec --- /dev/null +++ b/live2d/node_modules/lodash/_baseEachRight.js @@ -0,0 +1,14 @@ +var baseForOwnRight = require('./_baseForOwnRight'), + createBaseEach = require('./_createBaseEach'); + +/** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ +var baseEachRight = createBaseEach(baseForOwnRight, true); + +module.exports = baseEachRight; diff --git a/live2d/node_modules/lodash/_baseEvery.js b/live2d/node_modules/lodash/_baseEvery.js new file mode 100644 index 0000000..fa52f7b --- /dev/null +++ b/live2d/node_modules/lodash/_baseEvery.js @@ -0,0 +1,21 @@ +var baseEach = require('./_baseEach'); + +/** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ +function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; +} + +module.exports = baseEvery; diff --git a/live2d/node_modules/lodash/_baseExtremum.js b/live2d/node_modules/lodash/_baseExtremum.js new file mode 100644 index 0000000..9d6aa77 --- /dev/null +++ b/live2d/node_modules/lodash/_baseExtremum.js @@ -0,0 +1,32 @@ +var isSymbol = require('./isSymbol'); + +/** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ +function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; +} + +module.exports = baseExtremum; diff --git a/live2d/node_modules/lodash/_baseFill.js b/live2d/node_modules/lodash/_baseFill.js new file mode 100644 index 0000000..46ef9c7 --- /dev/null +++ b/live2d/node_modules/lodash/_baseFill.js @@ -0,0 +1,32 @@ +var toInteger = require('./toInteger'), + toLength = require('./toLength'); + +/** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ +function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; +} + +module.exports = baseFill; diff --git a/live2d/node_modules/lodash/_baseFilter.js b/live2d/node_modules/lodash/_baseFilter.js new file mode 100644 index 0000000..4678477 --- /dev/null +++ b/live2d/node_modules/lodash/_baseFilter.js @@ -0,0 +1,21 @@ +var baseEach = require('./_baseEach'); + +/** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; +} + +module.exports = baseFilter; diff --git a/live2d/node_modules/lodash/_baseFindIndex.js b/live2d/node_modules/lodash/_baseFindIndex.js new file mode 100644 index 0000000..e3f5d8a --- /dev/null +++ b/live2d/node_modules/lodash/_baseFindIndex.js @@ -0,0 +1,24 @@ +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +module.exports = baseFindIndex; diff --git a/live2d/node_modules/lodash/_baseFindKey.js b/live2d/node_modules/lodash/_baseFindKey.js new file mode 100644 index 0000000..2e430f3 --- /dev/null +++ b/live2d/node_modules/lodash/_baseFindKey.js @@ -0,0 +1,23 @@ +/** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ +function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; +} + +module.exports = baseFindKey; diff --git a/live2d/node_modules/lodash/_baseFlatten.js b/live2d/node_modules/lodash/_baseFlatten.js new file mode 100644 index 0000000..4b1e009 --- /dev/null +++ b/live2d/node_modules/lodash/_baseFlatten.js @@ -0,0 +1,38 @@ +var arrayPush = require('./_arrayPush'), + isFlattenable = require('./_isFlattenable'); + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +module.exports = baseFlatten; diff --git a/live2d/node_modules/lodash/_baseFor.js b/live2d/node_modules/lodash/_baseFor.js new file mode 100644 index 0000000..d946590 --- /dev/null +++ b/live2d/node_modules/lodash/_baseFor.js @@ -0,0 +1,16 @@ +var createBaseFor = require('./_createBaseFor'); + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +module.exports = baseFor; diff --git a/live2d/node_modules/lodash/_baseForOwn.js b/live2d/node_modules/lodash/_baseForOwn.js new file mode 100644 index 0000000..503d523 --- /dev/null +++ b/live2d/node_modules/lodash/_baseForOwn.js @@ -0,0 +1,16 @@ +var baseFor = require('./_baseFor'), + keys = require('./keys'); + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} + +module.exports = baseForOwn; diff --git a/live2d/node_modules/lodash/_baseForOwnRight.js b/live2d/node_modules/lodash/_baseForOwnRight.js new file mode 100644 index 0000000..a4b10e6 --- /dev/null +++ b/live2d/node_modules/lodash/_baseForOwnRight.js @@ -0,0 +1,16 @@ +var baseForRight = require('./_baseForRight'), + keys = require('./keys'); + +/** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); +} + +module.exports = baseForOwnRight; diff --git a/live2d/node_modules/lodash/_baseForRight.js b/live2d/node_modules/lodash/_baseForRight.js new file mode 100644 index 0000000..32842cd --- /dev/null +++ b/live2d/node_modules/lodash/_baseForRight.js @@ -0,0 +1,15 @@ +var createBaseFor = require('./_createBaseFor'); + +/** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseForRight = createBaseFor(true); + +module.exports = baseForRight; diff --git a/live2d/node_modules/lodash/_baseFunctions.js b/live2d/node_modules/lodash/_baseFunctions.js new file mode 100644 index 0000000..d23bc9b --- /dev/null +++ b/live2d/node_modules/lodash/_baseFunctions.js @@ -0,0 +1,19 @@ +var arrayFilter = require('./_arrayFilter'), + isFunction = require('./isFunction'); + +/** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ +function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); +} + +module.exports = baseFunctions; diff --git a/live2d/node_modules/lodash/_baseGet.js b/live2d/node_modules/lodash/_baseGet.js new file mode 100644 index 0000000..a194913 --- /dev/null +++ b/live2d/node_modules/lodash/_baseGet.js @@ -0,0 +1,24 @@ +var castPath = require('./_castPath'), + toKey = require('./_toKey'); + +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; +} + +module.exports = baseGet; diff --git a/live2d/node_modules/lodash/_baseGetAllKeys.js b/live2d/node_modules/lodash/_baseGetAllKeys.js new file mode 100644 index 0000000..8ad204e --- /dev/null +++ b/live2d/node_modules/lodash/_baseGetAllKeys.js @@ -0,0 +1,20 @@ +var arrayPush = require('./_arrayPush'), + isArray = require('./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)); +} + +module.exports = baseGetAllKeys; diff --git a/live2d/node_modules/lodash/_baseGetTag.js b/live2d/node_modules/lodash/_baseGetTag.js new file mode 100644 index 0000000..b927ccc --- /dev/null +++ b/live2d/node_modules/lodash/_baseGetTag.js @@ -0,0 +1,28 @@ +var Symbol = require('./_Symbol'), + getRawTag = require('./_getRawTag'), + objectToString = require('./_objectToString'); + +/** `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); +} + +module.exports = baseGetTag; diff --git a/live2d/node_modules/lodash/_baseGt.js b/live2d/node_modules/lodash/_baseGt.js new file mode 100644 index 0000000..502d273 --- /dev/null +++ b/live2d/node_modules/lodash/_baseGt.js @@ -0,0 +1,14 @@ +/** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ +function baseGt(value, other) { + return value > other; +} + +module.exports = baseGt; diff --git a/live2d/node_modules/lodash/_baseHas.js b/live2d/node_modules/lodash/_baseHas.js new file mode 100644 index 0000000..1b73032 --- /dev/null +++ b/live2d/node_modules/lodash/_baseHas.js @@ -0,0 +1,19 @@ +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); +} + +module.exports = baseHas; diff --git a/live2d/node_modules/lodash/_baseHasIn.js b/live2d/node_modules/lodash/_baseHasIn.js new file mode 100644 index 0000000..2e0d042 --- /dev/null +++ b/live2d/node_modules/lodash/_baseHasIn.js @@ -0,0 +1,13 @@ +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} + +module.exports = baseHasIn; diff --git a/live2d/node_modules/lodash/_baseInRange.js b/live2d/node_modules/lodash/_baseInRange.js new file mode 100644 index 0000000..ec95666 --- /dev/null +++ b/live2d/node_modules/lodash/_baseInRange.js @@ -0,0 +1,18 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ +function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); +} + +module.exports = baseInRange; diff --git a/live2d/node_modules/lodash/_baseIndexOf.js b/live2d/node_modules/lodash/_baseIndexOf.js new file mode 100644 index 0000000..167e706 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIndexOf.js @@ -0,0 +1,20 @@ +var baseFindIndex = require('./_baseFindIndex'), + baseIsNaN = require('./_baseIsNaN'), + strictIndexOf = require('./_strictIndexOf'); + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); +} + +module.exports = baseIndexOf; diff --git a/live2d/node_modules/lodash/_baseIndexOfWith.js b/live2d/node_modules/lodash/_baseIndexOfWith.js new file mode 100644 index 0000000..f815fe0 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIndexOfWith.js @@ -0,0 +1,23 @@ +/** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; +} + +module.exports = baseIndexOfWith; diff --git a/live2d/node_modules/lodash/_baseIntersection.js b/live2d/node_modules/lodash/_baseIntersection.js new file mode 100644 index 0000000..c1d250c --- /dev/null +++ b/live2d/node_modules/lodash/_baseIntersection.js @@ -0,0 +1,74 @@ +var SetCache = require('./_SetCache'), + arrayIncludes = require('./_arrayIncludes'), + arrayIncludesWith = require('./_arrayIncludesWith'), + arrayMap = require('./_arrayMap'), + baseUnary = require('./_baseUnary'), + cacheHas = require('./_cacheHas'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ +function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; +} + +module.exports = baseIntersection; diff --git a/live2d/node_modules/lodash/_baseInverter.js b/live2d/node_modules/lodash/_baseInverter.js new file mode 100644 index 0000000..fbc337f --- /dev/null +++ b/live2d/node_modules/lodash/_baseInverter.js @@ -0,0 +1,21 @@ +var baseForOwn = require('./_baseForOwn'); + +/** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ +function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; +} + +module.exports = baseInverter; diff --git a/live2d/node_modules/lodash/_baseInvoke.js b/live2d/node_modules/lodash/_baseInvoke.js new file mode 100644 index 0000000..49bcf3c --- /dev/null +++ b/live2d/node_modules/lodash/_baseInvoke.js @@ -0,0 +1,24 @@ +var apply = require('./_apply'), + castPath = require('./_castPath'), + last = require('./last'), + parent = require('./_parent'), + toKey = require('./_toKey'); + +/** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ +function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined : apply(func, object, args); +} + +module.exports = baseInvoke; diff --git a/live2d/node_modules/lodash/_baseIsArguments.js b/live2d/node_modules/lodash/_baseIsArguments.js new file mode 100644 index 0000000..b3562cc --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsArguments.js @@ -0,0 +1,18 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var argsTag = '[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; +} + +module.exports = baseIsArguments; diff --git a/live2d/node_modules/lodash/_baseIsArrayBuffer.js b/live2d/node_modules/lodash/_baseIsArrayBuffer.js new file mode 100644 index 0000000..a2c4f30 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsArrayBuffer.js @@ -0,0 +1,17 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +var arrayBufferTag = '[object ArrayBuffer]'; + +/** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ +function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; +} + +module.exports = baseIsArrayBuffer; diff --git a/live2d/node_modules/lodash/_baseIsDate.js b/live2d/node_modules/lodash/_baseIsDate.js new file mode 100644 index 0000000..ba67c78 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsDate.js @@ -0,0 +1,18 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var dateTag = '[object Date]'; + +/** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ +function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; +} + +module.exports = baseIsDate; diff --git a/live2d/node_modules/lodash/_baseIsEqual.js b/live2d/node_modules/lodash/_baseIsEqual.js new file mode 100644 index 0000000..00a68a4 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsEqual.js @@ -0,0 +1,28 @@ +var baseIsEqualDeep = require('./_baseIsEqualDeep'), + isObjectLike = require('./isObjectLike'); + +/** + * 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); +} + +module.exports = baseIsEqual; diff --git a/live2d/node_modules/lodash/_baseIsEqualDeep.js b/live2d/node_modules/lodash/_baseIsEqualDeep.js new file mode 100644 index 0000000..e3cfd6a --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsEqualDeep.js @@ -0,0 +1,83 @@ +var Stack = require('./_Stack'), + equalArrays = require('./_equalArrays'), + equalByTag = require('./_equalByTag'), + equalObjects = require('./_equalObjects'), + getTag = require('./_getTag'), + isArray = require('./isArray'), + isBuffer = require('./isBuffer'), + isTypedArray = require('./isTypedArray'); + +/** 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(object), + othTag = othIsArr ? arrayTag : getTag(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); +} + +module.exports = baseIsEqualDeep; diff --git a/live2d/node_modules/lodash/_baseIsMap.js b/live2d/node_modules/lodash/_baseIsMap.js new file mode 100644 index 0000000..02a4021 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsMap.js @@ -0,0 +1,18 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var mapTag = '[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(value) == mapTag; +} + +module.exports = baseIsMap; diff --git a/live2d/node_modules/lodash/_baseIsMatch.js b/live2d/node_modules/lodash/_baseIsMatch.js new file mode 100644 index 0000000..72494be --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsMatch.js @@ -0,0 +1,62 @@ +var Stack = require('./_Stack'), + baseIsEqual = require('./_baseIsEqual'); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; +} + +module.exports = baseIsMatch; diff --git a/live2d/node_modules/lodash/_baseIsNaN.js b/live2d/node_modules/lodash/_baseIsNaN.js new file mode 100644 index 0000000..316f1eb --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsNaN.js @@ -0,0 +1,12 @@ +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +module.exports = baseIsNaN; diff --git a/live2d/node_modules/lodash/_baseIsNative.js b/live2d/node_modules/lodash/_baseIsNative.js new file mode 100644 index 0000000..8702330 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsNative.js @@ -0,0 +1,47 @@ +var isFunction = require('./isFunction'), + isMasked = require('./_isMasked'), + isObject = require('./isObject'), + toSource = require('./_toSource'); + +/** + * 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 = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).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)); +} + +module.exports = baseIsNative; diff --git a/live2d/node_modules/lodash/_baseIsRegExp.js b/live2d/node_modules/lodash/_baseIsRegExp.js new file mode 100644 index 0000000..6cd7c1a --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsRegExp.js @@ -0,0 +1,18 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var regexpTag = '[object RegExp]'; + +/** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ +function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; +} + +module.exports = baseIsRegExp; diff --git a/live2d/node_modules/lodash/_baseIsSet.js b/live2d/node_modules/lodash/_baseIsSet.js new file mode 100644 index 0000000..6dee367 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsSet.js @@ -0,0 +1,18 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var setTag = '[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(value) == setTag; +} + +module.exports = baseIsSet; diff --git a/live2d/node_modules/lodash/_baseIsTypedArray.js b/live2d/node_modules/lodash/_baseIsTypedArray.js new file mode 100644 index 0000000..1edb32f --- /dev/null +++ b/live2d/node_modules/lodash/_baseIsTypedArray.js @@ -0,0 +1,60 @@ +var baseGetTag = require('./_baseGetTag'), + isLength = require('./isLength'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + 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 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] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = 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)]; +} + +module.exports = baseIsTypedArray; diff --git a/live2d/node_modules/lodash/_baseIteratee.js b/live2d/node_modules/lodash/_baseIteratee.js new file mode 100644 index 0000000..995c257 --- /dev/null +++ b/live2d/node_modules/lodash/_baseIteratee.js @@ -0,0 +1,31 @@ +var baseMatches = require('./_baseMatches'), + baseMatchesProperty = require('./_baseMatchesProperty'), + identity = require('./identity'), + isArray = require('./isArray'), + property = require('./property'); + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); +} + +module.exports = baseIteratee; diff --git a/live2d/node_modules/lodash/_baseKeys.js b/live2d/node_modules/lodash/_baseKeys.js new file mode 100644 index 0000000..45e9e6f --- /dev/null +++ b/live2d/node_modules/lodash/_baseKeys.js @@ -0,0 +1,30 @@ +var isPrototype = require('./_isPrototype'), + nativeKeys = require('./_nativeKeys'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +module.exports = baseKeys; diff --git a/live2d/node_modules/lodash/_baseKeysIn.js b/live2d/node_modules/lodash/_baseKeysIn.js new file mode 100644 index 0000000..ea8a0a1 --- /dev/null +++ b/live2d/node_modules/lodash/_baseKeysIn.js @@ -0,0 +1,33 @@ +var isObject = require('./isObject'), + isPrototype = require('./_isPrototype'), + nativeKeysIn = require('./_nativeKeysIn'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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.call(object, key)))) { + result.push(key); + } + } + return result; +} + +module.exports = baseKeysIn; diff --git a/live2d/node_modules/lodash/_baseLodash.js b/live2d/node_modules/lodash/_baseLodash.js new file mode 100644 index 0000000..f76c790 --- /dev/null +++ b/live2d/node_modules/lodash/_baseLodash.js @@ -0,0 +1,10 @@ +/** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ +function baseLodash() { + // No operation performed. +} + +module.exports = baseLodash; diff --git a/live2d/node_modules/lodash/_baseLt.js b/live2d/node_modules/lodash/_baseLt.js new file mode 100644 index 0000000..8674d29 --- /dev/null +++ b/live2d/node_modules/lodash/_baseLt.js @@ -0,0 +1,14 @@ +/** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ +function baseLt(value, other) { + return value < other; +} + +module.exports = baseLt; diff --git a/live2d/node_modules/lodash/_baseMap.js b/live2d/node_modules/lodash/_baseMap.js new file mode 100644 index 0000000..0bf5cea --- /dev/null +++ b/live2d/node_modules/lodash/_baseMap.js @@ -0,0 +1,22 @@ +var baseEach = require('./_baseEach'), + isArrayLike = require('./isArrayLike'); + +/** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; +} + +module.exports = baseMap; diff --git a/live2d/node_modules/lodash/_baseMatches.js b/live2d/node_modules/lodash/_baseMatches.js new file mode 100644 index 0000000..e56582a --- /dev/null +++ b/live2d/node_modules/lodash/_baseMatches.js @@ -0,0 +1,22 @@ +var baseIsMatch = require('./_baseIsMatch'), + getMatchData = require('./_getMatchData'), + matchesStrictComparable = require('./_matchesStrictComparable'); + +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; +} + +module.exports = baseMatches; diff --git a/live2d/node_modules/lodash/_baseMatchesProperty.js b/live2d/node_modules/lodash/_baseMatchesProperty.js new file mode 100644 index 0000000..24afd89 --- /dev/null +++ b/live2d/node_modules/lodash/_baseMatchesProperty.js @@ -0,0 +1,33 @@ +var baseIsEqual = require('./_baseIsEqual'), + get = require('./get'), + hasIn = require('./hasIn'), + isKey = require('./_isKey'), + isStrictComparable = require('./_isStrictComparable'), + matchesStrictComparable = require('./_matchesStrictComparable'), + toKey = require('./_toKey'); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; +} + +module.exports = baseMatchesProperty; diff --git a/live2d/node_modules/lodash/_baseMean.js b/live2d/node_modules/lodash/_baseMean.js new file mode 100644 index 0000000..fa9e00a --- /dev/null +++ b/live2d/node_modules/lodash/_baseMean.js @@ -0,0 +1,20 @@ +var baseSum = require('./_baseSum'); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ +function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; +} + +module.exports = baseMean; diff --git a/live2d/node_modules/lodash/_baseMerge.js b/live2d/node_modules/lodash/_baseMerge.js new file mode 100644 index 0000000..c98b5eb --- /dev/null +++ b/live2d/node_modules/lodash/_baseMerge.js @@ -0,0 +1,42 @@ +var Stack = require('./_Stack'), + assignMergeValue = require('./_assignMergeValue'), + baseFor = require('./_baseFor'), + baseMergeDeep = require('./_baseMergeDeep'), + isObject = require('./isObject'), + keysIn = require('./keysIn'), + safeGet = require('./_safeGet'); + +/** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ +function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); +} + +module.exports = baseMerge; diff --git a/live2d/node_modules/lodash/_baseMergeDeep.js b/live2d/node_modules/lodash/_baseMergeDeep.js new file mode 100644 index 0000000..4679e8d --- /dev/null +++ b/live2d/node_modules/lodash/_baseMergeDeep.js @@ -0,0 +1,94 @@ +var assignMergeValue = require('./_assignMergeValue'), + cloneBuffer = require('./_cloneBuffer'), + cloneTypedArray = require('./_cloneTypedArray'), + copyArray = require('./_copyArray'), + initCloneObject = require('./_initCloneObject'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isArrayLikeObject = require('./isArrayLikeObject'), + isBuffer = require('./isBuffer'), + isFunction = require('./isFunction'), + isObject = require('./isObject'), + isPlainObject = require('./isPlainObject'), + isTypedArray = require('./isTypedArray'), + safeGet = require('./_safeGet'), + toPlainObject = require('./toPlainObject'); + +/** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ +function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); +} + +module.exports = baseMergeDeep; diff --git a/live2d/node_modules/lodash/_baseNth.js b/live2d/node_modules/lodash/_baseNth.js new file mode 100644 index 0000000..0403c2a --- /dev/null +++ b/live2d/node_modules/lodash/_baseNth.js @@ -0,0 +1,20 @@ +var isIndex = require('./_isIndex'); + +/** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ +function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; +} + +module.exports = baseNth; diff --git a/live2d/node_modules/lodash/_baseOrderBy.js b/live2d/node_modules/lodash/_baseOrderBy.js new file mode 100644 index 0000000..775a017 --- /dev/null +++ b/live2d/node_modules/lodash/_baseOrderBy.js @@ -0,0 +1,49 @@ +var arrayMap = require('./_arrayMap'), + baseGet = require('./_baseGet'), + baseIteratee = require('./_baseIteratee'), + baseMap = require('./_baseMap'), + baseSortBy = require('./_baseSortBy'), + baseUnary = require('./_baseUnary'), + compareMultiple = require('./_compareMultiple'), + identity = require('./identity'), + isArray = require('./isArray'); + +/** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ +function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); +} + +module.exports = baseOrderBy; diff --git a/live2d/node_modules/lodash/_basePick.js b/live2d/node_modules/lodash/_basePick.js new file mode 100644 index 0000000..09b458a --- /dev/null +++ b/live2d/node_modules/lodash/_basePick.js @@ -0,0 +1,19 @@ +var basePickBy = require('./_basePickBy'), + hasIn = require('./hasIn'); + +/** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ +function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); +} + +module.exports = basePick; diff --git a/live2d/node_modules/lodash/_basePickBy.js b/live2d/node_modules/lodash/_basePickBy.js new file mode 100644 index 0000000..85be68c --- /dev/null +++ b/live2d/node_modules/lodash/_basePickBy.js @@ -0,0 +1,30 @@ +var baseGet = require('./_baseGet'), + baseSet = require('./_baseSet'), + castPath = require('./_castPath'); + +/** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ +function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; +} + +module.exports = basePickBy; diff --git a/live2d/node_modules/lodash/_baseProperty.js b/live2d/node_modules/lodash/_baseProperty.js new file mode 100644 index 0000000..496281e --- /dev/null +++ b/live2d/node_modules/lodash/_baseProperty.js @@ -0,0 +1,14 @@ +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +module.exports = baseProperty; diff --git a/live2d/node_modules/lodash/_basePropertyDeep.js b/live2d/node_modules/lodash/_basePropertyDeep.js new file mode 100644 index 0000000..1e5aae5 --- /dev/null +++ b/live2d/node_modules/lodash/_basePropertyDeep.js @@ -0,0 +1,16 @@ +var baseGet = require('./_baseGet'); + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; +} + +module.exports = basePropertyDeep; diff --git a/live2d/node_modules/lodash/_basePropertyOf.js b/live2d/node_modules/lodash/_basePropertyOf.js new file mode 100644 index 0000000..4617399 --- /dev/null +++ b/live2d/node_modules/lodash/_basePropertyOf.js @@ -0,0 +1,14 @@ +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +module.exports = basePropertyOf; diff --git a/live2d/node_modules/lodash/_basePullAll.js b/live2d/node_modules/lodash/_basePullAll.js new file mode 100644 index 0000000..305720e --- /dev/null +++ b/live2d/node_modules/lodash/_basePullAll.js @@ -0,0 +1,51 @@ +var arrayMap = require('./_arrayMap'), + baseIndexOf = require('./_baseIndexOf'), + baseIndexOfWith = require('./_baseIndexOfWith'), + baseUnary = require('./_baseUnary'), + copyArray = require('./_copyArray'); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ +function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; +} + +module.exports = basePullAll; diff --git a/live2d/node_modules/lodash/_basePullAt.js b/live2d/node_modules/lodash/_basePullAt.js new file mode 100644 index 0000000..c3e9e71 --- /dev/null +++ b/live2d/node_modules/lodash/_basePullAt.js @@ -0,0 +1,37 @@ +var baseUnset = require('./_baseUnset'), + isIndex = require('./_isIndex'); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ +function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; +} + +module.exports = basePullAt; diff --git a/live2d/node_modules/lodash/_baseRandom.js b/live2d/node_modules/lodash/_baseRandom.js new file mode 100644 index 0000000..94f76a7 --- /dev/null +++ b/live2d/node_modules/lodash/_baseRandom.js @@ -0,0 +1,18 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor, + nativeRandom = Math.random; + +/** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ +function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); +} + +module.exports = baseRandom; diff --git a/live2d/node_modules/lodash/_baseRange.js b/live2d/node_modules/lodash/_baseRange.js new file mode 100644 index 0000000..0fb8e41 --- /dev/null +++ b/live2d/node_modules/lodash/_baseRange.js @@ -0,0 +1,28 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil, + nativeMax = Math.max; + +/** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ +function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; +} + +module.exports = baseRange; diff --git a/live2d/node_modules/lodash/_baseReduce.js b/live2d/node_modules/lodash/_baseReduce.js new file mode 100644 index 0000000..5a1f8b5 --- /dev/null +++ b/live2d/node_modules/lodash/_baseReduce.js @@ -0,0 +1,23 @@ +/** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ +function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; +} + +module.exports = baseReduce; diff --git a/live2d/node_modules/lodash/_baseRepeat.js b/live2d/node_modules/lodash/_baseRepeat.js new file mode 100644 index 0000000..ee44c31 --- /dev/null +++ b/live2d/node_modules/lodash/_baseRepeat.js @@ -0,0 +1,35 @@ +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor; + +/** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ +function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; +} + +module.exports = baseRepeat; diff --git a/live2d/node_modules/lodash/_baseRest.js b/live2d/node_modules/lodash/_baseRest.js new file mode 100644 index 0000000..d0dc4bd --- /dev/null +++ b/live2d/node_modules/lodash/_baseRest.js @@ -0,0 +1,17 @@ +var identity = require('./identity'), + overRest = require('./_overRest'), + setToString = require('./_setToString'); + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); +} + +module.exports = baseRest; diff --git a/live2d/node_modules/lodash/_baseSample.js b/live2d/node_modules/lodash/_baseSample.js new file mode 100644 index 0000000..58582b9 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSample.js @@ -0,0 +1,15 @@ +var arraySample = require('./_arraySample'), + values = require('./values'); + +/** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ +function baseSample(collection) { + return arraySample(values(collection)); +} + +module.exports = baseSample; diff --git a/live2d/node_modules/lodash/_baseSampleSize.js b/live2d/node_modules/lodash/_baseSampleSize.js new file mode 100644 index 0000000..5c90ec5 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSampleSize.js @@ -0,0 +1,18 @@ +var baseClamp = require('./_baseClamp'), + shuffleSelf = require('./_shuffleSelf'), + values = require('./values'); + +/** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ +function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); +} + +module.exports = baseSampleSize; diff --git a/live2d/node_modules/lodash/_baseSet.js b/live2d/node_modules/lodash/_baseSet.js new file mode 100644 index 0000000..99f4fbf --- /dev/null +++ b/live2d/node_modules/lodash/_baseSet.js @@ -0,0 +1,51 @@ +var assignValue = require('./_assignValue'), + castPath = require('./_castPath'), + isIndex = require('./_isIndex'), + isObject = require('./isObject'), + toKey = require('./_toKey'); + +/** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ +function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; +} + +module.exports = baseSet; diff --git a/live2d/node_modules/lodash/_baseSetData.js b/live2d/node_modules/lodash/_baseSetData.js new file mode 100644 index 0000000..c409947 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSetData.js @@ -0,0 +1,17 @@ +var identity = require('./identity'), + metaMap = require('./_metaMap'); + +/** + * The base implementation of `setData` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ +var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; +}; + +module.exports = baseSetData; diff --git a/live2d/node_modules/lodash/_baseSetToString.js b/live2d/node_modules/lodash/_baseSetToString.js new file mode 100644 index 0000000..89eaca3 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSetToString.js @@ -0,0 +1,22 @@ +var constant = require('./constant'), + defineProperty = require('./_defineProperty'), + identity = require('./identity'); + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +module.exports = baseSetToString; diff --git a/live2d/node_modules/lodash/_baseShuffle.js b/live2d/node_modules/lodash/_baseShuffle.js new file mode 100644 index 0000000..023077a --- /dev/null +++ b/live2d/node_modules/lodash/_baseShuffle.js @@ -0,0 +1,15 @@ +var shuffleSelf = require('./_shuffleSelf'), + values = require('./values'); + +/** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ +function baseShuffle(collection) { + return shuffleSelf(values(collection)); +} + +module.exports = baseShuffle; diff --git a/live2d/node_modules/lodash/_baseSlice.js b/live2d/node_modules/lodash/_baseSlice.js new file mode 100644 index 0000000..786f6c9 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSlice.js @@ -0,0 +1,31 @@ +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +module.exports = baseSlice; diff --git a/live2d/node_modules/lodash/_baseSome.js b/live2d/node_modules/lodash/_baseSome.js new file mode 100644 index 0000000..58f3f44 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSome.js @@ -0,0 +1,22 @@ +var baseEach = require('./_baseEach'); + +/** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection 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 baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; +} + +module.exports = baseSome; diff --git a/live2d/node_modules/lodash/_baseSortBy.js b/live2d/node_modules/lodash/_baseSortBy.js new file mode 100644 index 0000000..a25c92e --- /dev/null +++ b/live2d/node_modules/lodash/_baseSortBy.js @@ -0,0 +1,21 @@ +/** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ +function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; +} + +module.exports = baseSortBy; diff --git a/live2d/node_modules/lodash/_baseSortedIndex.js b/live2d/node_modules/lodash/_baseSortedIndex.js new file mode 100644 index 0000000..638c366 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSortedIndex.js @@ -0,0 +1,42 @@ +var baseSortedIndexBy = require('./_baseSortedIndexBy'), + identity = require('./identity'), + isSymbol = require('./isSymbol'); + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + +/** + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ +function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); +} + +module.exports = baseSortedIndex; diff --git a/live2d/node_modules/lodash/_baseSortedIndexBy.js b/live2d/node_modules/lodash/_baseSortedIndexBy.js new file mode 100644 index 0000000..c247b37 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSortedIndexBy.js @@ -0,0 +1,67 @@ +var isSymbol = require('./isSymbol'); + +/** Used as references for the maximum length and index of an array. */ +var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor, + nativeMin = Math.min; + +/** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ +function baseSortedIndexBy(array, value, iteratee, retHighest) { + var low = 0, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); +} + +module.exports = baseSortedIndexBy; diff --git a/live2d/node_modules/lodash/_baseSortedUniq.js b/live2d/node_modules/lodash/_baseSortedUniq.js new file mode 100644 index 0000000..802159a --- /dev/null +++ b/live2d/node_modules/lodash/_baseSortedUniq.js @@ -0,0 +1,30 @@ +var eq = require('./eq'); + +/** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ +function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; +} + +module.exports = baseSortedUniq; diff --git a/live2d/node_modules/lodash/_baseSum.js b/live2d/node_modules/lodash/_baseSum.js new file mode 100644 index 0000000..a9e84c1 --- /dev/null +++ b/live2d/node_modules/lodash/_baseSum.js @@ -0,0 +1,24 @@ +/** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ +function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined) { + result = result === undefined ? current : (result + current); + } + } + return result; +} + +module.exports = baseSum; diff --git a/live2d/node_modules/lodash/_baseTimes.js b/live2d/node_modules/lodash/_baseTimes.js new file mode 100644 index 0000000..0603fc3 --- /dev/null +++ b/live2d/node_modules/lodash/_baseTimes.js @@ -0,0 +1,20 @@ +/** + * 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; +} + +module.exports = baseTimes; diff --git a/live2d/node_modules/lodash/_baseToNumber.js b/live2d/node_modules/lodash/_baseToNumber.js new file mode 100644 index 0000000..04859f3 --- /dev/null +++ b/live2d/node_modules/lodash/_baseToNumber.js @@ -0,0 +1,24 @@ +var isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ +function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; +} + +module.exports = baseToNumber; diff --git a/live2d/node_modules/lodash/_baseToPairs.js b/live2d/node_modules/lodash/_baseToPairs.js new file mode 100644 index 0000000..bff1991 --- /dev/null +++ b/live2d/node_modules/lodash/_baseToPairs.js @@ -0,0 +1,18 @@ +var arrayMap = require('./_arrayMap'); + +/** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ +function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); +} + +module.exports = baseToPairs; diff --git a/live2d/node_modules/lodash/_baseToString.js b/live2d/node_modules/lodash/_baseToString.js new file mode 100644 index 0000000..ada6ad2 --- /dev/null +++ b/live2d/node_modules/lodash/_baseToString.js @@ -0,0 +1,37 @@ +var Symbol = require('./_Symbol'), + arrayMap = require('./_arrayMap'), + isArray = require('./isArray'), + isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +module.exports = baseToString; diff --git a/live2d/node_modules/lodash/_baseTrim.js b/live2d/node_modules/lodash/_baseTrim.js new file mode 100644 index 0000000..3e2797d --- /dev/null +++ b/live2d/node_modules/lodash/_baseTrim.js @@ -0,0 +1,19 @@ +var trimmedEndIndex = require('./_trimmedEndIndex'); + +/** Used to match leading whitespace. */ +var reTrimStart = /^\s+/; + +/** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ +function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; +} + +module.exports = baseTrim; diff --git a/live2d/node_modules/lodash/_baseUnary.js b/live2d/node_modules/lodash/_baseUnary.js new file mode 100644 index 0000000..98639e9 --- /dev/null +++ b/live2d/node_modules/lodash/_baseUnary.js @@ -0,0 +1,14 @@ +/** + * 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); + }; +} + +module.exports = baseUnary; diff --git a/live2d/node_modules/lodash/_baseUniq.js b/live2d/node_modules/lodash/_baseUniq.js new file mode 100644 index 0000000..aea459d --- /dev/null +++ b/live2d/node_modules/lodash/_baseUniq.js @@ -0,0 +1,72 @@ +var SetCache = require('./_SetCache'), + arrayIncludes = require('./_arrayIncludes'), + arrayIncludesWith = require('./_arrayIncludesWith'), + cacheHas = require('./_cacheHas'), + createSet = require('./_createSet'), + setToArray = require('./_setToArray'); + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ +function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; +} + +module.exports = baseUniq; diff --git a/live2d/node_modules/lodash/_baseUnset.js b/live2d/node_modules/lodash/_baseUnset.js new file mode 100644 index 0000000..eefc6e3 --- /dev/null +++ b/live2d/node_modules/lodash/_baseUnset.js @@ -0,0 +1,20 @@ +var castPath = require('./_castPath'), + last = require('./last'), + parent = require('./_parent'), + toKey = require('./_toKey'); + +/** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ +function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; +} + +module.exports = baseUnset; diff --git a/live2d/node_modules/lodash/_baseUpdate.js b/live2d/node_modules/lodash/_baseUpdate.js new file mode 100644 index 0000000..92a6237 --- /dev/null +++ b/live2d/node_modules/lodash/_baseUpdate.js @@ -0,0 +1,18 @@ +var baseGet = require('./_baseGet'), + baseSet = require('./_baseSet'); + +/** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ +function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); +} + +module.exports = baseUpdate; diff --git a/live2d/node_modules/lodash/_baseValues.js b/live2d/node_modules/lodash/_baseValues.js new file mode 100644 index 0000000..b95faad --- /dev/null +++ b/live2d/node_modules/lodash/_baseValues.js @@ -0,0 +1,19 @@ +var arrayMap = require('./_arrayMap'); + +/** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ +function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); +} + +module.exports = baseValues; diff --git a/live2d/node_modules/lodash/_baseWhile.js b/live2d/node_modules/lodash/_baseWhile.js new file mode 100644 index 0000000..07eac61 --- /dev/null +++ b/live2d/node_modules/lodash/_baseWhile.js @@ -0,0 +1,26 @@ +var baseSlice = require('./_baseSlice'); + +/** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ +function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); +} + +module.exports = baseWhile; diff --git a/live2d/node_modules/lodash/_baseWrapperValue.js b/live2d/node_modules/lodash/_baseWrapperValue.js new file mode 100644 index 0000000..443e0df --- /dev/null +++ b/live2d/node_modules/lodash/_baseWrapperValue.js @@ -0,0 +1,25 @@ +var LazyWrapper = require('./_LazyWrapper'), + arrayPush = require('./_arrayPush'), + arrayReduce = require('./_arrayReduce'); + +/** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ +function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); +} + +module.exports = baseWrapperValue; diff --git a/live2d/node_modules/lodash/_baseXor.js b/live2d/node_modules/lodash/_baseXor.js new file mode 100644 index 0000000..8e69338 --- /dev/null +++ b/live2d/node_modules/lodash/_baseXor.js @@ -0,0 +1,36 @@ +var baseDifference = require('./_baseDifference'), + baseFlatten = require('./_baseFlatten'), + baseUniq = require('./_baseUniq'); + +/** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ +function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); +} + +module.exports = baseXor; diff --git a/live2d/node_modules/lodash/_baseZipObject.js b/live2d/node_modules/lodash/_baseZipObject.js new file mode 100644 index 0000000..401f85b --- /dev/null +++ b/live2d/node_modules/lodash/_baseZipObject.js @@ -0,0 +1,23 @@ +/** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ +function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); + } + return result; +} + +module.exports = baseZipObject; diff --git a/live2d/node_modules/lodash/_cacheHas.js b/live2d/node_modules/lodash/_cacheHas.js new file mode 100644 index 0000000..2dec892 --- /dev/null +++ b/live2d/node_modules/lodash/_cacheHas.js @@ -0,0 +1,13 @@ +/** + * 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); +} + +module.exports = cacheHas; diff --git a/live2d/node_modules/lodash/_castArrayLikeObject.js b/live2d/node_modules/lodash/_castArrayLikeObject.js new file mode 100644 index 0000000..92c75fa --- /dev/null +++ b/live2d/node_modules/lodash/_castArrayLikeObject.js @@ -0,0 +1,14 @@ +var isArrayLikeObject = require('./isArrayLikeObject'); + +/** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ +function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; +} + +module.exports = castArrayLikeObject; diff --git a/live2d/node_modules/lodash/_castFunction.js b/live2d/node_modules/lodash/_castFunction.js new file mode 100644 index 0000000..98c91ae --- /dev/null +++ b/live2d/node_modules/lodash/_castFunction.js @@ -0,0 +1,14 @@ +var identity = require('./identity'); + +/** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ +function castFunction(value) { + return typeof value == 'function' ? value : identity; +} + +module.exports = castFunction; diff --git a/live2d/node_modules/lodash/_castPath.js b/live2d/node_modules/lodash/_castPath.js new file mode 100644 index 0000000..017e4c1 --- /dev/null +++ b/live2d/node_modules/lodash/_castPath.js @@ -0,0 +1,21 @@ +var isArray = require('./isArray'), + isKey = require('./_isKey'), + stringToPath = require('./_stringToPath'), + toString = require('./toString'); + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); +} + +module.exports = castPath; diff --git a/live2d/node_modules/lodash/_castRest.js b/live2d/node_modules/lodash/_castRest.js new file mode 100644 index 0000000..213c66f --- /dev/null +++ b/live2d/node_modules/lodash/_castRest.js @@ -0,0 +1,14 @@ +var baseRest = require('./_baseRest'); + +/** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +var castRest = baseRest; + +module.exports = castRest; diff --git a/live2d/node_modules/lodash/_castSlice.js b/live2d/node_modules/lodash/_castSlice.js new file mode 100644 index 0000000..071faeb --- /dev/null +++ b/live2d/node_modules/lodash/_castSlice.js @@ -0,0 +1,18 @@ +var baseSlice = require('./_baseSlice'); + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +module.exports = castSlice; diff --git a/live2d/node_modules/lodash/_charsEndIndex.js b/live2d/node_modules/lodash/_charsEndIndex.js new file mode 100644 index 0000000..07908ff --- /dev/null +++ b/live2d/node_modules/lodash/_charsEndIndex.js @@ -0,0 +1,19 @@ +var baseIndexOf = require('./_baseIndexOf'); + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ +function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +module.exports = charsEndIndex; diff --git a/live2d/node_modules/lodash/_charsStartIndex.js b/live2d/node_modules/lodash/_charsStartIndex.js new file mode 100644 index 0000000..b17afd2 --- /dev/null +++ b/live2d/node_modules/lodash/_charsStartIndex.js @@ -0,0 +1,20 @@ +var baseIndexOf = require('./_baseIndexOf'); + +/** + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ +function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; +} + +module.exports = charsStartIndex; diff --git a/live2d/node_modules/lodash/_cloneArrayBuffer.js b/live2d/node_modules/lodash/_cloneArrayBuffer.js new file mode 100644 index 0000000..c3d8f6e --- /dev/null +++ b/live2d/node_modules/lodash/_cloneArrayBuffer.js @@ -0,0 +1,16 @@ +var Uint8Array = require('./_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; +} + +module.exports = cloneArrayBuffer; diff --git a/live2d/node_modules/lodash/_cloneBuffer.js b/live2d/node_modules/lodash/_cloneBuffer.js new file mode 100644 index 0000000..27c4810 --- /dev/null +++ b/live2d/node_modules/lodash/_cloneBuffer.js @@ -0,0 +1,35 @@ +var root = require('./_root'); + +/** 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; +} + +module.exports = cloneBuffer; diff --git a/live2d/node_modules/lodash/_cloneDataView.js b/live2d/node_modules/lodash/_cloneDataView.js new file mode 100644 index 0000000..9c9b7b0 --- /dev/null +++ b/live2d/node_modules/lodash/_cloneDataView.js @@ -0,0 +1,16 @@ +var cloneArrayBuffer = require('./_cloneArrayBuffer'); + +/** + * 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); +} + +module.exports = cloneDataView; diff --git a/live2d/node_modules/lodash/_cloneRegExp.js b/live2d/node_modules/lodash/_cloneRegExp.js new file mode 100644 index 0000000..64a30df --- /dev/null +++ b/live2d/node_modules/lodash/_cloneRegExp.js @@ -0,0 +1,17 @@ +/** 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; +} + +module.exports = cloneRegExp; diff --git a/live2d/node_modules/lodash/_cloneSymbol.js b/live2d/node_modules/lodash/_cloneSymbol.js new file mode 100644 index 0000000..bede39f --- /dev/null +++ b/live2d/node_modules/lodash/_cloneSymbol.js @@ -0,0 +1,18 @@ +var Symbol = require('./_Symbol'); + +/** 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)) : {}; +} + +module.exports = cloneSymbol; diff --git a/live2d/node_modules/lodash/_cloneTypedArray.js b/live2d/node_modules/lodash/_cloneTypedArray.js new file mode 100644 index 0000000..7aad84d --- /dev/null +++ b/live2d/node_modules/lodash/_cloneTypedArray.js @@ -0,0 +1,16 @@ +var cloneArrayBuffer = require('./_cloneArrayBuffer'); + +/** + * 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); +} + +module.exports = cloneTypedArray; diff --git a/live2d/node_modules/lodash/_compareAscending.js b/live2d/node_modules/lodash/_compareAscending.js new file mode 100644 index 0000000..8dc2791 --- /dev/null +++ b/live2d/node_modules/lodash/_compareAscending.js @@ -0,0 +1,41 @@ +var isSymbol = require('./isSymbol'); + +/** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ +function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; +} + +module.exports = compareAscending; diff --git a/live2d/node_modules/lodash/_compareMultiple.js b/live2d/node_modules/lodash/_compareMultiple.js new file mode 100644 index 0000000..ad61f0f --- /dev/null +++ b/live2d/node_modules/lodash/_compareMultiple.js @@ -0,0 +1,44 @@ +var compareAscending = require('./_compareAscending'); + +/** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ +function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; +} + +module.exports = compareMultiple; diff --git a/live2d/node_modules/lodash/_composeArgs.js b/live2d/node_modules/lodash/_composeArgs.js new file mode 100644 index 0000000..1ce40f4 --- /dev/null +++ b/live2d/node_modules/lodash/_composeArgs.js @@ -0,0 +1,39 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; +} + +module.exports = composeArgs; diff --git a/live2d/node_modules/lodash/_composeArgsRight.js b/live2d/node_modules/lodash/_composeArgsRight.js new file mode 100644 index 0000000..8dc588d --- /dev/null +++ b/live2d/node_modules/lodash/_composeArgsRight.js @@ -0,0 +1,41 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ +function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + return result; +} + +module.exports = composeArgsRight; diff --git a/live2d/node_modules/lodash/_copyArray.js b/live2d/node_modules/lodash/_copyArray.js new file mode 100644 index 0000000..cd94d5d --- /dev/null +++ b/live2d/node_modules/lodash/_copyArray.js @@ -0,0 +1,20 @@ +/** + * 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; +} + +module.exports = copyArray; diff --git a/live2d/node_modules/lodash/_copyObject.js b/live2d/node_modules/lodash/_copyObject.js new file mode 100644 index 0000000..2f2a5c2 --- /dev/null +++ b/live2d/node_modules/lodash/_copyObject.js @@ -0,0 +1,40 @@ +var assignValue = require('./_assignValue'), + baseAssignValue = require('./_baseAssignValue'); + +/** + * 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; +} + +module.exports = copyObject; diff --git a/live2d/node_modules/lodash/_copySymbols.js b/live2d/node_modules/lodash/_copySymbols.js new file mode 100644 index 0000000..c35944a --- /dev/null +++ b/live2d/node_modules/lodash/_copySymbols.js @@ -0,0 +1,16 @@ +var copyObject = require('./_copyObject'), + getSymbols = require('./_getSymbols'); + +/** + * 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); +} + +module.exports = copySymbols; diff --git a/live2d/node_modules/lodash/_copySymbolsIn.js b/live2d/node_modules/lodash/_copySymbolsIn.js new file mode 100644 index 0000000..fdf20a7 --- /dev/null +++ b/live2d/node_modules/lodash/_copySymbolsIn.js @@ -0,0 +1,16 @@ +var copyObject = require('./_copyObject'), + getSymbolsIn = require('./_getSymbolsIn'); + +/** + * 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); +} + +module.exports = copySymbolsIn; diff --git a/live2d/node_modules/lodash/_coreJsData.js b/live2d/node_modules/lodash/_coreJsData.js new file mode 100644 index 0000000..f8e5b4e --- /dev/null +++ b/live2d/node_modules/lodash/_coreJsData.js @@ -0,0 +1,6 @@ +var root = require('./_root'); + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +module.exports = coreJsData; diff --git a/live2d/node_modules/lodash/_countHolders.js b/live2d/node_modules/lodash/_countHolders.js new file mode 100644 index 0000000..718fcda --- /dev/null +++ b/live2d/node_modules/lodash/_countHolders.js @@ -0,0 +1,21 @@ +/** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ +function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; +} + +module.exports = countHolders; diff --git a/live2d/node_modules/lodash/_createAggregator.js b/live2d/node_modules/lodash/_createAggregator.js new file mode 100644 index 0000000..0be42c4 --- /dev/null +++ b/live2d/node_modules/lodash/_createAggregator.js @@ -0,0 +1,23 @@ +var arrayAggregator = require('./_arrayAggregator'), + baseAggregator = require('./_baseAggregator'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); + +/** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ +function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, baseIteratee(iteratee, 2), accumulator); + }; +} + +module.exports = createAggregator; diff --git a/live2d/node_modules/lodash/_createAssigner.js b/live2d/node_modules/lodash/_createAssigner.js new file mode 100644 index 0000000..1f904c5 --- /dev/null +++ b/live2d/node_modules/lodash/_createAssigner.js @@ -0,0 +1,37 @@ +var baseRest = require('./_baseRest'), + isIterateeCall = require('./_isIterateeCall'); + +/** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ +function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); +} + +module.exports = createAssigner; diff --git a/live2d/node_modules/lodash/_createBaseEach.js b/live2d/node_modules/lodash/_createBaseEach.js new file mode 100644 index 0000000..d24fdd1 --- /dev/null +++ b/live2d/node_modules/lodash/_createBaseEach.js @@ -0,0 +1,32 @@ +var isArrayLike = require('./isArrayLike'); + +/** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; +} + +module.exports = createBaseEach; diff --git a/live2d/node_modules/lodash/_createBaseFor.js b/live2d/node_modules/lodash/_createBaseFor.js new file mode 100644 index 0000000..94cbf29 --- /dev/null +++ b/live2d/node_modules/lodash/_createBaseFor.js @@ -0,0 +1,25 @@ +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +module.exports = createBaseFor; diff --git a/live2d/node_modules/lodash/_createBind.js b/live2d/node_modules/lodash/_createBind.js new file mode 100644 index 0000000..07cb99f --- /dev/null +++ b/live2d/node_modules/lodash/_createBind.js @@ -0,0 +1,28 @@ +var createCtor = require('./_createCtor'), + root = require('./_root'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1; + +/** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; +} + +module.exports = createBind; diff --git a/live2d/node_modules/lodash/_createCaseFirst.js b/live2d/node_modules/lodash/_createCaseFirst.js new file mode 100644 index 0000000..fe8ea48 --- /dev/null +++ b/live2d/node_modules/lodash/_createCaseFirst.js @@ -0,0 +1,33 @@ +var castSlice = require('./_castSlice'), + hasUnicode = require('./_hasUnicode'), + stringToArray = require('./_stringToArray'), + toString = require('./toString'); + +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + +module.exports = createCaseFirst; diff --git a/live2d/node_modules/lodash/_createCompounder.js b/live2d/node_modules/lodash/_createCompounder.js new file mode 100644 index 0000000..8d4cee2 --- /dev/null +++ b/live2d/node_modules/lodash/_createCompounder.js @@ -0,0 +1,24 @@ +var arrayReduce = require('./_arrayReduce'), + deburr = require('./deburr'), + words = require('./words'); + +/** Used to compose unicode capture groups. */ +var rsApos = "['\u2019]"; + +/** Used to match apostrophes. */ +var reApos = RegExp(rsApos, 'g'); + +/** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ +function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; +} + +module.exports = createCompounder; diff --git a/live2d/node_modules/lodash/_createCtor.js b/live2d/node_modules/lodash/_createCtor.js new file mode 100644 index 0000000..9047aa5 --- /dev/null +++ b/live2d/node_modules/lodash/_createCtor.js @@ -0,0 +1,37 @@ +var baseCreate = require('./_baseCreate'), + isObject = require('./isObject'); + +/** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ +function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; +} + +module.exports = createCtor; diff --git a/live2d/node_modules/lodash/_createCurry.js b/live2d/node_modules/lodash/_createCurry.js new file mode 100644 index 0000000..f06c2cd --- /dev/null +++ b/live2d/node_modules/lodash/_createCurry.js @@ -0,0 +1,46 @@ +var apply = require('./_apply'), + createCtor = require('./_createCtor'), + createHybrid = require('./_createHybrid'), + createRecurry = require('./_createRecurry'), + getHolder = require('./_getHolder'), + replaceHolders = require('./_replaceHolders'), + root = require('./_root'); + +/** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; +} + +module.exports = createCurry; diff --git a/live2d/node_modules/lodash/_createFind.js b/live2d/node_modules/lodash/_createFind.js new file mode 100644 index 0000000..8859ff8 --- /dev/null +++ b/live2d/node_modules/lodash/_createFind.js @@ -0,0 +1,25 @@ +var baseIteratee = require('./_baseIteratee'), + isArrayLike = require('./isArrayLike'), + keys = require('./keys'); + +/** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ +function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = baseIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; +} + +module.exports = createFind; diff --git a/live2d/node_modules/lodash/_createFlow.js b/live2d/node_modules/lodash/_createFlow.js new file mode 100644 index 0000000..baaddbf --- /dev/null +++ b/live2d/node_modules/lodash/_createFlow.js @@ -0,0 +1,78 @@ +var LodashWrapper = require('./_LodashWrapper'), + flatRest = require('./_flatRest'), + getData = require('./_getData'), + getFuncName = require('./_getFuncName'), + isArray = require('./isArray'), + isLaziable = require('./_isLaziable'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used to compose bitmasks for function metadata. */ +var WRAP_CURRY_FLAG = 8, + WRAP_PARTIAL_FLAG = 32, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256; + +/** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ +function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); +} + +module.exports = createFlow; diff --git a/live2d/node_modules/lodash/_createHybrid.js b/live2d/node_modules/lodash/_createHybrid.js new file mode 100644 index 0000000..b671bd1 --- /dev/null +++ b/live2d/node_modules/lodash/_createHybrid.js @@ -0,0 +1,92 @@ +var composeArgs = require('./_composeArgs'), + composeArgsRight = require('./_composeArgsRight'), + countHolders = require('./_countHolders'), + createCtor = require('./_createCtor'), + createRecurry = require('./_createRecurry'), + getHolder = require('./_getHolder'), + reorder = require('./_reorder'), + replaceHolders = require('./_replaceHolders'), + root = require('./_root'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_ARY_FLAG = 128, + WRAP_FLIP_FLAG = 512; + +/** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; +} + +module.exports = createHybrid; diff --git a/live2d/node_modules/lodash/_createInverter.js b/live2d/node_modules/lodash/_createInverter.js new file mode 100644 index 0000000..6c0c562 --- /dev/null +++ b/live2d/node_modules/lodash/_createInverter.js @@ -0,0 +1,17 @@ +var baseInverter = require('./_baseInverter'); + +/** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ +function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; +} + +module.exports = createInverter; diff --git a/live2d/node_modules/lodash/_createMathOperation.js b/live2d/node_modules/lodash/_createMathOperation.js new file mode 100644 index 0000000..f1e238a --- /dev/null +++ b/live2d/node_modules/lodash/_createMathOperation.js @@ -0,0 +1,38 @@ +var baseToNumber = require('./_baseToNumber'), + baseToString = require('./_baseToString'); + +/** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ +function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return defaultValue; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; +} + +module.exports = createMathOperation; diff --git a/live2d/node_modules/lodash/_createOver.js b/live2d/node_modules/lodash/_createOver.js new file mode 100644 index 0000000..3b94551 --- /dev/null +++ b/live2d/node_modules/lodash/_createOver.js @@ -0,0 +1,27 @@ +var apply = require('./_apply'), + arrayMap = require('./_arrayMap'), + baseIteratee = require('./_baseIteratee'), + baseRest = require('./_baseRest'), + baseUnary = require('./_baseUnary'), + flatRest = require('./_flatRest'); + +/** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ +function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); +} + +module.exports = createOver; diff --git a/live2d/node_modules/lodash/_createPadding.js b/live2d/node_modules/lodash/_createPadding.js new file mode 100644 index 0000000..2124612 --- /dev/null +++ b/live2d/node_modules/lodash/_createPadding.js @@ -0,0 +1,33 @@ +var baseRepeat = require('./_baseRepeat'), + baseToString = require('./_baseToString'), + castSlice = require('./_castSlice'), + hasUnicode = require('./_hasUnicode'), + stringSize = require('./_stringSize'), + stringToArray = require('./_stringToArray'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil; + +/** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ +function createPadding(length, chars) { + chars = chars === undefined ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); +} + +module.exports = createPadding; diff --git a/live2d/node_modules/lodash/_createPartial.js b/live2d/node_modules/lodash/_createPartial.js new file mode 100644 index 0000000..e16c248 --- /dev/null +++ b/live2d/node_modules/lodash/_createPartial.js @@ -0,0 +1,43 @@ +var apply = require('./_apply'), + createCtor = require('./_createCtor'), + root = require('./_root'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1; + +/** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ +function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; +} + +module.exports = createPartial; diff --git a/live2d/node_modules/lodash/_createRange.js b/live2d/node_modules/lodash/_createRange.js new file mode 100644 index 0000000..9f52c77 --- /dev/null +++ b/live2d/node_modules/lodash/_createRange.js @@ -0,0 +1,30 @@ +var baseRange = require('./_baseRange'), + isIterateeCall = require('./_isIterateeCall'), + toFinite = require('./toFinite'); + +/** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ +function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; +} + +module.exports = createRange; diff --git a/live2d/node_modules/lodash/_createRecurry.js b/live2d/node_modules/lodash/_createRecurry.js new file mode 100644 index 0000000..eb29fb2 --- /dev/null +++ b/live2d/node_modules/lodash/_createRecurry.js @@ -0,0 +1,56 @@ +var isLaziable = require('./_isLaziable'), + setData = require('./_setData'), + setWrapToString = require('./_setWrapToString'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64; + +/** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); +} + +module.exports = createRecurry; diff --git a/live2d/node_modules/lodash/_createRelationalOperation.js b/live2d/node_modules/lodash/_createRelationalOperation.js new file mode 100644 index 0000000..a17c6b5 --- /dev/null +++ b/live2d/node_modules/lodash/_createRelationalOperation.js @@ -0,0 +1,20 @@ +var toNumber = require('./toNumber'); + +/** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ +function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; +} + +module.exports = createRelationalOperation; diff --git a/live2d/node_modules/lodash/_createRound.js b/live2d/node_modules/lodash/_createRound.js new file mode 100644 index 0000000..88be5df --- /dev/null +++ b/live2d/node_modules/lodash/_createRound.js @@ -0,0 +1,35 @@ +var root = require('./_root'), + toInteger = require('./toInteger'), + toNumber = require('./toNumber'), + toString = require('./toString'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = root.isFinite, + nativeMin = Math.min; + +/** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ +function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; +} + +module.exports = createRound; diff --git a/live2d/node_modules/lodash/_createSet.js b/live2d/node_modules/lodash/_createSet.js new file mode 100644 index 0000000..0f644ee --- /dev/null +++ b/live2d/node_modules/lodash/_createSet.js @@ -0,0 +1,19 @@ +var Set = require('./_Set'), + noop = require('./noop'), + setToArray = require('./_setToArray'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ +var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); +}; + +module.exports = createSet; diff --git a/live2d/node_modules/lodash/_createToPairs.js b/live2d/node_modules/lodash/_createToPairs.js new file mode 100644 index 0000000..568417a --- /dev/null +++ b/live2d/node_modules/lodash/_createToPairs.js @@ -0,0 +1,30 @@ +var baseToPairs = require('./_baseToPairs'), + getTag = require('./_getTag'), + mapToArray = require('./_mapToArray'), + setToPairs = require('./_setToPairs'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + setTag = '[object Set]'; + +/** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ +function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; +} + +module.exports = createToPairs; diff --git a/live2d/node_modules/lodash/_createWrap.js b/live2d/node_modules/lodash/_createWrap.js new file mode 100644 index 0000000..33f0633 --- /dev/null +++ b/live2d/node_modules/lodash/_createWrap.js @@ -0,0 +1,106 @@ +var baseSetData = require('./_baseSetData'), + createBind = require('./_createBind'), + createCurry = require('./_createCurry'), + createHybrid = require('./_createHybrid'), + createPartial = require('./_createPartial'), + getData = require('./_getData'), + mergeData = require('./_mergeData'), + setData = require('./_setData'), + setWrapToString = require('./_setWrapToString'), + toInteger = require('./toInteger'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ +function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); +} + +module.exports = createWrap; diff --git a/live2d/node_modules/lodash/_customDefaultsAssignIn.js b/live2d/node_modules/lodash/_customDefaultsAssignIn.js new file mode 100644 index 0000000..1f49e6f --- /dev/null +++ b/live2d/node_modules/lodash/_customDefaultsAssignIn.js @@ -0,0 +1,29 @@ +var eq = require('./eq'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ +function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; +} + +module.exports = customDefaultsAssignIn; diff --git a/live2d/node_modules/lodash/_customDefaultsMerge.js b/live2d/node_modules/lodash/_customDefaultsMerge.js new file mode 100644 index 0000000..4cab317 --- /dev/null +++ b/live2d/node_modules/lodash/_customDefaultsMerge.js @@ -0,0 +1,28 @@ +var baseMerge = require('./_baseMerge'), + isObject = require('./isObject'); + +/** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ +function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; +} + +module.exports = customDefaultsMerge; diff --git a/live2d/node_modules/lodash/_customOmitClone.js b/live2d/node_modules/lodash/_customOmitClone.js new file mode 100644 index 0000000..968db2e --- /dev/null +++ b/live2d/node_modules/lodash/_customOmitClone.js @@ -0,0 +1,16 @@ +var isPlainObject = require('./isPlainObject'); + +/** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ +function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; +} + +module.exports = customOmitClone; diff --git a/live2d/node_modules/lodash/_deburrLetter.js b/live2d/node_modules/lodash/_deburrLetter.js new file mode 100644 index 0000000..3e531ed --- /dev/null +++ b/live2d/node_modules/lodash/_deburrLetter.js @@ -0,0 +1,71 @@ +var basePropertyOf = require('./_basePropertyOf'); + +/** Used to map Latin Unicode letters to basic Latin letters. */ +var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' +}; + +/** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +module.exports = deburrLetter; diff --git a/live2d/node_modules/lodash/_defineProperty.js b/live2d/node_modules/lodash/_defineProperty.js new file mode 100644 index 0000000..b6116d9 --- /dev/null +++ b/live2d/node_modules/lodash/_defineProperty.js @@ -0,0 +1,11 @@ +var getNative = require('./_getNative'); + +var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} +}()); + +module.exports = defineProperty; diff --git a/live2d/node_modules/lodash/_equalArrays.js b/live2d/node_modules/lodash/_equalArrays.js new file mode 100644 index 0000000..824228c --- /dev/null +++ b/live2d/node_modules/lodash/_equalArrays.js @@ -0,0 +1,84 @@ +var SetCache = require('./_SetCache'), + arraySome = require('./_arraySome'), + cacheHas = require('./_cacheHas'); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 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, + 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) ? 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; +} + +module.exports = equalArrays; diff --git a/live2d/node_modules/lodash/_equalByTag.js b/live2d/node_modules/lodash/_equalByTag.js new file mode 100644 index 0000000..71919e8 --- /dev/null +++ b/live2d/node_modules/lodash/_equalByTag.js @@ -0,0 +1,112 @@ +var Symbol = require('./_Symbol'), + Uint8Array = require('./_Uint8Array'), + eq = require('./eq'), + equalArrays = require('./_equalArrays'), + mapToArray = require('./_mapToArray'), + setToArray = require('./_setToArray'); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 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 ? 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: + 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; + 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; +} + +module.exports = equalByTag; diff --git a/live2d/node_modules/lodash/_equalObjects.js b/live2d/node_modules/lodash/_equalObjects.js new file mode 100644 index 0000000..cdaacd2 --- /dev/null +++ b/live2d/node_modules/lodash/_equalObjects.js @@ -0,0 +1,90 @@ +var getAllKeys = require('./_getAllKeys'); + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1; + +/** 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 `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, + 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.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; +} + +module.exports = equalObjects; diff --git a/live2d/node_modules/lodash/_escapeHtmlChar.js b/live2d/node_modules/lodash/_escapeHtmlChar.js new file mode 100644 index 0000000..7ca68ee --- /dev/null +++ b/live2d/node_modules/lodash/_escapeHtmlChar.js @@ -0,0 +1,21 @@ +var basePropertyOf = require('./_basePropertyOf'); + +/** Used to map characters to HTML entities. */ +var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; + +/** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ +var escapeHtmlChar = basePropertyOf(htmlEscapes); + +module.exports = escapeHtmlChar; diff --git a/live2d/node_modules/lodash/_escapeStringChar.js b/live2d/node_modules/lodash/_escapeStringChar.js new file mode 100644 index 0000000..44eca96 --- /dev/null +++ b/live2d/node_modules/lodash/_escapeStringChar.js @@ -0,0 +1,22 @@ +/** Used to escape characters for inclusion in compiled string literals. */ +var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' +}; + +/** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ +function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; +} + +module.exports = escapeStringChar; diff --git a/live2d/node_modules/lodash/_flatRest.js b/live2d/node_modules/lodash/_flatRest.js new file mode 100644 index 0000000..94ab6cc --- /dev/null +++ b/live2d/node_modules/lodash/_flatRest.js @@ -0,0 +1,16 @@ +var flatten = require('./flatten'), + overRest = require('./_overRest'), + setToString = require('./_setToString'); + +/** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); +} + +module.exports = flatRest; diff --git a/live2d/node_modules/lodash/_freeGlobal.js b/live2d/node_modules/lodash/_freeGlobal.js new file mode 100644 index 0000000..bbec998 --- /dev/null +++ b/live2d/node_modules/lodash/_freeGlobal.js @@ -0,0 +1,4 @@ +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; diff --git a/live2d/node_modules/lodash/_getAllKeys.js b/live2d/node_modules/lodash/_getAllKeys.js new file mode 100644 index 0000000..a9ce699 --- /dev/null +++ b/live2d/node_modules/lodash/_getAllKeys.js @@ -0,0 +1,16 @@ +var baseGetAllKeys = require('./_baseGetAllKeys'), + getSymbols = require('./_getSymbols'), + keys = require('./keys'); + +/** + * 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); +} + +module.exports = getAllKeys; diff --git a/live2d/node_modules/lodash/_getAllKeysIn.js b/live2d/node_modules/lodash/_getAllKeysIn.js new file mode 100644 index 0000000..1b46678 --- /dev/null +++ b/live2d/node_modules/lodash/_getAllKeysIn.js @@ -0,0 +1,17 @@ +var baseGetAllKeys = require('./_baseGetAllKeys'), + getSymbolsIn = require('./_getSymbolsIn'), + keysIn = require('./keysIn'); + +/** + * 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); +} + +module.exports = getAllKeysIn; diff --git a/live2d/node_modules/lodash/_getData.js b/live2d/node_modules/lodash/_getData.js new file mode 100644 index 0000000..a1fe7b7 --- /dev/null +++ b/live2d/node_modules/lodash/_getData.js @@ -0,0 +1,15 @@ +var metaMap = require('./_metaMap'), + noop = require('./noop'); + +/** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ +var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); +}; + +module.exports = getData; diff --git a/live2d/node_modules/lodash/_getFuncName.js b/live2d/node_modules/lodash/_getFuncName.js new file mode 100644 index 0000000..21e15b3 --- /dev/null +++ b/live2d/node_modules/lodash/_getFuncName.js @@ -0,0 +1,31 @@ +var realNames = require('./_realNames'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ +function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; +} + +module.exports = getFuncName; diff --git a/live2d/node_modules/lodash/_getHolder.js b/live2d/node_modules/lodash/_getHolder.js new file mode 100644 index 0000000..65e94b5 --- /dev/null +++ b/live2d/node_modules/lodash/_getHolder.js @@ -0,0 +1,13 @@ +/** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ +function getHolder(func) { + var object = func; + return object.placeholder; +} + +module.exports = getHolder; diff --git a/live2d/node_modules/lodash/_getMapData.js b/live2d/node_modules/lodash/_getMapData.js new file mode 100644 index 0000000..17f6303 --- /dev/null +++ b/live2d/node_modules/lodash/_getMapData.js @@ -0,0 +1,18 @@ +var isKeyable = require('./_isKeyable'); + +/** + * 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; +} + +module.exports = getMapData; diff --git a/live2d/node_modules/lodash/_getMatchData.js b/live2d/node_modules/lodash/_getMatchData.js new file mode 100644 index 0000000..2cc70f9 --- /dev/null +++ b/live2d/node_modules/lodash/_getMatchData.js @@ -0,0 +1,24 @@ +var isStrictComparable = require('./_isStrictComparable'), + keys = require('./keys'); + +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; +} + +module.exports = getMatchData; diff --git a/live2d/node_modules/lodash/_getNative.js b/live2d/node_modules/lodash/_getNative.js new file mode 100644 index 0000000..97a622b --- /dev/null +++ b/live2d/node_modules/lodash/_getNative.js @@ -0,0 +1,17 @@ +var baseIsNative = require('./_baseIsNative'), + getValue = require('./_getValue'); + +/** + * 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; +} + +module.exports = getNative; diff --git a/live2d/node_modules/lodash/_getPrototype.js b/live2d/node_modules/lodash/_getPrototype.js new file mode 100644 index 0000000..e808612 --- /dev/null +++ b/live2d/node_modules/lodash/_getPrototype.js @@ -0,0 +1,6 @@ +var overArg = require('./_overArg'); + +/** Built-in value references. */ +var getPrototype = overArg(Object.getPrototypeOf, Object); + +module.exports = getPrototype; diff --git a/live2d/node_modules/lodash/_getRawTag.js b/live2d/node_modules/lodash/_getRawTag.js new file mode 100644 index 0000000..49a95c9 --- /dev/null +++ b/live2d/node_modules/lodash/_getRawTag.js @@ -0,0 +1,46 @@ +var Symbol = require('./_Symbol'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Built-in value references. */ +var symToStringTag = 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.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +module.exports = getRawTag; diff --git a/live2d/node_modules/lodash/_getSymbols.js b/live2d/node_modules/lodash/_getSymbols.js new file mode 100644 index 0000000..7d6eafe --- /dev/null +++ b/live2d/node_modules/lodash/_getSymbols.js @@ -0,0 +1,30 @@ +var arrayFilter = require('./_arrayFilter'), + stubArray = require('./stubArray'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.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); + }); +}; + +module.exports = getSymbols; diff --git a/live2d/node_modules/lodash/_getSymbolsIn.js b/live2d/node_modules/lodash/_getSymbolsIn.js new file mode 100644 index 0000000..cec0855 --- /dev/null +++ b/live2d/node_modules/lodash/_getSymbolsIn.js @@ -0,0 +1,25 @@ +var arrayPush = require('./_arrayPush'), + getPrototype = require('./_getPrototype'), + getSymbols = require('./_getSymbols'), + stubArray = require('./stubArray'); + +/* 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; +}; + +module.exports = getSymbolsIn; diff --git a/live2d/node_modules/lodash/_getTag.js b/live2d/node_modules/lodash/_getTag.js new file mode 100644 index 0000000..deaf89d --- /dev/null +++ b/live2d/node_modules/lodash/_getTag.js @@ -0,0 +1,58 @@ +var DataView = require('./_DataView'), + Map = require('./_Map'), + Promise = require('./_Promise'), + Set = require('./_Set'), + WeakMap = require('./_WeakMap'), + baseGetTag = require('./_baseGetTag'), + toSource = require('./_toSource'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + objectTag = '[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), + 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 && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? 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; + }; +} + +module.exports = getTag; diff --git a/live2d/node_modules/lodash/_getValue.js b/live2d/node_modules/lodash/_getValue.js new file mode 100644 index 0000000..5f7d773 --- /dev/null +++ b/live2d/node_modules/lodash/_getValue.js @@ -0,0 +1,13 @@ +/** + * 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]; +} + +module.exports = getValue; diff --git a/live2d/node_modules/lodash/_getView.js b/live2d/node_modules/lodash/_getView.js new file mode 100644 index 0000000..df1e5d4 --- /dev/null +++ b/live2d/node_modules/lodash/_getView.js @@ -0,0 +1,33 @@ +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ +function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; +} + +module.exports = getView; diff --git a/live2d/node_modules/lodash/_getWrapDetails.js b/live2d/node_modules/lodash/_getWrapDetails.js new file mode 100644 index 0000000..3bcc6e4 --- /dev/null +++ b/live2d/node_modules/lodash/_getWrapDetails.js @@ -0,0 +1,17 @@ +/** Used to match wrap detail comments. */ +var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + +/** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ +function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; +} + +module.exports = getWrapDetails; diff --git a/live2d/node_modules/lodash/_hasPath.js b/live2d/node_modules/lodash/_hasPath.js new file mode 100644 index 0000000..93dbde1 --- /dev/null +++ b/live2d/node_modules/lodash/_hasPath.js @@ -0,0 +1,39 @@ +var castPath = require('./_castPath'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isIndex = require('./_isIndex'), + isLength = require('./isLength'), + toKey = require('./_toKey'); + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); +} + +module.exports = hasPath; diff --git a/live2d/node_modules/lodash/_hasUnicode.js b/live2d/node_modules/lodash/_hasUnicode.js new file mode 100644 index 0000000..cb6ca15 --- /dev/null +++ b/live2d/node_modules/lodash/_hasUnicode.js @@ -0,0 +1,26 @@ +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsZWJ = '\\u200d'; + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + +module.exports = hasUnicode; diff --git a/live2d/node_modules/lodash/_hasUnicodeWord.js b/live2d/node_modules/lodash/_hasUnicodeWord.js new file mode 100644 index 0000000..95d52c4 --- /dev/null +++ b/live2d/node_modules/lodash/_hasUnicodeWord.js @@ -0,0 +1,15 @@ +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ +function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); +} + +module.exports = hasUnicodeWord; diff --git a/live2d/node_modules/lodash/_hashClear.js b/live2d/node_modules/lodash/_hashClear.js new file mode 100644 index 0000000..5d4b70c --- /dev/null +++ b/live2d/node_modules/lodash/_hashClear.js @@ -0,0 +1,15 @@ +var nativeCreate = require('./_nativeCreate'); + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +module.exports = hashClear; diff --git a/live2d/node_modules/lodash/_hashDelete.js b/live2d/node_modules/lodash/_hashDelete.js new file mode 100644 index 0000000..ea9dabf --- /dev/null +++ b/live2d/node_modules/lodash/_hashDelete.js @@ -0,0 +1,17 @@ +/** + * 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; +} + +module.exports = hashDelete; diff --git a/live2d/node_modules/lodash/_hashGet.js b/live2d/node_modules/lodash/_hashGet.js new file mode 100644 index 0000000..1fc2f34 --- /dev/null +++ b/live2d/node_modules/lodash/_hashGet.js @@ -0,0 +1,30 @@ +var nativeCreate = require('./_nativeCreate'); + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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 ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +module.exports = hashGet; diff --git a/live2d/node_modules/lodash/_hashHas.js b/live2d/node_modules/lodash/_hashHas.js new file mode 100644 index 0000000..281a551 --- /dev/null +++ b/live2d/node_modules/lodash/_hashHas.js @@ -0,0 +1,23 @@ +var nativeCreate = require('./_nativeCreate'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.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.call(data, key); +} + +module.exports = hashHas; diff --git a/live2d/node_modules/lodash/_hashSet.js b/live2d/node_modules/lodash/_hashSet.js new file mode 100644 index 0000000..e105528 --- /dev/null +++ b/live2d/node_modules/lodash/_hashSet.js @@ -0,0 +1,23 @@ +var nativeCreate = require('./_nativeCreate'); + +/** 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; +} + +module.exports = hashSet; diff --git a/live2d/node_modules/lodash/_initCloneArray.js b/live2d/node_modules/lodash/_initCloneArray.js new file mode 100644 index 0000000..078c15a --- /dev/null +++ b/live2d/node_modules/lodash/_initCloneArray.js @@ -0,0 +1,26 @@ +/** 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; +} + +module.exports = initCloneArray; diff --git a/live2d/node_modules/lodash/_initCloneByTag.js b/live2d/node_modules/lodash/_initCloneByTag.js new file mode 100644 index 0000000..f69a008 --- /dev/null +++ b/live2d/node_modules/lodash/_initCloneByTag.js @@ -0,0 +1,77 @@ +var cloneArrayBuffer = require('./_cloneArrayBuffer'), + cloneDataView = require('./_cloneDataView'), + cloneRegExp = require('./_cloneRegExp'), + cloneSymbol = require('./_cloneSymbol'), + cloneTypedArray = require('./_cloneTypedArray'); + +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]', + dateTag = '[object Date]', + 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]', + 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]'; + +/** + * 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: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } +} + +module.exports = initCloneByTag; diff --git a/live2d/node_modules/lodash/_initCloneObject.js b/live2d/node_modules/lodash/_initCloneObject.js new file mode 100644 index 0000000..5a13e64 --- /dev/null +++ b/live2d/node_modules/lodash/_initCloneObject.js @@ -0,0 +1,18 @@ +var baseCreate = require('./_baseCreate'), + getPrototype = require('./_getPrototype'), + isPrototype = require('./_isPrototype'); + +/** + * 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)) + : {}; +} + +module.exports = initCloneObject; diff --git a/live2d/node_modules/lodash/_insertWrapDetails.js b/live2d/node_modules/lodash/_insertWrapDetails.js new file mode 100644 index 0000000..e790808 --- /dev/null +++ b/live2d/node_modules/lodash/_insertWrapDetails.js @@ -0,0 +1,23 @@ +/** Used to match wrap detail comments. */ +var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; + +/** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ +function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); +} + +module.exports = insertWrapDetails; diff --git a/live2d/node_modules/lodash/_isFlattenable.js b/live2d/node_modules/lodash/_isFlattenable.js new file mode 100644 index 0000000..4cc2c24 --- /dev/null +++ b/live2d/node_modules/lodash/_isFlattenable.js @@ -0,0 +1,20 @@ +var Symbol = require('./_Symbol'), + isArguments = require('./isArguments'), + isArray = require('./isArray'); + +/** Built-in value references. */ +var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +module.exports = isFlattenable; diff --git a/live2d/node_modules/lodash/_isIndex.js b/live2d/node_modules/lodash/_isIndex.js new file mode 100644 index 0000000..061cd39 --- /dev/null +++ b/live2d/node_modules/lodash/_isIndex.js @@ -0,0 +1,25 @@ +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 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 : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +module.exports = isIndex; diff --git a/live2d/node_modules/lodash/_isIterateeCall.js b/live2d/node_modules/lodash/_isIterateeCall.js new file mode 100644 index 0000000..a0bb5a9 --- /dev/null +++ b/live2d/node_modules/lodash/_isIterateeCall.js @@ -0,0 +1,30 @@ +var eq = require('./eq'), + isArrayLike = require('./isArrayLike'), + isIndex = require('./_isIndex'), + isObject = require('./isObject'); + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +module.exports = isIterateeCall; diff --git a/live2d/node_modules/lodash/_isKey.js b/live2d/node_modules/lodash/_isKey.js new file mode 100644 index 0000000..ff08b06 --- /dev/null +++ b/live2d/node_modules/lodash/_isKey.js @@ -0,0 +1,29 @@ +var isArray = require('./isArray'), + isSymbol = require('./isSymbol'); + +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +module.exports = isKey; diff --git a/live2d/node_modules/lodash/_isKeyable.js b/live2d/node_modules/lodash/_isKeyable.js new file mode 100644 index 0000000..39f1828 --- /dev/null +++ b/live2d/node_modules/lodash/_isKeyable.js @@ -0,0 +1,15 @@ +/** + * 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); +} + +module.exports = isKeyable; diff --git a/live2d/node_modules/lodash/_isLaziable.js b/live2d/node_modules/lodash/_isLaziable.js new file mode 100644 index 0000000..a57c4f2 --- /dev/null +++ b/live2d/node_modules/lodash/_isLaziable.js @@ -0,0 +1,28 @@ +var LazyWrapper = require('./_LazyWrapper'), + getData = require('./_getData'), + getFuncName = require('./_getFuncName'), + lodash = require('./wrapperLodash'); + +/** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ +function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; +} + +module.exports = isLaziable; diff --git a/live2d/node_modules/lodash/_isMaskable.js b/live2d/node_modules/lodash/_isMaskable.js new file mode 100644 index 0000000..eb98d09 --- /dev/null +++ b/live2d/node_modules/lodash/_isMaskable.js @@ -0,0 +1,14 @@ +var coreJsData = require('./_coreJsData'), + isFunction = require('./isFunction'), + stubFalse = require('./stubFalse'); + +/** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ +var isMaskable = coreJsData ? isFunction : stubFalse; + +module.exports = isMaskable; diff --git a/live2d/node_modules/lodash/_isMasked.js b/live2d/node_modules/lodash/_isMasked.js new file mode 100644 index 0000000..4b0f21b --- /dev/null +++ b/live2d/node_modules/lodash/_isMasked.js @@ -0,0 +1,20 @@ +var coreJsData = require('./_coreJsData'); + +/** 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); +} + +module.exports = isMasked; diff --git a/live2d/node_modules/lodash/_isPrototype.js b/live2d/node_modules/lodash/_isPrototype.js new file mode 100644 index 0000000..0f29498 --- /dev/null +++ b/live2d/node_modules/lodash/_isPrototype.js @@ -0,0 +1,18 @@ +/** Used for built-in method references. */ +var objectProto = 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; + + return value === proto; +} + +module.exports = isPrototype; diff --git a/live2d/node_modules/lodash/_isStrictComparable.js b/live2d/node_modules/lodash/_isStrictComparable.js new file mode 100644 index 0000000..b59f40b --- /dev/null +++ b/live2d/node_modules/lodash/_isStrictComparable.js @@ -0,0 +1,15 @@ +var isObject = require('./isObject'); + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); +} + +module.exports = isStrictComparable; diff --git a/live2d/node_modules/lodash/_iteratorToArray.js b/live2d/node_modules/lodash/_iteratorToArray.js new file mode 100644 index 0000000..4768566 --- /dev/null +++ b/live2d/node_modules/lodash/_iteratorToArray.js @@ -0,0 +1,18 @@ +/** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ +function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + return result; +} + +module.exports = iteratorToArray; diff --git a/live2d/node_modules/lodash/_lazyClone.js b/live2d/node_modules/lodash/_lazyClone.js new file mode 100644 index 0000000..d8a51f8 --- /dev/null +++ b/live2d/node_modules/lodash/_lazyClone.js @@ -0,0 +1,23 @@ +var LazyWrapper = require('./_LazyWrapper'), + copyArray = require('./_copyArray'); + +/** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ +function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + return result; +} + +module.exports = lazyClone; diff --git a/live2d/node_modules/lodash/_lazyReverse.js b/live2d/node_modules/lodash/_lazyReverse.js new file mode 100644 index 0000000..c5b5219 --- /dev/null +++ b/live2d/node_modules/lodash/_lazyReverse.js @@ -0,0 +1,23 @@ +var LazyWrapper = require('./_LazyWrapper'); + +/** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ +function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; +} + +module.exports = lazyReverse; diff --git a/live2d/node_modules/lodash/_lazyValue.js b/live2d/node_modules/lodash/_lazyValue.js new file mode 100644 index 0000000..371ca8d --- /dev/null +++ b/live2d/node_modules/lodash/_lazyValue.js @@ -0,0 +1,69 @@ +var baseWrapperValue = require('./_baseWrapperValue'), + getView = require('./_getView'), + isArray = require('./isArray'); + +/** Used to indicate the type of lazy iteratees. */ +var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ +function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; +} + +module.exports = lazyValue; diff --git a/live2d/node_modules/lodash/_listCacheClear.js b/live2d/node_modules/lodash/_listCacheClear.js new file mode 100644 index 0000000..acbe39a --- /dev/null +++ b/live2d/node_modules/lodash/_listCacheClear.js @@ -0,0 +1,13 @@ +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +module.exports = listCacheClear; diff --git a/live2d/node_modules/lodash/_listCacheDelete.js b/live2d/node_modules/lodash/_listCacheDelete.js new file mode 100644 index 0000000..b1384ad --- /dev/null +++ b/live2d/node_modules/lodash/_listCacheDelete.js @@ -0,0 +1,35 @@ +var assocIndexOf = require('./_assocIndexOf'); + +/** 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; +} + +module.exports = listCacheDelete; diff --git a/live2d/node_modules/lodash/_listCacheGet.js b/live2d/node_modules/lodash/_listCacheGet.js new file mode 100644 index 0000000..f8192fc --- /dev/null +++ b/live2d/node_modules/lodash/_listCacheGet.js @@ -0,0 +1,19 @@ +var assocIndexOf = require('./_assocIndexOf'); + +/** + * 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]; +} + +module.exports = listCacheGet; diff --git a/live2d/node_modules/lodash/_listCacheHas.js b/live2d/node_modules/lodash/_listCacheHas.js new file mode 100644 index 0000000..2adf671 --- /dev/null +++ b/live2d/node_modules/lodash/_listCacheHas.js @@ -0,0 +1,16 @@ +var assocIndexOf = require('./_assocIndexOf'); + +/** + * 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; +} + +module.exports = listCacheHas; diff --git a/live2d/node_modules/lodash/_listCacheSet.js b/live2d/node_modules/lodash/_listCacheSet.js new file mode 100644 index 0000000..5855c95 --- /dev/null +++ b/live2d/node_modules/lodash/_listCacheSet.js @@ -0,0 +1,26 @@ +var assocIndexOf = require('./_assocIndexOf'); + +/** + * 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; +} + +module.exports = listCacheSet; diff --git a/live2d/node_modules/lodash/_mapCacheClear.js b/live2d/node_modules/lodash/_mapCacheClear.js new file mode 100644 index 0000000..bc9ca20 --- /dev/null +++ b/live2d/node_modules/lodash/_mapCacheClear.js @@ -0,0 +1,21 @@ +var Hash = require('./_Hash'), + ListCache = require('./_ListCache'), + Map = require('./_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 || ListCache), + 'string': new Hash + }; +} + +module.exports = mapCacheClear; diff --git a/live2d/node_modules/lodash/_mapCacheDelete.js b/live2d/node_modules/lodash/_mapCacheDelete.js new file mode 100644 index 0000000..946ca3c --- /dev/null +++ b/live2d/node_modules/lodash/_mapCacheDelete.js @@ -0,0 +1,18 @@ +var getMapData = require('./_getMapData'); + +/** + * 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; +} + +module.exports = mapCacheDelete; diff --git a/live2d/node_modules/lodash/_mapCacheGet.js b/live2d/node_modules/lodash/_mapCacheGet.js new file mode 100644 index 0000000..f29f55c --- /dev/null +++ b/live2d/node_modules/lodash/_mapCacheGet.js @@ -0,0 +1,16 @@ +var getMapData = require('./_getMapData'); + +/** + * 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); +} + +module.exports = mapCacheGet; diff --git a/live2d/node_modules/lodash/_mapCacheHas.js b/live2d/node_modules/lodash/_mapCacheHas.js new file mode 100644 index 0000000..a1214c0 --- /dev/null +++ b/live2d/node_modules/lodash/_mapCacheHas.js @@ -0,0 +1,16 @@ +var getMapData = require('./_getMapData'); + +/** + * 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); +} + +module.exports = mapCacheHas; diff --git a/live2d/node_modules/lodash/_mapCacheSet.js b/live2d/node_modules/lodash/_mapCacheSet.js new file mode 100644 index 0000000..7346849 --- /dev/null +++ b/live2d/node_modules/lodash/_mapCacheSet.js @@ -0,0 +1,22 @@ +var getMapData = require('./_getMapData'); + +/** + * 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; +} + +module.exports = mapCacheSet; diff --git a/live2d/node_modules/lodash/_mapToArray.js b/live2d/node_modules/lodash/_mapToArray.js new file mode 100644 index 0000000..fe3dd53 --- /dev/null +++ b/live2d/node_modules/lodash/_mapToArray.js @@ -0,0 +1,18 @@ +/** + * 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; +} + +module.exports = mapToArray; diff --git a/live2d/node_modules/lodash/_matchesStrictComparable.js b/live2d/node_modules/lodash/_matchesStrictComparable.js new file mode 100644 index 0000000..f608af9 --- /dev/null +++ b/live2d/node_modules/lodash/_matchesStrictComparable.js @@ -0,0 +1,20 @@ +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; +} + +module.exports = matchesStrictComparable; diff --git a/live2d/node_modules/lodash/_memoizeCapped.js b/live2d/node_modules/lodash/_memoizeCapped.js new file mode 100644 index 0000000..7f71c8f --- /dev/null +++ b/live2d/node_modules/lodash/_memoizeCapped.js @@ -0,0 +1,26 @@ +var memoize = require('./memoize'); + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +module.exports = memoizeCapped; diff --git a/live2d/node_modules/lodash/_mergeData.js b/live2d/node_modules/lodash/_mergeData.js new file mode 100644 index 0000000..cb570f9 --- /dev/null +++ b/live2d/node_modules/lodash/_mergeData.js @@ -0,0 +1,90 @@ +var composeArgs = require('./_composeArgs'), + composeArgsRight = require('./_composeArgsRight'), + replaceHolders = require('./_replaceHolders'); + +/** Used as the internal argument placeholder. */ +var PLACEHOLDER = '__lodash_placeholder__'; + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ +function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; +} + +module.exports = mergeData; diff --git a/live2d/node_modules/lodash/_metaMap.js b/live2d/node_modules/lodash/_metaMap.js new file mode 100644 index 0000000..0157a0b --- /dev/null +++ b/live2d/node_modules/lodash/_metaMap.js @@ -0,0 +1,6 @@ +var WeakMap = require('./_WeakMap'); + +/** Used to store function metadata. */ +var metaMap = WeakMap && new WeakMap; + +module.exports = metaMap; diff --git a/live2d/node_modules/lodash/_nativeCreate.js b/live2d/node_modules/lodash/_nativeCreate.js new file mode 100644 index 0000000..c7aede8 --- /dev/null +++ b/live2d/node_modules/lodash/_nativeCreate.js @@ -0,0 +1,6 @@ +var getNative = require('./_getNative'); + +/* Built-in method references that are verified to be native. */ +var nativeCreate = getNative(Object, 'create'); + +module.exports = nativeCreate; diff --git a/live2d/node_modules/lodash/_nativeKeys.js b/live2d/node_modules/lodash/_nativeKeys.js new file mode 100644 index 0000000..479a104 --- /dev/null +++ b/live2d/node_modules/lodash/_nativeKeys.js @@ -0,0 +1,6 @@ +var overArg = require('./_overArg'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); + +module.exports = nativeKeys; diff --git a/live2d/node_modules/lodash/_nativeKeysIn.js b/live2d/node_modules/lodash/_nativeKeysIn.js new file mode 100644 index 0000000..00ee505 --- /dev/null +++ b/live2d/node_modules/lodash/_nativeKeysIn.js @@ -0,0 +1,20 @@ +/** + * 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; +} + +module.exports = nativeKeysIn; diff --git a/live2d/node_modules/lodash/_nodeUtil.js b/live2d/node_modules/lodash/_nodeUtil.js new file mode 100644 index 0000000..983d78f --- /dev/null +++ b/live2d/node_modules/lodash/_nodeUtil.js @@ -0,0 +1,30 @@ +var freeGlobal = require('./_freeGlobal'); + +/** 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) {} +}()); + +module.exports = nodeUtil; diff --git a/live2d/node_modules/lodash/_objectToString.js b/live2d/node_modules/lodash/_objectToString.js new file mode 100644 index 0000000..c614ec0 --- /dev/null +++ b/live2d/node_modules/lodash/_objectToString.js @@ -0,0 +1,22 @@ +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.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); +} + +module.exports = objectToString; diff --git a/live2d/node_modules/lodash/_overArg.js b/live2d/node_modules/lodash/_overArg.js new file mode 100644 index 0000000..651c5c5 --- /dev/null +++ b/live2d/node_modules/lodash/_overArg.js @@ -0,0 +1,15 @@ +/** + * 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)); + }; +} + +module.exports = overArg; diff --git a/live2d/node_modules/lodash/_overRest.js b/live2d/node_modules/lodash/_overRest.js new file mode 100644 index 0000000..c7cdef3 --- /dev/null +++ b/live2d/node_modules/lodash/_overRest.js @@ -0,0 +1,36 @@ +var apply = require('./_apply'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +module.exports = overRest; diff --git a/live2d/node_modules/lodash/_parent.js b/live2d/node_modules/lodash/_parent.js new file mode 100644 index 0000000..f174328 --- /dev/null +++ b/live2d/node_modules/lodash/_parent.js @@ -0,0 +1,16 @@ +var baseGet = require('./_baseGet'), + baseSlice = require('./_baseSlice'); + +/** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ +function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); +} + +module.exports = parent; diff --git a/live2d/node_modules/lodash/_reEscape.js b/live2d/node_modules/lodash/_reEscape.js new file mode 100644 index 0000000..7f47eda --- /dev/null +++ b/live2d/node_modules/lodash/_reEscape.js @@ -0,0 +1,4 @@ +/** Used to match template delimiters. */ +var reEscape = /<%-([\s\S]+?)%>/g; + +module.exports = reEscape; diff --git a/live2d/node_modules/lodash/_reEvaluate.js b/live2d/node_modules/lodash/_reEvaluate.js new file mode 100644 index 0000000..6adfc31 --- /dev/null +++ b/live2d/node_modules/lodash/_reEvaluate.js @@ -0,0 +1,4 @@ +/** Used to match template delimiters. */ +var reEvaluate = /<%([\s\S]+?)%>/g; + +module.exports = reEvaluate; diff --git a/live2d/node_modules/lodash/_reInterpolate.js b/live2d/node_modules/lodash/_reInterpolate.js new file mode 100644 index 0000000..d02ff0b --- /dev/null +++ b/live2d/node_modules/lodash/_reInterpolate.js @@ -0,0 +1,4 @@ +/** Used to match template delimiters. */ +var reInterpolate = /<%=([\s\S]+?)%>/g; + +module.exports = reInterpolate; diff --git a/live2d/node_modules/lodash/_realNames.js b/live2d/node_modules/lodash/_realNames.js new file mode 100644 index 0000000..aa0d529 --- /dev/null +++ b/live2d/node_modules/lodash/_realNames.js @@ -0,0 +1,4 @@ +/** Used to lookup unminified function names. */ +var realNames = {}; + +module.exports = realNames; diff --git a/live2d/node_modules/lodash/_reorder.js b/live2d/node_modules/lodash/_reorder.js new file mode 100644 index 0000000..a3502b0 --- /dev/null +++ b/live2d/node_modules/lodash/_reorder.js @@ -0,0 +1,29 @@ +var copyArray = require('./_copyArray'), + isIndex = require('./_isIndex'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ +function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; +} + +module.exports = reorder; diff --git a/live2d/node_modules/lodash/_replaceHolders.js b/live2d/node_modules/lodash/_replaceHolders.js new file mode 100644 index 0000000..74360ec --- /dev/null +++ b/live2d/node_modules/lodash/_replaceHolders.js @@ -0,0 +1,29 @@ +/** Used as the internal argument placeholder. */ +var PLACEHOLDER = '__lodash_placeholder__'; + +/** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ +function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + return result; +} + +module.exports = replaceHolders; diff --git a/live2d/node_modules/lodash/_root.js b/live2d/node_modules/lodash/_root.js new file mode 100644 index 0000000..d2852be --- /dev/null +++ b/live2d/node_modules/lodash/_root.js @@ -0,0 +1,9 @@ +var freeGlobal = require('./_freeGlobal'); + +/** 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')(); + +module.exports = root; diff --git a/live2d/node_modules/lodash/_safeGet.js b/live2d/node_modules/lodash/_safeGet.js new file mode 100644 index 0000000..b070897 --- /dev/null +++ b/live2d/node_modules/lodash/_safeGet.js @@ -0,0 +1,21 @@ +/** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; +} + +module.exports = safeGet; diff --git a/live2d/node_modules/lodash/_setCacheAdd.js b/live2d/node_modules/lodash/_setCacheAdd.js new file mode 100644 index 0000000..1081a74 --- /dev/null +++ b/live2d/node_modules/lodash/_setCacheAdd.js @@ -0,0 +1,19 @@ +/** 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; +} + +module.exports = setCacheAdd; diff --git a/live2d/node_modules/lodash/_setCacheHas.js b/live2d/node_modules/lodash/_setCacheHas.js new file mode 100644 index 0000000..9a49255 --- /dev/null +++ b/live2d/node_modules/lodash/_setCacheHas.js @@ -0,0 +1,14 @@ +/** + * 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); +} + +module.exports = setCacheHas; diff --git a/live2d/node_modules/lodash/_setData.js b/live2d/node_modules/lodash/_setData.js new file mode 100644 index 0000000..e5cf3eb --- /dev/null +++ b/live2d/node_modules/lodash/_setData.js @@ -0,0 +1,20 @@ +var baseSetData = require('./_baseSetData'), + shortOut = require('./_shortOut'); + +/** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ +var setData = shortOut(baseSetData); + +module.exports = setData; diff --git a/live2d/node_modules/lodash/_setToArray.js b/live2d/node_modules/lodash/_setToArray.js new file mode 100644 index 0000000..b87f074 --- /dev/null +++ b/live2d/node_modules/lodash/_setToArray.js @@ -0,0 +1,18 @@ +/** + * 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; +} + +module.exports = setToArray; diff --git a/live2d/node_modules/lodash/_setToPairs.js b/live2d/node_modules/lodash/_setToPairs.js new file mode 100644 index 0000000..36ad37a --- /dev/null +++ b/live2d/node_modules/lodash/_setToPairs.js @@ -0,0 +1,18 @@ +/** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ +function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; +} + +module.exports = setToPairs; diff --git a/live2d/node_modules/lodash/_setToString.js b/live2d/node_modules/lodash/_setToString.js new file mode 100644 index 0000000..6ca8419 --- /dev/null +++ b/live2d/node_modules/lodash/_setToString.js @@ -0,0 +1,14 @@ +var baseSetToString = require('./_baseSetToString'), + shortOut = require('./_shortOut'); + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +module.exports = setToString; diff --git a/live2d/node_modules/lodash/_setWrapToString.js b/live2d/node_modules/lodash/_setWrapToString.js new file mode 100644 index 0000000..decdc44 --- /dev/null +++ b/live2d/node_modules/lodash/_setWrapToString.js @@ -0,0 +1,21 @@ +var getWrapDetails = require('./_getWrapDetails'), + insertWrapDetails = require('./_insertWrapDetails'), + setToString = require('./_setToString'), + updateWrapDetails = require('./_updateWrapDetails'); + +/** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ +function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); +} + +module.exports = setWrapToString; diff --git a/live2d/node_modules/lodash/_shortOut.js b/live2d/node_modules/lodash/_shortOut.js new file mode 100644 index 0000000..3300a07 --- /dev/null +++ b/live2d/node_modules/lodash/_shortOut.js @@ -0,0 +1,37 @@ +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 800, + HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +module.exports = shortOut; diff --git a/live2d/node_modules/lodash/_shuffleSelf.js b/live2d/node_modules/lodash/_shuffleSelf.js new file mode 100644 index 0000000..8bcc4f5 --- /dev/null +++ b/live2d/node_modules/lodash/_shuffleSelf.js @@ -0,0 +1,28 @@ +var baseRandom = require('./_baseRandom'); + +/** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ +function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; +} + +module.exports = shuffleSelf; diff --git a/live2d/node_modules/lodash/_stackClear.js b/live2d/node_modules/lodash/_stackClear.js new file mode 100644 index 0000000..ce8e5a9 --- /dev/null +++ b/live2d/node_modules/lodash/_stackClear.js @@ -0,0 +1,15 @@ +var ListCache = require('./_ListCache'); + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; + this.size = 0; +} + +module.exports = stackClear; diff --git a/live2d/node_modules/lodash/_stackDelete.js b/live2d/node_modules/lodash/_stackDelete.js new file mode 100644 index 0000000..ff9887a --- /dev/null +++ b/live2d/node_modules/lodash/_stackDelete.js @@ -0,0 +1,18 @@ +/** + * 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; +} + +module.exports = stackDelete; diff --git a/live2d/node_modules/lodash/_stackGet.js b/live2d/node_modules/lodash/_stackGet.js new file mode 100644 index 0000000..1cdf004 --- /dev/null +++ b/live2d/node_modules/lodash/_stackGet.js @@ -0,0 +1,14 @@ +/** + * 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); +} + +module.exports = stackGet; diff --git a/live2d/node_modules/lodash/_stackHas.js b/live2d/node_modules/lodash/_stackHas.js new file mode 100644 index 0000000..16a3ad1 --- /dev/null +++ b/live2d/node_modules/lodash/_stackHas.js @@ -0,0 +1,14 @@ +/** + * 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); +} + +module.exports = stackHas; diff --git a/live2d/node_modules/lodash/_stackSet.js b/live2d/node_modules/lodash/_stackSet.js new file mode 100644 index 0000000..b790ac5 --- /dev/null +++ b/live2d/node_modules/lodash/_stackSet.js @@ -0,0 +1,34 @@ +var ListCache = require('./_ListCache'), + Map = require('./_Map'), + MapCache = require('./_MapCache'); + +/** 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; +} + +module.exports = stackSet; diff --git a/live2d/node_modules/lodash/_strictIndexOf.js b/live2d/node_modules/lodash/_strictIndexOf.js new file mode 100644 index 0000000..0486a49 --- /dev/null +++ b/live2d/node_modules/lodash/_strictIndexOf.js @@ -0,0 +1,23 @@ +/** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = strictIndexOf; diff --git a/live2d/node_modules/lodash/_strictLastIndexOf.js b/live2d/node_modules/lodash/_strictLastIndexOf.js new file mode 100644 index 0000000..d7310dc --- /dev/null +++ b/live2d/node_modules/lodash/_strictLastIndexOf.js @@ -0,0 +1,21 @@ +/** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; +} + +module.exports = strictLastIndexOf; diff --git a/live2d/node_modules/lodash/_stringSize.js b/live2d/node_modules/lodash/_stringSize.js new file mode 100644 index 0000000..17ef462 --- /dev/null +++ b/live2d/node_modules/lodash/_stringSize.js @@ -0,0 +1,18 @@ +var asciiSize = require('./_asciiSize'), + hasUnicode = require('./_hasUnicode'), + unicodeSize = require('./_unicodeSize'); + +/** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ +function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); +} + +module.exports = stringSize; diff --git a/live2d/node_modules/lodash/_stringToArray.js b/live2d/node_modules/lodash/_stringToArray.js new file mode 100644 index 0000000..d161158 --- /dev/null +++ b/live2d/node_modules/lodash/_stringToArray.js @@ -0,0 +1,18 @@ +var asciiToArray = require('./_asciiToArray'), + hasUnicode = require('./_hasUnicode'), + unicodeToArray = require('./_unicodeToArray'); + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +module.exports = stringToArray; diff --git a/live2d/node_modules/lodash/_stringToPath.js b/live2d/node_modules/lodash/_stringToPath.js new file mode 100644 index 0000000..8f39f8a --- /dev/null +++ b/live2d/node_modules/lodash/_stringToPath.js @@ -0,0 +1,27 @@ +var memoizeCapped = require('./_memoizeCapped'); + +/** Used to match property names within property paths. */ +var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +module.exports = stringToPath; diff --git a/live2d/node_modules/lodash/_toKey.js b/live2d/node_modules/lodash/_toKey.js new file mode 100644 index 0000000..c6d645c --- /dev/null +++ b/live2d/node_modules/lodash/_toKey.js @@ -0,0 +1,21 @@ +var isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +module.exports = toKey; diff --git a/live2d/node_modules/lodash/_toSource.js b/live2d/node_modules/lodash/_toSource.js new file mode 100644 index 0000000..a020b38 --- /dev/null +++ b/live2d/node_modules/lodash/_toSource.js @@ -0,0 +1,26 @@ +/** Used for built-in method references. */ +var funcProto = Function.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.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.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +module.exports = toSource; diff --git a/live2d/node_modules/lodash/_trimmedEndIndex.js b/live2d/node_modules/lodash/_trimmedEndIndex.js new file mode 100644 index 0000000..139439a --- /dev/null +++ b/live2d/node_modules/lodash/_trimmedEndIndex.js @@ -0,0 +1,19 @@ +/** Used to match a single whitespace character. */ +var reWhitespace = /\s/; + +/** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ +function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; +} + +module.exports = trimmedEndIndex; diff --git a/live2d/node_modules/lodash/_unescapeHtmlChar.js b/live2d/node_modules/lodash/_unescapeHtmlChar.js new file mode 100644 index 0000000..a71fecb --- /dev/null +++ b/live2d/node_modules/lodash/_unescapeHtmlChar.js @@ -0,0 +1,21 @@ +var basePropertyOf = require('./_basePropertyOf'); + +/** Used to map HTML entities to characters. */ +var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" +}; + +/** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ +var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + +module.exports = unescapeHtmlChar; diff --git a/live2d/node_modules/lodash/_unicodeSize.js b/live2d/node_modules/lodash/_unicodeSize.js new file mode 100644 index 0000000..68137ec --- /dev/null +++ b/live2d/node_modules/lodash/_unicodeSize.js @@ -0,0 +1,44 @@ +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; +} + +module.exports = unicodeSize; diff --git a/live2d/node_modules/lodash/_unicodeToArray.js b/live2d/node_modules/lodash/_unicodeToArray.js new file mode 100644 index 0000000..2a725c0 --- /dev/null +++ b/live2d/node_modules/lodash/_unicodeToArray.js @@ -0,0 +1,40 @@ +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} + +module.exports = unicodeToArray; diff --git a/live2d/node_modules/lodash/_unicodeWords.js b/live2d/node_modules/lodash/_unicodeWords.js new file mode 100644 index 0000000..e72e6e0 --- /dev/null +++ b/live2d/node_modules/lodash/_unicodeWords.js @@ -0,0 +1,69 @@ +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + +/** Used to compose unicode capture groups. */ +var rsApos = "['\u2019]", + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; + +/** Used to match complex or compound words. */ +var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function unicodeWords(string) { + return string.match(reUnicodeWord) || []; +} + +module.exports = unicodeWords; diff --git a/live2d/node_modules/lodash/_updateWrapDetails.js b/live2d/node_modules/lodash/_updateWrapDetails.js new file mode 100644 index 0000000..8759fbd --- /dev/null +++ b/live2d/node_modules/lodash/_updateWrapDetails.js @@ -0,0 +1,46 @@ +var arrayEach = require('./_arrayEach'), + arrayIncludes = require('./_arrayIncludes'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + +/** Used to associate wrap methods with their bit flags. */ +var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] +]; + +/** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ +function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); +} + +module.exports = updateWrapDetails; diff --git a/live2d/node_modules/lodash/_wrapperClone.js b/live2d/node_modules/lodash/_wrapperClone.js new file mode 100644 index 0000000..7bb58a2 --- /dev/null +++ b/live2d/node_modules/lodash/_wrapperClone.js @@ -0,0 +1,23 @@ +var LazyWrapper = require('./_LazyWrapper'), + LodashWrapper = require('./_LodashWrapper'), + copyArray = require('./_copyArray'); + +/** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ +function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; +} + +module.exports = wrapperClone; diff --git a/live2d/node_modules/lodash/add.js b/live2d/node_modules/lodash/add.js new file mode 100644 index 0000000..f069515 --- /dev/null +++ b/live2d/node_modules/lodash/add.js @@ -0,0 +1,22 @@ +var createMathOperation = require('./_createMathOperation'); + +/** + * Adds two numbers. + * + * @static + * @memberOf _ + * @since 3.4.0 + * @category Math + * @param {number} augend The first number in an addition. + * @param {number} addend The second number in an addition. + * @returns {number} Returns the total. + * @example + * + * _.add(6, 4); + * // => 10 + */ +var add = createMathOperation(function(augend, addend) { + return augend + addend; +}, 0); + +module.exports = add; diff --git a/live2d/node_modules/lodash/after.js b/live2d/node_modules/lodash/after.js new file mode 100644 index 0000000..3900c97 --- /dev/null +++ b/live2d/node_modules/lodash/after.js @@ -0,0 +1,42 @@ +var toInteger = require('./toInteger'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ +function after(n, func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; +} + +module.exports = after; diff --git a/live2d/node_modules/lodash/array.js b/live2d/node_modules/lodash/array.js new file mode 100644 index 0000000..af688d3 --- /dev/null +++ b/live2d/node_modules/lodash/array.js @@ -0,0 +1,67 @@ +module.exports = { + 'chunk': require('./chunk'), + 'compact': require('./compact'), + 'concat': require('./concat'), + 'difference': require('./difference'), + 'differenceBy': require('./differenceBy'), + 'differenceWith': require('./differenceWith'), + 'drop': require('./drop'), + 'dropRight': require('./dropRight'), + 'dropRightWhile': require('./dropRightWhile'), + 'dropWhile': require('./dropWhile'), + 'fill': require('./fill'), + 'findIndex': require('./findIndex'), + 'findLastIndex': require('./findLastIndex'), + 'first': require('./first'), + 'flatten': require('./flatten'), + 'flattenDeep': require('./flattenDeep'), + 'flattenDepth': require('./flattenDepth'), + 'fromPairs': require('./fromPairs'), + 'head': require('./head'), + 'indexOf': require('./indexOf'), + 'initial': require('./initial'), + 'intersection': require('./intersection'), + 'intersectionBy': require('./intersectionBy'), + 'intersectionWith': require('./intersectionWith'), + 'join': require('./join'), + 'last': require('./last'), + 'lastIndexOf': require('./lastIndexOf'), + 'nth': require('./nth'), + 'pull': require('./pull'), + 'pullAll': require('./pullAll'), + 'pullAllBy': require('./pullAllBy'), + 'pullAllWith': require('./pullAllWith'), + 'pullAt': require('./pullAt'), + 'remove': require('./remove'), + 'reverse': require('./reverse'), + 'slice': require('./slice'), + 'sortedIndex': require('./sortedIndex'), + 'sortedIndexBy': require('./sortedIndexBy'), + 'sortedIndexOf': require('./sortedIndexOf'), + 'sortedLastIndex': require('./sortedLastIndex'), + 'sortedLastIndexBy': require('./sortedLastIndexBy'), + 'sortedLastIndexOf': require('./sortedLastIndexOf'), + 'sortedUniq': require('./sortedUniq'), + 'sortedUniqBy': require('./sortedUniqBy'), + 'tail': require('./tail'), + 'take': require('./take'), + 'takeRight': require('./takeRight'), + 'takeRightWhile': require('./takeRightWhile'), + 'takeWhile': require('./takeWhile'), + 'union': require('./union'), + 'unionBy': require('./unionBy'), + 'unionWith': require('./unionWith'), + 'uniq': require('./uniq'), + 'uniqBy': require('./uniqBy'), + 'uniqWith': require('./uniqWith'), + 'unzip': require('./unzip'), + 'unzipWith': require('./unzipWith'), + 'without': require('./without'), + 'xor': require('./xor'), + 'xorBy': require('./xorBy'), + 'xorWith': require('./xorWith'), + 'zip': require('./zip'), + 'zipObject': require('./zipObject'), + 'zipObjectDeep': require('./zipObjectDeep'), + 'zipWith': require('./zipWith') +}; diff --git a/live2d/node_modules/lodash/ary.js b/live2d/node_modules/lodash/ary.js new file mode 100644 index 0000000..70c87d0 --- /dev/null +++ b/live2d/node_modules/lodash/ary.js @@ -0,0 +1,29 @@ +var createWrap = require('./_createWrap'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_ARY_FLAG = 128; + +/** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ +function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); +} + +module.exports = ary; diff --git a/live2d/node_modules/lodash/assign.js b/live2d/node_modules/lodash/assign.js new file mode 100644 index 0000000..909db26 --- /dev/null +++ b/live2d/node_modules/lodash/assign.js @@ -0,0 +1,58 @@ +var assignValue = require('./_assignValue'), + copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + isArrayLike = require('./isArrayLike'), + isPrototype = require('./_isPrototype'), + keys = require('./keys'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ +var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } +}); + +module.exports = assign; diff --git a/live2d/node_modules/lodash/assignIn.js b/live2d/node_modules/lodash/assignIn.js new file mode 100644 index 0000000..e663473 --- /dev/null +++ b/live2d/node_modules/lodash/assignIn.js @@ -0,0 +1,40 @@ +var copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + keysIn = require('./keysIn'); + +/** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ +var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); +}); + +module.exports = assignIn; diff --git a/live2d/node_modules/lodash/assignInWith.js b/live2d/node_modules/lodash/assignInWith.js new file mode 100644 index 0000000..68fcc0b --- /dev/null +++ b/live2d/node_modules/lodash/assignInWith.js @@ -0,0 +1,38 @@ +var copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + keysIn = require('./keysIn'); + +/** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); +}); + +module.exports = assignInWith; diff --git a/live2d/node_modules/lodash/assignWith.js b/live2d/node_modules/lodash/assignWith.js new file mode 100644 index 0000000..7dc6c76 --- /dev/null +++ b/live2d/node_modules/lodash/assignWith.js @@ -0,0 +1,37 @@ +var copyObject = require('./_copyObject'), + createAssigner = require('./_createAssigner'), + keys = require('./keys'); + +/** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); +}); + +module.exports = assignWith; diff --git a/live2d/node_modules/lodash/at.js b/live2d/node_modules/lodash/at.js new file mode 100644 index 0000000..781ee9e --- /dev/null +++ b/live2d/node_modules/lodash/at.js @@ -0,0 +1,23 @@ +var baseAt = require('./_baseAt'), + flatRest = require('./_flatRest'); + +/** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ +var at = flatRest(baseAt); + +module.exports = at; diff --git a/live2d/node_modules/lodash/attempt.js b/live2d/node_modules/lodash/attempt.js new file mode 100644 index 0000000..624d015 --- /dev/null +++ b/live2d/node_modules/lodash/attempt.js @@ -0,0 +1,35 @@ +var apply = require('./_apply'), + baseRest = require('./_baseRest'), + isError = require('./isError'); + +/** + * Attempts to invoke `func`, returning either the result or the caught error + * object. Any additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Util + * @param {Function} func The function to attempt. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {*} Returns the `func` result or error object. + * @example + * + * // Avoid throwing errors for invalid selectors. + * var elements = _.attempt(function(selector) { + * return document.querySelectorAll(selector); + * }, '>_>'); + * + * if (_.isError(elements)) { + * elements = []; + * } + */ +var attempt = baseRest(function(func, args) { + try { + return apply(func, undefined, args); + } catch (e) { + return isError(e) ? e : new Error(e); + } +}); + +module.exports = attempt; diff --git a/live2d/node_modules/lodash/before.js b/live2d/node_modules/lodash/before.js new file mode 100644 index 0000000..a3e0a16 --- /dev/null +++ b/live2d/node_modules/lodash/before.js @@ -0,0 +1,40 @@ +var toInteger = require('./toInteger'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ +function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; +} + +module.exports = before; diff --git a/live2d/node_modules/lodash/bind.js b/live2d/node_modules/lodash/bind.js new file mode 100644 index 0000000..b1076e9 --- /dev/null +++ b/live2d/node_modules/lodash/bind.js @@ -0,0 +1,57 @@ +var baseRest = require('./_baseRest'), + createWrap = require('./_createWrap'), + getHolder = require('./_getHolder'), + replaceHolders = require('./_replaceHolders'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_PARTIAL_FLAG = 32; + +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); +}); + +// Assign default placeholders. +bind.placeholder = {}; + +module.exports = bind; diff --git a/live2d/node_modules/lodash/bindAll.js b/live2d/node_modules/lodash/bindAll.js new file mode 100644 index 0000000..a35706d --- /dev/null +++ b/live2d/node_modules/lodash/bindAll.js @@ -0,0 +1,41 @@ +var arrayEach = require('./_arrayEach'), + baseAssignValue = require('./_baseAssignValue'), + bind = require('./bind'), + flatRest = require('./_flatRest'), + toKey = require('./_toKey'); + +/** + * Binds methods of an object to the object itself, overwriting the existing + * method. + * + * **Note:** This method doesn't set the "length" property of bound functions. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {Object} object The object to bind and assign the bound methods to. + * @param {...(string|string[])} methodNames The object method names to bind. + * @returns {Object} Returns `object`. + * @example + * + * var view = { + * 'label': 'docs', + * 'click': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * _.bindAll(view, ['click']); + * jQuery(element).on('click', view.click); + * // => Logs 'clicked docs' when clicked. + */ +var bindAll = flatRest(function(object, methodNames) { + arrayEach(methodNames, function(key) { + key = toKey(key); + baseAssignValue(object, key, bind(object[key], object)); + }); + return object; +}); + +module.exports = bindAll; diff --git a/live2d/node_modules/lodash/bindKey.js b/live2d/node_modules/lodash/bindKey.js new file mode 100644 index 0000000..f7fd64c --- /dev/null +++ b/live2d/node_modules/lodash/bindKey.js @@ -0,0 +1,68 @@ +var baseRest = require('./_baseRest'), + createWrap = require('./_createWrap'), + getHolder = require('./_getHolder'), + replaceHolders = require('./_replaceHolders'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_PARTIAL_FLAG = 32; + +/** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); +}); + +// Assign default placeholders. +bindKey.placeholder = {}; + +module.exports = bindKey; diff --git a/live2d/node_modules/lodash/camelCase.js b/live2d/node_modules/lodash/camelCase.js new file mode 100644 index 0000000..d7390de --- /dev/null +++ b/live2d/node_modules/lodash/camelCase.js @@ -0,0 +1,29 @@ +var capitalize = require('./capitalize'), + createCompounder = require('./_createCompounder'); + +/** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ +var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); +}); + +module.exports = camelCase; diff --git a/live2d/node_modules/lodash/capitalize.js b/live2d/node_modules/lodash/capitalize.js new file mode 100644 index 0000000..3e1600e --- /dev/null +++ b/live2d/node_modules/lodash/capitalize.js @@ -0,0 +1,23 @@ +var toString = require('./toString'), + upperFirst = require('./upperFirst'); + +/** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ +function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); +} + +module.exports = capitalize; diff --git a/live2d/node_modules/lodash/castArray.js b/live2d/node_modules/lodash/castArray.js new file mode 100644 index 0000000..e470bdb --- /dev/null +++ b/live2d/node_modules/lodash/castArray.js @@ -0,0 +1,44 @@ +var isArray = require('./isArray'); + +/** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ +function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; +} + +module.exports = castArray; diff --git a/live2d/node_modules/lodash/ceil.js b/live2d/node_modules/lodash/ceil.js new file mode 100644 index 0000000..56c8722 --- /dev/null +++ b/live2d/node_modules/lodash/ceil.js @@ -0,0 +1,26 @@ +var createRound = require('./_createRound'); + +/** + * Computes `number` rounded up to `precision`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Math + * @param {number} number The number to round up. + * @param {number} [precision=0] The precision to round up to. + * @returns {number} Returns the rounded up number. + * @example + * + * _.ceil(4.006); + * // => 5 + * + * _.ceil(6.004, 2); + * // => 6.01 + * + * _.ceil(6040, -2); + * // => 6100 + */ +var ceil = createRound('ceil'); + +module.exports = ceil; diff --git a/live2d/node_modules/lodash/chain.js b/live2d/node_modules/lodash/chain.js new file mode 100644 index 0000000..f6cd647 --- /dev/null +++ b/live2d/node_modules/lodash/chain.js @@ -0,0 +1,38 @@ +var lodash = require('./wrapperLodash'); + +/** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ +function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; +} + +module.exports = chain; diff --git a/live2d/node_modules/lodash/chunk.js b/live2d/node_modules/lodash/chunk.js new file mode 100644 index 0000000..5b562fe --- /dev/null +++ b/live2d/node_modules/lodash/chunk.js @@ -0,0 +1,50 @@ +var baseSlice = require('./_baseSlice'), + isIterateeCall = require('./_isIterateeCall'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil, + nativeMax = Math.max; + +/** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ +function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; +} + +module.exports = chunk; diff --git a/live2d/node_modules/lodash/clamp.js b/live2d/node_modules/lodash/clamp.js new file mode 100644 index 0000000..91a72c9 --- /dev/null +++ b/live2d/node_modules/lodash/clamp.js @@ -0,0 +1,39 @@ +var baseClamp = require('./_baseClamp'), + toNumber = require('./toNumber'); + +/** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ +function clamp(number, lower, upper) { + if (upper === undefined) { + upper = lower; + lower = undefined; + } + if (upper !== undefined) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); +} + +module.exports = clamp; diff --git a/live2d/node_modules/lodash/clone.js b/live2d/node_modules/lodash/clone.js new file mode 100644 index 0000000..dd439d6 --- /dev/null +++ b/live2d/node_modules/lodash/clone.js @@ -0,0 +1,36 @@ +var baseClone = require('./_baseClone'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_SYMBOLS_FLAG = 4; + +/** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ +function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); +} + +module.exports = clone; diff --git a/live2d/node_modules/lodash/cloneDeep.js b/live2d/node_modules/lodash/cloneDeep.js new file mode 100644 index 0000000..4425fbe --- /dev/null +++ b/live2d/node_modules/lodash/cloneDeep.js @@ -0,0 +1,29 @@ +var baseClone = require('./_baseClone'); + +/** 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); +} + +module.exports = cloneDeep; diff --git a/live2d/node_modules/lodash/cloneDeepWith.js b/live2d/node_modules/lodash/cloneDeepWith.js new file mode 100644 index 0000000..fd9c6c0 --- /dev/null +++ b/live2d/node_modules/lodash/cloneDeepWith.js @@ -0,0 +1,40 @@ +var baseClone = require('./_baseClone'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1, + CLONE_SYMBOLS_FLAG = 4; + +/** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ +function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); +} + +module.exports = cloneDeepWith; diff --git a/live2d/node_modules/lodash/cloneWith.js b/live2d/node_modules/lodash/cloneWith.js new file mode 100644 index 0000000..d2f4e75 --- /dev/null +++ b/live2d/node_modules/lodash/cloneWith.js @@ -0,0 +1,42 @@ +var baseClone = require('./_baseClone'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_SYMBOLS_FLAG = 4; + +/** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ +function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); +} + +module.exports = cloneWith; diff --git a/live2d/node_modules/lodash/collection.js b/live2d/node_modules/lodash/collection.js new file mode 100644 index 0000000..77fe837 --- /dev/null +++ b/live2d/node_modules/lodash/collection.js @@ -0,0 +1,30 @@ +module.exports = { + 'countBy': require('./countBy'), + 'each': require('./each'), + 'eachRight': require('./eachRight'), + 'every': require('./every'), + 'filter': require('./filter'), + 'find': require('./find'), + 'findLast': require('./findLast'), + 'flatMap': require('./flatMap'), + 'flatMapDeep': require('./flatMapDeep'), + 'flatMapDepth': require('./flatMapDepth'), + 'forEach': require('./forEach'), + 'forEachRight': require('./forEachRight'), + 'groupBy': require('./groupBy'), + 'includes': require('./includes'), + 'invokeMap': require('./invokeMap'), + 'keyBy': require('./keyBy'), + 'map': require('./map'), + 'orderBy': require('./orderBy'), + 'partition': require('./partition'), + 'reduce': require('./reduce'), + 'reduceRight': require('./reduceRight'), + 'reject': require('./reject'), + 'sample': require('./sample'), + 'sampleSize': require('./sampleSize'), + 'shuffle': require('./shuffle'), + 'size': require('./size'), + 'some': require('./some'), + 'sortBy': require('./sortBy') +}; diff --git a/live2d/node_modules/lodash/commit.js b/live2d/node_modules/lodash/commit.js new file mode 100644 index 0000000..fe4db71 --- /dev/null +++ b/live2d/node_modules/lodash/commit.js @@ -0,0 +1,33 @@ +var LodashWrapper = require('./_LodashWrapper'); + +/** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ +function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); +} + +module.exports = wrapperCommit; diff --git a/live2d/node_modules/lodash/compact.js b/live2d/node_modules/lodash/compact.js new file mode 100644 index 0000000..031fab4 --- /dev/null +++ b/live2d/node_modules/lodash/compact.js @@ -0,0 +1,31 @@ +/** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ +function compact(array) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; +} + +module.exports = compact; diff --git a/live2d/node_modules/lodash/concat.js b/live2d/node_modules/lodash/concat.js new file mode 100644 index 0000000..1da48a4 --- /dev/null +++ b/live2d/node_modules/lodash/concat.js @@ -0,0 +1,43 @@ +var arrayPush = require('./_arrayPush'), + baseFlatten = require('./_baseFlatten'), + copyArray = require('./_copyArray'), + isArray = require('./isArray'); + +/** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ +function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); +} + +module.exports = concat; diff --git a/live2d/node_modules/lodash/cond.js b/live2d/node_modules/lodash/cond.js new file mode 100644 index 0000000..6455598 --- /dev/null +++ b/live2d/node_modules/lodash/cond.js @@ -0,0 +1,60 @@ +var apply = require('./_apply'), + arrayMap = require('./_arrayMap'), + baseIteratee = require('./_baseIteratee'), + baseRest = require('./_baseRest'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that iterates over `pairs` and invokes the corresponding + * function of the first predicate to return truthy. The predicate-function + * pairs are invoked with the `this` binding and arguments of the created + * function. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Util + * @param {Array} pairs The predicate-function pairs. + * @returns {Function} Returns the new composite function. + * @example + * + * var func = _.cond([ + * [_.matches({ 'a': 1 }), _.constant('matches A')], + * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], + * [_.stubTrue, _.constant('no match')] + * ]); + * + * func({ 'a': 1, 'b': 2 }); + * // => 'matches A' + * + * func({ 'a': 0, 'b': 1 }); + * // => 'matches B' + * + * func({ 'a': '1', 'b': '2' }); + * // => 'no match' + */ +function cond(pairs) { + var length = pairs == null ? 0 : pairs.length, + toIteratee = baseIteratee; + + pairs = !length ? [] : arrayMap(pairs, function(pair) { + if (typeof pair[1] != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return [toIteratee(pair[0]), pair[1]]; + }); + + return baseRest(function(args) { + var index = -1; + while (++index < length) { + var pair = pairs[index]; + if (apply(pair[0], this, args)) { + return apply(pair[1], this, args); + } + } + }); +} + +module.exports = cond; diff --git a/live2d/node_modules/lodash/conforms.js b/live2d/node_modules/lodash/conforms.js new file mode 100644 index 0000000..5501a94 --- /dev/null +++ b/live2d/node_modules/lodash/conforms.js @@ -0,0 +1,35 @@ +var baseClone = require('./_baseClone'), + baseConforms = require('./_baseConforms'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1; + +/** + * Creates a function that invokes the predicate properties of `source` with + * the corresponding property values of a given object, returning `true` if + * all predicates return truthy, else `false`. + * + * **Note:** The created function is equivalent to `_.conformsTo` with + * `source` partially applied. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Util + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + * @example + * + * var objects = [ + * { 'a': 2, 'b': 1 }, + * { 'a': 1, 'b': 2 } + * ]; + * + * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); + * // => [{ 'a': 1, 'b': 2 }] + */ +function conforms(source) { + return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); +} + +module.exports = conforms; diff --git a/live2d/node_modules/lodash/conformsTo.js b/live2d/node_modules/lodash/conformsTo.js new file mode 100644 index 0000000..b8a93eb --- /dev/null +++ b/live2d/node_modules/lodash/conformsTo.js @@ -0,0 +1,32 @@ +var baseConformsTo = require('./_baseConformsTo'), + keys = require('./keys'); + +/** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ +function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); +} + +module.exports = conformsTo; diff --git a/live2d/node_modules/lodash/constant.js b/live2d/node_modules/lodash/constant.js new file mode 100644 index 0000000..655ece3 --- /dev/null +++ b/live2d/node_modules/lodash/constant.js @@ -0,0 +1,26 @@ +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant(value) { + return function() { + return value; + }; +} + +module.exports = constant; diff --git a/live2d/node_modules/lodash/core.js b/live2d/node_modules/lodash/core.js new file mode 100644 index 0000000..be1d567 --- /dev/null +++ b/live2d/node_modules/lodash/core.js @@ -0,0 +1,3877 @@ +/** + * @license + * Lodash (Custom Build) + * Build: `lodash core -o ./dist/lodash.core.js` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Error message constants. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_PARTIAL_FLAG = 32; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + numberTag = '[object Number]', + objectTag = '[object Object]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + stringTag = '[object String]'; + + /** Used to match HTML entities and HTML characters. */ + var reUnescapedHtml = /[&<>"']/g, + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** 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')(); + + /** 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; + + /*--------------------------------------------------------------------------*/ + + /** + * 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) { + array.push.apply(array, values); + return array; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return baseMap(props, function(key) { + return object[key]; + }); + } + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * 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)); + }; + } + + /*--------------------------------------------------------------------------*/ + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Built-in value references. */ + var objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeIsFinite = root.isFinite, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + return value instanceof LodashWrapper + ? value + : new LodashWrapper(value); + } + + /** + * 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; + }; + }()); + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + } + + LodashWrapper.prototype = baseCreate(lodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * 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.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * 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) { + object[key] = value; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !false) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return baseFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * 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) { + return objectToString(value); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ + var baseIsArguments = noop; + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * 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); + } + + /** + * 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 : baseGetTag(object), + othTag = othIsArr ? arrayTag : baseGetTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + stack || (stack = []); + var objStack = find(stack, function(entry) { + return entry[0] == object; + }); + var othStack = find(stack, function(entry) { + return entry[0] == other; + }); + if (objStack && othStack) { + return objStack[1] == other; + } + stack.push([object, other]); + stack.push([other, object]); + if (isSameTag && !objIsObj) { + var result = (objIsArr) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + stack.pop(); + return result; + } + 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; + + var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + stack.pop(); + return result; + } + } + if (!isSameTag) { + return false; + } + var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack); + stack.pop(); + return result; + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(func) { + if (typeof func == 'function') { + return func; + } + if (func == null) { + return identity; + } + return (typeof func == 'object' ? baseMatches : baseProperty)(func); + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var props = nativeKeys(source); + return function(object) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length]; + if (!(key in object && + baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG) + )) { + return false; + } + } + return true; + }; + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, props) { + object = Object(object); + return reduce(props, function(result, key) { + if (key in object) { + result[key] = object[key]; + } + return result; + }, {}); + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + 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) { + return baseSlice(source, 0, source.length); + } + + /** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection 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 baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + return reduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = false; + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = false; + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * 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; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = baseIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return fn.apply(isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * 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, + 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) ? [] : undefined; + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + var compared; + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!baseSome(other, function(othValue, othIndex) { + if (!indexOf(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; + } + } + return result; + } + + /** + * 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 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 + ''); + + } + return false; + } + + /** + * 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, + objProps = keys(object), + objLength = objProps.length, + othProps = keys(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.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; + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + var compared; + // 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; + } + } + return result; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value); + } + + /** + * 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 : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * 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; + } + + /** + * 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); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return func.apply(this, otherArgs); + }; + } + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = identity; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + return baseFilter(array, Boolean); + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else { + fromIndex = 0; + } + var index = (fromIndex || 0) - 1, + isReflexive = value === value; + + while (++index < length) { + var other = array[index]; + if ((isReflexive ? other === value : other !== other)) { + return index; + } + } + return -1; + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + start = start == null ? 0 : +start; + end = end === undefined ? length : +end; + return length ? baseSlice(array, start, end) : []; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + predicate = guard ? undefined : predicate; + return baseEvery(collection, baseIteratee(predicate)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ + function filter(collection, predicate) { + return baseFilter(collection, baseIteratee(predicate)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + return baseEach(collection, baseIteratee(iteratee)); + } + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + return baseMap(collection, baseIteratee(iteratee)); + } + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + collection = isArrayLike(collection) ? collection : nativeKeys(collection); + return collection.length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + predicate = guard ? undefined : predicate; + return baseSome(collection, baseIteratee(predicate)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] + */ + function sortBy(collection, iteratee) { + var index = 0; + iteratee = baseIteratee(iteratee); + + return baseMap(baseMap(collection, function(value, key, collection) { + return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) }; + }).sort(function(object, other) { + return compareAscending(object.criteria, other.criteria) || (object.index - other.index); + }), baseProperty('value')); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials); + }); + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + if (!isObject(value)) { + return value; + } + return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value)); + } + + /** + * 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); + } + + /** + * 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.call(value, 'callee') && + !propertyIsEnumerable.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; + + /** + * 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); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = baseIsDate; + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (isArrayLike(value) && + (isArray(value) || isString(value) || + isFunction(value.splice) || isArguments(value))) { + return !value.length; + } + return !nativeKeys(value).length; + } + + /** + * 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); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * 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 || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * 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 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'); + } + + /** + * 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 `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = baseIsRegExp; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!isArrayLike(value)) { + return values(value); + } + return value.length ? copyArray(value) : []; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + var toInteger = Number; + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + var toNumber = Number; + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + copyObject(source, nativeKeys(source), object); + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, nativeKeysIn(source), object); + }); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : assign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasOwnProperty.call(object, path); + } + + /** + * 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'] + */ + var keys = nativeKeys; + + /** + * 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) + */ + var keysIn = nativeKeysIn; + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + var value = object == null ? undefined : object[path]; + if (value === undefined) { + value = defaultValue; + } + return isFunction(value) ? value.call(object) : value; + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /*------------------------------------------------------------------------*/ + + /** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ + function identity(value) { + return value; + } + + /** + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name, the created function returns the + * property value for a given element. If `func` is an array or object, the + * created function returns `true` for elements that contain the equivalent + * source properties, otherwise it returns `false`. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Util + * @param {*} [func=_.identity] The value to convert to a callback. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); + * // => [{ 'user': 'barney', 'age': 36, 'active': true }] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, _.iteratee(['user', 'fred'])); + * // => [{ 'user': 'fred', 'age': 40 }] + * + * // The `_.property` iteratee shorthand. + * _.map(users, _.iteratee('user')); + * // => ['barney', 'fred'] + * + * // Create custom iteratee shorthands. + * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { + * return !_.isRegExp(func) ? iteratee(func) : function(string) { + * return func.test(string); + * }; + * }); + * + * _.filter(['abc', 'def'], /ef/); + * // => ['def'] + */ + var iteratee = baseIteratee; + + /** + * Creates a function that performs a partial deep comparison between a given + * object and `source`, returning `true` if the given object has equivalent + * property values, else `false`. + * + * **Note:** The created function is equivalent to `_.isMatch` with `source` + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * **Note:** Multiple values can be checked by combining several matchers + * using `_.overSome` + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Util + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + * @example + * + * var objects = [ + * { 'a': 1, 'b': 2, 'c': 3 }, + * { 'a': 4, 'b': 5, 'c': 6 } + * ]; + * + * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); + * // => [{ 'a': 4, 'b': 5, 'c': 6 }] + * + * // Checking for several possible values + * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); + * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] + */ + function matches(source) { + return baseMatches(assign({}, source)); + } + + /** + * Adds all own enumerable string keyed function properties of a source + * object to the destination object. If `object` is a function, then methods + * are added to its prototype as well. + * + * **Note:** Use `_.runInContext` to create a pristine `lodash` function to + * avoid conflicts caused by modifying the original. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {Function|Object} [object=lodash] The destination object. + * @param {Object} source The object of functions to add. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.chain=true] Specify whether mixins are chainable. + * @returns {Function|Object} Returns `object`. + * @example + * + * function vowels(string) { + * return _.filter(string, function(v) { + * return /[aeiou]/i.test(v); + * }); + * } + * + * _.mixin({ 'vowels': vowels }); + * _.vowels('fred'); + * // => ['e'] + * + * _('fred').vowels().value(); + * // => ['e'] + * + * _.mixin({ 'vowels': vowels }, { 'chain': false }); + * _('fred').vowels(); + * // => ['e'] + */ + function mixin(object, source, options) { + var props = keys(source), + methodNames = baseFunctions(source, props); + + if (options == null && + !(isObject(source) && (methodNames.length || !props.length))) { + options = source; + source = object; + object = this; + methodNames = baseFunctions(source, keys(source)); + } + var chain = !(isObject(options) && 'chain' in options) || !!options.chain, + isFunc = isFunction(object); + + baseEach(methodNames, function(methodName) { + var func = source[methodName]; + object[methodName] = func; + if (isFunc) { + object.prototype[methodName] = function() { + var chainAll = this.__chain__; + if (chain || chainAll) { + var result = object(this.__wrapped__), + actions = result.__actions__ = copyArray(this.__actions__); + + actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); + result.__chain__ = chainAll; + return result; + } + return func.apply(object, arrayPush([this.value()], arguments)); + }; + } + }); + + return object; + } + + /** + * Reverts the `_` variable to its previous value and returns a reference to + * the `lodash` function. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @returns {Function} Returns the `lodash` function. + * @example + * + * var lodash = _.noConflict(); + */ + function noConflict() { + if (root._ === this) { + root._ = oldDash; + } + return this; + } + + /** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ + function noop() { + // No operation performed. + } + + /** + * Generates a unique ID. If `prefix` is given, the ID is appended to it. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {string} [prefix=''] The value to prefix the ID with. + * @returns {string} Returns the unique ID. + * @example + * + * _.uniqueId('contact_'); + * // => 'contact_104' + * + * _.uniqueId(); + * // => '105' + */ + function uniqueId(prefix) { + var id = ++idCounter; + return toString(prefix) + id; + } + + /*------------------------------------------------------------------------*/ + + /** + * Computes the maximum value of `array`. If `array` is empty or falsey, + * `undefined` is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + * @example + * + * _.max([4, 2, 8, 6]); + * // => 8 + * + * _.max([]); + * // => undefined + */ + function max(array) { + return (array && array.length) + ? baseExtremum(array, identity, baseGt) + : undefined; + } + + /** + * Computes the minimum value of `array`. If `array` is empty or falsey, + * `undefined` is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + * @example + * + * _.min([4, 2, 8, 6]); + * // => 2 + * + * _.min([]); + * // => undefined + */ + function min(array) { + return (array && array.length) + ? baseExtremum(array, identity, baseLt) + : undefined; + } + + /*------------------------------------------------------------------------*/ + + // Add methods that return wrapped values in chain sequences. + lodash.assignIn = assignIn; + lodash.before = before; + lodash.bind = bind; + lodash.chain = chain; + lodash.compact = compact; + lodash.concat = concat; + lodash.create = create; + lodash.defaults = defaults; + lodash.defer = defer; + lodash.delay = delay; + lodash.filter = filter; + lodash.flatten = flatten; + lodash.flattenDeep = flattenDeep; + lodash.iteratee = iteratee; + lodash.keys = keys; + lodash.map = map; + lodash.matches = matches; + lodash.mixin = mixin; + lodash.negate = negate; + lodash.once = once; + lodash.pick = pick; + lodash.slice = slice; + lodash.sortBy = sortBy; + lodash.tap = tap; + lodash.thru = thru; + lodash.toArray = toArray; + lodash.values = values; + + // Add aliases. + lodash.extend = assignIn; + + // Add methods to `lodash.prototype`. + mixin(lodash, lodash); + + /*------------------------------------------------------------------------*/ + + // Add methods that return unwrapped values in chain sequences. + lodash.clone = clone; + lodash.escape = escape; + lodash.every = every; + lodash.find = find; + lodash.forEach = forEach; + lodash.has = has; + lodash.head = head; + lodash.identity = identity; + lodash.indexOf = indexOf; + lodash.isArguments = isArguments; + lodash.isArray = isArray; + lodash.isBoolean = isBoolean; + lodash.isDate = isDate; + lodash.isEmpty = isEmpty; + lodash.isEqual = isEqual; + lodash.isFinite = isFinite; + lodash.isFunction = isFunction; + lodash.isNaN = isNaN; + lodash.isNull = isNull; + lodash.isNumber = isNumber; + lodash.isObject = isObject; + lodash.isRegExp = isRegExp; + lodash.isString = isString; + lodash.isUndefined = isUndefined; + lodash.last = last; + lodash.max = max; + lodash.min = min; + lodash.noConflict = noConflict; + lodash.noop = noop; + lodash.reduce = reduce; + lodash.result = result; + lodash.size = size; + lodash.some = some; + lodash.uniqueId = uniqueId; + + // Add aliases. + lodash.each = forEach; + lodash.first = head; + + mixin(lodash, (function() { + var source = {}; + baseForOwn(lodash, function(func, methodName) { + if (!hasOwnProperty.call(lodash.prototype, methodName)) { + source[methodName] = func; + } + }); + return source; + }()), { 'chain': false }); + + /*------------------------------------------------------------------------*/ + + /** + * The semantic version number. + * + * @static + * @memberOf _ + * @type {string} + */ + lodash.VERSION = VERSION; + + // Add `Array` methods to `lodash.prototype`. + baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { + var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName], + chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', + retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName); + + lodash.prototype[methodName] = function() { + var args = arguments; + if (retUnwrapped && !this.__chain__) { + var value = this.value(); + return func.apply(isArray(value) ? value : [], args); + } + return this[chainName](function(value) { + return func.apply(isArray(value) ? value : [], args); + }); + }; + }); + + // Add chain sequence methods to the `lodash` wrapper. + lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; + + /*--------------------------------------------------------------------------*/ + + // Some AMD build optimizers, like r.js, check for condition patterns like: + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + // Expose Lodash on the global object to prevent errors when Lodash is + // loaded by a script tag in the presence of an AMD loader. + // See http://requirejs.org/docs/errors.html#mismatch for more details. + // Use `_.noConflict` to remove Lodash from the global object. + root._ = lodash; + + // Define as an anonymous module so, through path mapping, it can be + // referenced as the "underscore" module. + define(function() { + return lodash; + }); + } + // Check for `exports` after `define` in case a build optimizer adds it. + else if (freeModule) { + // Export for Node.js. + (freeModule.exports = lodash)._ = lodash; + // Export for CommonJS support. + freeExports._ = lodash; + } + else { + // Export to the global object. + root._ = lodash; + } +}.call(this)); diff --git a/live2d/node_modules/lodash/core.min.js b/live2d/node_modules/lodash/core.min.js new file mode 100644 index 0000000..e425e4d --- /dev/null +++ b/live2d/node_modules/lodash/core.min.js @@ -0,0 +1,29 @@ +/** + * @license + * Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * Build: `lodash core -o ./dist/lodash.core.js` + */ +;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); +return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++et}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){ +return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, +r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;var c=o.get(n),f=o.get(t);if(c&&f)return c==t&&f==n;for(var c=-1,f=true,a=2&r?[]:Z;++cr?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn); +}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n; +return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n); +return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){ +return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i; +var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ +var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } +}); + +module.exports = countBy; diff --git a/live2d/node_modules/lodash/create.js b/live2d/node_modules/lodash/create.js new file mode 100644 index 0000000..919edb8 --- /dev/null +++ b/live2d/node_modules/lodash/create.js @@ -0,0 +1,43 @@ +var baseAssign = require('./_baseAssign'), + baseCreate = require('./_baseCreate'); + +/** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ +function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); +} + +module.exports = create; diff --git a/live2d/node_modules/lodash/curry.js b/live2d/node_modules/lodash/curry.js new file mode 100644 index 0000000..918db1a --- /dev/null +++ b/live2d/node_modules/lodash/curry.js @@ -0,0 +1,57 @@ +var createWrap = require('./_createWrap'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_CURRY_FLAG = 8; + +/** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts the remaining `func` + * arguments, and so on. The arity of `func` may be specified if `func.length` + * is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ +function curry(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curry.placeholder; + return result; +} + +// Assign default placeholders. +curry.placeholder = {}; + +module.exports = curry; diff --git a/live2d/node_modules/lodash/curryRight.js b/live2d/node_modules/lodash/curryRight.js new file mode 100644 index 0000000..c85b6f3 --- /dev/null +++ b/live2d/node_modules/lodash/curryRight.js @@ -0,0 +1,54 @@ +var createWrap = require('./_createWrap'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_CURRY_RIGHT_FLAG = 16; + +/** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ +function curryRight(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryRight.placeholder; + return result; +} + +// Assign default placeholders. +curryRight.placeholder = {}; + +module.exports = curryRight; diff --git a/live2d/node_modules/lodash/date.js b/live2d/node_modules/lodash/date.js new file mode 100644 index 0000000..cbf5b41 --- /dev/null +++ b/live2d/node_modules/lodash/date.js @@ -0,0 +1,3 @@ +module.exports = { + 'now': require('./now') +}; diff --git a/live2d/node_modules/lodash/debounce.js b/live2d/node_modules/lodash/debounce.js new file mode 100644 index 0000000..8f751d5 --- /dev/null +++ b/live2d/node_modules/lodash/debounce.js @@ -0,0 +1,191 @@ +var isObject = require('./isObject'), + now = require('./now'), + toNumber = require('./toNumber'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ +function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} + +module.exports = debounce; diff --git a/live2d/node_modules/lodash/deburr.js b/live2d/node_modules/lodash/deburr.js new file mode 100644 index 0000000..f85e314 --- /dev/null +++ b/live2d/node_modules/lodash/deburr.js @@ -0,0 +1,45 @@ +var deburrLetter = require('./_deburrLetter'), + toString = require('./toString'); + +/** Used to match Latin Unicode letters (excluding mathematical operators). */ +var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + +/** Used to compose unicode character classes. */ +var rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; + +/** Used to compose unicode capture groups. */ +var rsCombo = '[' + rsComboRange + ']'; + +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); +} + +module.exports = deburr; diff --git a/live2d/node_modules/lodash/defaultTo.js b/live2d/node_modules/lodash/defaultTo.js new file mode 100644 index 0000000..5b33359 --- /dev/null +++ b/live2d/node_modules/lodash/defaultTo.js @@ -0,0 +1,25 @@ +/** + * Checks `value` to determine whether a default value should be returned in + * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, + * or `undefined`. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Util + * @param {*} value The value to check. + * @param {*} defaultValue The default value. + * @returns {*} Returns the resolved value. + * @example + * + * _.defaultTo(1, 10); + * // => 1 + * + * _.defaultTo(undefined, 10); + * // => 10 + */ +function defaultTo(value, defaultValue) { + return (value == null || value !== value) ? defaultValue : value; +} + +module.exports = defaultTo; diff --git a/live2d/node_modules/lodash/defaults.js b/live2d/node_modules/lodash/defaults.js new file mode 100644 index 0000000..c74df04 --- /dev/null +++ b/live2d/node_modules/lodash/defaults.js @@ -0,0 +1,64 @@ +var baseRest = require('./_baseRest'), + eq = require('./eq'), + isIterateeCall = require('./_isIterateeCall'), + keysIn = require('./keysIn'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ +var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; +}); + +module.exports = defaults; diff --git a/live2d/node_modules/lodash/defaultsDeep.js b/live2d/node_modules/lodash/defaultsDeep.js new file mode 100644 index 0000000..9b5fa3e --- /dev/null +++ b/live2d/node_modules/lodash/defaultsDeep.js @@ -0,0 +1,30 @@ +var apply = require('./_apply'), + baseRest = require('./_baseRest'), + customDefaultsMerge = require('./_customDefaultsMerge'), + mergeWith = require('./mergeWith'); + +/** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ +var defaultsDeep = baseRest(function(args) { + args.push(undefined, customDefaultsMerge); + return apply(mergeWith, undefined, args); +}); + +module.exports = defaultsDeep; diff --git a/live2d/node_modules/lodash/defer.js b/live2d/node_modules/lodash/defer.js new file mode 100644 index 0000000..f6d6c6f --- /dev/null +++ b/live2d/node_modules/lodash/defer.js @@ -0,0 +1,26 @@ +var baseDelay = require('./_baseDelay'), + baseRest = require('./_baseRest'); + +/** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ +var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); +}); + +module.exports = defer; diff --git a/live2d/node_modules/lodash/delay.js b/live2d/node_modules/lodash/delay.js new file mode 100644 index 0000000..bd55479 --- /dev/null +++ b/live2d/node_modules/lodash/delay.js @@ -0,0 +1,28 @@ +var baseDelay = require('./_baseDelay'), + baseRest = require('./_baseRest'), + toNumber = require('./toNumber'); + +/** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ +var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); +}); + +module.exports = delay; diff --git a/live2d/node_modules/lodash/difference.js b/live2d/node_modules/lodash/difference.js new file mode 100644 index 0000000..fa28bb3 --- /dev/null +++ b/live2d/node_modules/lodash/difference.js @@ -0,0 +1,33 @@ +var baseDifference = require('./_baseDifference'), + baseFlatten = require('./_baseFlatten'), + baseRest = require('./_baseRest'), + isArrayLikeObject = require('./isArrayLikeObject'); + +/** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ +var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; +}); + +module.exports = difference; diff --git a/live2d/node_modules/lodash/differenceBy.js b/live2d/node_modules/lodash/differenceBy.js new file mode 100644 index 0000000..2cd63e7 --- /dev/null +++ b/live2d/node_modules/lodash/differenceBy.js @@ -0,0 +1,44 @@ +var baseDifference = require('./_baseDifference'), + baseFlatten = require('./_baseFlatten'), + baseIteratee = require('./_baseIteratee'), + baseRest = require('./_baseRest'), + isArrayLikeObject = require('./isArrayLikeObject'), + last = require('./last'); + +/** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ +var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee, 2)) + : []; +}); + +module.exports = differenceBy; diff --git a/live2d/node_modules/lodash/differenceWith.js b/live2d/node_modules/lodash/differenceWith.js new file mode 100644 index 0000000..c0233f4 --- /dev/null +++ b/live2d/node_modules/lodash/differenceWith.js @@ -0,0 +1,40 @@ +var baseDifference = require('./_baseDifference'), + baseFlatten = require('./_baseFlatten'), + baseRest = require('./_baseRest'), + isArrayLikeObject = require('./isArrayLikeObject'), + last = require('./last'); + +/** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ +var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) + : []; +}); + +module.exports = differenceWith; diff --git a/live2d/node_modules/lodash/divide.js b/live2d/node_modules/lodash/divide.js new file mode 100644 index 0000000..8cae0cd --- /dev/null +++ b/live2d/node_modules/lodash/divide.js @@ -0,0 +1,22 @@ +var createMathOperation = require('./_createMathOperation'); + +/** + * Divide two numbers. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Math + * @param {number} dividend The first number in a division. + * @param {number} divisor The second number in a division. + * @returns {number} Returns the quotient. + * @example + * + * _.divide(6, 4); + * // => 1.5 + */ +var divide = createMathOperation(function(dividend, divisor) { + return dividend / divisor; +}, 1); + +module.exports = divide; diff --git a/live2d/node_modules/lodash/drop.js b/live2d/node_modules/lodash/drop.js new file mode 100644 index 0000000..d5c3cba --- /dev/null +++ b/live2d/node_modules/lodash/drop.js @@ -0,0 +1,38 @@ +var baseSlice = require('./_baseSlice'), + toInteger = require('./toInteger'); + +/** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); +} + +module.exports = drop; diff --git a/live2d/node_modules/lodash/dropRight.js b/live2d/node_modules/lodash/dropRight.js new file mode 100644 index 0000000..441fe99 --- /dev/null +++ b/live2d/node_modules/lodash/dropRight.js @@ -0,0 +1,39 @@ +var baseSlice = require('./_baseSlice'), + toInteger = require('./toInteger'); + +/** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = dropRight; diff --git a/live2d/node_modules/lodash/dropRightWhile.js b/live2d/node_modules/lodash/dropRightWhile.js new file mode 100644 index 0000000..9ad36a0 --- /dev/null +++ b/live2d/node_modules/lodash/dropRightWhile.js @@ -0,0 +1,45 @@ +var baseIteratee = require('./_baseIteratee'), + baseWhile = require('./_baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ +function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, baseIteratee(predicate, 3), true, true) + : []; +} + +module.exports = dropRightWhile; diff --git a/live2d/node_modules/lodash/dropWhile.js b/live2d/node_modules/lodash/dropWhile.js new file mode 100644 index 0000000..903ef56 --- /dev/null +++ b/live2d/node_modules/lodash/dropWhile.js @@ -0,0 +1,45 @@ +var baseIteratee = require('./_baseIteratee'), + baseWhile = require('./_baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ +function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, baseIteratee(predicate, 3), true) + : []; +} + +module.exports = dropWhile; diff --git a/live2d/node_modules/lodash/each.js b/live2d/node_modules/lodash/each.js new file mode 100644 index 0000000..8800f42 --- /dev/null +++ b/live2d/node_modules/lodash/each.js @@ -0,0 +1 @@ +module.exports = require('./forEach'); diff --git a/live2d/node_modules/lodash/eachRight.js b/live2d/node_modules/lodash/eachRight.js new file mode 100644 index 0000000..3252b2a --- /dev/null +++ b/live2d/node_modules/lodash/eachRight.js @@ -0,0 +1 @@ +module.exports = require('./forEachRight'); diff --git a/live2d/node_modules/lodash/endsWith.js b/live2d/node_modules/lodash/endsWith.js new file mode 100644 index 0000000..76fc866 --- /dev/null +++ b/live2d/node_modules/lodash/endsWith.js @@ -0,0 +1,43 @@ +var baseClamp = require('./_baseClamp'), + baseToString = require('./_baseToString'), + toInteger = require('./toInteger'), + toString = require('./toString'); + +/** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ +function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; +} + +module.exports = endsWith; diff --git a/live2d/node_modules/lodash/entries.js b/live2d/node_modules/lodash/entries.js new file mode 100644 index 0000000..7a88df2 --- /dev/null +++ b/live2d/node_modules/lodash/entries.js @@ -0,0 +1 @@ +module.exports = require('./toPairs'); diff --git a/live2d/node_modules/lodash/entriesIn.js b/live2d/node_modules/lodash/entriesIn.js new file mode 100644 index 0000000..f6c6331 --- /dev/null +++ b/live2d/node_modules/lodash/entriesIn.js @@ -0,0 +1 @@ +module.exports = require('./toPairsIn'); diff --git a/live2d/node_modules/lodash/eq.js b/live2d/node_modules/lodash/eq.js new file mode 100644 index 0000000..a940688 --- /dev/null +++ b/live2d/node_modules/lodash/eq.js @@ -0,0 +1,37 @@ +/** + * 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); +} + +module.exports = eq; diff --git a/live2d/node_modules/lodash/escape.js b/live2d/node_modules/lodash/escape.js new file mode 100644 index 0000000..9247e00 --- /dev/null +++ b/live2d/node_modules/lodash/escape.js @@ -0,0 +1,43 @@ +var escapeHtmlChar = require('./_escapeHtmlChar'), + toString = require('./toString'); + +/** Used to match HTML entities and HTML characters. */ +var reUnescapedHtml = /[&<>"']/g, + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + +/** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ +function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; +} + +module.exports = escape; diff --git a/live2d/node_modules/lodash/escapeRegExp.js b/live2d/node_modules/lodash/escapeRegExp.js new file mode 100644 index 0000000..0a58c69 --- /dev/null +++ b/live2d/node_modules/lodash/escapeRegExp.js @@ -0,0 +1,32 @@ +var toString = require('./toString'); + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + +/** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ +function escapeRegExp(string) { + string = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; +} + +module.exports = escapeRegExp; diff --git a/live2d/node_modules/lodash/every.js b/live2d/node_modules/lodash/every.js new file mode 100644 index 0000000..25080da --- /dev/null +++ b/live2d/node_modules/lodash/every.js @@ -0,0 +1,56 @@ +var arrayEvery = require('./_arrayEvery'), + baseEvery = require('./_baseEvery'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'), + isIterateeCall = require('./_isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ +function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, baseIteratee(predicate, 3)); +} + +module.exports = every; diff --git a/live2d/node_modules/lodash/extend.js b/live2d/node_modules/lodash/extend.js new file mode 100644 index 0000000..e00166c --- /dev/null +++ b/live2d/node_modules/lodash/extend.js @@ -0,0 +1 @@ +module.exports = require('./assignIn'); diff --git a/live2d/node_modules/lodash/extendWith.js b/live2d/node_modules/lodash/extendWith.js new file mode 100644 index 0000000..dbdcb3b --- /dev/null +++ b/live2d/node_modules/lodash/extendWith.js @@ -0,0 +1 @@ +module.exports = require('./assignInWith'); diff --git a/live2d/node_modules/lodash/fill.js b/live2d/node_modules/lodash/fill.js new file mode 100644 index 0000000..ae13aa1 --- /dev/null +++ b/live2d/node_modules/lodash/fill.js @@ -0,0 +1,45 @@ +var baseFill = require('./_baseFill'), + isIterateeCall = require('./_isIterateeCall'); + +/** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ +function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); +} + +module.exports = fill; diff --git a/live2d/node_modules/lodash/filter.js b/live2d/node_modules/lodash/filter.js new file mode 100644 index 0000000..89e0c8c --- /dev/null +++ b/live2d/node_modules/lodash/filter.js @@ -0,0 +1,52 @@ +var arrayFilter = require('./_arrayFilter'), + baseFilter = require('./_baseFilter'), + baseIteratee = require('./_baseIteratee'), + isArray = require('./isArray'); + +/** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ +function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, baseIteratee(predicate, 3)); +} + +module.exports = filter; diff --git a/live2d/node_modules/lodash/find.js b/live2d/node_modules/lodash/find.js new file mode 100644 index 0000000..de732cc --- /dev/null +++ b/live2d/node_modules/lodash/find.js @@ -0,0 +1,42 @@ +var createFind = require('./_createFind'), + findIndex = require('./findIndex'); + +/** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ +var find = createFind(findIndex); + +module.exports = find; diff --git a/live2d/node_modules/lodash/findIndex.js b/live2d/node_modules/lodash/findIndex.js new file mode 100644 index 0000000..4689069 --- /dev/null +++ b/live2d/node_modules/lodash/findIndex.js @@ -0,0 +1,55 @@ +var baseFindIndex = require('./_baseFindIndex'), + baseIteratee = require('./_baseIteratee'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ +function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index); +} + +module.exports = findIndex; diff --git a/live2d/node_modules/lodash/findKey.js b/live2d/node_modules/lodash/findKey.js new file mode 100644 index 0000000..cac0248 --- /dev/null +++ b/live2d/node_modules/lodash/findKey.js @@ -0,0 +1,44 @@ +var baseFindKey = require('./_baseFindKey'), + baseForOwn = require('./_baseForOwn'), + baseIteratee = require('./_baseIteratee'); + +/** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ +function findKey(object, predicate) { + return baseFindKey(object, baseIteratee(predicate, 3), baseForOwn); +} + +module.exports = findKey; diff --git a/live2d/node_modules/lodash/findLast.js b/live2d/node_modules/lodash/findLast.js new file mode 100644 index 0000000..70b4271 --- /dev/null +++ b/live2d/node_modules/lodash/findLast.js @@ -0,0 +1,25 @@ +var createFind = require('./_createFind'), + findLastIndex = require('./findLastIndex'); + +/** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ +var findLast = createFind(findLastIndex); + +module.exports = findLast; diff --git a/live2d/node_modules/lodash/findLastIndex.js b/live2d/node_modules/lodash/findLastIndex.js new file mode 100644 index 0000000..7da3431 --- /dev/null +++ b/live2d/node_modules/lodash/findLastIndex.js @@ -0,0 +1,59 @@ +var baseFindIndex = require('./_baseFindIndex'), + baseIteratee = require('./_baseIteratee'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ +function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index, true); +} + +module.exports = findLastIndex; diff --git a/live2d/node_modules/lodash/findLastKey.js b/live2d/node_modules/lodash/findLastKey.js new file mode 100644 index 0000000..66fb9fb --- /dev/null +++ b/live2d/node_modules/lodash/findLastKey.js @@ -0,0 +1,44 @@ +var baseFindKey = require('./_baseFindKey'), + baseForOwnRight = require('./_baseForOwnRight'), + baseIteratee = require('./_baseIteratee'); + +/** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ +function findLastKey(object, predicate) { + return baseFindKey(object, baseIteratee(predicate, 3), baseForOwnRight); +} + +module.exports = findLastKey; diff --git a/live2d/node_modules/lodash/first.js b/live2d/node_modules/lodash/first.js new file mode 100644 index 0000000..53f4ad1 --- /dev/null +++ b/live2d/node_modules/lodash/first.js @@ -0,0 +1 @@ +module.exports = require('./head'); diff --git a/live2d/node_modules/lodash/flake.lock b/live2d/node_modules/lodash/flake.lock new file mode 100644 index 0000000..dd03252 --- /dev/null +++ b/live2d/node_modules/lodash/flake.lock @@ -0,0 +1,40 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1613582597, + "narHash": "sha256-6LvipIvFuhyorHpUqK3HjySC5Y6gshXHFBhU9EJ4DoM=", + "path": "/nix/store/srvplqq673sqd9vyfhyc5w1p88y1gfm4-source", + "rev": "6b1057b452c55bb3b463f0d7055bc4ec3fd1f381", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/live2d/node_modules/lodash/flake.nix b/live2d/node_modules/lodash/flake.nix new file mode 100644 index 0000000..15a451c --- /dev/null +++ b/live2d/node_modules/lodash/flake.nix @@ -0,0 +1,20 @@ +{ + inputs = { + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages."${system}"; + in rec { + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + yarn + nodejs-14_x + nodePackages.typescript-language-server + nodePackages.eslint + ]; + }; + }); +} diff --git a/live2d/node_modules/lodash/flatMap.js b/live2d/node_modules/lodash/flatMap.js new file mode 100644 index 0000000..e668506 --- /dev/null +++ b/live2d/node_modules/lodash/flatMap.js @@ -0,0 +1,29 @@ +var baseFlatten = require('./_baseFlatten'), + map = require('./map'); + +/** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); +} + +module.exports = flatMap; diff --git a/live2d/node_modules/lodash/flatMapDeep.js b/live2d/node_modules/lodash/flatMapDeep.js new file mode 100644 index 0000000..4653d60 --- /dev/null +++ b/live2d/node_modules/lodash/flatMapDeep.js @@ -0,0 +1,31 @@ +var baseFlatten = require('./_baseFlatten'), + map = require('./map'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ +function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); +} + +module.exports = flatMapDeep; diff --git a/live2d/node_modules/lodash/flatMapDepth.js b/live2d/node_modules/lodash/flatMapDepth.js new file mode 100644 index 0000000..6d72005 --- /dev/null +++ b/live2d/node_modules/lodash/flatMapDepth.js @@ -0,0 +1,31 @@ +var baseFlatten = require('./_baseFlatten'), + map = require('./map'), + toInteger = require('./toInteger'); + +/** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ +function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); +} + +module.exports = flatMapDepth; diff --git a/live2d/node_modules/lodash/flatten.js b/live2d/node_modules/lodash/flatten.js new file mode 100644 index 0000000..3f09f7f --- /dev/null +++ b/live2d/node_modules/lodash/flatten.js @@ -0,0 +1,22 @@ +var baseFlatten = require('./_baseFlatten'); + +/** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ +function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; +} + +module.exports = flatten; diff --git a/live2d/node_modules/lodash/flattenDeep.js b/live2d/node_modules/lodash/flattenDeep.js new file mode 100644 index 0000000..8ad585c --- /dev/null +++ b/live2d/node_modules/lodash/flattenDeep.js @@ -0,0 +1,25 @@ +var baseFlatten = require('./_baseFlatten'); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ +function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; +} + +module.exports = flattenDeep; diff --git a/live2d/node_modules/lodash/flattenDepth.js b/live2d/node_modules/lodash/flattenDepth.js new file mode 100644 index 0000000..441fdcc --- /dev/null +++ b/live2d/node_modules/lodash/flattenDepth.js @@ -0,0 +1,33 @@ +var baseFlatten = require('./_baseFlatten'), + toInteger = require('./toInteger'); + +/** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ +function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); +} + +module.exports = flattenDepth; diff --git a/live2d/node_modules/lodash/flip.js b/live2d/node_modules/lodash/flip.js new file mode 100644 index 0000000..c28dd78 --- /dev/null +++ b/live2d/node_modules/lodash/flip.js @@ -0,0 +1,28 @@ +var createWrap = require('./_createWrap'); + +/** Used to compose bitmasks for function metadata. */ +var WRAP_FLIP_FLAG = 512; + +/** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ +function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); +} + +module.exports = flip; diff --git a/live2d/node_modules/lodash/floor.js b/live2d/node_modules/lodash/floor.js new file mode 100644 index 0000000..ab6dfa2 --- /dev/null +++ b/live2d/node_modules/lodash/floor.js @@ -0,0 +1,26 @@ +var createRound = require('./_createRound'); + +/** + * Computes `number` rounded down to `precision`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Math + * @param {number} number The number to round down. + * @param {number} [precision=0] The precision to round down to. + * @returns {number} Returns the rounded down number. + * @example + * + * _.floor(4.006); + * // => 4 + * + * _.floor(0.046, 2); + * // => 0.04 + * + * _.floor(4060, -2); + * // => 4000 + */ +var floor = createRound('floor'); + +module.exports = floor; diff --git a/live2d/node_modules/lodash/flow.js b/live2d/node_modules/lodash/flow.js new file mode 100644 index 0000000..74b6b62 --- /dev/null +++ b/live2d/node_modules/lodash/flow.js @@ -0,0 +1,27 @@ +var createFlow = require('./_createFlow'); + +/** + * Creates a function that returns the result of invoking the given functions + * with the `this` binding of the created function, where each successive + * invocation is supplied the return value of the previous. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Util + * @param {...(Function|Function[])} [funcs] The functions to invoke. + * @returns {Function} Returns the new composite function. + * @see _.flowRight + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flow([_.add, square]); + * addSquare(1, 2); + * // => 9 + */ +var flow = createFlow(); + +module.exports = flow; diff --git a/live2d/node_modules/lodash/flowRight.js b/live2d/node_modules/lodash/flowRight.js new file mode 100644 index 0000000..1146141 --- /dev/null +++ b/live2d/node_modules/lodash/flowRight.js @@ -0,0 +1,26 @@ +var createFlow = require('./_createFlow'); + +/** + * This method is like `_.flow` except that it creates a function that + * invokes the given functions from right to left. + * + * @static + * @since 3.0.0 + * @memberOf _ + * @category Util + * @param {...(Function|Function[])} [funcs] The functions to invoke. + * @returns {Function} Returns the new composite function. + * @see _.flow + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flowRight([square, _.add]); + * addSquare(1, 2); + * // => 9 + */ +var flowRight = createFlow(true); + +module.exports = flowRight; diff --git a/live2d/node_modules/lodash/forEach.js b/live2d/node_modules/lodash/forEach.js new file mode 100644 index 0000000..c64eaa7 --- /dev/null +++ b/live2d/node_modules/lodash/forEach.js @@ -0,0 +1,41 @@ +var arrayEach = require('./_arrayEach'), + baseEach = require('./_baseEach'), + castFunction = require('./_castFunction'), + isArray = require('./isArray'); + +/** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, castFunction(iteratee)); +} + +module.exports = forEach; diff --git a/live2d/node_modules/lodash/forEachRight.js b/live2d/node_modules/lodash/forEachRight.js new file mode 100644 index 0000000..7390eba --- /dev/null +++ b/live2d/node_modules/lodash/forEachRight.js @@ -0,0 +1,31 @@ +var arrayEachRight = require('./_arrayEachRight'), + baseEachRight = require('./_baseEachRight'), + castFunction = require('./_castFunction'), + isArray = require('./isArray'); + +/** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ +function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, castFunction(iteratee)); +} + +module.exports = forEachRight; diff --git a/live2d/node_modules/lodash/forIn.js b/live2d/node_modules/lodash/forIn.js new file mode 100644 index 0000000..583a596 --- /dev/null +++ b/live2d/node_modules/lodash/forIn.js @@ -0,0 +1,39 @@ +var baseFor = require('./_baseFor'), + castFunction = require('./_castFunction'), + keysIn = require('./keysIn'); + +/** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */ +function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, castFunction(iteratee), keysIn); +} + +module.exports = forIn; diff --git a/live2d/node_modules/lodash/forInRight.js b/live2d/node_modules/lodash/forInRight.js new file mode 100644 index 0000000..4aedf58 --- /dev/null +++ b/live2d/node_modules/lodash/forInRight.js @@ -0,0 +1,37 @@ +var baseForRight = require('./_baseForRight'), + castFunction = require('./_castFunction'), + keysIn = require('./keysIn'); + +/** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ +function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, castFunction(iteratee), keysIn); +} + +module.exports = forInRight; diff --git a/live2d/node_modules/lodash/forOwn.js b/live2d/node_modules/lodash/forOwn.js new file mode 100644 index 0000000..94eed84 --- /dev/null +++ b/live2d/node_modules/lodash/forOwn.js @@ -0,0 +1,36 @@ +var baseForOwn = require('./_baseForOwn'), + castFunction = require('./_castFunction'); + +/** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +function forOwn(object, iteratee) { + return object && baseForOwn(object, castFunction(iteratee)); +} + +module.exports = forOwn; diff --git a/live2d/node_modules/lodash/forOwnRight.js b/live2d/node_modules/lodash/forOwnRight.js new file mode 100644 index 0000000..86f338f --- /dev/null +++ b/live2d/node_modules/lodash/forOwnRight.js @@ -0,0 +1,34 @@ +var baseForOwnRight = require('./_baseForOwnRight'), + castFunction = require('./_castFunction'); + +/** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ +function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, castFunction(iteratee)); +} + +module.exports = forOwnRight; diff --git a/live2d/node_modules/lodash/fp.js b/live2d/node_modules/lodash/fp.js new file mode 100644 index 0000000..e372dbb --- /dev/null +++ b/live2d/node_modules/lodash/fp.js @@ -0,0 +1,2 @@ +var _ = require('./lodash.min').runInContext(); +module.exports = require('./fp/_baseConvert')(_, _); diff --git a/live2d/node_modules/lodash/fp/F.js b/live2d/node_modules/lodash/fp/F.js new file mode 100644 index 0000000..a05a63a --- /dev/null +++ b/live2d/node_modules/lodash/fp/F.js @@ -0,0 +1 @@ +module.exports = require('./stubFalse'); diff --git a/live2d/node_modules/lodash/fp/T.js b/live2d/node_modules/lodash/fp/T.js new file mode 100644 index 0000000..e2ba8ea --- /dev/null +++ b/live2d/node_modules/lodash/fp/T.js @@ -0,0 +1 @@ +module.exports = require('./stubTrue'); diff --git a/live2d/node_modules/lodash/fp/__.js b/live2d/node_modules/lodash/fp/__.js new file mode 100644 index 0000000..4af98de --- /dev/null +++ b/live2d/node_modules/lodash/fp/__.js @@ -0,0 +1 @@ +module.exports = require('./placeholder'); diff --git a/live2d/node_modules/lodash/fp/_baseConvert.js b/live2d/node_modules/lodash/fp/_baseConvert.js new file mode 100644 index 0000000..9baf8e1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/_baseConvert.js @@ -0,0 +1,569 @@ +var mapping = require('./_mapping'), + fallbackHolder = require('./placeholder'); + +/** Built-in value reference. */ +var push = Array.prototype.push; + +/** + * Creates a function, with an arity of `n`, that invokes `func` with the + * arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} n The arity of the new function. + * @returns {Function} Returns the new function. + */ +function baseArity(func, n) { + return n == 2 + ? function(a, b) { return func.apply(undefined, arguments); } + : function(a) { return func.apply(undefined, arguments); }; +} + +/** + * Creates a function that invokes `func`, with up to `n` arguments, ignoring + * any additional arguments. + * + * @private + * @param {Function} func The function to cap arguments for. + * @param {number} n The arity cap. + * @returns {Function} Returns the new function. + */ +function baseAry(func, n) { + return n == 2 + ? function(a, b) { return func(a, b); } + : function(a) { return func(a); }; +} + +/** + * Creates a clone of `array`. + * + * @private + * @param {Array} array The array to clone. + * @returns {Array} Returns the cloned array. + */ +function cloneArray(array) { + var length = array ? array.length : 0, + result = Array(length); + + while (length--) { + result[length] = array[length]; + } + return result; +} + +/** + * Creates a function that clones a given object using the assignment `func`. + * + * @private + * @param {Function} func The assignment function. + * @returns {Function} Returns the new cloner function. + */ +function createCloner(func) { + return function(object) { + return func({}, object); + }; +} + +/** + * A specialized version of `_.spread` which flattens the spread array into + * the arguments of the invoked `func`. + * + * @private + * @param {Function} func The function to spread arguments over. + * @param {number} start The start position of the spread. + * @returns {Function} Returns the new function. + */ +function flatSpread(func, start) { + return function() { + var length = arguments.length, + lastIndex = length - 1, + args = Array(length); + + while (length--) { + args[length] = arguments[length]; + } + var array = args[start], + otherArgs = args.slice(0, start); + + if (array) { + push.apply(otherArgs, array); + } + if (start != lastIndex) { + push.apply(otherArgs, args.slice(start + 1)); + } + return func.apply(this, otherArgs); + }; +} + +/** + * Creates a function that wraps `func` and uses `cloner` to clone the first + * argument it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} cloner The function to clone arguments. + * @returns {Function} Returns the new immutable function. + */ +function wrapImmutable(func, cloner) { + return function() { + var length = arguments.length; + if (!length) { + return; + } + var args = Array(length); + while (length--) { + args[length] = arguments[length]; + } + var result = args[0] = cloner.apply(undefined, args); + func.apply(undefined, args); + return result; + }; +} + +/** + * The base implementation of `convert` which accepts a `util` object of methods + * required to perform conversions. + * + * @param {Object} util The util object. + * @param {string} name The name of the function to convert. + * @param {Function} func The function to convert. + * @param {Object} [options] The options object. + * @param {boolean} [options.cap=true] Specify capping iteratee arguments. + * @param {boolean} [options.curry=true] Specify currying. + * @param {boolean} [options.fixed=true] Specify fixed arity. + * @param {boolean} [options.immutable=true] Specify immutable operations. + * @param {boolean} [options.rearg=true] Specify rearranging arguments. + * @returns {Function|Object} Returns the converted function or object. + */ +function baseConvert(util, name, func, options) { + var isLib = typeof name == 'function', + isObj = name === Object(name); + + if (isObj) { + options = func; + func = name; + name = undefined; + } + if (func == null) { + throw new TypeError; + } + options || (options = {}); + + var config = { + 'cap': 'cap' in options ? options.cap : true, + 'curry': 'curry' in options ? options.curry : true, + 'fixed': 'fixed' in options ? options.fixed : true, + 'immutable': 'immutable' in options ? options.immutable : true, + 'rearg': 'rearg' in options ? options.rearg : true + }; + + var defaultHolder = isLib ? func : fallbackHolder, + forceCurry = ('curry' in options) && options.curry, + forceFixed = ('fixed' in options) && options.fixed, + forceRearg = ('rearg' in options) && options.rearg, + pristine = isLib ? func.runInContext() : undefined; + + var helpers = isLib ? func : { + 'ary': util.ary, + 'assign': util.assign, + 'clone': util.clone, + 'curry': util.curry, + 'forEach': util.forEach, + 'isArray': util.isArray, + 'isError': util.isError, + 'isFunction': util.isFunction, + 'isWeakMap': util.isWeakMap, + 'iteratee': util.iteratee, + 'keys': util.keys, + 'rearg': util.rearg, + 'toInteger': util.toInteger, + 'toPath': util.toPath + }; + + var ary = helpers.ary, + assign = helpers.assign, + clone = helpers.clone, + curry = helpers.curry, + each = helpers.forEach, + isArray = helpers.isArray, + isError = helpers.isError, + isFunction = helpers.isFunction, + isWeakMap = helpers.isWeakMap, + keys = helpers.keys, + rearg = helpers.rearg, + toInteger = helpers.toInteger, + toPath = helpers.toPath; + + var aryMethodKeys = keys(mapping.aryMethod); + + var wrappers = { + 'castArray': function(castArray) { + return function() { + var value = arguments[0]; + return isArray(value) + ? castArray(cloneArray(value)) + : castArray.apply(undefined, arguments); + }; + }, + 'iteratee': function(iteratee) { + return function() { + var func = arguments[0], + arity = arguments[1], + result = iteratee(func, arity), + length = result.length; + + if (config.cap && typeof arity == 'number') { + arity = arity > 2 ? (arity - 2) : 1; + return (length && length <= arity) ? result : baseAry(result, arity); + } + return result; + }; + }, + 'mixin': function(mixin) { + return function(source) { + var func = this; + if (!isFunction(func)) { + return mixin(func, Object(source)); + } + var pairs = []; + each(keys(source), function(key) { + if (isFunction(source[key])) { + pairs.push([key, func.prototype[key]]); + } + }); + + mixin(func, Object(source)); + + each(pairs, function(pair) { + var value = pair[1]; + if (isFunction(value)) { + func.prototype[pair[0]] = value; + } else { + delete func.prototype[pair[0]]; + } + }); + return func; + }; + }, + 'nthArg': function(nthArg) { + return function(n) { + var arity = n < 0 ? 1 : (toInteger(n) + 1); + return curry(nthArg(n), arity); + }; + }, + 'rearg': function(rearg) { + return function(func, indexes) { + var arity = indexes ? indexes.length : 0; + return curry(rearg(func, indexes), arity); + }; + }, + 'runInContext': function(runInContext) { + return function(context) { + return baseConvert(util, runInContext(context), options); + }; + } + }; + + /*--------------------------------------------------------------------------*/ + + /** + * Casts `func` to a function with an arity capped iteratee if needed. + * + * @private + * @param {string} name The name of the function to inspect. + * @param {Function} func The function to inspect. + * @returns {Function} Returns the cast function. + */ + function castCap(name, func) { + if (config.cap) { + var indexes = mapping.iterateeRearg[name]; + if (indexes) { + return iterateeRearg(func, indexes); + } + var n = !isLib && mapping.iterateeAry[name]; + if (n) { + return iterateeAry(func, n); + } + } + return func; + } + + /** + * Casts `func` to a curried function if needed. + * + * @private + * @param {string} name The name of the function to inspect. + * @param {Function} func The function to inspect. + * @param {number} n The arity of `func`. + * @returns {Function} Returns the cast function. + */ + function castCurry(name, func, n) { + return (forceCurry || (config.curry && n > 1)) + ? curry(func, n) + : func; + } + + /** + * Casts `func` to a fixed arity function if needed. + * + * @private + * @param {string} name The name of the function to inspect. + * @param {Function} func The function to inspect. + * @param {number} n The arity cap. + * @returns {Function} Returns the cast function. + */ + function castFixed(name, func, n) { + if (config.fixed && (forceFixed || !mapping.skipFixed[name])) { + var data = mapping.methodSpread[name], + start = data && data.start; + + return start === undefined ? ary(func, n) : flatSpread(func, start); + } + return func; + } + + /** + * Casts `func` to an rearged function if needed. + * + * @private + * @param {string} name The name of the function to inspect. + * @param {Function} func The function to inspect. + * @param {number} n The arity of `func`. + * @returns {Function} Returns the cast function. + */ + function castRearg(name, func, n) { + return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name])) + ? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n]) + : func; + } + + /** + * Creates a clone of `object` by `path`. + * + * @private + * @param {Object} object The object to clone. + * @param {Array|string} path The path to clone by. + * @returns {Object} Returns the cloned object. + */ + function cloneByPath(object, path) { + path = toPath(path); + + var index = -1, + length = path.length, + lastIndex = length - 1, + result = clone(Object(object)), + nested = result; + + while (nested != null && ++index < length) { + var key = path[index], + value = nested[key]; + + if (value != null && + !(isFunction(value) || isError(value) || isWeakMap(value))) { + nested[key] = clone(index == lastIndex ? value : Object(value)); + } + nested = nested[key]; + } + return result; + } + + /** + * Converts `lodash` to an immutable auto-curried iteratee-first data-last + * version with conversion `options` applied. + * + * @param {Object} [options] The options object. See `baseConvert` for more details. + * @returns {Function} Returns the converted `lodash`. + */ + function convertLib(options) { + return _.runInContext.convert(options)(undefined); + } + + /** + * Create a converter function for `func` of `name`. + * + * @param {string} name The name of the function to convert. + * @param {Function} func The function to convert. + * @returns {Function} Returns the new converter function. + */ + function createConverter(name, func) { + var realName = mapping.aliasToReal[name] || name, + methodName = mapping.remap[realName] || realName, + oldOptions = options; + + return function(options) { + var newUtil = isLib ? pristine : helpers, + newFunc = isLib ? pristine[methodName] : func, + newOptions = assign(assign({}, oldOptions), options); + + return baseConvert(newUtil, realName, newFunc, newOptions); + }; + } + + /** + * Creates a function that wraps `func` to invoke its iteratee, with up to `n` + * arguments, ignoring any additional arguments. + * + * @private + * @param {Function} func The function to cap iteratee arguments for. + * @param {number} n The arity cap. + * @returns {Function} Returns the new function. + */ + function iterateeAry(func, n) { + return overArg(func, function(func) { + return typeof func == 'function' ? baseAry(func, n) : func; + }); + } + + /** + * Creates a function that wraps `func` to invoke its iteratee with arguments + * arranged according to the specified `indexes` where the argument value at + * the first index is provided as the first argument, the argument value at + * the second index is provided as the second argument, and so on. + * + * @private + * @param {Function} func The function to rearrange iteratee arguments for. + * @param {number[]} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + */ + function iterateeRearg(func, indexes) { + return overArg(func, function(func) { + var n = indexes.length; + return baseArity(rearg(baseAry(func, n), indexes), n); + }); + } + + /** + * Creates a function that invokes `func` with its first 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() { + var length = arguments.length; + if (!length) { + return func(); + } + var args = Array(length); + while (length--) { + args[length] = arguments[length]; + } + var index = config.rearg ? 0 : (length - 1); + args[index] = transform(args[index]); + return func.apply(undefined, args); + }; + } + + /** + * Creates a function that wraps `func` and applys the conversions + * rules by `name`. + * + * @private + * @param {string} name The name of the function to wrap. + * @param {Function} func The function to wrap. + * @returns {Function} Returns the converted function. + */ + function wrap(name, func, placeholder) { + var result, + realName = mapping.aliasToReal[name] || name, + wrapped = func, + wrapper = wrappers[realName]; + + if (wrapper) { + wrapped = wrapper(func); + } + else if (config.immutable) { + if (mapping.mutate.array[realName]) { + wrapped = wrapImmutable(func, cloneArray); + } + else if (mapping.mutate.object[realName]) { + wrapped = wrapImmutable(func, createCloner(func)); + } + else if (mapping.mutate.set[realName]) { + wrapped = wrapImmutable(func, cloneByPath); + } + } + each(aryMethodKeys, function(aryKey) { + each(mapping.aryMethod[aryKey], function(otherName) { + if (realName == otherName) { + var data = mapping.methodSpread[realName], + afterRearg = data && data.afterRearg; + + result = afterRearg + ? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey) + : castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey); + + result = castCap(realName, result); + result = castCurry(realName, result, aryKey); + return false; + } + }); + return !result; + }); + + result || (result = wrapped); + if (result == func) { + result = forceCurry ? curry(result, 1) : function() { + return func.apply(this, arguments); + }; + } + result.convert = createConverter(realName, func); + result.placeholder = func.placeholder = placeholder; + + return result; + } + + /*--------------------------------------------------------------------------*/ + + if (!isObj) { + return wrap(name, func, defaultHolder); + } + var _ = func; + + // Convert methods by ary cap. + var pairs = []; + each(aryMethodKeys, function(aryKey) { + each(mapping.aryMethod[aryKey], function(key) { + var func = _[mapping.remap[key] || key]; + if (func) { + pairs.push([key, wrap(key, func, _)]); + } + }); + }); + + // Convert remaining methods. + each(keys(_), function(key) { + var func = _[key]; + if (typeof func == 'function') { + var length = pairs.length; + while (length--) { + if (pairs[length][0] == key) { + return; + } + } + func.convert = createConverter(key, func); + pairs.push([key, func]); + } + }); + + // Assign to `_` leaving `_.prototype` unchanged to allow chaining. + each(pairs, function(pair) { + _[pair[0]] = pair[1]; + }); + + _.convert = convertLib; + _.placeholder = _; + + // Assign aliases. + each(keys(_), function(key) { + each(mapping.realToAlias[key] || [], function(alias) { + _[alias] = _[key]; + }); + }); + + return _; +} + +module.exports = baseConvert; diff --git a/live2d/node_modules/lodash/fp/_convertBrowser.js b/live2d/node_modules/lodash/fp/_convertBrowser.js new file mode 100644 index 0000000..bde030d --- /dev/null +++ b/live2d/node_modules/lodash/fp/_convertBrowser.js @@ -0,0 +1,18 @@ +var baseConvert = require('./_baseConvert'); + +/** + * Converts `lodash` to an immutable auto-curried iteratee-first data-last + * version with conversion `options` applied. + * + * @param {Function} lodash The lodash function to convert. + * @param {Object} [options] The options object. See `baseConvert` for more details. + * @returns {Function} Returns the converted `lodash`. + */ +function browserConvert(lodash, options) { + return baseConvert(lodash, lodash, options); +} + +if (typeof _ == 'function' && typeof _.runInContext == 'function') { + _ = browserConvert(_.runInContext()); +} +module.exports = browserConvert; diff --git a/live2d/node_modules/lodash/fp/_falseOptions.js b/live2d/node_modules/lodash/fp/_falseOptions.js new file mode 100644 index 0000000..773235e --- /dev/null +++ b/live2d/node_modules/lodash/fp/_falseOptions.js @@ -0,0 +1,7 @@ +module.exports = { + 'cap': false, + 'curry': false, + 'fixed': false, + 'immutable': false, + 'rearg': false +}; diff --git a/live2d/node_modules/lodash/fp/_mapping.js b/live2d/node_modules/lodash/fp/_mapping.js new file mode 100644 index 0000000..a642ec0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/_mapping.js @@ -0,0 +1,358 @@ +/** Used to map aliases to their real names. */ +exports.aliasToReal = { + + // Lodash aliases. + 'each': 'forEach', + 'eachRight': 'forEachRight', + 'entries': 'toPairs', + 'entriesIn': 'toPairsIn', + 'extend': 'assignIn', + 'extendAll': 'assignInAll', + 'extendAllWith': 'assignInAllWith', + 'extendWith': 'assignInWith', + 'first': 'head', + + // Methods that are curried variants of others. + 'conforms': 'conformsTo', + 'matches': 'isMatch', + 'property': 'get', + + // Ramda aliases. + '__': 'placeholder', + 'F': 'stubFalse', + 'T': 'stubTrue', + 'all': 'every', + 'allPass': 'overEvery', + 'always': 'constant', + 'any': 'some', + 'anyPass': 'overSome', + 'apply': 'spread', + 'assoc': 'set', + 'assocPath': 'set', + 'complement': 'negate', + 'compose': 'flowRight', + 'contains': 'includes', + 'dissoc': 'unset', + 'dissocPath': 'unset', + 'dropLast': 'dropRight', + 'dropLastWhile': 'dropRightWhile', + 'equals': 'isEqual', + 'identical': 'eq', + 'indexBy': 'keyBy', + 'init': 'initial', + 'invertObj': 'invert', + 'juxt': 'over', + 'omitAll': 'omit', + 'nAry': 'ary', + 'path': 'get', + 'pathEq': 'matchesProperty', + 'pathOr': 'getOr', + 'paths': 'at', + 'pickAll': 'pick', + 'pipe': 'flow', + 'pluck': 'map', + 'prop': 'get', + 'propEq': 'matchesProperty', + 'propOr': 'getOr', + 'props': 'at', + 'symmetricDifference': 'xor', + 'symmetricDifferenceBy': 'xorBy', + 'symmetricDifferenceWith': 'xorWith', + 'takeLast': 'takeRight', + 'takeLastWhile': 'takeRightWhile', + 'unapply': 'rest', + 'unnest': 'flatten', + 'useWith': 'overArgs', + 'where': 'conformsTo', + 'whereEq': 'isMatch', + 'zipObj': 'zipObject' +}; + +/** Used to map ary to method names. */ +exports.aryMethod = { + '1': [ + 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create', + 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow', + 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll', + 'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse', + 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart', + 'uniqueId', 'words', 'zipAll' + ], + '2': [ + 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith', + 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith', + 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN', + 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference', + 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', + 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex', + 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach', + 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get', + 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection', + 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy', + 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty', + 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit', + 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial', + 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll', + 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove', + 'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex', + 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy', + 'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', + 'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', + 'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', + 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', + 'zipObjectDeep' + ], + '3': [ + 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', + 'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr', + 'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith', + 'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', + 'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd', + 'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight', + 'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy', + 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy', + 'xorWith', 'zipWith' + ], + '4': [ + 'fill', 'setWith', 'updateWith' + ] +}; + +/** Used to map ary to rearg configs. */ +exports.aryRearg = { + '2': [1, 0], + '3': [2, 0, 1], + '4': [3, 2, 0, 1] +}; + +/** Used to map method names to their iteratee ary. */ +exports.iterateeAry = { + 'dropRightWhile': 1, + 'dropWhile': 1, + 'every': 1, + 'filter': 1, + 'find': 1, + 'findFrom': 1, + 'findIndex': 1, + 'findIndexFrom': 1, + 'findKey': 1, + 'findLast': 1, + 'findLastFrom': 1, + 'findLastIndex': 1, + 'findLastIndexFrom': 1, + 'findLastKey': 1, + 'flatMap': 1, + 'flatMapDeep': 1, + 'flatMapDepth': 1, + 'forEach': 1, + 'forEachRight': 1, + 'forIn': 1, + 'forInRight': 1, + 'forOwn': 1, + 'forOwnRight': 1, + 'map': 1, + 'mapKeys': 1, + 'mapValues': 1, + 'partition': 1, + 'reduce': 2, + 'reduceRight': 2, + 'reject': 1, + 'remove': 1, + 'some': 1, + 'takeRightWhile': 1, + 'takeWhile': 1, + 'times': 1, + 'transform': 2 +}; + +/** Used to map method names to iteratee rearg configs. */ +exports.iterateeRearg = { + 'mapKeys': [1], + 'reduceRight': [1, 0] +}; + +/** Used to map method names to rearg configs. */ +exports.methodRearg = { + 'assignInAllWith': [1, 0], + 'assignInWith': [1, 2, 0], + 'assignAllWith': [1, 0], + 'assignWith': [1, 2, 0], + 'differenceBy': [1, 2, 0], + 'differenceWith': [1, 2, 0], + 'getOr': [2, 1, 0], + 'intersectionBy': [1, 2, 0], + 'intersectionWith': [1, 2, 0], + 'isEqualWith': [1, 2, 0], + 'isMatchWith': [2, 1, 0], + 'mergeAllWith': [1, 0], + 'mergeWith': [1, 2, 0], + 'padChars': [2, 1, 0], + 'padCharsEnd': [2, 1, 0], + 'padCharsStart': [2, 1, 0], + 'pullAllBy': [2, 1, 0], + 'pullAllWith': [2, 1, 0], + 'rangeStep': [1, 2, 0], + 'rangeStepRight': [1, 2, 0], + 'setWith': [3, 1, 2, 0], + 'sortedIndexBy': [2, 1, 0], + 'sortedLastIndexBy': [2, 1, 0], + 'unionBy': [1, 2, 0], + 'unionWith': [1, 2, 0], + 'updateWith': [3, 1, 2, 0], + 'xorBy': [1, 2, 0], + 'xorWith': [1, 2, 0], + 'zipWith': [1, 2, 0] +}; + +/** Used to map method names to spread configs. */ +exports.methodSpread = { + 'assignAll': { 'start': 0 }, + 'assignAllWith': { 'start': 0 }, + 'assignInAll': { 'start': 0 }, + 'assignInAllWith': { 'start': 0 }, + 'defaultsAll': { 'start': 0 }, + 'defaultsDeepAll': { 'start': 0 }, + 'invokeArgs': { 'start': 2 }, + 'invokeArgsMap': { 'start': 2 }, + 'mergeAll': { 'start': 0 }, + 'mergeAllWith': { 'start': 0 }, + 'partial': { 'start': 1 }, + 'partialRight': { 'start': 1 }, + 'without': { 'start': 1 }, + 'zipAll': { 'start': 0 } +}; + +/** Used to identify methods which mutate arrays or objects. */ +exports.mutate = { + 'array': { + 'fill': true, + 'pull': true, + 'pullAll': true, + 'pullAllBy': true, + 'pullAllWith': true, + 'pullAt': true, + 'remove': true, + 'reverse': true + }, + 'object': { + 'assign': true, + 'assignAll': true, + 'assignAllWith': true, + 'assignIn': true, + 'assignInAll': true, + 'assignInAllWith': true, + 'assignInWith': true, + 'assignWith': true, + 'defaults': true, + 'defaultsAll': true, + 'defaultsDeep': true, + 'defaultsDeepAll': true, + 'merge': true, + 'mergeAll': true, + 'mergeAllWith': true, + 'mergeWith': true, + }, + 'set': { + 'set': true, + 'setWith': true, + 'unset': true, + 'update': true, + 'updateWith': true + } +}; + +/** Used to map real names to their aliases. */ +exports.realToAlias = (function() { + var hasOwnProperty = Object.prototype.hasOwnProperty, + object = exports.aliasToReal, + result = {}; + + for (var key in object) { + var value = object[key]; + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + } + return result; +}()); + +/** Used to map method names to other names. */ +exports.remap = { + 'assignAll': 'assign', + 'assignAllWith': 'assignWith', + 'assignInAll': 'assignIn', + 'assignInAllWith': 'assignInWith', + 'curryN': 'curry', + 'curryRightN': 'curryRight', + 'defaultsAll': 'defaults', + 'defaultsDeepAll': 'defaultsDeep', + 'findFrom': 'find', + 'findIndexFrom': 'findIndex', + 'findLastFrom': 'findLast', + 'findLastIndexFrom': 'findLastIndex', + 'getOr': 'get', + 'includesFrom': 'includes', + 'indexOfFrom': 'indexOf', + 'invokeArgs': 'invoke', + 'invokeArgsMap': 'invokeMap', + 'lastIndexOfFrom': 'lastIndexOf', + 'mergeAll': 'merge', + 'mergeAllWith': 'mergeWith', + 'padChars': 'pad', + 'padCharsEnd': 'padEnd', + 'padCharsStart': 'padStart', + 'propertyOf': 'get', + 'rangeStep': 'range', + 'rangeStepRight': 'rangeRight', + 'restFrom': 'rest', + 'spreadFrom': 'spread', + 'trimChars': 'trim', + 'trimCharsEnd': 'trimEnd', + 'trimCharsStart': 'trimStart', + 'zipAll': 'zip' +}; + +/** Used to track methods that skip fixing their arity. */ +exports.skipFixed = { + 'castArray': true, + 'flow': true, + 'flowRight': true, + 'iteratee': true, + 'mixin': true, + 'rearg': true, + 'runInContext': true +}; + +/** Used to track methods that skip rearranging arguments. */ +exports.skipRearg = { + 'add': true, + 'assign': true, + 'assignIn': true, + 'bind': true, + 'bindKey': true, + 'concat': true, + 'difference': true, + 'divide': true, + 'eq': true, + 'gt': true, + 'gte': true, + 'isEqual': true, + 'lt': true, + 'lte': true, + 'matchesProperty': true, + 'merge': true, + 'multiply': true, + 'overArgs': true, + 'partial': true, + 'partialRight': true, + 'propertyOf': true, + 'random': true, + 'range': true, + 'rangeRight': true, + 'subtract': true, + 'zip': true, + 'zipObject': true, + 'zipObjectDeep': true +}; diff --git a/live2d/node_modules/lodash/fp/_util.js b/live2d/node_modules/lodash/fp/_util.js new file mode 100644 index 0000000..1dbf36f --- /dev/null +++ b/live2d/node_modules/lodash/fp/_util.js @@ -0,0 +1,16 @@ +module.exports = { + 'ary': require('../ary'), + 'assign': require('../_baseAssign'), + 'clone': require('../clone'), + 'curry': require('../curry'), + 'forEach': require('../_arrayEach'), + 'isArray': require('../isArray'), + 'isError': require('../isError'), + 'isFunction': require('../isFunction'), + 'isWeakMap': require('../isWeakMap'), + 'iteratee': require('../iteratee'), + 'keys': require('../_baseKeys'), + 'rearg': require('../rearg'), + 'toInteger': require('../toInteger'), + 'toPath': require('../toPath') +}; diff --git a/live2d/node_modules/lodash/fp/add.js b/live2d/node_modules/lodash/fp/add.js new file mode 100644 index 0000000..816eeec --- /dev/null +++ b/live2d/node_modules/lodash/fp/add.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('add', require('../add')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/after.js b/live2d/node_modules/lodash/fp/after.js new file mode 100644 index 0000000..21a0167 --- /dev/null +++ b/live2d/node_modules/lodash/fp/after.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('after', require('../after')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/all.js b/live2d/node_modules/lodash/fp/all.js new file mode 100644 index 0000000..d0839f7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/all.js @@ -0,0 +1 @@ +module.exports = require('./every'); diff --git a/live2d/node_modules/lodash/fp/allPass.js b/live2d/node_modules/lodash/fp/allPass.js new file mode 100644 index 0000000..79b73ef --- /dev/null +++ b/live2d/node_modules/lodash/fp/allPass.js @@ -0,0 +1 @@ +module.exports = require('./overEvery'); diff --git a/live2d/node_modules/lodash/fp/always.js b/live2d/node_modules/lodash/fp/always.js new file mode 100644 index 0000000..9887703 --- /dev/null +++ b/live2d/node_modules/lodash/fp/always.js @@ -0,0 +1 @@ +module.exports = require('./constant'); diff --git a/live2d/node_modules/lodash/fp/any.js b/live2d/node_modules/lodash/fp/any.js new file mode 100644 index 0000000..900ac25 --- /dev/null +++ b/live2d/node_modules/lodash/fp/any.js @@ -0,0 +1 @@ +module.exports = require('./some'); diff --git a/live2d/node_modules/lodash/fp/anyPass.js b/live2d/node_modules/lodash/fp/anyPass.js new file mode 100644 index 0000000..2774ab3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/anyPass.js @@ -0,0 +1 @@ +module.exports = require('./overSome'); diff --git a/live2d/node_modules/lodash/fp/apply.js b/live2d/node_modules/lodash/fp/apply.js new file mode 100644 index 0000000..2b75712 --- /dev/null +++ b/live2d/node_modules/lodash/fp/apply.js @@ -0,0 +1 @@ +module.exports = require('./spread'); diff --git a/live2d/node_modules/lodash/fp/array.js b/live2d/node_modules/lodash/fp/array.js new file mode 100644 index 0000000..fe939c2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/array.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../array')); diff --git a/live2d/node_modules/lodash/fp/ary.js b/live2d/node_modules/lodash/fp/ary.js new file mode 100644 index 0000000..8edf187 --- /dev/null +++ b/live2d/node_modules/lodash/fp/ary.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('ary', require('../ary')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assign.js b/live2d/node_modules/lodash/fp/assign.js new file mode 100644 index 0000000..23f47af --- /dev/null +++ b/live2d/node_modules/lodash/fp/assign.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assign', require('../assign')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignAll.js b/live2d/node_modules/lodash/fp/assignAll.js new file mode 100644 index 0000000..b1d36c7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignAll', require('../assign')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignAllWith.js b/live2d/node_modules/lodash/fp/assignAllWith.js new file mode 100644 index 0000000..21e836e --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignAllWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignAllWith', require('../assignWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignIn.js b/live2d/node_modules/lodash/fp/assignIn.js new file mode 100644 index 0000000..6e7c65f --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignIn', require('../assignIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignInAll.js b/live2d/node_modules/lodash/fp/assignInAll.js new file mode 100644 index 0000000..7ba75db --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignInAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignInAll', require('../assignIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignInAllWith.js b/live2d/node_modules/lodash/fp/assignInAllWith.js new file mode 100644 index 0000000..e766903 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignInAllWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignInAllWith', require('../assignInWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignInWith.js b/live2d/node_modules/lodash/fp/assignInWith.js new file mode 100644 index 0000000..acb5923 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignInWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignInWith', require('../assignInWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assignWith.js b/live2d/node_modules/lodash/fp/assignWith.js new file mode 100644 index 0000000..eb92521 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assignWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('assignWith', require('../assignWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/assoc.js b/live2d/node_modules/lodash/fp/assoc.js new file mode 100644 index 0000000..7648820 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assoc.js @@ -0,0 +1 @@ +module.exports = require('./set'); diff --git a/live2d/node_modules/lodash/fp/assocPath.js b/live2d/node_modules/lodash/fp/assocPath.js new file mode 100644 index 0000000..7648820 --- /dev/null +++ b/live2d/node_modules/lodash/fp/assocPath.js @@ -0,0 +1 @@ +module.exports = require('./set'); diff --git a/live2d/node_modules/lodash/fp/at.js b/live2d/node_modules/lodash/fp/at.js new file mode 100644 index 0000000..cc39d25 --- /dev/null +++ b/live2d/node_modules/lodash/fp/at.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('at', require('../at')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/attempt.js b/live2d/node_modules/lodash/fp/attempt.js new file mode 100644 index 0000000..26ca42e --- /dev/null +++ b/live2d/node_modules/lodash/fp/attempt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('attempt', require('../attempt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/before.js b/live2d/node_modules/lodash/fp/before.js new file mode 100644 index 0000000..7a2de65 --- /dev/null +++ b/live2d/node_modules/lodash/fp/before.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('before', require('../before')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/bind.js b/live2d/node_modules/lodash/fp/bind.js new file mode 100644 index 0000000..5cbe4f3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/bind.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('bind', require('../bind')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/bindAll.js b/live2d/node_modules/lodash/fp/bindAll.js new file mode 100644 index 0000000..6b4a4a0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/bindAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('bindAll', require('../bindAll')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/bindKey.js b/live2d/node_modules/lodash/fp/bindKey.js new file mode 100644 index 0000000..6a46c6b --- /dev/null +++ b/live2d/node_modules/lodash/fp/bindKey.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('bindKey', require('../bindKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/camelCase.js b/live2d/node_modules/lodash/fp/camelCase.js new file mode 100644 index 0000000..87b77b4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/camelCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('camelCase', require('../camelCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/capitalize.js b/live2d/node_modules/lodash/fp/capitalize.js new file mode 100644 index 0000000..cac74e1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/capitalize.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('capitalize', require('../capitalize'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/castArray.js b/live2d/node_modules/lodash/fp/castArray.js new file mode 100644 index 0000000..8681c09 --- /dev/null +++ b/live2d/node_modules/lodash/fp/castArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('castArray', require('../castArray')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/ceil.js b/live2d/node_modules/lodash/fp/ceil.js new file mode 100644 index 0000000..f416b72 --- /dev/null +++ b/live2d/node_modules/lodash/fp/ceil.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('ceil', require('../ceil')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/chain.js b/live2d/node_modules/lodash/fp/chain.js new file mode 100644 index 0000000..604fe39 --- /dev/null +++ b/live2d/node_modules/lodash/fp/chain.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('chain', require('../chain'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/chunk.js b/live2d/node_modules/lodash/fp/chunk.js new file mode 100644 index 0000000..871ab08 --- /dev/null +++ b/live2d/node_modules/lodash/fp/chunk.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('chunk', require('../chunk')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/clamp.js b/live2d/node_modules/lodash/fp/clamp.js new file mode 100644 index 0000000..3b06c01 --- /dev/null +++ b/live2d/node_modules/lodash/fp/clamp.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('clamp', require('../clamp')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/clone.js b/live2d/node_modules/lodash/fp/clone.js new file mode 100644 index 0000000..cadb59c --- /dev/null +++ b/live2d/node_modules/lodash/fp/clone.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('clone', require('../clone'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/cloneDeep.js b/live2d/node_modules/lodash/fp/cloneDeep.js new file mode 100644 index 0000000..a6107aa --- /dev/null +++ b/live2d/node_modules/lodash/fp/cloneDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('cloneDeep', require('../cloneDeep'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/cloneDeepWith.js b/live2d/node_modules/lodash/fp/cloneDeepWith.js new file mode 100644 index 0000000..6f01e44 --- /dev/null +++ b/live2d/node_modules/lodash/fp/cloneDeepWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('cloneDeepWith', require('../cloneDeepWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/cloneWith.js b/live2d/node_modules/lodash/fp/cloneWith.js new file mode 100644 index 0000000..aa88578 --- /dev/null +++ b/live2d/node_modules/lodash/fp/cloneWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('cloneWith', require('../cloneWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/collection.js b/live2d/node_modules/lodash/fp/collection.js new file mode 100644 index 0000000..fc8b328 --- /dev/null +++ b/live2d/node_modules/lodash/fp/collection.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../collection')); diff --git a/live2d/node_modules/lodash/fp/commit.js b/live2d/node_modules/lodash/fp/commit.js new file mode 100644 index 0000000..130a894 --- /dev/null +++ b/live2d/node_modules/lodash/fp/commit.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('commit', require('../commit'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/compact.js b/live2d/node_modules/lodash/fp/compact.js new file mode 100644 index 0000000..ce8f7a1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/compact.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('compact', require('../compact'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/complement.js b/live2d/node_modules/lodash/fp/complement.js new file mode 100644 index 0000000..93eb462 --- /dev/null +++ b/live2d/node_modules/lodash/fp/complement.js @@ -0,0 +1 @@ +module.exports = require('./negate'); diff --git a/live2d/node_modules/lodash/fp/compose.js b/live2d/node_modules/lodash/fp/compose.js new file mode 100644 index 0000000..1954e94 --- /dev/null +++ b/live2d/node_modules/lodash/fp/compose.js @@ -0,0 +1 @@ +module.exports = require('./flowRight'); diff --git a/live2d/node_modules/lodash/fp/concat.js b/live2d/node_modules/lodash/fp/concat.js new file mode 100644 index 0000000..e59346a --- /dev/null +++ b/live2d/node_modules/lodash/fp/concat.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('concat', require('../concat')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/cond.js b/live2d/node_modules/lodash/fp/cond.js new file mode 100644 index 0000000..6a0120e --- /dev/null +++ b/live2d/node_modules/lodash/fp/cond.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('cond', require('../cond'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/conforms.js b/live2d/node_modules/lodash/fp/conforms.js new file mode 100644 index 0000000..3247f64 --- /dev/null +++ b/live2d/node_modules/lodash/fp/conforms.js @@ -0,0 +1 @@ +module.exports = require('./conformsTo'); diff --git a/live2d/node_modules/lodash/fp/conformsTo.js b/live2d/node_modules/lodash/fp/conformsTo.js new file mode 100644 index 0000000..aa7f41e --- /dev/null +++ b/live2d/node_modules/lodash/fp/conformsTo.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('conformsTo', require('../conformsTo')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/constant.js b/live2d/node_modules/lodash/fp/constant.js new file mode 100644 index 0000000..9e406fc --- /dev/null +++ b/live2d/node_modules/lodash/fp/constant.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('constant', require('../constant'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/contains.js b/live2d/node_modules/lodash/fp/contains.js new file mode 100644 index 0000000..594722a --- /dev/null +++ b/live2d/node_modules/lodash/fp/contains.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/live2d/node_modules/lodash/fp/convert.js b/live2d/node_modules/lodash/fp/convert.js new file mode 100644 index 0000000..4795dc4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/convert.js @@ -0,0 +1,18 @@ +var baseConvert = require('./_baseConvert'), + util = require('./_util'); + +/** + * Converts `func` of `name` to an immutable auto-curried iteratee-first data-last + * version with conversion `options` applied. If `name` is an object its methods + * will be converted. + * + * @param {string} name The name of the function to wrap. + * @param {Function} [func] The function to wrap. + * @param {Object} [options] The options object. See `baseConvert` for more details. + * @returns {Function|Object} Returns the converted function or object. + */ +function convert(name, func, options) { + return baseConvert(util, name, func, options); +} + +module.exports = convert; diff --git a/live2d/node_modules/lodash/fp/countBy.js b/live2d/node_modules/lodash/fp/countBy.js new file mode 100644 index 0000000..dfa4643 --- /dev/null +++ b/live2d/node_modules/lodash/fp/countBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('countBy', require('../countBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/create.js b/live2d/node_modules/lodash/fp/create.js new file mode 100644 index 0000000..752025f --- /dev/null +++ b/live2d/node_modules/lodash/fp/create.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('create', require('../create')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/curry.js b/live2d/node_modules/lodash/fp/curry.js new file mode 100644 index 0000000..b0b4168 --- /dev/null +++ b/live2d/node_modules/lodash/fp/curry.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('curry', require('../curry')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/curryN.js b/live2d/node_modules/lodash/fp/curryN.js new file mode 100644 index 0000000..2ae7d00 --- /dev/null +++ b/live2d/node_modules/lodash/fp/curryN.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('curryN', require('../curry')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/curryRight.js b/live2d/node_modules/lodash/fp/curryRight.js new file mode 100644 index 0000000..cb619eb --- /dev/null +++ b/live2d/node_modules/lodash/fp/curryRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('curryRight', require('../curryRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/curryRightN.js b/live2d/node_modules/lodash/fp/curryRightN.js new file mode 100644 index 0000000..2495afc --- /dev/null +++ b/live2d/node_modules/lodash/fp/curryRightN.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('curryRightN', require('../curryRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/date.js b/live2d/node_modules/lodash/fp/date.js new file mode 100644 index 0000000..82cb952 --- /dev/null +++ b/live2d/node_modules/lodash/fp/date.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../date')); diff --git a/live2d/node_modules/lodash/fp/debounce.js b/live2d/node_modules/lodash/fp/debounce.js new file mode 100644 index 0000000..2612229 --- /dev/null +++ b/live2d/node_modules/lodash/fp/debounce.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('debounce', require('../debounce')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/deburr.js b/live2d/node_modules/lodash/fp/deburr.js new file mode 100644 index 0000000..96463ab --- /dev/null +++ b/live2d/node_modules/lodash/fp/deburr.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('deburr', require('../deburr'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defaultTo.js b/live2d/node_modules/lodash/fp/defaultTo.js new file mode 100644 index 0000000..d6b52a4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/defaultTo.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defaultTo', require('../defaultTo')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defaults.js b/live2d/node_modules/lodash/fp/defaults.js new file mode 100644 index 0000000..e1a8e6e --- /dev/null +++ b/live2d/node_modules/lodash/fp/defaults.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defaults', require('../defaults')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defaultsAll.js b/live2d/node_modules/lodash/fp/defaultsAll.js new file mode 100644 index 0000000..238fcc3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/defaultsAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defaultsAll', require('../defaults')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defaultsDeep.js b/live2d/node_modules/lodash/fp/defaultsDeep.js new file mode 100644 index 0000000..1f172ff --- /dev/null +++ b/live2d/node_modules/lodash/fp/defaultsDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defaultsDeep', require('../defaultsDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defaultsDeepAll.js b/live2d/node_modules/lodash/fp/defaultsDeepAll.js new file mode 100644 index 0000000..6835f2f --- /dev/null +++ b/live2d/node_modules/lodash/fp/defaultsDeepAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defaultsDeepAll', require('../defaultsDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/defer.js b/live2d/node_modules/lodash/fp/defer.js new file mode 100644 index 0000000..ec7990f --- /dev/null +++ b/live2d/node_modules/lodash/fp/defer.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('defer', require('../defer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/delay.js b/live2d/node_modules/lodash/fp/delay.js new file mode 100644 index 0000000..556dbd5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/delay.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('delay', require('../delay')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/difference.js b/live2d/node_modules/lodash/fp/difference.js new file mode 100644 index 0000000..2d03765 --- /dev/null +++ b/live2d/node_modules/lodash/fp/difference.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('difference', require('../difference')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/differenceBy.js b/live2d/node_modules/lodash/fp/differenceBy.js new file mode 100644 index 0000000..2f91491 --- /dev/null +++ b/live2d/node_modules/lodash/fp/differenceBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('differenceBy', require('../differenceBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/differenceWith.js b/live2d/node_modules/lodash/fp/differenceWith.js new file mode 100644 index 0000000..bcf5ad2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/differenceWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('differenceWith', require('../differenceWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/dissoc.js b/live2d/node_modules/lodash/fp/dissoc.js new file mode 100644 index 0000000..7ec7be1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dissoc.js @@ -0,0 +1 @@ +module.exports = require('./unset'); diff --git a/live2d/node_modules/lodash/fp/dissocPath.js b/live2d/node_modules/lodash/fp/dissocPath.js new file mode 100644 index 0000000..7ec7be1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dissocPath.js @@ -0,0 +1 @@ +module.exports = require('./unset'); diff --git a/live2d/node_modules/lodash/fp/divide.js b/live2d/node_modules/lodash/fp/divide.js new file mode 100644 index 0000000..82048c5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/divide.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('divide', require('../divide')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/drop.js b/live2d/node_modules/lodash/fp/drop.js new file mode 100644 index 0000000..2fa9b4f --- /dev/null +++ b/live2d/node_modules/lodash/fp/drop.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('drop', require('../drop')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/dropLast.js b/live2d/node_modules/lodash/fp/dropLast.js new file mode 100644 index 0000000..174e525 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dropLast.js @@ -0,0 +1 @@ +module.exports = require('./dropRight'); diff --git a/live2d/node_modules/lodash/fp/dropLastWhile.js b/live2d/node_modules/lodash/fp/dropLastWhile.js new file mode 100644 index 0000000..be2a9d2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dropLastWhile.js @@ -0,0 +1 @@ +module.exports = require('./dropRightWhile'); diff --git a/live2d/node_modules/lodash/fp/dropRight.js b/live2d/node_modules/lodash/fp/dropRight.js new file mode 100644 index 0000000..e98881f --- /dev/null +++ b/live2d/node_modules/lodash/fp/dropRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('dropRight', require('../dropRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/dropRightWhile.js b/live2d/node_modules/lodash/fp/dropRightWhile.js new file mode 100644 index 0000000..cacaa70 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dropRightWhile.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('dropRightWhile', require('../dropRightWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/dropWhile.js b/live2d/node_modules/lodash/fp/dropWhile.js new file mode 100644 index 0000000..285f864 --- /dev/null +++ b/live2d/node_modules/lodash/fp/dropWhile.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('dropWhile', require('../dropWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/each.js b/live2d/node_modules/lodash/fp/each.js new file mode 100644 index 0000000..8800f42 --- /dev/null +++ b/live2d/node_modules/lodash/fp/each.js @@ -0,0 +1 @@ +module.exports = require('./forEach'); diff --git a/live2d/node_modules/lodash/fp/eachRight.js b/live2d/node_modules/lodash/fp/eachRight.js new file mode 100644 index 0000000..3252b2a --- /dev/null +++ b/live2d/node_modules/lodash/fp/eachRight.js @@ -0,0 +1 @@ +module.exports = require('./forEachRight'); diff --git a/live2d/node_modules/lodash/fp/endsWith.js b/live2d/node_modules/lodash/fp/endsWith.js new file mode 100644 index 0000000..17dc2a4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/endsWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('endsWith', require('../endsWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/entries.js b/live2d/node_modules/lodash/fp/entries.js new file mode 100644 index 0000000..7a88df2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/entries.js @@ -0,0 +1 @@ +module.exports = require('./toPairs'); diff --git a/live2d/node_modules/lodash/fp/entriesIn.js b/live2d/node_modules/lodash/fp/entriesIn.js new file mode 100644 index 0000000..f6c6331 --- /dev/null +++ b/live2d/node_modules/lodash/fp/entriesIn.js @@ -0,0 +1 @@ +module.exports = require('./toPairsIn'); diff --git a/live2d/node_modules/lodash/fp/eq.js b/live2d/node_modules/lodash/fp/eq.js new file mode 100644 index 0000000..9a3d21b --- /dev/null +++ b/live2d/node_modules/lodash/fp/eq.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('eq', require('../eq')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/equals.js b/live2d/node_modules/lodash/fp/equals.js new file mode 100644 index 0000000..e6a5ce0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/equals.js @@ -0,0 +1 @@ +module.exports = require('./isEqual'); diff --git a/live2d/node_modules/lodash/fp/escape.js b/live2d/node_modules/lodash/fp/escape.js new file mode 100644 index 0000000..52c1fbb --- /dev/null +++ b/live2d/node_modules/lodash/fp/escape.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('escape', require('../escape'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/escapeRegExp.js b/live2d/node_modules/lodash/fp/escapeRegExp.js new file mode 100644 index 0000000..369b2ef --- /dev/null +++ b/live2d/node_modules/lodash/fp/escapeRegExp.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('escapeRegExp', require('../escapeRegExp'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/every.js b/live2d/node_modules/lodash/fp/every.js new file mode 100644 index 0000000..95c2776 --- /dev/null +++ b/live2d/node_modules/lodash/fp/every.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('every', require('../every')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/extend.js b/live2d/node_modules/lodash/fp/extend.js new file mode 100644 index 0000000..e00166c --- /dev/null +++ b/live2d/node_modules/lodash/fp/extend.js @@ -0,0 +1 @@ +module.exports = require('./assignIn'); diff --git a/live2d/node_modules/lodash/fp/extendAll.js b/live2d/node_modules/lodash/fp/extendAll.js new file mode 100644 index 0000000..cc55b64 --- /dev/null +++ b/live2d/node_modules/lodash/fp/extendAll.js @@ -0,0 +1 @@ +module.exports = require('./assignInAll'); diff --git a/live2d/node_modules/lodash/fp/extendAllWith.js b/live2d/node_modules/lodash/fp/extendAllWith.js new file mode 100644 index 0000000..6679d20 --- /dev/null +++ b/live2d/node_modules/lodash/fp/extendAllWith.js @@ -0,0 +1 @@ +module.exports = require('./assignInAllWith'); diff --git a/live2d/node_modules/lodash/fp/extendWith.js b/live2d/node_modules/lodash/fp/extendWith.js new file mode 100644 index 0000000..dbdcb3b --- /dev/null +++ b/live2d/node_modules/lodash/fp/extendWith.js @@ -0,0 +1 @@ +module.exports = require('./assignInWith'); diff --git a/live2d/node_modules/lodash/fp/fill.js b/live2d/node_modules/lodash/fp/fill.js new file mode 100644 index 0000000..b2d47e8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/fill.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('fill', require('../fill')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/filter.js b/live2d/node_modules/lodash/fp/filter.js new file mode 100644 index 0000000..796d501 --- /dev/null +++ b/live2d/node_modules/lodash/fp/filter.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('filter', require('../filter')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/find.js b/live2d/node_modules/lodash/fp/find.js new file mode 100644 index 0000000..f805d33 --- /dev/null +++ b/live2d/node_modules/lodash/fp/find.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('find', require('../find')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findFrom.js b/live2d/node_modules/lodash/fp/findFrom.js new file mode 100644 index 0000000..da8275e --- /dev/null +++ b/live2d/node_modules/lodash/fp/findFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findFrom', require('../find')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findIndex.js b/live2d/node_modules/lodash/fp/findIndex.js new file mode 100644 index 0000000..8c15fd1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/findIndex.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findIndex', require('../findIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findIndexFrom.js b/live2d/node_modules/lodash/fp/findIndexFrom.js new file mode 100644 index 0000000..32e98cb --- /dev/null +++ b/live2d/node_modules/lodash/fp/findIndexFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findIndexFrom', require('../findIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findKey.js b/live2d/node_modules/lodash/fp/findKey.js new file mode 100644 index 0000000..475bcfa --- /dev/null +++ b/live2d/node_modules/lodash/fp/findKey.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findKey', require('../findKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findLast.js b/live2d/node_modules/lodash/fp/findLast.js new file mode 100644 index 0000000..093fe94 --- /dev/null +++ b/live2d/node_modules/lodash/fp/findLast.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findLast', require('../findLast')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findLastFrom.js b/live2d/node_modules/lodash/fp/findLastFrom.js new file mode 100644 index 0000000..76c38fb --- /dev/null +++ b/live2d/node_modules/lodash/fp/findLastFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findLastFrom', require('../findLast')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findLastIndex.js b/live2d/node_modules/lodash/fp/findLastIndex.js new file mode 100644 index 0000000..36986df --- /dev/null +++ b/live2d/node_modules/lodash/fp/findLastIndex.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findLastIndex', require('../findLastIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findLastIndexFrom.js b/live2d/node_modules/lodash/fp/findLastIndexFrom.js new file mode 100644 index 0000000..34c8176 --- /dev/null +++ b/live2d/node_modules/lodash/fp/findLastIndexFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findLastIndexFrom', require('../findLastIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/findLastKey.js b/live2d/node_modules/lodash/fp/findLastKey.js new file mode 100644 index 0000000..5f81b60 --- /dev/null +++ b/live2d/node_modules/lodash/fp/findLastKey.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('findLastKey', require('../findLastKey')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/first.js b/live2d/node_modules/lodash/fp/first.js new file mode 100644 index 0000000..53f4ad1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/first.js @@ -0,0 +1 @@ +module.exports = require('./head'); diff --git a/live2d/node_modules/lodash/fp/flatMap.js b/live2d/node_modules/lodash/fp/flatMap.js new file mode 100644 index 0000000..d01dc4d --- /dev/null +++ b/live2d/node_modules/lodash/fp/flatMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatMap', require('../flatMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flatMapDeep.js b/live2d/node_modules/lodash/fp/flatMapDeep.js new file mode 100644 index 0000000..569c42e --- /dev/null +++ b/live2d/node_modules/lodash/fp/flatMapDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatMapDeep', require('../flatMapDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flatMapDepth.js b/live2d/node_modules/lodash/fp/flatMapDepth.js new file mode 100644 index 0000000..6eb68fd --- /dev/null +++ b/live2d/node_modules/lodash/fp/flatMapDepth.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatMapDepth', require('../flatMapDepth')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flatten.js b/live2d/node_modules/lodash/fp/flatten.js new file mode 100644 index 0000000..30425d8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/flatten.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flatten', require('../flatten'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flattenDeep.js b/live2d/node_modules/lodash/fp/flattenDeep.js new file mode 100644 index 0000000..aed5db2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/flattenDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flattenDeep', require('../flattenDeep'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flattenDepth.js b/live2d/node_modules/lodash/fp/flattenDepth.js new file mode 100644 index 0000000..ad65e37 --- /dev/null +++ b/live2d/node_modules/lodash/fp/flattenDepth.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flattenDepth', require('../flattenDepth')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flip.js b/live2d/node_modules/lodash/fp/flip.js new file mode 100644 index 0000000..0547e7b --- /dev/null +++ b/live2d/node_modules/lodash/fp/flip.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flip', require('../flip'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/floor.js b/live2d/node_modules/lodash/fp/floor.js new file mode 100644 index 0000000..a6cf335 --- /dev/null +++ b/live2d/node_modules/lodash/fp/floor.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('floor', require('../floor')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flow.js b/live2d/node_modules/lodash/fp/flow.js new file mode 100644 index 0000000..cd83677 --- /dev/null +++ b/live2d/node_modules/lodash/fp/flow.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flow', require('../flow')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/flowRight.js b/live2d/node_modules/lodash/fp/flowRight.js new file mode 100644 index 0000000..972a5b9 --- /dev/null +++ b/live2d/node_modules/lodash/fp/flowRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('flowRight', require('../flowRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forEach.js b/live2d/node_modules/lodash/fp/forEach.js new file mode 100644 index 0000000..2f49452 --- /dev/null +++ b/live2d/node_modules/lodash/fp/forEach.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forEach', require('../forEach')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forEachRight.js b/live2d/node_modules/lodash/fp/forEachRight.js new file mode 100644 index 0000000..3ff9733 --- /dev/null +++ b/live2d/node_modules/lodash/fp/forEachRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forEachRight', require('../forEachRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forIn.js b/live2d/node_modules/lodash/fp/forIn.js new file mode 100644 index 0000000..9341749 --- /dev/null +++ b/live2d/node_modules/lodash/fp/forIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forIn', require('../forIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forInRight.js b/live2d/node_modules/lodash/fp/forInRight.js new file mode 100644 index 0000000..cecf8bb --- /dev/null +++ b/live2d/node_modules/lodash/fp/forInRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forInRight', require('../forInRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forOwn.js b/live2d/node_modules/lodash/fp/forOwn.js new file mode 100644 index 0000000..246449e --- /dev/null +++ b/live2d/node_modules/lodash/fp/forOwn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forOwn', require('../forOwn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/forOwnRight.js b/live2d/node_modules/lodash/fp/forOwnRight.js new file mode 100644 index 0000000..c5e826e --- /dev/null +++ b/live2d/node_modules/lodash/fp/forOwnRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('forOwnRight', require('../forOwnRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/fromPairs.js b/live2d/node_modules/lodash/fp/fromPairs.js new file mode 100644 index 0000000..f8cc596 --- /dev/null +++ b/live2d/node_modules/lodash/fp/fromPairs.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('fromPairs', require('../fromPairs')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/function.js b/live2d/node_modules/lodash/fp/function.js new file mode 100644 index 0000000..dfe69b1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/function.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../function')); diff --git a/live2d/node_modules/lodash/fp/functions.js b/live2d/node_modules/lodash/fp/functions.js new file mode 100644 index 0000000..09d1bb1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/functions.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('functions', require('../functions'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/functionsIn.js b/live2d/node_modules/lodash/fp/functionsIn.js new file mode 100644 index 0000000..2cfeb83 --- /dev/null +++ b/live2d/node_modules/lodash/fp/functionsIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('functionsIn', require('../functionsIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/get.js b/live2d/node_modules/lodash/fp/get.js new file mode 100644 index 0000000..6d3a328 --- /dev/null +++ b/live2d/node_modules/lodash/fp/get.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('get', require('../get')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/getOr.js b/live2d/node_modules/lodash/fp/getOr.js new file mode 100644 index 0000000..7dbf771 --- /dev/null +++ b/live2d/node_modules/lodash/fp/getOr.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('getOr', require('../get')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/groupBy.js b/live2d/node_modules/lodash/fp/groupBy.js new file mode 100644 index 0000000..fc0bc78 --- /dev/null +++ b/live2d/node_modules/lodash/fp/groupBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('groupBy', require('../groupBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/gt.js b/live2d/node_modules/lodash/fp/gt.js new file mode 100644 index 0000000..9e57c80 --- /dev/null +++ b/live2d/node_modules/lodash/fp/gt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('gt', require('../gt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/gte.js b/live2d/node_modules/lodash/fp/gte.js new file mode 100644 index 0000000..4584786 --- /dev/null +++ b/live2d/node_modules/lodash/fp/gte.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('gte', require('../gte')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/has.js b/live2d/node_modules/lodash/fp/has.js new file mode 100644 index 0000000..b901298 --- /dev/null +++ b/live2d/node_modules/lodash/fp/has.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('has', require('../has')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/hasIn.js b/live2d/node_modules/lodash/fp/hasIn.js new file mode 100644 index 0000000..b3c3d1a --- /dev/null +++ b/live2d/node_modules/lodash/fp/hasIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('hasIn', require('../hasIn')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/head.js b/live2d/node_modules/lodash/fp/head.js new file mode 100644 index 0000000..2694f0a --- /dev/null +++ b/live2d/node_modules/lodash/fp/head.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('head', require('../head'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/identical.js b/live2d/node_modules/lodash/fp/identical.js new file mode 100644 index 0000000..85563f4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/identical.js @@ -0,0 +1 @@ +module.exports = require('./eq'); diff --git a/live2d/node_modules/lodash/fp/identity.js b/live2d/node_modules/lodash/fp/identity.js new file mode 100644 index 0000000..096415a --- /dev/null +++ b/live2d/node_modules/lodash/fp/identity.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('identity', require('../identity'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/inRange.js b/live2d/node_modules/lodash/fp/inRange.js new file mode 100644 index 0000000..202d940 --- /dev/null +++ b/live2d/node_modules/lodash/fp/inRange.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('inRange', require('../inRange')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/includes.js b/live2d/node_modules/lodash/fp/includes.js new file mode 100644 index 0000000..1146780 --- /dev/null +++ b/live2d/node_modules/lodash/fp/includes.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('includes', require('../includes')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/includesFrom.js b/live2d/node_modules/lodash/fp/includesFrom.js new file mode 100644 index 0000000..683afdb --- /dev/null +++ b/live2d/node_modules/lodash/fp/includesFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('includesFrom', require('../includes')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/indexBy.js b/live2d/node_modules/lodash/fp/indexBy.js new file mode 100644 index 0000000..7e64bc0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/indexBy.js @@ -0,0 +1 @@ +module.exports = require('./keyBy'); diff --git a/live2d/node_modules/lodash/fp/indexOf.js b/live2d/node_modules/lodash/fp/indexOf.js new file mode 100644 index 0000000..524658e --- /dev/null +++ b/live2d/node_modules/lodash/fp/indexOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('indexOf', require('../indexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/indexOfFrom.js b/live2d/node_modules/lodash/fp/indexOfFrom.js new file mode 100644 index 0000000..d99c822 --- /dev/null +++ b/live2d/node_modules/lodash/fp/indexOfFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('indexOfFrom', require('../indexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/init.js b/live2d/node_modules/lodash/fp/init.js new file mode 100644 index 0000000..2f88d8b --- /dev/null +++ b/live2d/node_modules/lodash/fp/init.js @@ -0,0 +1 @@ +module.exports = require('./initial'); diff --git a/live2d/node_modules/lodash/fp/initial.js b/live2d/node_modules/lodash/fp/initial.js new file mode 100644 index 0000000..b732ba0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/initial.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('initial', require('../initial'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/intersection.js b/live2d/node_modules/lodash/fp/intersection.js new file mode 100644 index 0000000..52936d5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/intersection.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('intersection', require('../intersection')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/intersectionBy.js b/live2d/node_modules/lodash/fp/intersectionBy.js new file mode 100644 index 0000000..72629f2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/intersectionBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('intersectionBy', require('../intersectionBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/intersectionWith.js b/live2d/node_modules/lodash/fp/intersectionWith.js new file mode 100644 index 0000000..e064f40 --- /dev/null +++ b/live2d/node_modules/lodash/fp/intersectionWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('intersectionWith', require('../intersectionWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invert.js b/live2d/node_modules/lodash/fp/invert.js new file mode 100644 index 0000000..2d5d1f0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/invert.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invert', require('../invert')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invertBy.js b/live2d/node_modules/lodash/fp/invertBy.js new file mode 100644 index 0000000..63ca97e --- /dev/null +++ b/live2d/node_modules/lodash/fp/invertBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invertBy', require('../invertBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invertObj.js b/live2d/node_modules/lodash/fp/invertObj.js new file mode 100644 index 0000000..f1d842e --- /dev/null +++ b/live2d/node_modules/lodash/fp/invertObj.js @@ -0,0 +1 @@ +module.exports = require('./invert'); diff --git a/live2d/node_modules/lodash/fp/invoke.js b/live2d/node_modules/lodash/fp/invoke.js new file mode 100644 index 0000000..fcf17f0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/invoke.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invoke', require('../invoke')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invokeArgs.js b/live2d/node_modules/lodash/fp/invokeArgs.js new file mode 100644 index 0000000..d3f2953 --- /dev/null +++ b/live2d/node_modules/lodash/fp/invokeArgs.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invokeArgs', require('../invoke')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invokeArgsMap.js b/live2d/node_modules/lodash/fp/invokeArgsMap.js new file mode 100644 index 0000000..eaa9f84 --- /dev/null +++ b/live2d/node_modules/lodash/fp/invokeArgsMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invokeArgsMap', require('../invokeMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/invokeMap.js b/live2d/node_modules/lodash/fp/invokeMap.js new file mode 100644 index 0000000..6515fd7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/invokeMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('invokeMap', require('../invokeMap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isArguments.js b/live2d/node_modules/lodash/fp/isArguments.js new file mode 100644 index 0000000..1d93c9e --- /dev/null +++ b/live2d/node_modules/lodash/fp/isArguments.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isArguments', require('../isArguments'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isArray.js b/live2d/node_modules/lodash/fp/isArray.js new file mode 100644 index 0000000..ba7ade8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isArray', require('../isArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isArrayBuffer.js b/live2d/node_modules/lodash/fp/isArrayBuffer.js new file mode 100644 index 0000000..5088513 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isArrayBuffer.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isArrayBuffer', require('../isArrayBuffer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isArrayLike.js b/live2d/node_modules/lodash/fp/isArrayLike.js new file mode 100644 index 0000000..8f1856b --- /dev/null +++ b/live2d/node_modules/lodash/fp/isArrayLike.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isArrayLike', require('../isArrayLike'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isArrayLikeObject.js b/live2d/node_modules/lodash/fp/isArrayLikeObject.js new file mode 100644 index 0000000..2108498 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isArrayLikeObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isArrayLikeObject', require('../isArrayLikeObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isBoolean.js b/live2d/node_modules/lodash/fp/isBoolean.js new file mode 100644 index 0000000..9339f75 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isBoolean.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isBoolean', require('../isBoolean'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isBuffer.js b/live2d/node_modules/lodash/fp/isBuffer.js new file mode 100644 index 0000000..e60b123 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isBuffer.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isBuffer', require('../isBuffer'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isDate.js b/live2d/node_modules/lodash/fp/isDate.js new file mode 100644 index 0000000..dc41d08 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isDate.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isDate', require('../isDate'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isElement.js b/live2d/node_modules/lodash/fp/isElement.js new file mode 100644 index 0000000..18ee039 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isElement.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isElement', require('../isElement'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isEmpty.js b/live2d/node_modules/lodash/fp/isEmpty.js new file mode 100644 index 0000000..0f4ae84 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isEmpty.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isEmpty', require('../isEmpty'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isEqual.js b/live2d/node_modules/lodash/fp/isEqual.js new file mode 100644 index 0000000..4138386 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isEqual.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isEqual', require('../isEqual')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isEqualWith.js b/live2d/node_modules/lodash/fp/isEqualWith.js new file mode 100644 index 0000000..029ff5c --- /dev/null +++ b/live2d/node_modules/lodash/fp/isEqualWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isEqualWith', require('../isEqualWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isError.js b/live2d/node_modules/lodash/fp/isError.js new file mode 100644 index 0000000..3dfd81c --- /dev/null +++ b/live2d/node_modules/lodash/fp/isError.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isError', require('../isError'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isFinite.js b/live2d/node_modules/lodash/fp/isFinite.js new file mode 100644 index 0000000..0b647b8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isFinite.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isFinite', require('../isFinite'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isFunction.js b/live2d/node_modules/lodash/fp/isFunction.js new file mode 100644 index 0000000..ff8e5c4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isFunction.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isFunction', require('../isFunction'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isInteger.js b/live2d/node_modules/lodash/fp/isInteger.js new file mode 100644 index 0000000..67af4ff --- /dev/null +++ b/live2d/node_modules/lodash/fp/isInteger.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isInteger', require('../isInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isLength.js b/live2d/node_modules/lodash/fp/isLength.js new file mode 100644 index 0000000..fc101c5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isLength.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isLength', require('../isLength'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isMap.js b/live2d/node_modules/lodash/fp/isMap.js new file mode 100644 index 0000000..a209aa6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isMap', require('../isMap'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isMatch.js b/live2d/node_modules/lodash/fp/isMatch.js new file mode 100644 index 0000000..6264ca1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isMatch.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isMatch', require('../isMatch')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isMatchWith.js b/live2d/node_modules/lodash/fp/isMatchWith.js new file mode 100644 index 0000000..d95f319 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isMatchWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isMatchWith', require('../isMatchWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isNaN.js b/live2d/node_modules/lodash/fp/isNaN.js new file mode 100644 index 0000000..66a978f --- /dev/null +++ b/live2d/node_modules/lodash/fp/isNaN.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isNaN', require('../isNaN'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isNative.js b/live2d/node_modules/lodash/fp/isNative.js new file mode 100644 index 0000000..3d775ba --- /dev/null +++ b/live2d/node_modules/lodash/fp/isNative.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isNative', require('../isNative'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isNil.js b/live2d/node_modules/lodash/fp/isNil.js new file mode 100644 index 0000000..5952c02 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isNil.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isNil', require('../isNil'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isNull.js b/live2d/node_modules/lodash/fp/isNull.js new file mode 100644 index 0000000..f201a35 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isNull.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isNull', require('../isNull'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isNumber.js b/live2d/node_modules/lodash/fp/isNumber.js new file mode 100644 index 0000000..a2b5fa0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isNumber.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isNumber', require('../isNumber'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isObject.js b/live2d/node_modules/lodash/fp/isObject.js new file mode 100644 index 0000000..231ace0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isObject', require('../isObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isObjectLike.js b/live2d/node_modules/lodash/fp/isObjectLike.js new file mode 100644 index 0000000..f16082e --- /dev/null +++ b/live2d/node_modules/lodash/fp/isObjectLike.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isObjectLike', require('../isObjectLike'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isPlainObject.js b/live2d/node_modules/lodash/fp/isPlainObject.js new file mode 100644 index 0000000..b5bea90 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isPlainObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isPlainObject', require('../isPlainObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isRegExp.js b/live2d/node_modules/lodash/fp/isRegExp.js new file mode 100644 index 0000000..12a1a3d --- /dev/null +++ b/live2d/node_modules/lodash/fp/isRegExp.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isRegExp', require('../isRegExp'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isSafeInteger.js b/live2d/node_modules/lodash/fp/isSafeInteger.js new file mode 100644 index 0000000..7230f55 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isSafeInteger.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isSafeInteger', require('../isSafeInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isSet.js b/live2d/node_modules/lodash/fp/isSet.js new file mode 100644 index 0000000..35c01f6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isSet.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isSet', require('../isSet'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isString.js b/live2d/node_modules/lodash/fp/isString.js new file mode 100644 index 0000000..1fd0679 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isString.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isString', require('../isString'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isSymbol.js b/live2d/node_modules/lodash/fp/isSymbol.js new file mode 100644 index 0000000..3867695 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isSymbol.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isSymbol', require('../isSymbol'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isTypedArray.js b/live2d/node_modules/lodash/fp/isTypedArray.js new file mode 100644 index 0000000..8567953 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isTypedArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isTypedArray', require('../isTypedArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isUndefined.js b/live2d/node_modules/lodash/fp/isUndefined.js new file mode 100644 index 0000000..ddbca31 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isUndefined.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isUndefined', require('../isUndefined'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isWeakMap.js b/live2d/node_modules/lodash/fp/isWeakMap.js new file mode 100644 index 0000000..ef60c61 --- /dev/null +++ b/live2d/node_modules/lodash/fp/isWeakMap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isWeakMap', require('../isWeakMap'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/isWeakSet.js b/live2d/node_modules/lodash/fp/isWeakSet.js new file mode 100644 index 0000000..c99bfaa --- /dev/null +++ b/live2d/node_modules/lodash/fp/isWeakSet.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('isWeakSet', require('../isWeakSet'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/iteratee.js b/live2d/node_modules/lodash/fp/iteratee.js new file mode 100644 index 0000000..9f0f717 --- /dev/null +++ b/live2d/node_modules/lodash/fp/iteratee.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('iteratee', require('../iteratee')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/join.js b/live2d/node_modules/lodash/fp/join.js new file mode 100644 index 0000000..a220e00 --- /dev/null +++ b/live2d/node_modules/lodash/fp/join.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('join', require('../join')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/juxt.js b/live2d/node_modules/lodash/fp/juxt.js new file mode 100644 index 0000000..f71e04e --- /dev/null +++ b/live2d/node_modules/lodash/fp/juxt.js @@ -0,0 +1 @@ +module.exports = require('./over'); diff --git a/live2d/node_modules/lodash/fp/kebabCase.js b/live2d/node_modules/lodash/fp/kebabCase.js new file mode 100644 index 0000000..60737f1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/kebabCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('kebabCase', require('../kebabCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/keyBy.js b/live2d/node_modules/lodash/fp/keyBy.js new file mode 100644 index 0000000..9a6a85d --- /dev/null +++ b/live2d/node_modules/lodash/fp/keyBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('keyBy', require('../keyBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/keys.js b/live2d/node_modules/lodash/fp/keys.js new file mode 100644 index 0000000..e12bb07 --- /dev/null +++ b/live2d/node_modules/lodash/fp/keys.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('keys', require('../keys'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/keysIn.js b/live2d/node_modules/lodash/fp/keysIn.js new file mode 100644 index 0000000..f3eb36a --- /dev/null +++ b/live2d/node_modules/lodash/fp/keysIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('keysIn', require('../keysIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lang.js b/live2d/node_modules/lodash/fp/lang.js new file mode 100644 index 0000000..08cc9c1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/lang.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../lang')); diff --git a/live2d/node_modules/lodash/fp/last.js b/live2d/node_modules/lodash/fp/last.js new file mode 100644 index 0000000..0f71699 --- /dev/null +++ b/live2d/node_modules/lodash/fp/last.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('last', require('../last'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lastIndexOf.js b/live2d/node_modules/lodash/fp/lastIndexOf.js new file mode 100644 index 0000000..ddf39c3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/lastIndexOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lastIndexOf', require('../lastIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lastIndexOfFrom.js b/live2d/node_modules/lodash/fp/lastIndexOfFrom.js new file mode 100644 index 0000000..1ff6a0b --- /dev/null +++ b/live2d/node_modules/lodash/fp/lastIndexOfFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lastIndexOfFrom', require('../lastIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lowerCase.js b/live2d/node_modules/lodash/fp/lowerCase.js new file mode 100644 index 0000000..ea64bc1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/lowerCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lowerCase', require('../lowerCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lowerFirst.js b/live2d/node_modules/lodash/fp/lowerFirst.js new file mode 100644 index 0000000..539720a --- /dev/null +++ b/live2d/node_modules/lodash/fp/lowerFirst.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lowerFirst', require('../lowerFirst'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lt.js b/live2d/node_modules/lodash/fp/lt.js new file mode 100644 index 0000000..a31d21e --- /dev/null +++ b/live2d/node_modules/lodash/fp/lt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lt', require('../lt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/lte.js b/live2d/node_modules/lodash/fp/lte.js new file mode 100644 index 0000000..d795d10 --- /dev/null +++ b/live2d/node_modules/lodash/fp/lte.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('lte', require('../lte')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/map.js b/live2d/node_modules/lodash/fp/map.js new file mode 100644 index 0000000..cf98794 --- /dev/null +++ b/live2d/node_modules/lodash/fp/map.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('map', require('../map')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mapKeys.js b/live2d/node_modules/lodash/fp/mapKeys.js new file mode 100644 index 0000000..1684587 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mapKeys.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mapKeys', require('../mapKeys')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mapValues.js b/live2d/node_modules/lodash/fp/mapValues.js new file mode 100644 index 0000000..4004972 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mapValues.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mapValues', require('../mapValues')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/matches.js b/live2d/node_modules/lodash/fp/matches.js new file mode 100644 index 0000000..29d1e1e --- /dev/null +++ b/live2d/node_modules/lodash/fp/matches.js @@ -0,0 +1 @@ +module.exports = require('./isMatch'); diff --git a/live2d/node_modules/lodash/fp/matchesProperty.js b/live2d/node_modules/lodash/fp/matchesProperty.js new file mode 100644 index 0000000..4575bd2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/matchesProperty.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('matchesProperty', require('../matchesProperty')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/math.js b/live2d/node_modules/lodash/fp/math.js new file mode 100644 index 0000000..e8f50f7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/math.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../math')); diff --git a/live2d/node_modules/lodash/fp/max.js b/live2d/node_modules/lodash/fp/max.js new file mode 100644 index 0000000..a66acac --- /dev/null +++ b/live2d/node_modules/lodash/fp/max.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('max', require('../max'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/maxBy.js b/live2d/node_modules/lodash/fp/maxBy.js new file mode 100644 index 0000000..d083fd6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/maxBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('maxBy', require('../maxBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mean.js b/live2d/node_modules/lodash/fp/mean.js new file mode 100644 index 0000000..3117246 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mean.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mean', require('../mean'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/meanBy.js b/live2d/node_modules/lodash/fp/meanBy.js new file mode 100644 index 0000000..556f25e --- /dev/null +++ b/live2d/node_modules/lodash/fp/meanBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('meanBy', require('../meanBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/memoize.js b/live2d/node_modules/lodash/fp/memoize.js new file mode 100644 index 0000000..638eec6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/memoize.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('memoize', require('../memoize')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/merge.js b/live2d/node_modules/lodash/fp/merge.js new file mode 100644 index 0000000..ac66add --- /dev/null +++ b/live2d/node_modules/lodash/fp/merge.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('merge', require('../merge')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mergeAll.js b/live2d/node_modules/lodash/fp/mergeAll.js new file mode 100644 index 0000000..a3674d6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mergeAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mergeAll', require('../merge')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mergeAllWith.js b/live2d/node_modules/lodash/fp/mergeAllWith.js new file mode 100644 index 0000000..4bd4206 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mergeAllWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mergeAllWith', require('../mergeWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mergeWith.js b/live2d/node_modules/lodash/fp/mergeWith.js new file mode 100644 index 0000000..00d44d5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/mergeWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mergeWith', require('../mergeWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/method.js b/live2d/node_modules/lodash/fp/method.js new file mode 100644 index 0000000..f4060c6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/method.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('method', require('../method')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/methodOf.js b/live2d/node_modules/lodash/fp/methodOf.js new file mode 100644 index 0000000..6139905 --- /dev/null +++ b/live2d/node_modules/lodash/fp/methodOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('methodOf', require('../methodOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/min.js b/live2d/node_modules/lodash/fp/min.js new file mode 100644 index 0000000..d12c6b4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/min.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('min', require('../min'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/minBy.js b/live2d/node_modules/lodash/fp/minBy.js new file mode 100644 index 0000000..fdb9e24 --- /dev/null +++ b/live2d/node_modules/lodash/fp/minBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('minBy', require('../minBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/mixin.js b/live2d/node_modules/lodash/fp/mixin.js new file mode 100644 index 0000000..332e6fb --- /dev/null +++ b/live2d/node_modules/lodash/fp/mixin.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('mixin', require('../mixin')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/multiply.js b/live2d/node_modules/lodash/fp/multiply.js new file mode 100644 index 0000000..4dcf0b0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/multiply.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('multiply', require('../multiply')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/nAry.js b/live2d/node_modules/lodash/fp/nAry.js new file mode 100644 index 0000000..f262a76 --- /dev/null +++ b/live2d/node_modules/lodash/fp/nAry.js @@ -0,0 +1 @@ +module.exports = require('./ary'); diff --git a/live2d/node_modules/lodash/fp/negate.js b/live2d/node_modules/lodash/fp/negate.js new file mode 100644 index 0000000..8b6dc7c --- /dev/null +++ b/live2d/node_modules/lodash/fp/negate.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('negate', require('../negate'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/next.js b/live2d/node_modules/lodash/fp/next.js new file mode 100644 index 0000000..140155e --- /dev/null +++ b/live2d/node_modules/lodash/fp/next.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('next', require('../next'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/noop.js b/live2d/node_modules/lodash/fp/noop.js new file mode 100644 index 0000000..b9e32cc --- /dev/null +++ b/live2d/node_modules/lodash/fp/noop.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('noop', require('../noop'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/now.js b/live2d/node_modules/lodash/fp/now.js new file mode 100644 index 0000000..6de2068 --- /dev/null +++ b/live2d/node_modules/lodash/fp/now.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('now', require('../now'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/nth.js b/live2d/node_modules/lodash/fp/nth.js new file mode 100644 index 0000000..da4fda7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/nth.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('nth', require('../nth')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/nthArg.js b/live2d/node_modules/lodash/fp/nthArg.js new file mode 100644 index 0000000..fce3165 --- /dev/null +++ b/live2d/node_modules/lodash/fp/nthArg.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('nthArg', require('../nthArg')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/number.js b/live2d/node_modules/lodash/fp/number.js new file mode 100644 index 0000000..5c10b88 --- /dev/null +++ b/live2d/node_modules/lodash/fp/number.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../number')); diff --git a/live2d/node_modules/lodash/fp/object.js b/live2d/node_modules/lodash/fp/object.js new file mode 100644 index 0000000..ae39a13 --- /dev/null +++ b/live2d/node_modules/lodash/fp/object.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../object')); diff --git a/live2d/node_modules/lodash/fp/omit.js b/live2d/node_modules/lodash/fp/omit.js new file mode 100644 index 0000000..fd68529 --- /dev/null +++ b/live2d/node_modules/lodash/fp/omit.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('omit', require('../omit')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/omitAll.js b/live2d/node_modules/lodash/fp/omitAll.js new file mode 100644 index 0000000..144cf4b --- /dev/null +++ b/live2d/node_modules/lodash/fp/omitAll.js @@ -0,0 +1 @@ +module.exports = require('./omit'); diff --git a/live2d/node_modules/lodash/fp/omitBy.js b/live2d/node_modules/lodash/fp/omitBy.js new file mode 100644 index 0000000..90df738 --- /dev/null +++ b/live2d/node_modules/lodash/fp/omitBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('omitBy', require('../omitBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/once.js b/live2d/node_modules/lodash/fp/once.js new file mode 100644 index 0000000..f8f0a5c --- /dev/null +++ b/live2d/node_modules/lodash/fp/once.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('once', require('../once'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/orderBy.js b/live2d/node_modules/lodash/fp/orderBy.js new file mode 100644 index 0000000..848e210 --- /dev/null +++ b/live2d/node_modules/lodash/fp/orderBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('orderBy', require('../orderBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/over.js b/live2d/node_modules/lodash/fp/over.js new file mode 100644 index 0000000..01eba7b --- /dev/null +++ b/live2d/node_modules/lodash/fp/over.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('over', require('../over')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/overArgs.js b/live2d/node_modules/lodash/fp/overArgs.js new file mode 100644 index 0000000..738556f --- /dev/null +++ b/live2d/node_modules/lodash/fp/overArgs.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('overArgs', require('../overArgs')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/overEvery.js b/live2d/node_modules/lodash/fp/overEvery.js new file mode 100644 index 0000000..9f5a032 --- /dev/null +++ b/live2d/node_modules/lodash/fp/overEvery.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('overEvery', require('../overEvery')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/overSome.js b/live2d/node_modules/lodash/fp/overSome.js new file mode 100644 index 0000000..15939d5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/overSome.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('overSome', require('../overSome')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pad.js b/live2d/node_modules/lodash/fp/pad.js new file mode 100644 index 0000000..f1dea4a --- /dev/null +++ b/live2d/node_modules/lodash/fp/pad.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pad', require('../pad')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/padChars.js b/live2d/node_modules/lodash/fp/padChars.js new file mode 100644 index 0000000..d6e0804 --- /dev/null +++ b/live2d/node_modules/lodash/fp/padChars.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padChars', require('../pad')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/padCharsEnd.js b/live2d/node_modules/lodash/fp/padCharsEnd.js new file mode 100644 index 0000000..d4ab79a --- /dev/null +++ b/live2d/node_modules/lodash/fp/padCharsEnd.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padCharsEnd', require('../padEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/padCharsStart.js b/live2d/node_modules/lodash/fp/padCharsStart.js new file mode 100644 index 0000000..a08a300 --- /dev/null +++ b/live2d/node_modules/lodash/fp/padCharsStart.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padCharsStart', require('../padStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/padEnd.js b/live2d/node_modules/lodash/fp/padEnd.js new file mode 100644 index 0000000..a8522ec --- /dev/null +++ b/live2d/node_modules/lodash/fp/padEnd.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padEnd', require('../padEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/padStart.js b/live2d/node_modules/lodash/fp/padStart.js new file mode 100644 index 0000000..f4ca79d --- /dev/null +++ b/live2d/node_modules/lodash/fp/padStart.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('padStart', require('../padStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/parseInt.js b/live2d/node_modules/lodash/fp/parseInt.js new file mode 100644 index 0000000..27314cc --- /dev/null +++ b/live2d/node_modules/lodash/fp/parseInt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('parseInt', require('../parseInt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/partial.js b/live2d/node_modules/lodash/fp/partial.js new file mode 100644 index 0000000..5d46015 --- /dev/null +++ b/live2d/node_modules/lodash/fp/partial.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('partial', require('../partial')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/partialRight.js b/live2d/node_modules/lodash/fp/partialRight.js new file mode 100644 index 0000000..7f05fed --- /dev/null +++ b/live2d/node_modules/lodash/fp/partialRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('partialRight', require('../partialRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/partition.js b/live2d/node_modules/lodash/fp/partition.js new file mode 100644 index 0000000..2ebcacc --- /dev/null +++ b/live2d/node_modules/lodash/fp/partition.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('partition', require('../partition')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/path.js b/live2d/node_modules/lodash/fp/path.js new file mode 100644 index 0000000..b29cfb2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/path.js @@ -0,0 +1 @@ +module.exports = require('./get'); diff --git a/live2d/node_modules/lodash/fp/pathEq.js b/live2d/node_modules/lodash/fp/pathEq.js new file mode 100644 index 0000000..36c027a --- /dev/null +++ b/live2d/node_modules/lodash/fp/pathEq.js @@ -0,0 +1 @@ +module.exports = require('./matchesProperty'); diff --git a/live2d/node_modules/lodash/fp/pathOr.js b/live2d/node_modules/lodash/fp/pathOr.js new file mode 100644 index 0000000..4ab5820 --- /dev/null +++ b/live2d/node_modules/lodash/fp/pathOr.js @@ -0,0 +1 @@ +module.exports = require('./getOr'); diff --git a/live2d/node_modules/lodash/fp/paths.js b/live2d/node_modules/lodash/fp/paths.js new file mode 100644 index 0000000..1eb7950 --- /dev/null +++ b/live2d/node_modules/lodash/fp/paths.js @@ -0,0 +1 @@ +module.exports = require('./at'); diff --git a/live2d/node_modules/lodash/fp/pick.js b/live2d/node_modules/lodash/fp/pick.js new file mode 100644 index 0000000..197393d --- /dev/null +++ b/live2d/node_modules/lodash/fp/pick.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pick', require('../pick')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pickAll.js b/live2d/node_modules/lodash/fp/pickAll.js new file mode 100644 index 0000000..a8ecd46 --- /dev/null +++ b/live2d/node_modules/lodash/fp/pickAll.js @@ -0,0 +1 @@ +module.exports = require('./pick'); diff --git a/live2d/node_modules/lodash/fp/pickBy.js b/live2d/node_modules/lodash/fp/pickBy.js new file mode 100644 index 0000000..d832d16 --- /dev/null +++ b/live2d/node_modules/lodash/fp/pickBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pickBy', require('../pickBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pipe.js b/live2d/node_modules/lodash/fp/pipe.js new file mode 100644 index 0000000..b2e1e2c --- /dev/null +++ b/live2d/node_modules/lodash/fp/pipe.js @@ -0,0 +1 @@ +module.exports = require('./flow'); diff --git a/live2d/node_modules/lodash/fp/placeholder.js b/live2d/node_modules/lodash/fp/placeholder.js new file mode 100644 index 0000000..1ce1739 --- /dev/null +++ b/live2d/node_modules/lodash/fp/placeholder.js @@ -0,0 +1,6 @@ +/** + * The default argument placeholder value for methods. + * + * @type {Object} + */ +module.exports = {}; diff --git a/live2d/node_modules/lodash/fp/plant.js b/live2d/node_modules/lodash/fp/plant.js new file mode 100644 index 0000000..eca8f32 --- /dev/null +++ b/live2d/node_modules/lodash/fp/plant.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('plant', require('../plant'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pluck.js b/live2d/node_modules/lodash/fp/pluck.js new file mode 100644 index 0000000..0d1e1ab --- /dev/null +++ b/live2d/node_modules/lodash/fp/pluck.js @@ -0,0 +1 @@ +module.exports = require('./map'); diff --git a/live2d/node_modules/lodash/fp/prop.js b/live2d/node_modules/lodash/fp/prop.js new file mode 100644 index 0000000..b29cfb2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/prop.js @@ -0,0 +1 @@ +module.exports = require('./get'); diff --git a/live2d/node_modules/lodash/fp/propEq.js b/live2d/node_modules/lodash/fp/propEq.js new file mode 100644 index 0000000..36c027a --- /dev/null +++ b/live2d/node_modules/lodash/fp/propEq.js @@ -0,0 +1 @@ +module.exports = require('./matchesProperty'); diff --git a/live2d/node_modules/lodash/fp/propOr.js b/live2d/node_modules/lodash/fp/propOr.js new file mode 100644 index 0000000..4ab5820 --- /dev/null +++ b/live2d/node_modules/lodash/fp/propOr.js @@ -0,0 +1 @@ +module.exports = require('./getOr'); diff --git a/live2d/node_modules/lodash/fp/property.js b/live2d/node_modules/lodash/fp/property.js new file mode 100644 index 0000000..b29cfb2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/property.js @@ -0,0 +1 @@ +module.exports = require('./get'); diff --git a/live2d/node_modules/lodash/fp/propertyOf.js b/live2d/node_modules/lodash/fp/propertyOf.js new file mode 100644 index 0000000..f6273ee --- /dev/null +++ b/live2d/node_modules/lodash/fp/propertyOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('propertyOf', require('../get')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/props.js b/live2d/node_modules/lodash/fp/props.js new file mode 100644 index 0000000..1eb7950 --- /dev/null +++ b/live2d/node_modules/lodash/fp/props.js @@ -0,0 +1 @@ +module.exports = require('./at'); diff --git a/live2d/node_modules/lodash/fp/pull.js b/live2d/node_modules/lodash/fp/pull.js new file mode 100644 index 0000000..8d7084f --- /dev/null +++ b/live2d/node_modules/lodash/fp/pull.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pull', require('../pull')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pullAll.js b/live2d/node_modules/lodash/fp/pullAll.js new file mode 100644 index 0000000..98d5c9a --- /dev/null +++ b/live2d/node_modules/lodash/fp/pullAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pullAll', require('../pullAll')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pullAllBy.js b/live2d/node_modules/lodash/fp/pullAllBy.js new file mode 100644 index 0000000..876bc3b --- /dev/null +++ b/live2d/node_modules/lodash/fp/pullAllBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pullAllBy', require('../pullAllBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pullAllWith.js b/live2d/node_modules/lodash/fp/pullAllWith.js new file mode 100644 index 0000000..f71ba4d --- /dev/null +++ b/live2d/node_modules/lodash/fp/pullAllWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pullAllWith', require('../pullAllWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/pullAt.js b/live2d/node_modules/lodash/fp/pullAt.js new file mode 100644 index 0000000..e8b3bb6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/pullAt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('pullAt', require('../pullAt')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/random.js b/live2d/node_modules/lodash/fp/random.js new file mode 100644 index 0000000..99d852e --- /dev/null +++ b/live2d/node_modules/lodash/fp/random.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('random', require('../random')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/range.js b/live2d/node_modules/lodash/fp/range.js new file mode 100644 index 0000000..a6bb591 --- /dev/null +++ b/live2d/node_modules/lodash/fp/range.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('range', require('../range')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/rangeRight.js b/live2d/node_modules/lodash/fp/rangeRight.js new file mode 100644 index 0000000..fdb712f --- /dev/null +++ b/live2d/node_modules/lodash/fp/rangeRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rangeRight', require('../rangeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/rangeStep.js b/live2d/node_modules/lodash/fp/rangeStep.js new file mode 100644 index 0000000..d72dfc2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/rangeStep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rangeStep', require('../range')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/rangeStepRight.js b/live2d/node_modules/lodash/fp/rangeStepRight.js new file mode 100644 index 0000000..8b2a67b --- /dev/null +++ b/live2d/node_modules/lodash/fp/rangeStepRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rangeStepRight', require('../rangeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/rearg.js b/live2d/node_modules/lodash/fp/rearg.js new file mode 100644 index 0000000..678e02a --- /dev/null +++ b/live2d/node_modules/lodash/fp/rearg.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rearg', require('../rearg')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/reduce.js b/live2d/node_modules/lodash/fp/reduce.js new file mode 100644 index 0000000..4cef0a0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/reduce.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('reduce', require('../reduce')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/reduceRight.js b/live2d/node_modules/lodash/fp/reduceRight.js new file mode 100644 index 0000000..caf5bb5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/reduceRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('reduceRight', require('../reduceRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/reject.js b/live2d/node_modules/lodash/fp/reject.js new file mode 100644 index 0000000..c163273 --- /dev/null +++ b/live2d/node_modules/lodash/fp/reject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('reject', require('../reject')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/remove.js b/live2d/node_modules/lodash/fp/remove.js new file mode 100644 index 0000000..e9d1327 --- /dev/null +++ b/live2d/node_modules/lodash/fp/remove.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('remove', require('../remove')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/repeat.js b/live2d/node_modules/lodash/fp/repeat.js new file mode 100644 index 0000000..08470f2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/repeat.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('repeat', require('../repeat')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/replace.js b/live2d/node_modules/lodash/fp/replace.js new file mode 100644 index 0000000..2227db6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/replace.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('replace', require('../replace')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/rest.js b/live2d/node_modules/lodash/fp/rest.js new file mode 100644 index 0000000..c1f3d64 --- /dev/null +++ b/live2d/node_modules/lodash/fp/rest.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rest', require('../rest')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/restFrom.js b/live2d/node_modules/lodash/fp/restFrom.js new file mode 100644 index 0000000..714e42b --- /dev/null +++ b/live2d/node_modules/lodash/fp/restFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('restFrom', require('../rest')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/result.js b/live2d/node_modules/lodash/fp/result.js new file mode 100644 index 0000000..f86ce07 --- /dev/null +++ b/live2d/node_modules/lodash/fp/result.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('result', require('../result')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/reverse.js b/live2d/node_modules/lodash/fp/reverse.js new file mode 100644 index 0000000..07c9f5e --- /dev/null +++ b/live2d/node_modules/lodash/fp/reverse.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('reverse', require('../reverse')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/round.js b/live2d/node_modules/lodash/fp/round.js new file mode 100644 index 0000000..4c0e5c8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/round.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('round', require('../round')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sample.js b/live2d/node_modules/lodash/fp/sample.js new file mode 100644 index 0000000..6bea125 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sample.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sample', require('../sample'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sampleSize.js b/live2d/node_modules/lodash/fp/sampleSize.js new file mode 100644 index 0000000..359ed6f --- /dev/null +++ b/live2d/node_modules/lodash/fp/sampleSize.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sampleSize', require('../sampleSize')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/seq.js b/live2d/node_modules/lodash/fp/seq.js new file mode 100644 index 0000000..d8f42b0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/seq.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../seq')); diff --git a/live2d/node_modules/lodash/fp/set.js b/live2d/node_modules/lodash/fp/set.js new file mode 100644 index 0000000..0b56a56 --- /dev/null +++ b/live2d/node_modules/lodash/fp/set.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('set', require('../set')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/setWith.js b/live2d/node_modules/lodash/fp/setWith.js new file mode 100644 index 0000000..0b58495 --- /dev/null +++ b/live2d/node_modules/lodash/fp/setWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('setWith', require('../setWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/shuffle.js b/live2d/node_modules/lodash/fp/shuffle.js new file mode 100644 index 0000000..aa3a1ca --- /dev/null +++ b/live2d/node_modules/lodash/fp/shuffle.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('shuffle', require('../shuffle'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/size.js b/live2d/node_modules/lodash/fp/size.js new file mode 100644 index 0000000..7490136 --- /dev/null +++ b/live2d/node_modules/lodash/fp/size.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('size', require('../size'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/slice.js b/live2d/node_modules/lodash/fp/slice.js new file mode 100644 index 0000000..15945d3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/slice.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('slice', require('../slice')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/snakeCase.js b/live2d/node_modules/lodash/fp/snakeCase.js new file mode 100644 index 0000000..a0ff780 --- /dev/null +++ b/live2d/node_modules/lodash/fp/snakeCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('snakeCase', require('../snakeCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/some.js b/live2d/node_modules/lodash/fp/some.js new file mode 100644 index 0000000..a4fa2d0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/some.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('some', require('../some')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortBy.js b/live2d/node_modules/lodash/fp/sortBy.js new file mode 100644 index 0000000..e0790ad --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortBy', require('../sortBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedIndex.js b/live2d/node_modules/lodash/fp/sortedIndex.js new file mode 100644 index 0000000..364a054 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedIndex.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedIndex', require('../sortedIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedIndexBy.js b/live2d/node_modules/lodash/fp/sortedIndexBy.js new file mode 100644 index 0000000..9593dbd --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedIndexBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedIndexBy', require('../sortedIndexBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedIndexOf.js b/live2d/node_modules/lodash/fp/sortedIndexOf.js new file mode 100644 index 0000000..c9084ca --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedIndexOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedIndexOf', require('../sortedIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedLastIndex.js b/live2d/node_modules/lodash/fp/sortedLastIndex.js new file mode 100644 index 0000000..47fe241 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedLastIndex.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedLastIndex', require('../sortedLastIndex')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedLastIndexBy.js b/live2d/node_modules/lodash/fp/sortedLastIndexBy.js new file mode 100644 index 0000000..0f9a347 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedLastIndexBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedLastIndexBy', require('../sortedLastIndexBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedLastIndexOf.js b/live2d/node_modules/lodash/fp/sortedLastIndexOf.js new file mode 100644 index 0000000..0d4d932 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedLastIndexOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedLastIndexOf', require('../sortedLastIndexOf')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedUniq.js b/live2d/node_modules/lodash/fp/sortedUniq.js new file mode 100644 index 0000000..882d283 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedUniq.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedUniq', require('../sortedUniq'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sortedUniqBy.js b/live2d/node_modules/lodash/fp/sortedUniqBy.js new file mode 100644 index 0000000..033db91 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sortedUniqBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sortedUniqBy', require('../sortedUniqBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/split.js b/live2d/node_modules/lodash/fp/split.js new file mode 100644 index 0000000..14de1a7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/split.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('split', require('../split')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/spread.js b/live2d/node_modules/lodash/fp/spread.js new file mode 100644 index 0000000..2d11b70 --- /dev/null +++ b/live2d/node_modules/lodash/fp/spread.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('spread', require('../spread')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/spreadFrom.js b/live2d/node_modules/lodash/fp/spreadFrom.js new file mode 100644 index 0000000..0b630df --- /dev/null +++ b/live2d/node_modules/lodash/fp/spreadFrom.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('spreadFrom', require('../spread')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/startCase.js b/live2d/node_modules/lodash/fp/startCase.js new file mode 100644 index 0000000..ada98c9 --- /dev/null +++ b/live2d/node_modules/lodash/fp/startCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('startCase', require('../startCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/startsWith.js b/live2d/node_modules/lodash/fp/startsWith.js new file mode 100644 index 0000000..985e2f2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/startsWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('startsWith', require('../startsWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/string.js b/live2d/node_modules/lodash/fp/string.js new file mode 100644 index 0000000..773b037 --- /dev/null +++ b/live2d/node_modules/lodash/fp/string.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../string')); diff --git a/live2d/node_modules/lodash/fp/stubArray.js b/live2d/node_modules/lodash/fp/stubArray.js new file mode 100644 index 0000000..cd604cb --- /dev/null +++ b/live2d/node_modules/lodash/fp/stubArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('stubArray', require('../stubArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/stubFalse.js b/live2d/node_modules/lodash/fp/stubFalse.js new file mode 100644 index 0000000..3296664 --- /dev/null +++ b/live2d/node_modules/lodash/fp/stubFalse.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('stubFalse', require('../stubFalse'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/stubObject.js b/live2d/node_modules/lodash/fp/stubObject.js new file mode 100644 index 0000000..c6c8ec4 --- /dev/null +++ b/live2d/node_modules/lodash/fp/stubObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('stubObject', require('../stubObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/stubString.js b/live2d/node_modules/lodash/fp/stubString.js new file mode 100644 index 0000000..701051e --- /dev/null +++ b/live2d/node_modules/lodash/fp/stubString.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('stubString', require('../stubString'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/stubTrue.js b/live2d/node_modules/lodash/fp/stubTrue.js new file mode 100644 index 0000000..9249082 --- /dev/null +++ b/live2d/node_modules/lodash/fp/stubTrue.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('stubTrue', require('../stubTrue'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/subtract.js b/live2d/node_modules/lodash/fp/subtract.js new file mode 100644 index 0000000..d32b16d --- /dev/null +++ b/live2d/node_modules/lodash/fp/subtract.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('subtract', require('../subtract')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sum.js b/live2d/node_modules/lodash/fp/sum.js new file mode 100644 index 0000000..5cce12b --- /dev/null +++ b/live2d/node_modules/lodash/fp/sum.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sum', require('../sum'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/sumBy.js b/live2d/node_modules/lodash/fp/sumBy.js new file mode 100644 index 0000000..c882656 --- /dev/null +++ b/live2d/node_modules/lodash/fp/sumBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('sumBy', require('../sumBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/symmetricDifference.js b/live2d/node_modules/lodash/fp/symmetricDifference.js new file mode 100644 index 0000000..78c16ad --- /dev/null +++ b/live2d/node_modules/lodash/fp/symmetricDifference.js @@ -0,0 +1 @@ +module.exports = require('./xor'); diff --git a/live2d/node_modules/lodash/fp/symmetricDifferenceBy.js b/live2d/node_modules/lodash/fp/symmetricDifferenceBy.js new file mode 100644 index 0000000..298fc7f --- /dev/null +++ b/live2d/node_modules/lodash/fp/symmetricDifferenceBy.js @@ -0,0 +1 @@ +module.exports = require('./xorBy'); diff --git a/live2d/node_modules/lodash/fp/symmetricDifferenceWith.js b/live2d/node_modules/lodash/fp/symmetricDifferenceWith.js new file mode 100644 index 0000000..70bc6fa --- /dev/null +++ b/live2d/node_modules/lodash/fp/symmetricDifferenceWith.js @@ -0,0 +1 @@ +module.exports = require('./xorWith'); diff --git a/live2d/node_modules/lodash/fp/tail.js b/live2d/node_modules/lodash/fp/tail.js new file mode 100644 index 0000000..f122f0a --- /dev/null +++ b/live2d/node_modules/lodash/fp/tail.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('tail', require('../tail'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/take.js b/live2d/node_modules/lodash/fp/take.js new file mode 100644 index 0000000..9af98a7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/take.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('take', require('../take')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/takeLast.js b/live2d/node_modules/lodash/fp/takeLast.js new file mode 100644 index 0000000..e98c84a --- /dev/null +++ b/live2d/node_modules/lodash/fp/takeLast.js @@ -0,0 +1 @@ +module.exports = require('./takeRight'); diff --git a/live2d/node_modules/lodash/fp/takeLastWhile.js b/live2d/node_modules/lodash/fp/takeLastWhile.js new file mode 100644 index 0000000..5367968 --- /dev/null +++ b/live2d/node_modules/lodash/fp/takeLastWhile.js @@ -0,0 +1 @@ +module.exports = require('./takeRightWhile'); diff --git a/live2d/node_modules/lodash/fp/takeRight.js b/live2d/node_modules/lodash/fp/takeRight.js new file mode 100644 index 0000000..b82950a --- /dev/null +++ b/live2d/node_modules/lodash/fp/takeRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('takeRight', require('../takeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/takeRightWhile.js b/live2d/node_modules/lodash/fp/takeRightWhile.js new file mode 100644 index 0000000..8ffb0a2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/takeRightWhile.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('takeRightWhile', require('../takeRightWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/takeWhile.js b/live2d/node_modules/lodash/fp/takeWhile.js new file mode 100644 index 0000000..2813664 --- /dev/null +++ b/live2d/node_modules/lodash/fp/takeWhile.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('takeWhile', require('../takeWhile')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/tap.js b/live2d/node_modules/lodash/fp/tap.js new file mode 100644 index 0000000..d33ad6e --- /dev/null +++ b/live2d/node_modules/lodash/fp/tap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('tap', require('../tap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/template.js b/live2d/node_modules/lodash/fp/template.js new file mode 100644 index 0000000..74857e1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/template.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('template', require('../template')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/templateSettings.js b/live2d/node_modules/lodash/fp/templateSettings.js new file mode 100644 index 0000000..7bcc0a8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/templateSettings.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('templateSettings', require('../templateSettings'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/throttle.js b/live2d/node_modules/lodash/fp/throttle.js new file mode 100644 index 0000000..77fff14 --- /dev/null +++ b/live2d/node_modules/lodash/fp/throttle.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('throttle', require('../throttle')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/thru.js b/live2d/node_modules/lodash/fp/thru.js new file mode 100644 index 0000000..d42b3b1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/thru.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('thru', require('../thru')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/times.js b/live2d/node_modules/lodash/fp/times.js new file mode 100644 index 0000000..0dab06d --- /dev/null +++ b/live2d/node_modules/lodash/fp/times.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('times', require('../times')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toArray.js b/live2d/node_modules/lodash/fp/toArray.js new file mode 100644 index 0000000..f0c360a --- /dev/null +++ b/live2d/node_modules/lodash/fp/toArray.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toArray', require('../toArray'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toFinite.js b/live2d/node_modules/lodash/fp/toFinite.js new file mode 100644 index 0000000..3a47687 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toFinite.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toFinite', require('../toFinite'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toInteger.js b/live2d/node_modules/lodash/fp/toInteger.js new file mode 100644 index 0000000..e0af6a7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toInteger.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toInteger', require('../toInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toIterator.js b/live2d/node_modules/lodash/fp/toIterator.js new file mode 100644 index 0000000..65e6baa --- /dev/null +++ b/live2d/node_modules/lodash/fp/toIterator.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toIterator', require('../toIterator'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toJSON.js b/live2d/node_modules/lodash/fp/toJSON.js new file mode 100644 index 0000000..2d718d0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toJSON.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toJSON', require('../toJSON'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toLength.js b/live2d/node_modules/lodash/fp/toLength.js new file mode 100644 index 0000000..b97cdd9 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toLength.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toLength', require('../toLength'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toLower.js b/live2d/node_modules/lodash/fp/toLower.js new file mode 100644 index 0000000..616ef36 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toLower.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toLower', require('../toLower'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toNumber.js b/live2d/node_modules/lodash/fp/toNumber.js new file mode 100644 index 0000000..d0c6f4d --- /dev/null +++ b/live2d/node_modules/lodash/fp/toNumber.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toNumber', require('../toNumber'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toPairs.js b/live2d/node_modules/lodash/fp/toPairs.js new file mode 100644 index 0000000..af78378 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toPairs.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toPairs', require('../toPairs'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toPairsIn.js b/live2d/node_modules/lodash/fp/toPairsIn.js new file mode 100644 index 0000000..66504ab --- /dev/null +++ b/live2d/node_modules/lodash/fp/toPairsIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toPairsIn', require('../toPairsIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toPath.js b/live2d/node_modules/lodash/fp/toPath.js new file mode 100644 index 0000000..b4d5e50 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toPath.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toPath', require('../toPath'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toPlainObject.js b/live2d/node_modules/lodash/fp/toPlainObject.js new file mode 100644 index 0000000..278bb86 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toPlainObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toPlainObject', require('../toPlainObject'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toSafeInteger.js b/live2d/node_modules/lodash/fp/toSafeInteger.js new file mode 100644 index 0000000..367a26f --- /dev/null +++ b/live2d/node_modules/lodash/fp/toSafeInteger.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toSafeInteger', require('../toSafeInteger'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toString.js b/live2d/node_modules/lodash/fp/toString.js new file mode 100644 index 0000000..cec4f8e --- /dev/null +++ b/live2d/node_modules/lodash/fp/toString.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toString', require('../toString'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/toUpper.js b/live2d/node_modules/lodash/fp/toUpper.js new file mode 100644 index 0000000..54f9a56 --- /dev/null +++ b/live2d/node_modules/lodash/fp/toUpper.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('toUpper', require('../toUpper'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/transform.js b/live2d/node_modules/lodash/fp/transform.js new file mode 100644 index 0000000..759d088 --- /dev/null +++ b/live2d/node_modules/lodash/fp/transform.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('transform', require('../transform')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trim.js b/live2d/node_modules/lodash/fp/trim.js new file mode 100644 index 0000000..e6319a7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/trim.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trim', require('../trim')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trimChars.js b/live2d/node_modules/lodash/fp/trimChars.js new file mode 100644 index 0000000..c9294de --- /dev/null +++ b/live2d/node_modules/lodash/fp/trimChars.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trimChars', require('../trim')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trimCharsEnd.js b/live2d/node_modules/lodash/fp/trimCharsEnd.js new file mode 100644 index 0000000..284bc2f --- /dev/null +++ b/live2d/node_modules/lodash/fp/trimCharsEnd.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trimCharsEnd', require('../trimEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trimCharsStart.js b/live2d/node_modules/lodash/fp/trimCharsStart.js new file mode 100644 index 0000000..ff0ee65 --- /dev/null +++ b/live2d/node_modules/lodash/fp/trimCharsStart.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trimCharsStart', require('../trimStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trimEnd.js b/live2d/node_modules/lodash/fp/trimEnd.js new file mode 100644 index 0000000..7190880 --- /dev/null +++ b/live2d/node_modules/lodash/fp/trimEnd.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trimEnd', require('../trimEnd')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/trimStart.js b/live2d/node_modules/lodash/fp/trimStart.js new file mode 100644 index 0000000..fda902c --- /dev/null +++ b/live2d/node_modules/lodash/fp/trimStart.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('trimStart', require('../trimStart')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/truncate.js b/live2d/node_modules/lodash/fp/truncate.js new file mode 100644 index 0000000..d265c1d --- /dev/null +++ b/live2d/node_modules/lodash/fp/truncate.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('truncate', require('../truncate')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unapply.js b/live2d/node_modules/lodash/fp/unapply.js new file mode 100644 index 0000000..c5dfe77 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unapply.js @@ -0,0 +1 @@ +module.exports = require('./rest'); diff --git a/live2d/node_modules/lodash/fp/unary.js b/live2d/node_modules/lodash/fp/unary.js new file mode 100644 index 0000000..286c945 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unary.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unary', require('../unary'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unescape.js b/live2d/node_modules/lodash/fp/unescape.js new file mode 100644 index 0000000..fddcb46 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unescape.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unescape', require('../unescape'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/union.js b/live2d/node_modules/lodash/fp/union.js new file mode 100644 index 0000000..ef8228d --- /dev/null +++ b/live2d/node_modules/lodash/fp/union.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('union', require('../union')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unionBy.js b/live2d/node_modules/lodash/fp/unionBy.js new file mode 100644 index 0000000..603687a --- /dev/null +++ b/live2d/node_modules/lodash/fp/unionBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unionBy', require('../unionBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unionWith.js b/live2d/node_modules/lodash/fp/unionWith.js new file mode 100644 index 0000000..65bb3a7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unionWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unionWith', require('../unionWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/uniq.js b/live2d/node_modules/lodash/fp/uniq.js new file mode 100644 index 0000000..bc18524 --- /dev/null +++ b/live2d/node_modules/lodash/fp/uniq.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('uniq', require('../uniq'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/uniqBy.js b/live2d/node_modules/lodash/fp/uniqBy.js new file mode 100644 index 0000000..634c6a8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/uniqBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('uniqBy', require('../uniqBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/uniqWith.js b/live2d/node_modules/lodash/fp/uniqWith.js new file mode 100644 index 0000000..0ec601a --- /dev/null +++ b/live2d/node_modules/lodash/fp/uniqWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('uniqWith', require('../uniqWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/uniqueId.js b/live2d/node_modules/lodash/fp/uniqueId.js new file mode 100644 index 0000000..aa8fc2f --- /dev/null +++ b/live2d/node_modules/lodash/fp/uniqueId.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('uniqueId', require('../uniqueId')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unnest.js b/live2d/node_modules/lodash/fp/unnest.js new file mode 100644 index 0000000..5d34060 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unnest.js @@ -0,0 +1 @@ +module.exports = require('./flatten'); diff --git a/live2d/node_modules/lodash/fp/unset.js b/live2d/node_modules/lodash/fp/unset.js new file mode 100644 index 0000000..ea203a0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unset.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unset', require('../unset')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unzip.js b/live2d/node_modules/lodash/fp/unzip.js new file mode 100644 index 0000000..cc364b3 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unzip.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unzip', require('../unzip'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/unzipWith.js b/live2d/node_modules/lodash/fp/unzipWith.js new file mode 100644 index 0000000..182eaa1 --- /dev/null +++ b/live2d/node_modules/lodash/fp/unzipWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('unzipWith', require('../unzipWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/update.js b/live2d/node_modules/lodash/fp/update.js new file mode 100644 index 0000000..b8ce2cc --- /dev/null +++ b/live2d/node_modules/lodash/fp/update.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('update', require('../update')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/updateWith.js b/live2d/node_modules/lodash/fp/updateWith.js new file mode 100644 index 0000000..d5e8282 --- /dev/null +++ b/live2d/node_modules/lodash/fp/updateWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('updateWith', require('../updateWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/upperCase.js b/live2d/node_modules/lodash/fp/upperCase.js new file mode 100644 index 0000000..c886f20 --- /dev/null +++ b/live2d/node_modules/lodash/fp/upperCase.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('upperCase', require('../upperCase'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/upperFirst.js b/live2d/node_modules/lodash/fp/upperFirst.js new file mode 100644 index 0000000..d8c04df --- /dev/null +++ b/live2d/node_modules/lodash/fp/upperFirst.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('upperFirst', require('../upperFirst'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/useWith.js b/live2d/node_modules/lodash/fp/useWith.js new file mode 100644 index 0000000..d8b3df5 --- /dev/null +++ b/live2d/node_modules/lodash/fp/useWith.js @@ -0,0 +1 @@ +module.exports = require('./overArgs'); diff --git a/live2d/node_modules/lodash/fp/util.js b/live2d/node_modules/lodash/fp/util.js new file mode 100644 index 0000000..18c00ba --- /dev/null +++ b/live2d/node_modules/lodash/fp/util.js @@ -0,0 +1,2 @@ +var convert = require('./convert'); +module.exports = convert(require('../util')); diff --git a/live2d/node_modules/lodash/fp/value.js b/live2d/node_modules/lodash/fp/value.js new file mode 100644 index 0000000..555eec7 --- /dev/null +++ b/live2d/node_modules/lodash/fp/value.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('value', require('../value'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/valueOf.js b/live2d/node_modules/lodash/fp/valueOf.js new file mode 100644 index 0000000..f968807 --- /dev/null +++ b/live2d/node_modules/lodash/fp/valueOf.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('valueOf', require('../valueOf'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/values.js b/live2d/node_modules/lodash/fp/values.js new file mode 100644 index 0000000..2dfc561 --- /dev/null +++ b/live2d/node_modules/lodash/fp/values.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('values', require('../values'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/valuesIn.js b/live2d/node_modules/lodash/fp/valuesIn.js new file mode 100644 index 0000000..a1b2bb8 --- /dev/null +++ b/live2d/node_modules/lodash/fp/valuesIn.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('valuesIn', require('../valuesIn'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/where.js b/live2d/node_modules/lodash/fp/where.js new file mode 100644 index 0000000..3247f64 --- /dev/null +++ b/live2d/node_modules/lodash/fp/where.js @@ -0,0 +1 @@ +module.exports = require('./conformsTo'); diff --git a/live2d/node_modules/lodash/fp/whereEq.js b/live2d/node_modules/lodash/fp/whereEq.js new file mode 100644 index 0000000..29d1e1e --- /dev/null +++ b/live2d/node_modules/lodash/fp/whereEq.js @@ -0,0 +1 @@ +module.exports = require('./isMatch'); diff --git a/live2d/node_modules/lodash/fp/without.js b/live2d/node_modules/lodash/fp/without.js new file mode 100644 index 0000000..bad9e12 --- /dev/null +++ b/live2d/node_modules/lodash/fp/without.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('without', require('../without')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/words.js b/live2d/node_modules/lodash/fp/words.js new file mode 100644 index 0000000..4a90141 --- /dev/null +++ b/live2d/node_modules/lodash/fp/words.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('words', require('../words')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrap.js b/live2d/node_modules/lodash/fp/wrap.js new file mode 100644 index 0000000..e93bd8a --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrap.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrap', require('../wrap')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrapperAt.js b/live2d/node_modules/lodash/fp/wrapperAt.js new file mode 100644 index 0000000..8f0a310 --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrapperAt.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrapperAt', require('../wrapperAt'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrapperChain.js b/live2d/node_modules/lodash/fp/wrapperChain.js new file mode 100644 index 0000000..2a48ea2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrapperChain.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrapperChain', require('../wrapperChain'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrapperLodash.js b/live2d/node_modules/lodash/fp/wrapperLodash.js new file mode 100644 index 0000000..a7162d0 --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrapperLodash.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrapperLodash', require('../wrapperLodash'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrapperReverse.js b/live2d/node_modules/lodash/fp/wrapperReverse.js new file mode 100644 index 0000000..e1481aa --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrapperReverse.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrapperReverse', require('../wrapperReverse'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/wrapperValue.js b/live2d/node_modules/lodash/fp/wrapperValue.js new file mode 100644 index 0000000..8eb9112 --- /dev/null +++ b/live2d/node_modules/lodash/fp/wrapperValue.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('wrapperValue', require('../wrapperValue'), require('./_falseOptions')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/xor.js b/live2d/node_modules/lodash/fp/xor.js new file mode 100644 index 0000000..29e2819 --- /dev/null +++ b/live2d/node_modules/lodash/fp/xor.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('xor', require('../xor')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/xorBy.js b/live2d/node_modules/lodash/fp/xorBy.js new file mode 100644 index 0000000..b355686 --- /dev/null +++ b/live2d/node_modules/lodash/fp/xorBy.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('xorBy', require('../xorBy')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/xorWith.js b/live2d/node_modules/lodash/fp/xorWith.js new file mode 100644 index 0000000..8e05739 --- /dev/null +++ b/live2d/node_modules/lodash/fp/xorWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('xorWith', require('../xorWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/zip.js b/live2d/node_modules/lodash/fp/zip.js new file mode 100644 index 0000000..69e147a --- /dev/null +++ b/live2d/node_modules/lodash/fp/zip.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('zip', require('../zip')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/zipAll.js b/live2d/node_modules/lodash/fp/zipAll.js new file mode 100644 index 0000000..efa8ccb --- /dev/null +++ b/live2d/node_modules/lodash/fp/zipAll.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('zipAll', require('../zip')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/zipObj.js b/live2d/node_modules/lodash/fp/zipObj.js new file mode 100644 index 0000000..f4a3453 --- /dev/null +++ b/live2d/node_modules/lodash/fp/zipObj.js @@ -0,0 +1 @@ +module.exports = require('./zipObject'); diff --git a/live2d/node_modules/lodash/fp/zipObject.js b/live2d/node_modules/lodash/fp/zipObject.js new file mode 100644 index 0000000..462dbb6 --- /dev/null +++ b/live2d/node_modules/lodash/fp/zipObject.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('zipObject', require('../zipObject')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/zipObjectDeep.js b/live2d/node_modules/lodash/fp/zipObjectDeep.js new file mode 100644 index 0000000..53a5d33 --- /dev/null +++ b/live2d/node_modules/lodash/fp/zipObjectDeep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('zipObjectDeep', require('../zipObjectDeep')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fp/zipWith.js b/live2d/node_modules/lodash/fp/zipWith.js new file mode 100644 index 0000000..c5cf9e2 --- /dev/null +++ b/live2d/node_modules/lodash/fp/zipWith.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('zipWith', require('../zipWith')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/live2d/node_modules/lodash/fromPairs.js b/live2d/node_modules/lodash/fromPairs.js new file mode 100644 index 0000000..ee7940d --- /dev/null +++ b/live2d/node_modules/lodash/fromPairs.js @@ -0,0 +1,28 @@ +/** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ +function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; +} + +module.exports = fromPairs; diff --git a/live2d/node_modules/lodash/function.js b/live2d/node_modules/lodash/function.js new file mode 100644 index 0000000..b0fc6d9 --- /dev/null +++ b/live2d/node_modules/lodash/function.js @@ -0,0 +1,25 @@ +module.exports = { + 'after': require('./after'), + 'ary': require('./ary'), + 'before': require('./before'), + 'bind': require('./bind'), + 'bindKey': require('./bindKey'), + 'curry': require('./curry'), + 'curryRight': require('./curryRight'), + 'debounce': require('./debounce'), + 'defer': require('./defer'), + 'delay': require('./delay'), + 'flip': require('./flip'), + 'memoize': require('./memoize'), + 'negate': require('./negate'), + 'once': require('./once'), + 'overArgs': require('./overArgs'), + 'partial': require('./partial'), + 'partialRight': require('./partialRight'), + 'rearg': require('./rearg'), + 'rest': require('./rest'), + 'spread': require('./spread'), + 'throttle': require('./throttle'), + 'unary': require('./unary'), + 'wrap': require('./wrap') +}; diff --git a/live2d/node_modules/lodash/functions.js b/live2d/node_modules/lodash/functions.js new file mode 100644 index 0000000..9722928 --- /dev/null +++ b/live2d/node_modules/lodash/functions.js @@ -0,0 +1,31 @@ +var baseFunctions = require('./_baseFunctions'), + keys = require('./keys'); + +/** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ +function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); +} + +module.exports = functions; diff --git a/live2d/node_modules/lodash/functionsIn.js b/live2d/node_modules/lodash/functionsIn.js new file mode 100644 index 0000000..f00345d --- /dev/null +++ b/live2d/node_modules/lodash/functionsIn.js @@ -0,0 +1,31 @@ +var baseFunctions = require('./_baseFunctions'), + keysIn = require('./keysIn'); + +/** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ +function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); +} + +module.exports = functionsIn; diff --git a/live2d/node_modules/lodash/get.js b/live2d/node_modules/lodash/get.js new file mode 100644 index 0000000..8805ff9 --- /dev/null +++ b/live2d/node_modules/lodash/get.js @@ -0,0 +1,33 @@ +var baseGet = require('./_baseGet'); + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} + +module.exports = get; diff --git a/live2d/node_modules/lodash/groupBy.js b/live2d/node_modules/lodash/groupBy.js new file mode 100644 index 0000000..babf4f6 --- /dev/null +++ b/live2d/node_modules/lodash/groupBy.js @@ -0,0 +1,41 @@ +var baseAssignValue = require('./_baseAssignValue'), + createAggregator = require('./_createAggregator'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee shorthand. + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + baseAssignValue(result, key, [value]); + } +}); + +module.exports = groupBy; diff --git a/live2d/node_modules/lodash/gt.js b/live2d/node_modules/lodash/gt.js new file mode 100644 index 0000000..3a66282 --- /dev/null +++ b/live2d/node_modules/lodash/gt.js @@ -0,0 +1,29 @@ +var baseGt = require('./_baseGt'), + createRelationalOperation = require('./_createRelationalOperation'); + +/** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ +var gt = createRelationalOperation(baseGt); + +module.exports = gt; diff --git a/live2d/node_modules/lodash/gte.js b/live2d/node_modules/lodash/gte.js new file mode 100644 index 0000000..4180a68 --- /dev/null +++ b/live2d/node_modules/lodash/gte.js @@ -0,0 +1,30 @@ +var createRelationalOperation = require('./_createRelationalOperation'); + +/** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ +var gte = createRelationalOperation(function(value, other) { + return value >= other; +}); + +module.exports = gte; diff --git a/live2d/node_modules/lodash/has.js b/live2d/node_modules/lodash/has.js new file mode 100644 index 0000000..34df55e --- /dev/null +++ b/live2d/node_modules/lodash/has.js @@ -0,0 +1,35 @@ +var baseHas = require('./_baseHas'), + hasPath = require('./_hasPath'); + +/** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ +function has(object, path) { + return object != null && hasPath(object, path, baseHas); +} + +module.exports = has; diff --git a/live2d/node_modules/lodash/hasIn.js b/live2d/node_modules/lodash/hasIn.js new file mode 100644 index 0000000..06a3686 --- /dev/null +++ b/live2d/node_modules/lodash/hasIn.js @@ -0,0 +1,34 @@ +var baseHasIn = require('./_baseHasIn'), + hasPath = require('./_hasPath'); + +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); +} + +module.exports = hasIn; diff --git a/live2d/node_modules/lodash/head.js b/live2d/node_modules/lodash/head.js new file mode 100644 index 0000000..dee9d1f --- /dev/null +++ b/live2d/node_modules/lodash/head.js @@ -0,0 +1,23 @@ +/** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ +function head(array) { + return (array && array.length) ? array[0] : undefined; +} + +module.exports = head; diff --git a/live2d/node_modules/lodash/identity.js b/live2d/node_modules/lodash/identity.js new file mode 100644 index 0000000..2d5d963 --- /dev/null +++ b/live2d/node_modules/lodash/identity.js @@ -0,0 +1,21 @@ +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} + +module.exports = identity; diff --git a/live2d/node_modules/lodash/inRange.js b/live2d/node_modules/lodash/inRange.js new file mode 100644 index 0000000..f20728d --- /dev/null +++ b/live2d/node_modules/lodash/inRange.js @@ -0,0 +1,55 @@ +var baseInRange = require('./_baseInRange'), + toFinite = require('./toFinite'), + toNumber = require('./toNumber'); + +/** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ +function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); +} + +module.exports = inRange; diff --git a/live2d/node_modules/lodash/includes.js b/live2d/node_modules/lodash/includes.js new file mode 100644 index 0000000..ae0deed --- /dev/null +++ b/live2d/node_modules/lodash/includes.js @@ -0,0 +1,53 @@ +var baseIndexOf = require('./_baseIndexOf'), + isArrayLike = require('./isArrayLike'), + isString = require('./isString'), + toInteger = require('./toInteger'), + values = require('./values'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ +function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); +} + +module.exports = includes; diff --git a/live2d/node_modules/lodash/index.js b/live2d/node_modules/lodash/index.js new file mode 100644 index 0000000..5d063e2 --- /dev/null +++ b/live2d/node_modules/lodash/index.js @@ -0,0 +1 @@ +module.exports = require('./lodash'); \ No newline at end of file diff --git a/live2d/node_modules/lodash/indexOf.js b/live2d/node_modules/lodash/indexOf.js new file mode 100644 index 0000000..3c644af --- /dev/null +++ b/live2d/node_modules/lodash/indexOf.js @@ -0,0 +1,42 @@ +var baseIndexOf = require('./_baseIndexOf'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ +function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); +} + +module.exports = indexOf; diff --git a/live2d/node_modules/lodash/initial.js b/live2d/node_modules/lodash/initial.js new file mode 100644 index 0000000..f47fc50 --- /dev/null +++ b/live2d/node_modules/lodash/initial.js @@ -0,0 +1,22 @@ +var baseSlice = require('./_baseSlice'); + +/** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ +function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; +} + +module.exports = initial; diff --git a/live2d/node_modules/lodash/intersection.js b/live2d/node_modules/lodash/intersection.js new file mode 100644 index 0000000..a94c135 --- /dev/null +++ b/live2d/node_modules/lodash/intersection.js @@ -0,0 +1,30 @@ +var arrayMap = require('./_arrayMap'), + baseIntersection = require('./_baseIntersection'), + baseRest = require('./_baseRest'), + castArrayLikeObject = require('./_castArrayLikeObject'); + +/** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ +var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; +}); + +module.exports = intersection; diff --git a/live2d/node_modules/lodash/intersectionBy.js b/live2d/node_modules/lodash/intersectionBy.js new file mode 100644 index 0000000..31461aa --- /dev/null +++ b/live2d/node_modules/lodash/intersectionBy.js @@ -0,0 +1,45 @@ +var arrayMap = require('./_arrayMap'), + baseIntersection = require('./_baseIntersection'), + baseIteratee = require('./_baseIteratee'), + baseRest = require('./_baseRest'), + castArrayLikeObject = require('./_castArrayLikeObject'), + last = require('./last'); + +/** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ +var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, baseIteratee(iteratee, 2)) + : []; +}); + +module.exports = intersectionBy; diff --git a/live2d/node_modules/lodash/intersectionWith.js b/live2d/node_modules/lodash/intersectionWith.js new file mode 100644 index 0000000..63cabfa --- /dev/null +++ b/live2d/node_modules/lodash/intersectionWith.js @@ -0,0 +1,41 @@ +var arrayMap = require('./_arrayMap'), + baseIntersection = require('./_baseIntersection'), + baseRest = require('./_baseRest'), + castArrayLikeObject = require('./_castArrayLikeObject'), + last = require('./last'); + +/** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ +var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined, comparator) + : []; +}); + +module.exports = intersectionWith; diff --git a/live2d/node_modules/lodash/invert.js b/live2d/node_modules/lodash/invert.js new file mode 100644 index 0000000..8c47950 --- /dev/null +++ b/live2d/node_modules/lodash/invert.js @@ -0,0 +1,42 @@ +var constant = require('./constant'), + createInverter = require('./_createInverter'), + identity = require('./identity'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ +var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; +}, constant(identity)); + +module.exports = invert; diff --git a/live2d/node_modules/lodash/invertBy.js b/live2d/node_modules/lodash/invertBy.js new file mode 100644 index 0000000..3f4f7e5 --- /dev/null +++ b/live2d/node_modules/lodash/invertBy.js @@ -0,0 +1,56 @@ +var baseIteratee = require('./_baseIteratee'), + createInverter = require('./_createInverter'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ +var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } +}, baseIteratee); + +module.exports = invertBy; diff --git a/live2d/node_modules/lodash/invoke.js b/live2d/node_modules/lodash/invoke.js new file mode 100644 index 0000000..97d51eb --- /dev/null +++ b/live2d/node_modules/lodash/invoke.js @@ -0,0 +1,24 @@ +var baseInvoke = require('./_baseInvoke'), + baseRest = require('./_baseRest'); + +/** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ +var invoke = baseRest(baseInvoke); + +module.exports = invoke; diff --git a/live2d/node_modules/lodash/invokeMap.js b/live2d/node_modules/lodash/invokeMap.js new file mode 100644 index 0000000..8da5126 --- /dev/null +++ b/live2d/node_modules/lodash/invokeMap.js @@ -0,0 +1,41 @@ +var apply = require('./_apply'), + baseEach = require('./_baseEach'), + baseInvoke = require('./_baseInvoke'), + baseRest = require('./_baseRest'), + isArrayLike = require('./isArrayLike'); + +/** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ +var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; +}); + +module.exports = invokeMap; diff --git a/live2d/node_modules/lodash/isArguments.js b/live2d/node_modules/lodash/isArguments.js new file mode 100644 index 0000000..8b9ed66 --- /dev/null +++ b/live2d/node_modules/lodash/isArguments.js @@ -0,0 +1,36 @@ +var baseIsArguments = require('./_baseIsArguments'), + isObjectLike = require('./isObjectLike'); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.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.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +module.exports = isArguments; diff --git a/live2d/node_modules/lodash/isArray.js b/live2d/node_modules/lodash/isArray.js new file mode 100644 index 0000000..88ab55f --- /dev/null +++ b/live2d/node_modules/lodash/isArray.js @@ -0,0 +1,26 @@ +/** + * 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; + +module.exports = isArray; diff --git a/live2d/node_modules/lodash/isArrayBuffer.js b/live2d/node_modules/lodash/isArrayBuffer.js new file mode 100644 index 0000000..12904a6 --- /dev/null +++ b/live2d/node_modules/lodash/isArrayBuffer.js @@ -0,0 +1,27 @@ +var baseIsArrayBuffer = require('./_baseIsArrayBuffer'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* Node.js helper references. */ +var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer; + +/** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ +var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + +module.exports = isArrayBuffer; diff --git a/live2d/node_modules/lodash/isArrayLike.js b/live2d/node_modules/lodash/isArrayLike.js new file mode 100644 index 0000000..0f96680 --- /dev/null +++ b/live2d/node_modules/lodash/isArrayLike.js @@ -0,0 +1,33 @@ +var isFunction = require('./isFunction'), + isLength = require('./isLength'); + +/** + * 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); +} + +module.exports = isArrayLike; diff --git a/live2d/node_modules/lodash/isArrayLikeObject.js b/live2d/node_modules/lodash/isArrayLikeObject.js new file mode 100644 index 0000000..6c4812a --- /dev/null +++ b/live2d/node_modules/lodash/isArrayLikeObject.js @@ -0,0 +1,33 @@ +var isArrayLike = require('./isArrayLike'), + isObjectLike = require('./isObjectLike'); + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +module.exports = isArrayLikeObject; diff --git a/live2d/node_modules/lodash/isBoolean.js b/live2d/node_modules/lodash/isBoolean.js new file mode 100644 index 0000000..a43ed4b --- /dev/null +++ b/live2d/node_modules/lodash/isBoolean.js @@ -0,0 +1,29 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var boolTag = '[object Boolean]'; + +/** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ +function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); +} + +module.exports = isBoolean; diff --git a/live2d/node_modules/lodash/isBuffer.js b/live2d/node_modules/lodash/isBuffer.js new file mode 100644 index 0000000..c103cc7 --- /dev/null +++ b/live2d/node_modules/lodash/isBuffer.js @@ -0,0 +1,38 @@ +var root = require('./_root'), + stubFalse = require('./stubFalse'); + +/** 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; + +/* 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; + +module.exports = isBuffer; diff --git a/live2d/node_modules/lodash/isDate.js b/live2d/node_modules/lodash/isDate.js new file mode 100644 index 0000000..7f0209f --- /dev/null +++ b/live2d/node_modules/lodash/isDate.js @@ -0,0 +1,27 @@ +var baseIsDate = require('./_baseIsDate'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* Node.js helper references. */ +var nodeIsDate = nodeUtil && nodeUtil.isDate; + +/** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ +var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + +module.exports = isDate; diff --git a/live2d/node_modules/lodash/isElement.js b/live2d/node_modules/lodash/isElement.js new file mode 100644 index 0000000..76ae29c --- /dev/null +++ b/live2d/node_modules/lodash/isElement.js @@ -0,0 +1,25 @@ +var isObjectLike = require('./isObjectLike'), + isPlainObject = require('./isPlainObject'); + +/** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ +function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); +} + +module.exports = isElement; diff --git a/live2d/node_modules/lodash/isEmpty.js b/live2d/node_modules/lodash/isEmpty.js new file mode 100644 index 0000000..3597294 --- /dev/null +++ b/live2d/node_modules/lodash/isEmpty.js @@ -0,0 +1,77 @@ +var baseKeys = require('./_baseKeys'), + getTag = require('./_getTag'), + isArguments = require('./isArguments'), + isArray = require('./isArray'), + isArrayLike = require('./isArrayLike'), + isBuffer = require('./isBuffer'), + isPrototype = require('./_isPrototype'), + isTypedArray = require('./isTypedArray'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]', + setTag = '[object Set]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ +function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; +} + +module.exports = isEmpty; diff --git a/live2d/node_modules/lodash/isEqual.js b/live2d/node_modules/lodash/isEqual.js new file mode 100644 index 0000000..5e23e76 --- /dev/null +++ b/live2d/node_modules/lodash/isEqual.js @@ -0,0 +1,35 @@ +var baseIsEqual = require('./_baseIsEqual'); + +/** + * 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); +} + +module.exports = isEqual; diff --git a/live2d/node_modules/lodash/isEqualWith.js b/live2d/node_modules/lodash/isEqualWith.js new file mode 100644 index 0000000..21bdc7f --- /dev/null +++ b/live2d/node_modules/lodash/isEqualWith.js @@ -0,0 +1,41 @@ +var baseIsEqual = require('./_baseIsEqual'); + +/** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ +function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; +} + +module.exports = isEqualWith; diff --git a/live2d/node_modules/lodash/isError.js b/live2d/node_modules/lodash/isError.js new file mode 100644 index 0000000..b4f41e0 --- /dev/null +++ b/live2d/node_modules/lodash/isError.js @@ -0,0 +1,36 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'), + isPlainObject = require('./isPlainObject'); + +/** `Object#toString` result references. */ +var domExcTag = '[object DOMException]', + errorTag = '[object Error]'; + +/** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ +function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); +} + +module.exports = isError; diff --git a/live2d/node_modules/lodash/isFinite.js b/live2d/node_modules/lodash/isFinite.js new file mode 100644 index 0000000..601842b --- /dev/null +++ b/live2d/node_modules/lodash/isFinite.js @@ -0,0 +1,36 @@ +var root = require('./_root'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = root.isFinite; + +/** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ +function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); +} + +module.exports = isFinite; diff --git a/live2d/node_modules/lodash/isFunction.js b/live2d/node_modules/lodash/isFunction.js new file mode 100644 index 0000000..907a8cd --- /dev/null +++ b/live2d/node_modules/lodash/isFunction.js @@ -0,0 +1,37 @@ +var baseGetTag = require('./_baseGetTag'), + isObject = require('./isObject'); + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]', + funcTag = '[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 || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +module.exports = isFunction; diff --git a/live2d/node_modules/lodash/isInteger.js b/live2d/node_modules/lodash/isInteger.js new file mode 100644 index 0000000..66aa87d --- /dev/null +++ b/live2d/node_modules/lodash/isInteger.js @@ -0,0 +1,33 @@ +var toInteger = require('./toInteger'); + +/** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ +function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); +} + +module.exports = isInteger; diff --git a/live2d/node_modules/lodash/isLength.js b/live2d/node_modules/lodash/isLength.js new file mode 100644 index 0000000..3a95caa --- /dev/null +++ b/live2d/node_modules/lodash/isLength.js @@ -0,0 +1,35 @@ +/** 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; +} + +module.exports = isLength; diff --git a/live2d/node_modules/lodash/isMap.js b/live2d/node_modules/lodash/isMap.js new file mode 100644 index 0000000..44f8517 --- /dev/null +++ b/live2d/node_modules/lodash/isMap.js @@ -0,0 +1,27 @@ +var baseIsMap = require('./_baseIsMap'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* 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; + +module.exports = isMap; diff --git a/live2d/node_modules/lodash/isMatch.js b/live2d/node_modules/lodash/isMatch.js new file mode 100644 index 0000000..9773a18 --- /dev/null +++ b/live2d/node_modules/lodash/isMatch.js @@ -0,0 +1,36 @@ +var baseIsMatch = require('./_baseIsMatch'), + getMatchData = require('./_getMatchData'); + +/** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ +function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); +} + +module.exports = isMatch; diff --git a/live2d/node_modules/lodash/isMatchWith.js b/live2d/node_modules/lodash/isMatchWith.js new file mode 100644 index 0000000..187b6a6 --- /dev/null +++ b/live2d/node_modules/lodash/isMatchWith.js @@ -0,0 +1,41 @@ +var baseIsMatch = require('./_baseIsMatch'), + getMatchData = require('./_getMatchData'); + +/** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ +function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseIsMatch(object, source, getMatchData(source), customizer); +} + +module.exports = isMatchWith; diff --git a/live2d/node_modules/lodash/isNaN.js b/live2d/node_modules/lodash/isNaN.js new file mode 100644 index 0000000..7d0d783 --- /dev/null +++ b/live2d/node_modules/lodash/isNaN.js @@ -0,0 +1,38 @@ +var isNumber = require('./isNumber'); + +/** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ +function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; +} + +module.exports = isNaN; diff --git a/live2d/node_modules/lodash/isNative.js b/live2d/node_modules/lodash/isNative.js new file mode 100644 index 0000000..f0cb8d5 --- /dev/null +++ b/live2d/node_modules/lodash/isNative.js @@ -0,0 +1,40 @@ +var baseIsNative = require('./_baseIsNative'), + isMaskable = require('./_isMaskable'); + +/** Error message constants. */ +var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.'; + +/** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ +function isNative(value) { + if (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); +} + +module.exports = isNative; diff --git a/live2d/node_modules/lodash/isNil.js b/live2d/node_modules/lodash/isNil.js new file mode 100644 index 0000000..79f0505 --- /dev/null +++ b/live2d/node_modules/lodash/isNil.js @@ -0,0 +1,25 @@ +/** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ +function isNil(value) { + return value == null; +} + +module.exports = isNil; diff --git a/live2d/node_modules/lodash/isNull.js b/live2d/node_modules/lodash/isNull.js new file mode 100644 index 0000000..c0a374d --- /dev/null +++ b/live2d/node_modules/lodash/isNull.js @@ -0,0 +1,22 @@ +/** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ +function isNull(value) { + return value === null; +} + +module.exports = isNull; diff --git a/live2d/node_modules/lodash/isNumber.js b/live2d/node_modules/lodash/isNumber.js new file mode 100644 index 0000000..cd34ee4 --- /dev/null +++ b/live2d/node_modules/lodash/isNumber.js @@ -0,0 +1,38 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var numberTag = '[object Number]'; + +/** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ +function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); +} + +module.exports = isNumber; diff --git a/live2d/node_modules/lodash/isObject.js b/live2d/node_modules/lodash/isObject.js new file mode 100644 index 0000000..1dc8939 --- /dev/null +++ b/live2d/node_modules/lodash/isObject.js @@ -0,0 +1,31 @@ +/** + * 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'); +} + +module.exports = isObject; diff --git a/live2d/node_modules/lodash/isObjectLike.js b/live2d/node_modules/lodash/isObjectLike.js new file mode 100644 index 0000000..301716b --- /dev/null +++ b/live2d/node_modules/lodash/isObjectLike.js @@ -0,0 +1,29 @@ +/** + * 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'; +} + +module.exports = isObjectLike; diff --git a/live2d/node_modules/lodash/isPlainObject.js b/live2d/node_modules/lodash/isPlainObject.js new file mode 100644 index 0000000..2387373 --- /dev/null +++ b/live2d/node_modules/lodash/isPlainObject.js @@ -0,0 +1,62 @@ +var baseGetTag = require('./_baseGetTag'), + getPrototype = require('./_getPrototype'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var objectTag = '[object Object]'; + +/** Used for built-in method references. */ +var funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to infer the `Object` constructor. */ +var objectCtorString = funcToString.call(Object); + +/** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ +function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; +} + +module.exports = isPlainObject; diff --git a/live2d/node_modules/lodash/isRegExp.js b/live2d/node_modules/lodash/isRegExp.js new file mode 100644 index 0000000..76c9b6e --- /dev/null +++ b/live2d/node_modules/lodash/isRegExp.js @@ -0,0 +1,27 @@ +var baseIsRegExp = require('./_baseIsRegExp'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* Node.js helper references. */ +var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; + +/** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ +var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + +module.exports = isRegExp; diff --git a/live2d/node_modules/lodash/isSafeInteger.js b/live2d/node_modules/lodash/isSafeInteger.js new file mode 100644 index 0000000..2a48526 --- /dev/null +++ b/live2d/node_modules/lodash/isSafeInteger.js @@ -0,0 +1,37 @@ +var isInteger = require('./isInteger'); + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ +function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; +} + +module.exports = isSafeInteger; diff --git a/live2d/node_modules/lodash/isSet.js b/live2d/node_modules/lodash/isSet.js new file mode 100644 index 0000000..ab88bdf --- /dev/null +++ b/live2d/node_modules/lodash/isSet.js @@ -0,0 +1,27 @@ +var baseIsSet = require('./_baseIsSet'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* 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; + +module.exports = isSet; diff --git a/live2d/node_modules/lodash/isString.js b/live2d/node_modules/lodash/isString.js new file mode 100644 index 0000000..627eb9c --- /dev/null +++ b/live2d/node_modules/lodash/isString.js @@ -0,0 +1,30 @@ +var baseGetTag = require('./_baseGetTag'), + isArray = require('./isArray'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var stringTag = '[object String]'; + +/** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ +function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); +} + +module.exports = isString; diff --git a/live2d/node_modules/lodash/isSymbol.js b/live2d/node_modules/lodash/isSymbol.js new file mode 100644 index 0000000..dfb60b9 --- /dev/null +++ b/live2d/node_modules/lodash/isSymbol.js @@ -0,0 +1,29 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +module.exports = isSymbol; diff --git a/live2d/node_modules/lodash/isTypedArray.js b/live2d/node_modules/lodash/isTypedArray.js new file mode 100644 index 0000000..da3f8dd --- /dev/null +++ b/live2d/node_modules/lodash/isTypedArray.js @@ -0,0 +1,27 @@ +var baseIsTypedArray = require('./_baseIsTypedArray'), + baseUnary = require('./_baseUnary'), + nodeUtil = require('./_nodeUtil'); + +/* 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; + +module.exports = isTypedArray; diff --git a/live2d/node_modules/lodash/isUndefined.js b/live2d/node_modules/lodash/isUndefined.js new file mode 100644 index 0000000..377d121 --- /dev/null +++ b/live2d/node_modules/lodash/isUndefined.js @@ -0,0 +1,22 @@ +/** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ +function isUndefined(value) { + return value === undefined; +} + +module.exports = isUndefined; diff --git a/live2d/node_modules/lodash/isWeakMap.js b/live2d/node_modules/lodash/isWeakMap.js new file mode 100644 index 0000000..8d36f66 --- /dev/null +++ b/live2d/node_modules/lodash/isWeakMap.js @@ -0,0 +1,28 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var weakMapTag = '[object WeakMap]'; + +/** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ +function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; +} + +module.exports = isWeakMap; diff --git a/live2d/node_modules/lodash/isWeakSet.js b/live2d/node_modules/lodash/isWeakSet.js new file mode 100644 index 0000000..e628b26 --- /dev/null +++ b/live2d/node_modules/lodash/isWeakSet.js @@ -0,0 +1,28 @@ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var weakSetTag = '[object WeakSet]'; + +/** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ +function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; +} + +module.exports = isWeakSet; diff --git a/live2d/node_modules/lodash/iteratee.js b/live2d/node_modules/lodash/iteratee.js new file mode 100644 index 0000000..61b73a8 --- /dev/null +++ b/live2d/node_modules/lodash/iteratee.js @@ -0,0 +1,53 @@ +var baseClone = require('./_baseClone'), + baseIteratee = require('./_baseIteratee'); + +/** Used to compose bitmasks for cloning. */ +var CLONE_DEEP_FLAG = 1; + +/** + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name, the created function returns the + * property value for a given element. If `func` is an array or object, the + * created function returns `true` for elements that contain the equivalent + * source properties, otherwise it returns `false`. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Util + * @param {*} [func=_.identity] The value to convert to a callback. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); + * // => [{ 'user': 'barney', 'age': 36, 'active': true }] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, _.iteratee(['user', 'fred'])); + * // => [{ 'user': 'fred', 'age': 40 }] + * + * // The `_.property` iteratee shorthand. + * _.map(users, _.iteratee('user')); + * // => ['barney', 'fred'] + * + * // Create custom iteratee shorthands. + * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { + * return !_.isRegExp(func) ? iteratee(func) : function(string) { + * return func.test(string); + * }; + * }); + * + * _.filter(['abc', 'def'], /ef/); + * // => ['def'] + */ +function iteratee(func) { + return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); +} + +module.exports = iteratee; diff --git a/live2d/node_modules/lodash/join.js b/live2d/node_modules/lodash/join.js new file mode 100644 index 0000000..45de079 --- /dev/null +++ b/live2d/node_modules/lodash/join.js @@ -0,0 +1,26 @@ +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeJoin = arrayProto.join; + +/** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ +function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); +} + +module.exports = join; diff --git a/live2d/node_modules/lodash/kebabCase.js b/live2d/node_modules/lodash/kebabCase.js new file mode 100644 index 0000000..8a52be6 --- /dev/null +++ b/live2d/node_modules/lodash/kebabCase.js @@ -0,0 +1,28 @@ +var createCompounder = require('./_createCompounder'); + +/** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__FOO_BAR__'); + * // => 'foo-bar' + */ +var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); +}); + +module.exports = kebabCase; diff --git a/live2d/node_modules/lodash/keyBy.js b/live2d/node_modules/lodash/keyBy.js new file mode 100644 index 0000000..acc007a --- /dev/null +++ b/live2d/node_modules/lodash/keyBy.js @@ -0,0 +1,36 @@ +var baseAssignValue = require('./_baseAssignValue'), + createAggregator = require('./_createAggregator'); + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ +var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); +}); + +module.exports = keyBy; diff --git a/live2d/node_modules/lodash/keys.js b/live2d/node_modules/lodash/keys.js new file mode 100644 index 0000000..d143c71 --- /dev/null +++ b/live2d/node_modules/lodash/keys.js @@ -0,0 +1,37 @@ +var arrayLikeKeys = require('./_arrayLikeKeys'), + baseKeys = require('./_baseKeys'), + isArrayLike = require('./isArrayLike'); + +/** + * 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); +} + +module.exports = keys; diff --git a/live2d/node_modules/lodash/keysIn.js b/live2d/node_modules/lodash/keysIn.js new file mode 100644 index 0000000..a62308f --- /dev/null +++ b/live2d/node_modules/lodash/keysIn.js @@ -0,0 +1,32 @@ +var arrayLikeKeys = require('./_arrayLikeKeys'), + baseKeysIn = require('./_baseKeysIn'), + isArrayLike = require('./isArrayLike'); + +/** + * 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); +} + +module.exports = keysIn; diff --git a/live2d/node_modules/lodash/lang.js b/live2d/node_modules/lodash/lang.js new file mode 100644 index 0000000..a396216 --- /dev/null +++ b/live2d/node_modules/lodash/lang.js @@ -0,0 +1,58 @@ +module.exports = { + 'castArray': require('./castArray'), + 'clone': require('./clone'), + 'cloneDeep': require('./cloneDeep'), + 'cloneDeepWith': require('./cloneDeepWith'), + 'cloneWith': require('./cloneWith'), + 'conformsTo': require('./conformsTo'), + 'eq': require('./eq'), + 'gt': require('./gt'), + 'gte': require('./gte'), + 'isArguments': require('./isArguments'), + 'isArray': require('./isArray'), + 'isArrayBuffer': require('./isArrayBuffer'), + 'isArrayLike': require('./isArrayLike'), + 'isArrayLikeObject': require('./isArrayLikeObject'), + 'isBoolean': require('./isBoolean'), + 'isBuffer': require('./isBuffer'), + 'isDate': require('./isDate'), + 'isElement': require('./isElement'), + 'isEmpty': require('./isEmpty'), + 'isEqual': require('./isEqual'), + 'isEqualWith': require('./isEqualWith'), + 'isError': require('./isError'), + 'isFinite': require('./isFinite'), + 'isFunction': require('./isFunction'), + 'isInteger': require('./isInteger'), + 'isLength': require('./isLength'), + 'isMap': require('./isMap'), + 'isMatch': require('./isMatch'), + 'isMatchWith': require('./isMatchWith'), + 'isNaN': require('./isNaN'), + 'isNative': require('./isNative'), + 'isNil': require('./isNil'), + 'isNull': require('./isNull'), + 'isNumber': require('./isNumber'), + 'isObject': require('./isObject'), + 'isObjectLike': require('./isObjectLike'), + 'isPlainObject': require('./isPlainObject'), + 'isRegExp': require('./isRegExp'), + 'isSafeInteger': require('./isSafeInteger'), + 'isSet': require('./isSet'), + 'isString': require('./isString'), + 'isSymbol': require('./isSymbol'), + 'isTypedArray': require('./isTypedArray'), + 'isUndefined': require('./isUndefined'), + 'isWeakMap': require('./isWeakMap'), + 'isWeakSet': require('./isWeakSet'), + 'lt': require('./lt'), + 'lte': require('./lte'), + 'toArray': require('./toArray'), + 'toFinite': require('./toFinite'), + 'toInteger': require('./toInteger'), + 'toLength': require('./toLength'), + 'toNumber': require('./toNumber'), + 'toPlainObject': require('./toPlainObject'), + 'toSafeInteger': require('./toSafeInteger'), + 'toString': require('./toString') +}; diff --git a/live2d/node_modules/lodash/last.js b/live2d/node_modules/lodash/last.js new file mode 100644 index 0000000..cad1eaf --- /dev/null +++ b/live2d/node_modules/lodash/last.js @@ -0,0 +1,20 @@ +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; +} + +module.exports = last; diff --git a/live2d/node_modules/lodash/lastIndexOf.js b/live2d/node_modules/lodash/lastIndexOf.js new file mode 100644 index 0000000..dabfb61 --- /dev/null +++ b/live2d/node_modules/lodash/lastIndexOf.js @@ -0,0 +1,46 @@ +var baseFindIndex = require('./_baseFindIndex'), + baseIsNaN = require('./_baseIsNaN'), + strictLastIndexOf = require('./_strictLastIndexOf'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ +function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); +} + +module.exports = lastIndexOf; diff --git a/live2d/node_modules/lodash/lodash.js b/live2d/node_modules/lodash/lodash.js new file mode 100644 index 0000000..4131e93 --- /dev/null +++ b/live2d/node_modules/lodash/lodash.js @@ -0,0 +1,17209 @@ +/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + + /** Error message constants. */ + var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', + FUNC_ERROR_TEXT = 'Expected a function', + INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as the internal argument placeholder. */ + var PLACEHOLDER = '__lodash_placeholder__'; + + /** Used to compose bitmasks for cloning. */ + var CLONE_DEEP_FLAG = 1, + CLONE_FLAT_FLAG = 2, + CLONE_SYMBOLS_FLAG = 4; + + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_BIND_KEY_FLAG = 2, + WRAP_CURRY_BOUND_FLAG = 4, + WRAP_CURRY_FLAG = 8, + WRAP_CURRY_RIGHT_FLAG = 16, + WRAP_PARTIAL_FLAG = 32, + WRAP_PARTIAL_RIGHT_FLAG = 64, + WRAP_ARY_FLAG = 128, + WRAP_REARG_FLAG = 256, + WRAP_FLIP_FLAG = 512; + + /** Used as default options for `_.truncate`. */ + var DEFAULT_TRUNC_LENGTH = 30, + DEFAULT_TRUNC_OMISSION = '...'; + + /** Used to detect hot functions by number of calls within a span of milliseconds. */ + var HOT_COUNT = 800, + HOT_SPAN = 16; + + /** Used to indicate the type of lazy iteratees. */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** Used as references for the maximum length and index of an array. */ + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; + + /** Used to associate wrap methods with their bit flags. */ + var wrapFlags = [ + ['ary', WRAP_ARY_FLAG], + ['bind', WRAP_BIND_FLAG], + ['bindKey', WRAP_BIND_KEY_FLAG], + ['curry', WRAP_CURRY_FLAG], + ['curryRight', WRAP_CURRY_RIGHT_FLAG], + ['flip', WRAP_FLIP_FLAG], + ['partial', WRAP_PARTIAL_FLAG], + ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], + ['rearg', WRAP_REARG_FLAG] + ]; + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + domExcTag = '[object DOMException]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]', + weakSetTag = '[object WeakSet]'; + + 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 match empty string literals in compiled template source. */ + var reEmptyStringLeading = /\b__p \+= '';/g, + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; + + /** Used to match HTML entities and HTML characters. */ + var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reUnescapedHtml = /[&<>"']/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source), + reHasUnescapedHtml = RegExp(reUnescapedHtml.source); + + /** Used to match template delimiters. */ + var reEscape = /<%-([\s\S]+?)%>/g, + reEvaluate = /<%([\s\S]+?)%>/g, + reInterpolate = /<%=([\s\S]+?)%>/g; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** Used to match wrap detail comments. */ + var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, + reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, + reSplitDetails = /,? & /; + + /** Used to match words composed of alphanumeric characters. */ + var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + + /** + * Used to validate the `validate` option in `_.template` variable. + * + * Forbids characters which could potentially change the meaning of the function argument definition: + * - "()," (modification of function parameters) + * - "=" (default value) + * - "[]{}" (destructuring of function parameters) + * - "/" (beginning of a comment) + * - whitespace + */ + var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Used to match + * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). + */ + var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; + + /** Used to match `RegExp` flags from their coerced string values. */ + var reFlags = /\w*$/; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Used to match Latin Unicode letters (excluding mathematical operators). */ + var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + + /** Used to ensure capturing order of template delimiters. */ + var reNoMatch = /($^)/; + + /** Used to match unescaped characters in compiled string literals. */ + var reUnescapedString = /['\n\r\u2028\u2029\\]/g; + + /** Used to compose unicode character classes. */ + var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f', + reComboHalfMarksRange = '\\ufe20-\\ufe2f', + rsComboSymbolsRange = '\\u20d0-\\u20ff', + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + + /** Used to compose unicode capture groups. */ + var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + + /** Used to compose unicode regexes. */ + var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', + rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', + rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + + /** Used to match apostrophes. */ + var reApos = RegExp(rsApos, 'g'); + + /** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ + var reComboMark = RegExp(rsCombo, 'g'); + + /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ + var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + + /** Used to match complex or compound words. */ + var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', + rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, + rsUpper + '+' + rsOptContrUpper, + rsOrdUpper, + rsOrdLower, + rsDigits, + rsEmoji + ].join('|'), 'g'); + + /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + + /** Used to detect strings that need a more robust regexp to match words. */ + var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + + /** Used to assign default `context` object properties. */ + var contextProps = [ + 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', + 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', + 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', + '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + ]; + + /** Used to make template sourceURLs easier to identify. */ + var templateCounter = -1; + + /** 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] = typedArrayTags[arrayTag] = + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; + + /** 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; + + /** Used to map Latin Unicode letters to basic Latin letters. */ + var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 's' + }; + + /** Used to map characters to HTML entities. */ + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + /** Used to map HTML entities to characters. */ + var htmlUnescapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + + /** Used to escape characters for inclusion in compiled string literals. */ + var stringEscapes = { + '\\': '\\', + "'": "'", + '\n': 'n', + '\r': 'r', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + /** Built-in method references without a dependency on `root`. */ + var freeParseFloat = parseFloat, + freeParseInt = parseInt; + + /** 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')(); + + /** 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 nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, + nodeIsDate = nodeUtil && nodeUtil.isDate, + nodeIsMap = nodeUtil && nodeUtil.isMap, + nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, + nodeIsSet = nodeUtil && nodeUtil.isSet, + nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + + /*--------------------------------------------------------------------------*/ + + /** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ + function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + + /** + * A specialized version of `baseAggregator` for arrays. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function arrayAggregator(array, setter, iteratee, accumulator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + var value = array[index]; + setter(accumulator, value, iteratee(value), array); + } + return accumulator; + } + + /** + * 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; + } + + /** + * A specialized version of `_.forEachRight` 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 arrayEachRight(array, iteratee) { + var length = array == null ? 0 : array.length; + + while (length--) { + if (iteratee(array[length], length, array) === false) { + break; + } + } + return array; + } + + /** + * A specialized version of `_.every` 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 all elements pass the predicate check, + * else `false`. + */ + function arrayEvery(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (!predicate(array[index], index, array)) { + return false; + } + } + return true; + } + + /** + * 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; + } + + /** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludes(array, value) { + var length = array == null ? 0 : array.length; + return !!length && baseIndexOf(array, value, 0) > -1; + } + + /** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ + function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } + } + return false; + } + + /** + * A specialized version of `_.map` 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 the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * 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; + } + + /** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array == null ? 0 : array.length; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; + } + + /** + * A specialized version of `_.reduceRight` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the last element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ + function arrayReduceRight(array, iteratee, accumulator, initAccum) { + var length = array == null ? 0 : array.length; + if (initAccum && length) { + accumulator = array[--length]; + } + while (length--) { + accumulator = iteratee(accumulator, array[length], length, array); + } + return accumulator; + } + + /** + * 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; + } + + /** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + var asciiSize = baseProperty('length'); + + /** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function asciiToArray(string) { + return string.split(''); + } + + /** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function asciiWords(string) { + return string.match(reAsciiWord) || []; + } + + /** + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the found element or its key, else `undefined`. + */ + function baseFindKey(collection, predicate, eachFunc) { + var result; + eachFunc(collection, function(value, key, collection) { + if (predicate(value, key, collection)) { + result = key; + return false; + } + }); + return result; + } + + /** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); + } + + /** + * This function is like `baseIndexOf` except that it accepts a comparator. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @param {Function} comparator The comparator invoked per element. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function baseIndexOfWith(array, value, fromIndex, comparator) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (comparator(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ + function baseIsNaN(value) { + return value !== value; + } + + /** + * The base implementation of `_.mean` and `_.meanBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the mean. + */ + function baseMean(array, iteratee) { + var length = array == null ? 0 : array.length; + return length ? (baseSum(array, iteratee) / length) : NAN; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; + } + + /** + * The base implementation of `_.reduce` and `_.reduceRight`, without support + * for iteratee shorthands, which iterates over `collection` using `eachFunc`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} accumulator The initial value. + * @param {boolean} initAccum Specify using the first or last element of + * `collection` as the initial value. + * @param {Function} eachFunc The function to iterate over `collection`. + * @returns {*} Returns the accumulated value. + */ + function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection, function(value, index, collection) { + accumulator = initAccum + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); + }); + return accumulator; + } + + /** + * The base implementation of `_.sortBy` which uses `comparer` to define the + * sort order of `array` and replaces criteria objects with their corresponding + * values. + * + * @private + * @param {Array} array The array to sort. + * @param {Function} comparer The function to define sort order. + * @returns {Array} Returns `array`. + */ + function baseSortBy(array, comparer) { + var length = array.length; + + array.sort(comparer); + while (length--) { + array[length] = array[length].value; + } + return array; + } + + /** + * The base implementation of `_.sum` and `_.sumBy` without support for + * iteratee shorthands. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {number} Returns the sum. + */ + function baseSum(array, iteratee) { + var result, + index = -1, + length = array.length; + + while (++index < length) { + var current = iteratee(array[index]); + if (current !== undefined) { + result = result === undefined ? current : (result + current); + } + } + return result; + } + + /** + * 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; + } + + /** + * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array + * of key-value pairs for `object` corresponding to the property names of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the key-value pairs. + */ + function baseToPairs(object, props) { + return arrayMap(props, function(key) { + return [key, object[key]]; + }); + } + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + /** + * 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); + }; + } + + /** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ + function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); + } + + /** + * 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 by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. + */ + function charsStartIndex(strSymbols, chrSymbols) { + var index = -1, + length = strSymbols.length; + + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. + * + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. + */ + function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; + + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; + } + + /** + * Gets the number of `placeholder` occurrences in `array`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} placeholder The placeholder to search for. + * @returns {number} Returns the placeholder count. + */ + function countHolders(array, placeholder) { + var length = array.length, + result = 0; + + while (length--) { + if (array[length] === placeholder) { + ++result; + } + } + return result; + } + + /** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ + var deburrLetter = basePropertyOf(deburredLetters); + + /** + * Used by `_.escape` to convert characters to HTML entities. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + var escapeHtmlChar = basePropertyOf(htmlEscapes); + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. + * + * @private + * @param {string} chr The matched character to escape. + * @returns {string} Returns the escaped character. + */ + function escapeStringChar(chr) { + return '\\' + stringEscapes[chr]; + } + + /** + * 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]; + } + + /** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ + function hasUnicode(string) { + return reHasUnicode.test(string); + } + + /** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ + function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); + } + + /** + * Converts `iterator` to an array. + * + * @private + * @param {Object} iterator The iterator to convert. + * @returns {Array} Returns the converted array. + */ + function iteratorToArray(iterator) { + var data, + result = []; + + while (!(data = iterator.next()).done) { + result.push(data.value); + } + 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; + } + + /** + * 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)); + }; + } + + /** + * Replaces all `placeholder` elements in `array` with an internal placeholder + * and returns an array of their indexes. + * + * @private + * @param {Array} array The array to modify. + * @param {*} placeholder The placeholder to replace. + * @returns {Array} Returns the new array of placeholder indexes. + */ + function replaceHolders(array, placeholder) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value === placeholder || value === PLACEHOLDER) { + array[index] = PLACEHOLDER; + result[resIndex++] = index; + } + } + 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; + } + + /** + * Converts `set` to its value-value pairs. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the value-value pairs. + */ + function setToPairs(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = [value, value]; + }); + return result; + } + + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + + /** + * Gets the number of symbols in `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ + function stringSize(string) { + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); + } + + /** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + /** + * Used by `_.unescape` to convert HTML entities to characters. + * + * @private + * @param {string} chr The matched character to unescape. + * @returns {string} Returns the unescaped character. + */ + var unescapeHtmlChar = basePropertyOf(htmlUnescapes); + + /** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ + function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + ++result; + } + return result; + } + + /** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ + function unicodeToArray(string) { + return string.match(reUnicode) || []; + } + + /** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ + function unicodeWords(string) { + return string.match(reUnicodeWord) || []; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Create a new pristine `lodash` function using the `context` object. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Util + * @param {Object} [context=root] The context object. + * @returns {Function} Returns a new `lodash` function. + * @example + * + * _.mixin({ 'foo': _.constant('foo') }); + * + * var lodash = _.runInContext(); + * lodash.mixin({ 'bar': lodash.constant('bar') }); + * + * _.isFunction(_.foo); + * // => true + * _.isFunction(_.bar); + * // => false + * + * lodash.isFunction(lodash.foo); + * // => false + * lodash.isFunction(lodash.bar); + * // => true + * + * // Create a suped-up `defer` in Node.js. + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; + */ + var runInContext = (function runInContext(context) { + context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); + + /** Built-in constructor references. */ + var Array = context.Array, + Date = context.Date, + Error = context.Error, + Function = context.Function, + Math = context.Math, + Object = context.Object, + RegExp = context.RegExp, + String = context.String, + TypeError = context.TypeError; + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to generate unique IDs. */ + var idCounter = 0; + + /** 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) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to infer the `Object` constructor. */ + var objectCtorString = funcToString.call(Object); + + /** Used to restore the original `_` reference in `_.noConflict`. */ + var oldDash = root._; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Buffer = moduleExports ? context.Buffer : undefined, + Symbol = context.Symbol, + Uint8Array = context.Uint8Array, + allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, + symIterator = Symbol ? Symbol.iterator : undefined, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /** Mocked built-ins. */ + var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, + ctxNow = Date && Date.now !== root.Date.now && Date.now, + ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeFloor = Math.floor, + nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeIsFinite = context.isFinite, + nativeJoin = arrayProto.join, + nativeKeys = overArg(Object.keys, Object), + nativeMax = Math.max, + nativeMin = Math.min, + nativeNow = Date.now, + nativeParseInt = context.parseInt, + nativeRandom = Math.random, + nativeReverse = arrayProto.reverse; + + /* Built-in method references that are verified to be native. */ + var DataView = getNative(context, 'DataView'), + Map = getNative(context, 'Map'), + Promise = getNative(context, 'Promise'), + Set = getNative(context, 'Set'), + WeakMap = getNative(context, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + + /** Used to store function metadata. */ + var metaMap = WeakMap && new WeakMap; + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to detect maps, sets, and weakmaps. */ + var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); + } + + /** + * 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; + }; + }()); + + /** + * The function whose prototype chain sequence wrappers inherit from. + * + * @private + */ + function baseLodash() { + // No operation performed. + } + + /** + * The base constructor for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll] Enable explicit method chain sequences. + */ + function LodashWrapper(value, chainAll) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__chain__ = !!chainAll; + this.__index__ = 0; + this.__values__ = undefined; + } + + /** + * By default, the template delimiters used by lodash are like those in + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. + * + * @static + * @memberOf _ + * @type {Object} + */ + lodash.templateSettings = { + + /** + * Used to detect `data` property values to be HTML-escaped. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'escape': reEscape, + + /** + * Used to detect code to be evaluated. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'evaluate': reEvaluate, + + /** + * Used to detect `data` property values to inject. + * + * @memberOf _.templateSettings + * @type {RegExp} + */ + 'interpolate': reInterpolate, + + /** + * Used to reference the data object in the template text. + * + * @memberOf _.templateSettings + * @type {string} + */ + 'variable': '', + + /** + * Used to import variables into the compiled template. + * + * @memberOf _.templateSettings + * @type {Object} + */ + 'imports': { + + /** + * A reference to the `lodash` function. + * + * @memberOf _.templateSettings.imports + * @type {Function} + */ + '_': lodash + } + }; + + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; + lodash.prototype.constructor = lodash; + + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. + * + * @private + * @constructor + * @param {*} value The value to wrap. + */ + function LazyWrapper(value) { + this.__wrapped__ = value; + this.__actions__ = []; + this.__dir__ = 1; + this.__filtered__ = false; + this.__iteratees__ = []; + this.__takeCount__ = MAX_ARRAY_LENGTH; + this.__views__ = []; + } + + /** + * Creates a clone of the lazy wrapper object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = copyArray(this.__actions__); + result.__dir__ = this.__dir__; + result.__filtered__ = this.__filtered__; + result.__iteratees__ = copyArray(this.__iteratees__); + result.__takeCount__ = this.__takeCount__; + result.__views__ = copyArray(this.__views__); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + if (this.__filtered__) { + var result = new LazyWrapper(this); + result.__dir__ = -1; + result.__filtered__ = true; + } else { + result = this.clone(); + result.__dir__ *= -1; + } + return result; + } + + /** + * Extracts the unwrapped value from its lazy wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), + isRight = dir < 0, + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), + start = view.start, + end = view.end, + length = end - start, + index = isRight ? end : (start - 1), + iteratees = this.__iteratees__, + iterLength = iteratees.length, + resIndex = 0, + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { + return baseWrapperValue(array, this.__actions__); + } + var result = []; + + outer: + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + result[resIndex++] = value; + } + return result; + } + + // Ensure `LazyWrapper` is an instance of `baseLodash`. + LazyWrapper.prototype = baseCreate(baseLodash.prototype); + LazyWrapper.prototype.constructor = LazyWrapper; + + /*------------------------------------------------------------------------*/ + + /** + * 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]); + } + } + + /** + * 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; + } + + /** + * 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 ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * 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.call(data, key); + } + + /** + * 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; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * 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]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * 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; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * 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]); + } + } + + /** + * 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 + }; + } + + /** + * 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; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * + * 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]); + } + } + + /** + * 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); + } + + // Add methods to `SetCache`. + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; + SetCache.prototype.has = setCacheHas; + + /*------------------------------------------------------------------------*/ + + /** + * 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; + } + + /** + * 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); + } + + /** + * 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; + } + + // Add methods to `Stack`. + Stack.prototype.clear = stackClear; + Stack.prototype['delete'] = stackDelete; + Stack.prototype.get = stackGet; + Stack.prototype.has = stackHas; + Stack.prototype.set = stackSet; + + /*------------------------------------------------------------------------*/ + + /** + * 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.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; + } + + /** + * A specialized version of `_.sample` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + + /** + * This function is like `assignValue` except that it doesn't assign + * `undefined` values. + * + * @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 assignMergeValue(object, key, value) { + if ((value !== undefined && !eq(object[key], value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * 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.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * 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; + } + + /** + * Aggregates elements of `collection` on `accumulator` with keys transformed + * by `iteratee` and values set by `setter`. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform keys. + * @param {Object} accumulator The initial aggregated object. + * @returns {Function} Returns `accumulator`. + */ + function baseAggregator(collection, setter, iteratee, accumulator) { + baseEach(collection, function(value, key, collection) { + setter(accumulator, value, iteratee(value), collection); + }); + return accumulator; + } + + /** + * 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); + } + + /** + * 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); + } + + /** + * 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) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.at` without support for individual paths. + * + * @private + * @param {Object} object The object to iterate over. + * @param {string[]} paths The property paths to pick. + * @returns {Array} Returns the picked elements. + */ + function baseAt(object, paths) { + var index = -1, + length = paths.length, + result = Array(length), + skip = object == null; + + while (++index < length) { + result[index] = skip ? undefined : get(object, paths[index]); + } + return result; + } + + /** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ + function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; + } + + /** + * 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, + isFlat = bitmask & CLONE_FLAT_FLAG, + isFull = bitmask & CLONE_SYMBOLS_FLAG; + + 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(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; + } + + /** + * The base implementation of `_.conforms` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property predicates to conform to. + * @returns {Function} Returns the new spec function. + */ + function baseConforms(source) { + var props = keys(source); + return function(object) { + return baseConformsTo(object, source, props); + }; + } + + /** + * The base implementation of `_.conformsTo` which accepts `props` to check. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + */ + function baseConformsTo(object, source, props) { + var length = props.length; + if (object == null) { + return !length; + } + object = Object(object); + while (length--) { + var key = props[length], + predicate = source[key], + value = object[key]; + + if ((value === undefined && !(key in object)) || !predicate(value)) { + return false; + } + } + return true; + } + + /** + * The base implementation of `_.delay` and `_.defer` which accepts `args` + * to provide to `func`. + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {Array} args The arguments to provide to `func`. + * @returns {number|Object} Returns the timer id or timeout object. + */ + function baseDelay(func, wait, args) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return setTimeout(function() { func.apply(undefined, args); }, wait); + } + + /** + * The base implementation of methods like `_.difference` without support + * for excluding multiple arrays or iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Array} values The values to exclude. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + */ + function baseDifference(array, values, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + isCommon = true, + length = array.length, + result = [], + valuesLength = values.length; + + if (!length) { + return result; + } + if (iteratee) { + values = arrayMap(values, baseUnary(iteratee)); + } + if (comparator) { + includes = arrayIncludesWith; + isCommon = false; + } + else if (values.length >= LARGE_ARRAY_SIZE) { + includes = cacheHas; + isCommon = false; + values = new SetCache(values); + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; + } + } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.forEach` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEach = createBaseEach(baseForOwn); + + /** + * The base implementation of `_.forEachRight` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + */ + var baseEachRight = createBaseEach(baseForOwnRight, true); + + /** + * The base implementation of `_.every` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false` + */ + function baseEvery(collection, predicate) { + var result = true; + baseEach(collection, function(value, index, collection) { + result = !!predicate(value, index, collection); + return result; + }); + return result; + } + + /** + * The base implementation of methods like `_.max` and `_.min` which accepts a + * `comparator` to determine the extremum value. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The iteratee invoked per iteration. + * @param {Function} comparator The comparator used to compare values. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(array, iteratee, comparator) { + var index = -1, + length = array.length; + + while (++index < length) { + var value = array[index], + current = iteratee(value); + + if (current != null && (computed === undefined + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { + var computed = current, + result = value; + } + } + return result; + } + + /** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ + function baseFill(array, value, start, end) { + var length = array.length; + + start = toInteger(start); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : toInteger(end); + if (end < 0) { + end += length; + } + end = start > end ? 0 : toLength(end); + while (start < end) { + array[start++] = value; + } + return array; + } + + /** + * The base implementation of `_.filter` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ + function baseFilter(collection, predicate) { + var result = []; + baseEach(collection, function(value, index, collection) { + if (predicate(value, index, collection)) { + result.push(value); + } + }); + return result; + } + + /** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; + } + + /** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * This function is like `baseFor` except that it iterates over properties + * in the opposite order. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseForRight = createBaseFor(true); + + /** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); + } + + /** + * The base implementation of `_.forOwnRight` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForOwnRight(object, iteratee) { + return object && baseForRight(object, iteratee, keys); + } + + /** + * The base implementation of `_.functions` which creates an array of + * `object` function property names filtered from `props`. + * + * @private + * @param {Object} object The object to inspect. + * @param {Array} props The property names to filter. + * @returns {Array} Returns the function names. + */ + function baseFunctions(object, props) { + return arrayFilter(props, function(key) { + return isFunction(object[key]); + }); + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + /** + * 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)); + } + + /** + * 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); + } + + /** + * The base implementation of `_.gt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + */ + function baseGt(value, other) { + return value > other; + } + + /** + * The base implementation of `_.has` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHas(object, key) { + return object != null && hasOwnProperty.call(object, key); + } + + /** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ + function baseHasIn(object, key) { + return object != null && key in Object(object); + } + + /** + * The base implementation of `_.inRange` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to check. + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + */ + function baseInRange(number, start, end) { + return number >= nativeMin(start, end) && number < nativeMax(start, end); + } + + /** + * The base implementation of methods like `_.intersection`, without support + * for iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of shared values. + */ + function baseIntersection(arrays, iteratee, comparator) { + var includes = comparator ? arrayIncludesWith : arrayIncludes, + length = arrays[0].length, + othLength = arrays.length, + othIndex = othLength, + caches = Array(othLength), + maxLength = Infinity, + result = []; + + while (othIndex--) { + var array = arrays[othIndex]; + if (othIndex && iteratee) { + array = arrayMap(array, baseUnary(iteratee)); + } + maxLength = nativeMin(array.length, maxLength); + caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) + ? new SetCache(othIndex && array) + : undefined; + } + array = arrays[0]; + + var index = -1, + seen = caches[0]; + + outer: + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) + )) { + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) + ) { + continue outer; + } + } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.invert` and `_.invertBy` which inverts + * `object` with values transformed by `iteratee` and set by `setter`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} setter The function to set `accumulator` values. + * @param {Function} iteratee The iteratee to transform values. + * @param {Object} accumulator The initial inverted object. + * @returns {Function} Returns `accumulator`. + */ + function baseInverter(object, setter, iteratee, accumulator) { + baseForOwn(object, function(value, key, object) { + setter(accumulator, iteratee(value), key, object); + }); + return accumulator; + } + + /** + * The base implementation of `_.invoke` without support for individual + * method arguments. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function baseInvoke(object, path, args) { + path = castPath(path, object); + object = parent(object, path); + var func = object == null ? object : object[toKey(last(path))]; + return func == null ? undefined : apply(func, object, args); + } + + /** + * 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; + } + + /** + * The base implementation of `_.isArrayBuffer` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + */ + function baseIsArrayBuffer(value) { + return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; + } + + /** + * The base implementation of `_.isDate` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + */ + function baseIsDate(value) { + return isObjectLike(value) && baseGetTag(value) == dateTag; + } + + /** + * 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); + } + + /** + * 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(object), + othTag = othIsArr ? arrayTag : getTag(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 `_.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(value) == mapTag; + } + + /** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ + function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; + + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; + + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { + return false; + } + } + } + return true; + } + + /** + * 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)); + } + + /** + * The base implementation of `_.isRegExp` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + */ + function baseIsRegExp(value) { + return isObjectLike(value) && baseGetTag(value) == regexpTag; + } + + /** + * 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(value) == setTag; + } + + /** + * 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 `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ + function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); + } + + /** + * 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.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; + } + + /** + * 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.call(object, key)))) { + result.push(key); + } + } + return result; + } + + /** + * The base implementation of `_.lt` which doesn't coerce arguments. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + */ + function baseLt(value, other) { + return value < other; + } + + /** + * The base implementation of `_.map` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function baseMap(collection, iteratee) { + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value, key, collection) { + result[++index] = iteratee(value, key, collection); + }); + return result; + } + + /** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; + } + + /** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + }; + } + + /** + * The base implementation of `_.merge` without support for multiple sources. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {number} srcIndex The index of `source`. + * @param {Function} [customizer] The function to customize merged values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMerge(object, source, srcIndex, customizer, stack) { + if (object === source) { + return; + } + baseFor(source, function(srcValue, key) { + stack || (stack = new Stack); + if (isObject(srcValue)) { + baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); + } + else { + var newValue = customizer + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; + + if (newValue === undefined) { + newValue = srcValue; + } + assignMergeValue(object, key, newValue); + } + }, keysIn); + } + + /** + * A specialized version of `baseMerge` for arrays and objects which performs + * deep merges and tracks traversed objects enabling objects with circular + * references to be merged. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {string} key The key of the value to merge. + * @param {number} srcIndex The index of `source`. + * @param {Function} mergeFunc The function to merge values. + * @param {Function} [customizer] The function to customize assigned values. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + */ + function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet(object, key), + srcValue = safeGet(source, key), + stacked = stack.get(srcValue); + + if (stacked) { + assignMergeValue(object, key, stacked); + return; + } + var newValue = customizer + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; + + var isCommon = newValue === undefined; + + if (isCommon) { + var isArr = isArray(srcValue), + isBuff = !isArr && isBuffer(srcValue), + isTyped = !isArr && !isBuff && isTypedArray(srcValue); + + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray(objValue)) { + newValue = objValue; + } + else if (isArrayLikeObject(objValue)) { + newValue = copyArray(objValue); + } + else if (isBuff) { + isCommon = false; + newValue = cloneBuffer(srcValue, true); + } + else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray(srcValue, true); + } + else { + newValue = []; + } + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { + newValue = objValue; + if (isArguments(objValue)) { + newValue = toPlainObject(objValue); + } + else if (!isObject(objValue) || isFunction(objValue)) { + newValue = initCloneObject(srcValue); + } + } + else { + isCommon = false; + } + } + if (isCommon) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack['delete'](srcValue); + } + assignMergeValue(object, key, newValue); + } + + /** + * The base implementation of `_.nth` which doesn't coerce arguments. + * + * @private + * @param {Array} array The array to query. + * @param {number} n The index of the element to return. + * @returns {*} Returns the nth element of `array`. + */ + function baseNth(array, n) { + var length = array.length; + if (!length) { + return; + } + n += n < 0 ? length : 0; + return isIndex(n, length) ? array[n] : undefined; + } + + /** + * The base implementation of `_.orderBy` without param guards. + * + * @private + * @param {Array|Object} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {string[]} orders The sort orders of `iteratees`. + * @returns {Array} Returns the new sorted array. + */ + function baseOrderBy(collection, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap(iteratees, function(iteratee) { + if (isArray(iteratee)) { + return function(value) { + return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); + } + } + return iteratee; + }); + } else { + iteratees = [identity]; + } + + var index = -1; + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { + return iteratee(value); + }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); + } + + /** + * The base implementation of `_.pick` without support for individual + * property identifiers. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @returns {Object} Returns the new object. + */ + function basePick(object, paths) { + return basePickBy(object, paths, function(value, path) { + return hasIn(object, path); + }); + } + + /** + * The base implementation of `_.pickBy` without support for iteratee shorthands. + * + * @private + * @param {Object} object The source object. + * @param {string[]} paths The property paths to pick. + * @param {Function} predicate The function invoked per property. + * @returns {Object} Returns the new object. + */ + function basePickBy(object, paths, predicate) { + var index = -1, + length = paths.length, + result = {}; + + while (++index < length) { + var path = paths[index], + value = baseGet(object, path); + + if (predicate(value, path)) { + baseSet(result, castPath(path, object), value); + } + } + return result; + } + + /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ + function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; + } + + /** + * The base implementation of `_.pullAllBy` without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + */ + function basePullAll(array, values, iteratee, comparator) { + var indexOf = comparator ? baseIndexOfWith : baseIndexOf, + index = -1, + length = values.length, + seen = array; + + if (array === values) { + values = copyArray(values); + } + if (iteratee) { + seen = arrayMap(array, baseUnary(iteratee)); + } + while (++index < length) { + var fromIndex = 0, + value = values[index], + computed = iteratee ? iteratee(value) : value; + + while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { + if (seen !== array) { + splice.call(seen, fromIndex, 1); + } + splice.call(array, fromIndex, 1); + } + } + return array; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (length == lastIndex || index !== previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } else { + baseUnset(array, index); + } + } + } + return array; + } + + /** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ + function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); + } + + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ + function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; + } + return result; + } + + /** + * The base implementation of `_.repeat` which doesn't coerce arguments. + * + * @private + * @param {string} string The string to repeat. + * @param {number} n The number of times to repeat the string. + * @returns {string} Returns the repeated string. + */ + function baseRepeat(string, n) { + var result = ''; + if (!string || n < 1 || n > MAX_SAFE_INTEGER) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = nativeFloor(n / 2); + if (n) { + string += string; + } + } while (n); + + return result; + } + + /** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ + function baseRest(func, start) { + return setToString(overRest(func, start, identity), func + ''); + } + + /** + * The base implementation of `_.sample`. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + */ + function baseSample(collection) { + return arraySample(values(collection)); + } + + /** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `setData` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var baseSetData = !metaMap ? identity : function(func, data) { + metaMap.set(func, data); + return func; + }; + + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !defineProperty ? identity : function(func, string) { + return defineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + + /** + * The base implementation of `_.shuffle`. + * + * @private + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function baseShuffle(collection) { + return shuffleSelf(values(collection)); + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.some` without support for iteratee shorthands. + * + * @private + * @param {Array|Object} collection The collection 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 baseSome(collection, predicate) { + var result; + + baseEach(collection, function(value, index, collection) { + result = predicate(value, index, collection); + return !result; + }); + return !!result; + } + + /** + * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which + * performs a binary search of `array` to determine the index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndex(array, value, retHighest) { + var low = 0, + high = array == null ? low : array.length; + + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; + + if (computed !== null && !isSymbol(computed) && + (retHighest ? (computed <= value) : (computed < value))) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return baseSortedIndexBy(array, value, identity, retHighest); + } + + /** + * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` + * which invokes `iteratee` for `value` and each element of `array` to compute + * their sort ranking. The iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The iteratee invoked per element. + * @param {boolean} [retHighest] Specify returning the highest qualified index. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function baseSortedIndexBy(array, value, iteratee, retHighest) { + var low = 0, + high = array == null ? 0 : array.length; + if (high === 0) { + return 0; + } + + value = iteratee(value); + var valIsNaN = value !== value, + valIsNull = value === null, + valIsSymbol = isSymbol(value), + valIsUndefined = value === undefined; + + while (low < high) { + var mid = nativeFloor((low + high) / 2), + computed = iteratee(array[mid]), + othIsDefined = computed !== undefined, + othIsNull = computed === null, + othIsReflexive = computed === computed, + othIsSymbol = isSymbol(computed); + + if (valIsNaN) { + var setLow = retHighest || othIsReflexive; + } else if (valIsUndefined) { + setLow = othIsReflexive && (retHighest || othIsDefined); + } else if (valIsNull) { + setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + } else if (valIsSymbol) { + setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + } else if (othIsNull || othIsSymbol) { + setLow = false; + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { + low = mid + 1; + } else { + high = mid; + } + } + return nativeMin(high, MAX_ARRAY_INDEX); + } + + /** + * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseSortedUniq(array, iteratee) { + var index = -1, + length = array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + if (!index || !eq(computed, seen)) { + var seen = computed; + result[resIndex++] = value === 0 ? 0 : value; + } + } + return result; + } + + /** + * The base implementation of `_.toNumber` which doesn't ensure correct + * conversions of binary, hexadecimal, or octal string values. + * + * @private + * @param {*} value The value to process. + * @returns {number} Returns the number. + */ + function baseToNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + return +value; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ + function baseUniq(array, iteratee, comparator) { + var index = -1, + includes = arrayIncludes, + length = array.length, + isCommon = true, + result = [], + seen = result; + + if (comparator) { + isCommon = false; + includes = arrayIncludesWith; + } + else if (length >= LARGE_ARRAY_SIZE) { + var set = iteratee ? null : createSet(array); + if (set) { + return setToArray(set); + } + isCommon = false; + includes = cacheHas; + seen = new SetCache; + } + else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.unset`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The property path to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + */ + function baseUnset(object, path) { + path = castPath(path, object); + object = parent(object, path); + return object == null || delete object[toKey(last(path))]; + } + + /** + * The base implementation of `_.update`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to update. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseUpdate(object, path, updater, customizer) { + return baseSet(object, path, updater(baseGet(object, path)), customizer); + } + + /** + * The base implementation of methods like `_.dropWhile` and `_.takeWhile` + * without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ + function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && + predicate(array[index], index, array)) {} + + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); + } + + /** + * The base implementation of `wrapperValue` which returns the result of + * performing a sequence of actions on the unwrapped `value`, where each + * successive action is supplied the return value of the previous. + * + * @private + * @param {*} value The unwrapped value. + * @param {Array} actions Actions to perform to resolve the unwrapped value. + * @returns {*} Returns the resolved value. + */ + function baseWrapperValue(value, actions) { + var result = value; + if (result instanceof LazyWrapper) { + result = result.value(); + } + return arrayReduce(actions, function(result, action) { + return action.func.apply(action.thisArg, arrayPush([result], action.args)); + }, result); + } + + /** + * The base implementation of methods like `_.xor`, without support for + * iteratee shorthands, that accepts an array of arrays to inspect. + * + * @private + * @param {Array} arrays The arrays to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of values. + */ + function baseXor(arrays, iteratee, comparator) { + var length = arrays.length; + if (length < 2) { + return length ? baseUniq(arrays[0]) : []; + } + var index = -1, + result = Array(length); + + while (++index < length) { + var array = arrays[index], + othIndex = -1; + + while (++othIndex < length) { + if (othIndex != index) { + result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); + } + } + } + return baseUniq(baseFlatten(result, 1), iteratee, comparator); + } + + /** + * This base implementation of `_.zipObject` which assigns values using `assignFunc`. + * + * @private + * @param {Array} props The property identifiers. + * @param {Array} values The property values. + * @param {Function} assignFunc The function to assign values. + * @returns {Object} Returns the new object. + */ + function baseZipObject(props, values, assignFunc) { + var index = -1, + length = props.length, + valsLength = values.length, + result = {}; + + while (++index < length) { + var value = index < valsLength ? values[index] : undefined; + assignFunc(result, props[index], value); + } + return result; + } + + /** + * Casts `value` to an empty array if it's not an array like object. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array|Object} Returns the cast array-like object. + */ + function castArrayLikeObject(value) { + return isArrayLikeObject(value) ? value : []; + } + + /** + * Casts `value` to `identity` if it's not a function. + * + * @private + * @param {*} value The value to inspect. + * @returns {Function} Returns cast function. + */ + function castFunction(value) { + return typeof value == 'function' ? value : identity; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + + /** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ + function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); + } + + /** + * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). + * + * @private + * @param {number|Object} id The timer id or timeout object of the timer to clear. + */ + var clearTimeout = ctxClearTimeout || function(id) { + return root.clearTimeout(id); + }; + + /** + * 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; + } + + /** + * 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); + } + + /** + * 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; + } + + /** + * 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); + } + + /** + * Compares values to sort them in ascending order. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {number} Returns the sort order indicator for `value`. + */ + function compareAscending(value, other) { + if (value !== other) { + var valIsDefined = value !== undefined, + valIsNull = value === null, + valIsReflexive = value === value, + valIsSymbol = isSymbol(value); + + var othIsDefined = other !== undefined, + othIsNull = other === null, + othIsReflexive = other === other, + othIsSymbol = isSymbol(other); + + if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || + (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || + (valIsNull && othIsDefined && othIsReflexive) || + (!valIsDefined && othIsReflexive) || + !valIsReflexive) { + return 1; + } + if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || + (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || + (othIsNull && valIsDefined && valIsReflexive) || + (!othIsDefined && valIsReflexive) || + !othIsReflexive) { + return -1; + } + } + return 0; + } + + /** + * Used by `_.orderBy` to compare multiple properties of a value to another + * and stable sort them. + * + * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, + * specify an order of "desc" for descending or "asc" for ascending sort order + * of corresponding values. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {boolean[]|string[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ + function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = compareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order = orders[index]; + return result * (order == 'desc' ? -1 : 1); + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; + } + + /** + * Creates an array that is the composition of partially applied arguments, + * placeholders, and provided arguments into a single array of arguments. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to prepend to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgs(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersLength = holders.length, + leftIndex = -1, + leftLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(leftLength + rangeLength), + isUncurried = !isCurried; + + while (++leftIndex < leftLength) { + result[leftIndex] = partials[leftIndex]; + } + while (++argsIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[holders[argsIndex]] = args[argsIndex]; + } + } + while (rangeLength--) { + result[leftIndex++] = args[argsIndex++]; + } + return result; + } + + /** + * This function is like `composeArgs` except that the arguments composition + * is tailored for `_.partialRight`. + * + * @private + * @param {Array} args The provided arguments. + * @param {Array} partials The arguments to append to those provided. + * @param {Array} holders The `partials` placeholder indexes. + * @params {boolean} [isCurried] Specify composing for a curried function. + * @returns {Array} Returns the new array of composed arguments. + */ + function composeArgsRight(args, partials, holders, isCurried) { + var argsIndex = -1, + argsLength = args.length, + holdersIndex = -1, + holdersLength = holders.length, + rightIndex = -1, + rightLength = partials.length, + rangeLength = nativeMax(argsLength - holdersLength, 0), + result = Array(rangeLength + rightLength), + isUncurried = !isCurried; + + while (++argsIndex < rangeLength) { + result[argsIndex] = args[argsIndex]; + } + var offset = argsIndex; + while (++rightIndex < rightLength) { + result[offset + rightIndex] = partials[rightIndex]; + } + while (++holdersIndex < holdersLength) { + if (isUncurried || argsIndex < argsLength) { + result[offset + holders[holdersIndex]] = args[argsIndex++]; + } + } + 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; + } + + /** + * 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; + } + + /** + * 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); + } + + /** + * 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); + } + + /** + * Creates a function like `_.groupBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} [initializer] The accumulator object initializer. + * @returns {Function} Returns the new aggregator function. + */ + function createAggregator(setter, initializer) { + return function(collection, iteratee) { + var func = isArray(collection) ? arrayAggregator : baseAggregator, + accumulator = initializer ? initializer() : {}; + + return func(collection, setter, getIteratee(iteratee, 2), accumulator); + }; + } + + /** + * Creates a function like `_.assign`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return baseRest(function(object, sources) { + var index = -1, + length = sources.length, + customizer = length > 1 ? sources[length - 1] : undefined, + guard = length > 2 ? sources[2] : undefined; + + customizer = (assigner.length > 3 && typeof customizer == 'function') + ? (length--, customizer) + : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + object = Object(object); + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, index, customizer); + } + } + return object; + }); + } + + /** + * Creates a `baseEach` or `baseEachRight` function. + * + * @private + * @param {Function} eachFunc The function to iterate over a collection. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseEach(eachFunc, fromRight) { + return function(collection, iteratee) { + if (collection == null) { + return collection; + } + if (!isArrayLike(collection)) { + return eachFunc(collection, iteratee); + } + var length = collection.length, + index = fromRight ? length : -1, + iterable = Object(collection); + + while ((fromRight ? index-- : ++index < length)) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection; + }; + } + + /** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Creates a function that wraps `func` to invoke it with the optional `this` + * binding of `thisArg`. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createBind(func, bitmask, thisArg) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return fn.apply(isBind ? thisArg : this, arguments); + } + return wrapper; + } + + /** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ + function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; + } + + /** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ + function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; + } + + /** + * Creates a function that produces an instance of `Ctor` regardless of + * whether it was invoked as part of a `new` expression or by `call` or `apply`. + * + * @private + * @param {Function} Ctor The constructor to wrap. + * @returns {Function} Returns the new wrapped function. + */ + function createCtor(Ctor) { + return function() { + // Use a `switch` statement to work with class constructors. See + // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } + var thisBinding = baseCreate(Ctor.prototype), + result = Ctor.apply(thisBinding, args); + + // Mimic the constructor's `return` behavior. + // See https://es5.github.io/#x13.2.2 for more details. + return isObject(result) ? result : thisBinding; + }; + } + + /** + * Creates a function that wraps `func` to enable currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {number} arity The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createCurry(func, bitmask, arity) { + var Ctor = createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length, + placeholder = getHolder(wrapper); + + while (index--) { + args[index] = arguments[index]; + } + var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) + ? [] + : replaceHolders(args, placeholder); + + length -= holders.length; + if (length < arity) { + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); + } + var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + return apply(fn, this, args); + } + return wrapper; + } + + /** + * Creates a `_.find` or `_.findLast` function. + * + * @private + * @param {Function} findIndexFunc The function to find the collection index. + * @returns {Function} Returns the new find function. + */ + function createFind(findIndexFunc) { + return function(collection, predicate, fromIndex) { + var iterable = Object(collection); + if (!isArrayLike(collection)) { + var iteratee = getIteratee(predicate, 3); + collection = keys(collection); + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; + } + var index = findIndexFunc(collection, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; + }; + } + + /** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ + function createFlow(fromRight) { + return flatRest(function(funcs) { + var length = funcs.length, + index = length, + prereq = LodashWrapper.prototype.thru; + + if (fromRight) { + funcs.reverse(); + } + while (index--) { + var func = funcs[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (prereq && !wrapper && getFuncName(func) == 'wrapper') { + var wrapper = new LodashWrapper([], true); + } + } + index = wrapper ? index : length; + while (++index < length) { + func = funcs[index]; + + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && + data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && + !data[4].length && data[9] == 1 + ) { + wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); + } else { + wrapper = (func.length == 1 && isLaziable(func)) + ? wrapper[funcName]() + : wrapper.thru(func); + } + } + return function() { + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value)) { + return wrapper.plant(value).value(); + } + var index = 0, + result = length ? funcs[index].apply(this, args) : value; + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }); + } + + /** + * Creates a function that wraps `func` to invoke it with optional `this` + * binding of `thisArg`, partial application, and currying. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [partialsRight] The arguments to append to those provided + * to the new function. + * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { + var isAry = bitmask & WRAP_ARY_FLAG, + isBind = bitmask & WRAP_BIND_FLAG, + isBindKey = bitmask & WRAP_BIND_KEY_FLAG, + isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), + isFlip = bitmask & WRAP_FLIP_FLAG, + Ctor = isBindKey ? undefined : createCtor(func); + + function wrapper() { + var length = arguments.length, + args = Array(length), + index = length; + + while (index--) { + args[index] = arguments[index]; + } + if (isCurried) { + var placeholder = getHolder(wrapper), + holdersCount = countHolders(args, placeholder); + } + if (partials) { + args = composeArgs(args, partials, holders, isCurried); + } + if (partialsRight) { + args = composeArgsRight(args, partialsRight, holdersRight, isCurried); + } + length -= holdersCount; + if (isCurried && length < arity) { + var newHolders = replaceHolders(args, placeholder); + return createRecurry( + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length + ); + } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + + length = args.length; + if (argPos) { + args = reorder(args, argPos); + } else if (isFlip && length > 1) { + args.reverse(); + } + if (isAry && ary < length) { + args.length = ary; + } + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtor(fn); + } + return fn.apply(thisBinding, args); + } + return wrapper; + } + + /** + * Creates a function like `_.invertBy`. + * + * @private + * @param {Function} setter The function to set accumulator values. + * @param {Function} toIteratee The function to resolve iteratees. + * @returns {Function} Returns the new inverter function. + */ + function createInverter(setter, toIteratee) { + return function(object, iteratee) { + return baseInverter(object, setter, toIteratee(iteratee), {}); + }; + } + + /** + * Creates a function that performs a mathematical operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @param {number} [defaultValue] The value used for `undefined` arguments. + * @returns {Function} Returns the new mathematical operation function. + */ + function createMathOperation(operator, defaultValue) { + return function(value, other) { + var result; + if (value === undefined && other === undefined) { + return defaultValue; + } + if (value !== undefined) { + result = value; + } + if (other !== undefined) { + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); + } + return result; + }; + } + + /** + * Creates a function like `_.over`. + * + * @private + * @param {Function} arrayFunc The function to iterate over iteratees. + * @returns {Function} Returns the new over function. + */ + function createOver(arrayFunc) { + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); + return baseRest(function(args) { + var thisArg = this; + return arrayFunc(iteratees, function(iteratee) { + return apply(iteratee, thisArg, args); + }); + }); + }); + } + + /** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {number} length The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ + function createPadding(length, chars) { + chars = chars === undefined ? ' ' : baseToString(chars); + + var charsLength = chars.length; + if (charsLength < 2) { + return charsLength ? baseRepeat(chars, length) : chars; + } + var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + return hasUnicode(chars) + ? castSlice(stringToArray(result), 0, length).join('') + : result.slice(0, length); + } + + /** + * Creates a function that wraps `func` to invoke it with the `this` binding + * of `thisArg` and `partials` prepended to the arguments it receives. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} partials The arguments to prepend to those provided to + * the new function. + * @returns {Function} Returns the new wrapped function. + */ + function createPartial(func, bitmask, thisArg, partials) { + var isBind = bitmask & WRAP_BIND_FLAG, + Ctor = createCtor(func); + + function wrapper() { + var argsIndex = -1, + argsLength = arguments.length, + leftIndex = -1, + leftLength = partials.length, + args = Array(leftLength + argsLength), + fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; + + while (++leftIndex < leftLength) { + args[leftIndex] = partials[leftIndex]; + } + while (argsLength--) { + args[leftIndex++] = arguments[++argsIndex]; + } + return apply(fn, isBind ? thisArg : this, args); + } + return wrapper; + } + + /** + * Creates a `_.range` or `_.rangeRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new range function. + */ + function createRange(fromRight) { + return function(start, end, step) { + if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { + end = step = undefined; + } + // Ensure the sign of `-0` is preserved. + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); + return baseRange(start, end, step, fromRight); + }; + } + + /** + * Creates a function that performs a relational operation on two values. + * + * @private + * @param {Function} operator The function to perform the operation. + * @returns {Function} Returns the new relational operation function. + */ + function createRelationalOperation(operator) { + return function(value, other) { + if (!(typeof value == 'string' && typeof other == 'string')) { + value = toNumber(value); + other = toNumber(other); + } + return operator(value, other); + }; + } + + /** + * Creates a function that wraps `func` to continue currying. + * + * @private + * @param {Function} func The function to wrap. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @param {Function} wrapFunc The function to create the `func` wrapper. + * @param {*} placeholder The placeholder value. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to prepend to those provided to + * the new function. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { + var isCurry = bitmask & WRAP_CURRY_FLAG, + newHolders = isCurry ? holders : undefined, + newHoldersRight = isCurry ? undefined : holders, + newPartials = isCurry ? partials : undefined, + newPartialsRight = isCurry ? undefined : partials; + + bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); + bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); + + if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { + bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); + } + var newData = [ + func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, + newHoldersRight, argPos, ary, arity + ]; + + var result = wrapFunc.apply(undefined, newData); + if (isLaziable(func)) { + setData(result, newData); + } + result.placeholder = placeholder; + return setWrapToString(result, func, bitmask); + } + + /** + * Creates a function like `_.round`. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + number = toNumber(number); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); + if (precision && nativeIsFinite(number)) { + // Shift with exponential notation to avoid floating-point issues. + // See [MDN](https://mdn.io/round#Examples) for more details. + var pair = (toString(number) + 'e').split('e'), + value = func(pair[0] + 'e' + (+pair[1] + precision)); + + pair = (toString(value) + 'e').split('e'); + return +(pair[0] + 'e' + (+pair[1] - precision)); + } + return func(number); + }; + } + + /** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { + return new Set(values); + }; + + /** + * Creates a `_.toPairs` or `_.toPairsIn` function. + * + * @private + * @param {Function} keysFunc The function to get the keys of a given object. + * @returns {Function} Returns the new pairs function. + */ + function createToPairs(keysFunc) { + return function(object) { + var tag = getTag(object); + if (tag == mapTag) { + return mapToArray(object); + } + if (tag == setTag) { + return setToPairs(object); + } + return baseToPairs(object, keysFunc(object)); + }; + } + + /** + * Creates a function that either curries or invokes `func` with optional + * `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to wrap. + * @param {number} bitmask The bitmask flags. + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` or `_.curryRight` of a bound function + * 8 - `_.curry` + * 16 - `_.curryRight` + * 32 - `_.partial` + * 64 - `_.partialRight` + * 128 - `_.rearg` + * 256 - `_.ary` + * 512 - `_.flip` + * @param {*} [thisArg] The `this` binding of `func`. + * @param {Array} [partials] The arguments to be partially applied. + * @param {Array} [holders] The `partials` placeholder indexes. + * @param {Array} [argPos] The argument positions of the new function. + * @param {number} [ary] The arity cap of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new wrapped function. + */ + function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { + var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; + if (!isBindKey && typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = partials ? partials.length : 0; + if (!length) { + bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); + partials = holders = undefined; + } + ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); + arity = arity === undefined ? arity : toInteger(arity); + length -= holders ? holders.length : 0; + + if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { + var partialsRight = partials, + holdersRight = holders; + + partials = holders = undefined; + } + var data = isBindKey ? undefined : getData(func); + + var newData = [ + func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, + argPos, ary, arity + ]; + + if (data) { + mergeData(newData, data); + } + func = newData[0]; + bitmask = newData[1]; + thisArg = newData[2]; + partials = newData[3]; + holders = newData[4]; + arity = newData[9] = newData[9] === undefined + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); + + if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { + bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); + } + if (!bitmask || bitmask == WRAP_BIND_FLAG) { + var result = createBind(func, bitmask, thisArg); + } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { + result = createCurry(func, bitmask, arity); + } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { + result = createPartial(func, bitmask, thisArg, partials); + } else { + result = createHybrid.apply(undefined, newData); + } + var setter = data ? baseSetData : setData; + return setWrapToString(setter(result, newData), func, bitmask); + } + + /** + * Used by `_.defaults` to customize its `_.assignIn` use to assign properties + * of source objects to the destination object for all destination properties + * that resolve to `undefined`. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain + * objects. + * + * @private + * @param {*} value The value to inspect. + * @param {string} key The key of the property to inspect. + * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. + */ + function customOmitClone(value) { + return isPlainObject(value) ? undefined : value; + } + + /** + * 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, + 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) ? 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; + } + + /** + * 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; + 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; + } + + /** + * 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, + 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.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; + } + + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + + /** + * 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); + } + + /** + * Gets metadata for `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {*} Returns the metadata for `func`. + */ + var getData = !metaMap ? noop : function(func) { + return metaMap.get(func); + }; + + /** + * Gets the name of `func`. + * + * @private + * @param {Function} func The function to query. + * @returns {string} Returns the function name. + */ + function getFuncName(func) { + var result = (func.name + ''), + array = realNames[result], + length = hasOwnProperty.call(realNames, result) ? array.length : 0; + + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; + } + } + return result; + } + + /** + * Gets the argument placeholder value for `func`. + * + * @private + * @param {Function} func The function to inspect. + * @returns {*} Returns the placeholder value. + */ + function getHolder(func) { + var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; + return object.placeholder; + } + + /** + * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, + * this function returns the custom method, otherwise it returns `baseIteratee`. + * If arguments are provided, the chosen function is invoked with them and + * its result is returned. + * + * @private + * @param {*} [value] The value to convert to an iteratee. + * @param {number} [arity] The arity of the created iteratee. + * @returns {Function} Returns the chosen function or its result. + */ + function getIteratee() { + var result = lodash.iteratee || iteratee; + result = result === iteratee ? baseIteratee : result; + return arguments.length ? result(arguments[0], arguments[1]) : result; + } + + /** + * 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; + } + + /** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; + } + + /** + * 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; + } + + /** + * 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.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * 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); + }); + }; + + /** + * 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; + }; + + /** + * 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 && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? 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; + }; + } + + /** + * Gets the view, applying any `transforms` to the `start` and `end` positions. + * + * @private + * @param {number} start The start of the view. + * @param {number} end The end of the view. + * @param {Array} transforms The transformations to apply to the view. + * @returns {Object} Returns an object containing the `start` and `end` + * positions of the view. + */ + function getView(start, end, transforms) { + var index = -1, + length = transforms.length; + + while (++index < length) { + var data = transforms[index], + size = data.size; + + switch (data.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + return { 'start': start, 'end': end }; + } + + /** + * Extracts wrapper details from the `source` body comment. + * + * @private + * @param {string} source The source to inspect. + * @returns {Array} Returns the wrapper details. + */ + function getWrapDetails(source) { + var match = source.match(reWrapDetails); + return match ? match[1].split(reSplitDetails) : []; + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + path = castPath(path, object); + + var index = -1, + length = path.length, + result = false; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; + } + object = object[key]; + } + if (result || ++index != length) { + return result; + } + length = object == null ? 0 : object.length; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); + } + + /** + * 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; + } + + /** + * 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)) + : {}; + } + + /** + * 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: + return cloneArrayBuffer(object); + + case boolTag: + case dateTag: + return new Ctor(+object); + + case dataViewTag: + return cloneDataView(object, isDeep); + + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: + return cloneTypedArray(object, isDeep); + + case mapTag: + return new Ctor; + + case numberTag: + case stringTag: + return new Ctor(object); + + case regexpTag: + return cloneRegExp(object); + + case setTag: + return new Ctor; + + case symbolTag: + return cloneSymbol(object); + } + } + + /** + * Inserts wrapper `details` in a comment at the top of the `source` body. + * + * @private + * @param {string} source The source to modify. + * @returns {Array} details The details to insert. + * @returns {string} Returns the modified source. + */ + function insertWrapDetails(source, details) { + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; + details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; + details = details.join(length > 2 ? ', ' : ' '); + return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); + } + + /** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ + function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); + } + + /** + * 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 : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * 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); + } + + /** + * Checks if `func` has a lazy counterpart. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` has a lazy counterpart, + * else `false`. + */ + function isLaziable(func) { + var funcName = getFuncName(func), + other = lodash[funcName]; + + if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { + return false; + } + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; + } + + /** + * 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); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = coreJsData ? isFunction : stubFalse; + + /** + * 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; + + return value === proto; + } + + /** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ + function isStrictComparable(value) { + return value === value && !isObject(value); + } + + /** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ + function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; + } + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Merges the function metadata of `source` into `data`. + * + * Merging metadata reduces the number of wrappers used to invoke a function. + * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` + * may be applied regardless of execution order. Methods like `_.ary` and + * `_.rearg` modify function arguments, making the order in which they are + * executed important, preventing the merging of metadata. However, we make + * an exception for a safe combined case where curried functions have `_.ary` + * and or `_.rearg` applied. + * + * @private + * @param {Array} data The destination metadata. + * @param {Array} source The source metadata. + * @returns {Array} Returns `data`. + */ + function mergeData(data, source) { + var bitmask = data[1], + srcBitmask = source[1], + newBitmask = bitmask | srcBitmask, + isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); + + var isCombo = + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + + // Exit early if metadata can't be merged. + if (!(isCommon || isCombo)) { + return data; + } + // Use source `thisArg` if available. + if (srcBitmask & WRAP_BIND_FLAG) { + data[2] = source[2]; + // Set when currying a bound function. + newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; + } + // Compose partial arguments. + var value = source[3]; + if (value) { + var partials = data[3]; + data[3] = partials ? composeArgs(partials, value, source[4]) : value; + data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; + } + // Compose partial right arguments. + value = source[5]; + if (value) { + partials = data[5]; + data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; + data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; + } + // Use source `argPos` if available. + value = source[7]; + if (value) { + data[7] = value; + } + // Use source `ary` if it's smaller. + if (srcBitmask & WRAP_ARY_FLAG) { + data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); + } + // Use source `arity` if one is not provided. + if (data[9] == null) { + data[9] = source[9]; + } + // Use source `func` and merge bitmasks. + data[0] = source[0]; + data[1] = newBitmask; + + return data; + } + + /** + * 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; + } + + /** + * 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); + } + + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); + } + + /** + * Reorder `array` according to the specified indexes where the element at + * the first index is assigned as the first element, the element at + * the second index is assigned as the second element, and so on. + * + * @private + * @param {Array} array The array to reorder. + * @param {Array} indexes The arranged array indexes. + * @returns {Array} Returns `array`. + */ + function reorder(array, indexes) { + var arrLength = array.length, + length = nativeMin(indexes.length, arrLength), + oldArray = copyArray(array); + + while (length--) { + var index = indexes[length]; + array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; + } + return array; + } + + /** + * Gets the value at `key`, unless `key` is "__proto__" or "constructor". + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function safeGet(object, key) { + if (key === 'constructor' && typeof object[key] === 'function') { + return; + } + + if (key == '__proto__') { + return; + } + + return object[key]; + } + + /** + * Sets metadata for `func`. + * + * **Note:** If this function becomes hot, i.e. is invoked a lot in a short + * period of time, it will trip its breaker and transition to an identity + * function to avoid garbage collection pauses in V8. See + * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) + * for more details. + * + * @private + * @param {Function} func The function to associate metadata with. + * @param {*} data The metadata. + * @returns {Function} Returns `func`. + */ + var setData = shortOut(baseSetData); + + /** + * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). + * + * @private + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @returns {number|Object} Returns the timer id or timeout object. + */ + var setTimeout = ctxSetTimeout || function(func, wait) { + return root.setTimeout(func, wait); + }; + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + + /** + * Sets the `toString` method of `wrapper` to mimic the source of `reference` + * with wrapper details in a comment at the top of the source body. + * + * @private + * @param {Function} wrapper The function to modify. + * @param {Function} reference The reference function. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Function} Returns `wrapper`. + */ + function setWrapToString(wrapper, reference, bitmask) { + var source = (reference + ''); + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + /** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * 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.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /** + * Updates wrapper `details` based on `bitmask` flags. + * + * @private + * @returns {Array} details The details to modify. + * @param {number} bitmask The bitmask flags. See `createWrap` for more details. + * @returns {Array} Returns `details`. + */ + function updateWrapDetails(details, bitmask) { + arrayEach(wrapFlags, function(pair) { + var value = '_.' + pair[0]; + if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { + details.push(value); + } + }); + return details.sort(); + } + + /** + * Creates a clone of `wrapper`. + * + * @private + * @param {Object} wrapper The wrapper to clone. + * @returns {Object} Returns the cloned wrapper. + */ + function wrapperClone(wrapper) { + if (wrapper instanceof LazyWrapper) { + return wrapper.clone(); + } + var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); + result.__actions__ = copyArray(wrapper.__actions__); + result.__index__ = wrapper.__index__; + result.__values__ = wrapper.__values__; + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; + } + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + function compact(array) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[resIndex++] = value; + } + } + return result; + } + + /** + * Creates a new array concatenating `array` with any additional arrays + * and/or values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to concatenate. + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var other = _.concat(array, 2, [3], [[4]]); + * + * console.log(other); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + function concat() { + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), + array = arguments[0], + index = length; + + while (index--) { + args[index - 1] = arguments[index]; + } + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); + } + + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `iteratee` which + * is invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * **Note:** Unlike `_.pullAllBy`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] + * + * // The `_.property` iteratee shorthand. + * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var differenceBy = baseRest(function(array, values) { + var iteratee = last(values); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.difference` except that it accepts `comparator` + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.pullAllWith`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * + * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); + * // => [{ 'x': 2, 'y': 1 }] + */ + var differenceWith = baseRest(function(array, values) { + var comparator = last(values); + if (isArrayLikeObject(comparator)) { + comparator = undefined; + } + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) + : []; + }); + + /** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function drop(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ + function dropRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.dropRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney'] + * + * // The `_.matches` iteratee shorthand. + * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropRightWhile(users, ['active', false]); + * // => objects for ['barney'] + * + * // The `_.property` iteratee shorthand. + * _.dropRightWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true, true) + : []; + } + + /** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.dropWhile(users, function(o) { return !o.active; }); + * // => objects for ['pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.dropWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.dropWhile(users, ['active', false]); + * // => objects for ['pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.dropWhile(users, 'active'); + * // => objects for ['barney', 'fred', 'pebbles'] + */ + function dropWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), true) + : []; + } + + /** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8, 10], '*', 1, 3); + * // => [4, '*', '*', 10] + */ + function fill(array, value, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); + } + + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); + } + + /** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); + * // => 2 + * + * // The `_.matches` iteratee shorthand. + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastIndex(users, ['active', false]); + * // => 2 + * + * // The `_.property` iteratee shorthand. + * _.findLastIndex(users, 'active'); + * // => 0 + */ + function findLastIndex(array, predicate, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); + } + + /** + * Flattens `array` a single level deep. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, [3, [4]], 5]]); + * // => [1, 2, [3, [4]], 5] + */ + function flatten(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, 1) : []; + } + + /** + * Recursively flattens `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, [3, [4]], 5]]); + * // => [1, 2, 3, 4, 5] + */ + function flattenDeep(array) { + var length = array == null ? 0 : array.length; + return length ? baseFlatten(array, INFINITY) : []; + } + + /** + * Recursively flatten `array` up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Array + * @param {Array} array The array to flatten. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * var array = [1, [2, [3, [4]], 5]]; + * + * _.flattenDepth(array, 1); + * // => [1, 2, [3, [4]], 5] + * + * _.flattenDepth(array, 2); + * // => [1, 2, 3, [4], 5] + */ + function flattenDepth(array, depth) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(array, depth); + } + + /** + * The inverse of `_.toPairs`; this method returns an object composed + * from key-value `pairs`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} pairs The key-value pairs. + * @returns {Object} Returns the new object. + * @example + * + * _.fromPairs([['a', 1], ['b', 2]]); + * // => { 'a': 1, 'b': 2 } + */ + function fromPairs(pairs) { + var index = -1, + length = pairs == null ? 0 : pairs.length, + result = {}; + + while (++index < length) { + var pair = pairs[index]; + result[pair[0]] = pair[1]; + } + return result; + } + + /** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias first + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.head([1, 2, 3]); + * // => 1 + * + * _.head([]); + * // => undefined + */ + function head(array) { + return (array && array.length) ? array[0] : undefined; + } + + /** + * Gets the index at which the first occurrence of `value` is found in `array` + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the + * offset from the end of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseIndexOf(array, value, index); + } + + /** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ + function initial(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 0, -1) : []; + } + + /** + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersection([2, 1], [2, 3]); + * // => [2] + */ + var intersection = baseRest(function(arrays) { + var mapped = arrayMap(arrays, castArrayLikeObject); + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `iteratee` + * which is invoked for each element of each `arrays` to generate the criterion + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [2.1] + * + * // The `_.property` iteratee shorthand. + * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }] + */ + var intersectionBy = baseRest(function(arrays) { + var iteratee = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + if (iteratee === last(mapped)) { + iteratee = undefined; + } else { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, getIteratee(iteratee, 2)) + : []; + }); + + /** + * This method is like `_.intersection` except that it accepts `comparator` + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of intersecting values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.intersectionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }] + */ + var intersectionWith = baseRest(function(arrays) { + var comparator = last(arrays), + mapped = arrayMap(arrays, castArrayLikeObject); + + comparator = typeof comparator == 'function' ? comparator : undefined; + if (comparator) { + mapped.pop(); + } + return (mapped.length && mapped[0] === arrays[0]) + ? baseIntersection(mapped, undefined, comparator) + : []; + }); + + /** + * Converts all elements in `array` into a string separated by `separator`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to convert. + * @param {string} [separator=','] The element separator. + * @returns {string} Returns the joined string. + * @example + * + * _.join(['a', 'b', 'c'], '~'); + * // => 'a~b~c' + */ + function join(array, separator) { + return array == null ? '' : nativeJoin.call(array, separator); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array == null ? 0 : array.length; + return length ? array[length - 1] : undefined; + } + + /** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ + function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); + } + + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth + * element from the end is returned. + * + * @static + * @memberOf _ + * @since 4.11.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=0] The index of the element to return. + * @returns {*} Returns the nth element of `array`. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * + * _.nth(array, 1); + * // => 'b' + * + * _.nth(array, -2); + * // => 'c'; + */ + function nth(array, n) { + return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; + } + + /** + * Removes all given values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` + * to remove elements from an array by predicate. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pull(array, 'a', 'c'); + * console.log(array); + * // => ['b', 'b'] + */ + var pull = baseRest(pullAll); + + /** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; + * + * _.pullAll(array, ['a', 'c']); + * console.log(array); + * // => ['b', 'b'] + */ + function pullAll(array, values) { + return (array && array.length && values && values.length) + ? basePullAll(array, values) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `iteratee` which is + * invoked for each element of `array` and `values` to generate the criterion + * by which they're compared. The iteratee is invoked with one argument: (value). + * + * **Note:** Unlike `_.differenceBy`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ + function pullAllBy(array, values, iteratee) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, getIteratee(iteratee, 2)) + : array; + } + + /** + * This method is like `_.pullAll` except that it accepts `comparator` which + * is invoked to compare elements of `array` to `values`. The comparator is + * invoked with two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Array} values The values to remove. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns `array`. + * @example + * + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ + function pullAllWith(array, values, comparator) { + return (array && array.length && values && values.length) + ? basePullAll(array, values, undefined, comparator) + : array; + } + + /** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ + var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; + }); + + /** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is invoked + * with three arguments: (value, index, array). + * + * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` + * to pull elements from an array by value. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ + function remove(array, predicate) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = getIteratee(predicate, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; + } + + /** + * Reverses `array` so that the first element becomes the last, the second + * element becomes the second to last, and so on. + * + * **Note:** This method mutates `array` and is based on + * [`Array#reverse`](https://mdn.io/Array/reverse). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to modify. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.reverse(array); + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function reverse(array) { + return array == null ? array : nativeReverse.call(array); + } + + /** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of + * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are + * returned. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function slice(array, start, end) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + else { + start = start == null ? 0 : toInteger(start); + end = end === undefined ? length : toInteger(end); + } + return baseSlice(array, start, end); + } + + /** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + */ + function sortedIndex(array, value) { + return baseSortedIndex(array, value); + } + + /** + * This method is like `_.sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); + * // => 0 + */ + function sortedIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); + } + + /** + * This method is like `_.indexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 + */ + function sortedIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value); + if (index < length && eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 + */ + function sortedLastIndex(array, value) { + return baseSortedIndex(array, value, true); + } + + /** + * This method is like `_.sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * + * // The `_.property` iteratee shorthand. + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); + * // => 1 + */ + function sortedLastIndexBy(array, value, iteratee) { + return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); + } + + /** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); + * // => 3 + */ + function sortedLastIndexOf(array, value) { + var length = array == null ? 0 : array.length; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; + } + + /** + * This method is like `_.uniq` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniq([1, 1, 2]); + * // => [1, 2] + */ + function sortedUniq(array) { + return (array && array.length) + ? baseSortedUniq(array) + : []; + } + + /** + * This method is like `_.uniqBy` except that it's designed and optimized + * for sorted arrays. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); + * // => [1.1, 2.3] + */ + function sortedUniqBy(array, iteratee) { + return (array && array.length) + ? baseSortedUniq(array, getIteratee(iteratee, 2)) + : []; + } + + /** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.tail([1, 2, 3]); + * // => [2, 3] + */ + function tail(array) { + var length = array == null ? 0 : array.length; + return length ? baseSlice(array, 1, length) : []; + } + + /** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ + function take(array, n, guard) { + if (!(array && array.length)) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + return baseSlice(array, 0, n < 0 ? 0 : n); + } + + /** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ + function takeRight(array, n, guard) { + var length = array == null ? 0 : array.length; + if (!length) { + return []; + } + n = (guard || n === undefined) ? 1 : toInteger(n); + n = length - n; + return baseSlice(array, n < 0 ? 0 : n, length); + } + + /** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.matches` iteratee shorthand. + * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * // The `_.property` iteratee shorthand. + * _.takeRightWhile(users, 'active'); + * // => [] + */ + function takeRightWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3), false, true) + : []; + } + + /** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is invoked with + * three arguments: (value, index, array). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to query. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the slice of `array`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * // The `_.matches` iteratee shorthand. + * _.takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * // The `_.property` iteratee shorthand. + * _.takeWhile(users, 'active'); + * // => [] + */ + function takeWhile(array, predicate) { + return (array && array.length) + ? baseWhile(array, getIteratee(predicate, 3)) + : []; + } + + /** + * Creates an array of unique values, in order, from all given arrays using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([2], [1, 2]); + * // => [2, 1] + */ + var union = baseRest(function(arrays) { + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); + }); + + /** + * This method is like `_.union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which uniqueness is computed. Result values are chosen from the first + * array in which the value occurs. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + var unionBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. Result values are chosen from + * the first array in which the value occurs. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of combined values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.unionWith(objects, others, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var unionWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); + }); + + /** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ + function uniq(array) { + return (array && array.length) ? baseUniq(array) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * // The `_.property` iteratee shorthand. + * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ + function uniqBy(array, iteratee) { + return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; + } + + /** + * This method is like `_.uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.uniqWith(objects, _.isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator == 'function' ? comparator : undefined; + return (array && array.length) ? baseUniq(array, undefined, comparator) : []; + } + + /** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-zip + * configuration. + * + * @static + * @memberOf _ + * @since 1.2.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + * + * _.unzip(zipped); + * // => [['a', 'b'], [1, 2], [true, false]] + */ + function unzip(array) { + if (!(array && array.length)) { + return []; + } + var length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLikeObject(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + return baseTimes(length, function(index) { + return arrayMap(array, baseProperty(index)); + }); + } + + /** + * This method is like `_.unzip` except that it accepts `iteratee` to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee=_.identity] The function to combine + * regrouped values. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee) { + if (!(array && array.length)) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + return arrayMap(result, function(group) { + return apply(iteratee, undefined, group); + }); + } + + /** + * Creates an array excluding all given values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * **Note:** Unlike `_.pull`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.xor + * @example + * + * _.without([2, 1, 2, 3], 1, 2); + * // => [3] + */ + var without = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, values) + : []; + }); + + /** + * Creates an array of unique values that is the + * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the given arrays. The order of result values is determined by the order + * they occur in the arrays. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of filtered values. + * @see _.difference, _.without + * @example + * + * _.xor([2, 1], [2, 3]); + * // => [1, 3] + */ + var xor = baseRest(function(arrays) { + return baseXor(arrayFilter(arrays, isArrayLikeObject)); + }); + + /** + * This method is like `_.xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] + * + * // The `_.property` iteratee shorthand. + * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ + var xorBy = baseRest(function(arrays) { + var iteratee = last(arrays); + if (isArrayLikeObject(iteratee)) { + iteratee = undefined; + } + return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); + }); + + /** + * This method is like `_.xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * + * _.xorWith(objects, others, _.isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ + var xorWith = baseRest(function(arrays) { + var comparator = last(arrays); + comparator = typeof comparator == 'function' ? comparator : undefined; + return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); + }); + + /** + * Creates an array of grouped elements, the first of which contains the + * first elements of the given arrays, the second of which contains the + * second elements of the given arrays, and so on. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['a', 'b'], [1, 2], [true, false]); + * // => [['a', 1, true], ['b', 2, false]] + */ + var zip = baseRest(unzip); + + /** + * This method is like `_.fromPairs` except that it accepts two arrays, + * one of property identifiers and one of corresponding values. + * + * @static + * @memberOf _ + * @since 0.4.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['a', 'b'], [1, 2]); + * // => { 'a': 1, 'b': 2 } + */ + function zipObject(props, values) { + return baseZipObject(props || [], values || [], assignValue); + } + + /** + * This method is like `_.zipObject` except that it supports property paths. + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Array + * @param {Array} [props=[]] The property identifiers. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); + * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ + function zipObjectDeep(props, values) { + return baseZipObject(props || [], values || [], baseSet); + } + + /** + * This method is like `_.zip` except that it accepts `iteratee` to specify + * how grouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee=_.identity] The function to combine + * grouped values. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { + * return a + b + c; + * }); + * // => [111, 222] + */ + var zipWith = baseRest(function(arrays) { + var length = arrays.length, + iteratee = length > 1 ? arrays[length - 1] : undefined; + + iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; + return unzipWith(arrays, iteratee); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` wrapper instance that wraps `value` with explicit method + * chain sequences enabled. The result of such sequences must be unwrapped + * with `_#value`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Seq + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _ + * .chain(users) + * .sortBy('age') + * .map(function(o) { + * return o.user + ' is ' + o.age; + * }) + * .head() + * .value(); + * // => 'pebbles is 1' + */ + function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; + } + + /** + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain sequence in order to modify intermediate results. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * // Mutate input array. + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain sequence. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Seq + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ + function thru(value, interceptor) { + return interceptor(value); + } + + /** + * This method is the wrapper version of `_.at`. + * + * @name at + * @memberOf _ + * @since 1.0.0 + * @category Seq + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _(object).at(['a[0].b.c', 'a[1]']).value(); + * // => [3, 4] + */ + var wrapperAt = flatRest(function(paths) { + var length = paths.length, + start = length ? paths[0] : 0, + value = this.__wrapped__, + interceptor = function(object) { return baseAt(object, paths); }; + + if (length > 1 || this.__actions__.length || + !(value instanceof LazyWrapper) || !isIndex(start)) { + return this.thru(interceptor); + } + value = value.slice(start, +start + (length ? 1 : 0)); + value.__actions__.push({ + 'func': thru, + 'args': [interceptor], + 'thisArg': undefined + }); + return new LodashWrapper(value, this.__chain__).thru(function(array) { + if (length && !array.length) { + array.push(undefined); + } + return array; + }); + }); + + /** + * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. + * + * @name chain + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // A sequence without explicit chaining. + * _(users).head(); + * // => { 'user': 'barney', 'age': 36 } + * + * // A sequence with explicit chaining. + * _(users) + * .chain() + * .head() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ + function wrapperChain() { + return chain(this); + } + + /** + * Executes the chain sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapped = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapped = wrapped.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapped.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ + function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); + } + + /** + * Gets the next value on a wrapped object following the + * [iterator protocol](https://mdn.io/iteration_protocols#iterator). + * + * @name next + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the next iterator value. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped.next(); + * // => { 'done': false, 'value': 1 } + * + * wrapped.next(); + * // => { 'done': false, 'value': 2 } + * + * wrapped.next(); + * // => { 'done': true, 'value': undefined } + */ + function wrapperNext() { + if (this.__values__ === undefined) { + this.__values__ = toArray(this.value()); + } + var done = this.__index__ >= this.__values__.length, + value = done ? undefined : this.__values__[this.__index__++]; + + return { 'done': done, 'value': value }; + } + + /** + * Enables the wrapper to be iterable. + * + * @name Symbol.iterator + * @memberOf _ + * @since 4.0.0 + * @category Seq + * @returns {Object} Returns the wrapper object. + * @example + * + * var wrapped = _([1, 2]); + * + * wrapped[Symbol.iterator]() === wrapped; + * // => true + * + * Array.from(wrapped); + * // => [1, 2] + */ + function wrapperToIterator() { + return this; + } + + /** + * Creates a clone of the chain sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @since 3.2.0 + * @category Seq + * @param {*} value The value to plant. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2]).map(square); + * var other = wrapped.plant([3, 4]); + * + * other.value(); + * // => [9, 16] + * + * wrapped.value(); + * // => [1, 4] + */ + function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + clone.__index__ = 0; + clone.__values__ = undefined; + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; + } + + /** + * This method is the wrapper version of `_.reverse`. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @since 0.1.0 + * @category Seq + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + var wrapped = value; + if (this.__actions__.length) { + wrapped = new LazyWrapper(this); + } + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ + 'func': thru, + 'args': [reverse], + 'thisArg': undefined + }); + return new LodashWrapper(wrapped, this.__chain__); + } + return this.thru(reverse); + } + + /** + * Executes the chain sequence to resolve the unwrapped value. + * + * @name value + * @memberOf _ + * @since 0.1.0 + * @alias toJSON, valueOf + * @category Seq + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ + function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the number of times the key was returned by `iteratee`. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': 1, '6': 2 } + * + * // The `_.property` iteratee shorthand. + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ + var countBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } + }); + + /** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * Iteration is stopped once `predicate` returns falsey. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * **Note:** This method returns `true` for + * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because + * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of + * elements of empty collections. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.every(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.every(users, 'active'); + * // => false + */ + function every(collection, predicate, guard) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * **Note:** Unlike `_.remove`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.reject + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.filter(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.filter(users, { 'age': 36, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.filter(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.filter(users, 'active'); + * // => objects for ['barney'] + * + * // Combining several predicates using `_.overEvery` or `_.overSome`. + * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); + * // => objects for ['fred', 'barney'] + */ + function filter(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is invoked with three + * arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.find(users, function(o) { return o.age < 40; }); + * // => object for 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.find(users, { 'age': 1, 'active': true }); + * // => object for 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.find(users, ['active', false]); + * // => object for 'fred' + * + * // The `_.property` iteratee shorthand. + * _.find(users, 'active'); + * // => object for 'barney' + */ + var find = createFind(findIndex); + + /** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param {number} [fromIndex=collection.length-1] The index to search from. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ + var findLast = createFind(findLastIndex); + + /** + * Creates a flattened array of values by running each element in `collection` + * thru `iteratee` and flattening the mapped results. The iteratee is invoked + * with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee), 1); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDeep([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMapDeep(collection, iteratee) { + return baseFlatten(map(collection, iteratee), INFINITY); + } + + /** + * This method is like `_.flatMap` except that it recursively flattens the + * mapped results up to `depth` times. + * + * @static + * @memberOf _ + * @since 4.7.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {number} [depth=1] The maximum recursion depth. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [[[n, n]]]; + * } + * + * _.flatMapDepth([1, 2], duplicate, 2); + * // => [[1, 1], [2, 2]] + */ + function flatMapDepth(collection, iteratee, depth) { + depth = depth === undefined ? 1 : toInteger(depth); + return baseFlatten(map(collection, iteratee), depth); + } + + /** + * Iterates over elements of `collection` and invokes `iteratee` for each element. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" + * property are iterated like arrays. To avoid this behavior use `_.forIn` + * or `_.forOwn` for object iteration. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @alias each + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEachRight + * @example + * + * _.forEach([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `1` then `2`. + * + * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forEach(collection, iteratee) { + var func = isArray(collection) ? arrayEach : baseEach; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @alias eachRight + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array|Object} Returns `collection`. + * @see _.forEach + * @example + * + * _.forEachRight([1, 2], function(value) { + * console.log(value); + * }); + * // => Logs `2` then `1`. + */ + function forEachRight(collection, iteratee) { + var func = isArray(collection) ? arrayEachRight : baseEachRight; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The order of grouped values + * is determined by the order they occur in `collection`. The corresponding + * value of each key is an array of elements responsible for generating the + * key. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([6.1, 4.2, 6.3], Math.floor); + * // => { '4': [4.2], '6': [6.1, 6.3] } + * + * // The `_.property` iteratee shorthand. + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ + var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + baseAssignValue(result, key, [value]); + } + }); + + /** + * Checks if `value` is in `collection`. If `collection` is a string, it's + * checked for a substring of `value`, otherwise + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * is used for equality comparisons. If `fromIndex` is negative, it's used as + * the offset from the end of `collection`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {boolean} Returns `true` if `value` is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'a': 1, 'b': 2 }, 1); + * // => true + * + * _.includes('abcd', 'bc'); + * // => true + */ + function includes(collection, value, fromIndex, guard) { + collection = isArrayLike(collection) ? collection : values(collection); + fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; + + var length = collection.length; + if (fromIndex < 0) { + fromIndex = nativeMax(length + fromIndex, 0); + } + return isString(collection) + ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) + : (!!length && baseIndexOf(collection, value, fromIndex) > -1); + } + + /** + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `path` is a function, it's invoked + * for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke each method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invokeMap([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invokeMap = baseRest(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + result = isArrayLike(collection) ? Array(collection.length) : []; + + baseEach(collection, function(value) { + result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); + }); + return result; + }); + + /** + * Creates an object composed of keys generated from the results of running + * each element of `collection` thru `iteratee`. The corresponding value of + * each key is the last element responsible for generating the key. The + * iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The iteratee to transform keys. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var array = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.keyBy(array, function(o) { + * return String.fromCharCode(o.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.keyBy(array, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + */ + var keyBy = createAggregator(function(result, value, key) { + baseAssignValue(result, key, value); + }); + + /** + * Creates an array of values by running each element in `collection` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, + * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, + * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, + * `template`, `trim`, `trimEnd`, `trimStart`, and `words` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + * @example + * + * function square(n) { + * return n * n; + * } + * + * _.map([4, 8], square); + * // => [16, 64] + * + * _.map({ 'a': 4, 'b': 8 }, square); + * // => [16, 64] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // The `_.property` iteratee shorthand. + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ + function map(collection, iteratee) { + var func = isArray(collection) ? arrayMap : baseMap; + return func(collection, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.sortBy` except that it allows specifying the sort + * orders of the iteratees to sort by. If `orders` is unspecified, all values + * are sorted in ascending order. Otherwise, specify an order of "desc" for + * descending or "asc" for ascending sort order of corresponding values. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] + * The iteratees to sort by. + * @param {string[]} [orders] The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // Sort by `user` in ascending order and by `age` in descending order. + * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] + */ + function orderBy(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + orders = guard ? undefined : orders; + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseOrderBy(collection, iteratees, orders); + } + + /** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, the second of which + * contains elements `predicate` returns falsey for. The predicate is + * invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * _.partition(users, function(o) { return o.active; }); + * // => objects for [['fred'], ['barney', 'pebbles']] + * + * // The `_.matches` iteratee shorthand. + * _.partition(users, { 'age': 1, 'active': false }); + * // => objects for [['pebbles'], ['barney', 'fred']] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.partition(users, ['active', false]); + * // => objects for [['barney', 'pebbles'], ['fred']] + * + * // The `_.property` iteratee shorthand. + * _.partition(users, 'active'); + * // => objects for [['fred'], ['barney', 'pebbles']] + */ + var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); + }, function() { return [[], []]; }); + + /** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` thru `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not given, the first element of `collection` is used as the initial + * value. The iteratee is invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as iteratees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, + * and `sortBy` + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduceRight + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }, 0); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * return result; + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) + */ + function reduce(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduce : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); + } + + /** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @returns {*} Returns the accumulated value. + * @see _.reduce + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ + function reduceRight(collection, iteratee, accumulator) { + var func = isArray(collection) ? arrayReduceRight : baseReduce, + initAccum = arguments.length < 3; + + return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); + } + + /** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + * @see _.filter + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * _.reject(users, function(o) { return !o.active; }); + * // => objects for ['fred'] + * + * // The `_.matches` iteratee shorthand. + * _.reject(users, { 'age': 40, 'active': true }); + * // => objects for ['barney'] + * + * // The `_.matchesProperty` iteratee shorthand. + * _.reject(users, ['active', false]); + * // => objects for ['fred'] + * + * // The `_.property` iteratee shorthand. + * _.reject(users, 'active'); + * // => objects for ['barney'] + */ + function reject(collection, predicate) { + var func = isArray(collection) ? arrayFilter : baseFilter; + return func(collection, negate(getIteratee(predicate, 3))); + } + + /** + * Gets a random element from `collection`. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @returns {*} Returns the random element. + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + */ + function sample(collection) { + var func = isArray(collection) ? arraySample : baseSample; + return func(collection); + } + + /** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ + function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); + } + + /** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ + function shuffle(collection) { + var func = isArray(collection) ? arrayShuffle : baseShuffle; + return func(collection); + } + + /** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable string keyed properties for objects. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the collection size. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ + function size(collection) { + if (collection == null) { + return 0; + } + if (isArrayLike(collection)) { + return isString(collection) ? stringSize(collection) : collection.length; + } + var tag = getTag(collection); + if (tag == mapTag || tag == setTag) { + return collection.size; + } + return baseKeys(collection).length; + } + + /** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * Iteration is stopped once `predicate` returns truthy. The predicate is + * invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // The `_.matches` iteratee shorthand. + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // The `_.matchesProperty` iteratee shorthand. + * _.some(users, ['active', false]); + * // => true + * + * // The `_.property` iteratee shorthand. + * _.some(users, 'active'); + * // => true + */ + function some(collection, predicate, guard) { + var func = isArray(collection) ? arraySome : baseSome; + if (guard && isIterateeCall(collection, predicate, guard)) { + predicate = undefined; + } + return func(collection, getIteratee(predicate, 3)); + } + + /** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection thru each iteratee. This method + * performs a stable sort, that is, it preserves the original sort order of + * equal elements. The iteratees are invoked with one argument: (value). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {...(Function|Function[])} [iteratees=[_.identity]] + * The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] + * + * _.sortBy(users, ['user', 'age']); + * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] + */ + var sortBy = baseRest(function(collection, iteratees) { + if (collection == null) { + return []; + } + var length = iteratees.length; + if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + }); + + /*------------------------------------------------------------------------*/ + + /** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ + var now = ctxNow || function() { + return root.Date.now(); + }; + + /*------------------------------------------------------------------------*/ + + /** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {number} n The number of calls before `func` is invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var saves = ['profile', 'settings']; + * + * var done = _.after(saves.length, function() { + * console.log('done saving!'); + * }); + * + * _.forEach(saves, function(type) { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ + function after(n, func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n < 1) { + return func.apply(this, arguments); + } + }; + } + + /** + * Creates a function that invokes `func`, with up to `n` arguments, + * ignoring any additional arguments. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @param {number} [n=func.length] The arity cap. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.ary(parseInt, 1)); + * // => [6, 8, 10] + */ + function ary(func, n, guard) { + n = guard ? undefined : n; + n = (func && n == null) ? func.length : n; + return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); + } + + /** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {number} n The number of calls at which `func` is no longer invoked. + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * jQuery(element).on('click', _.before(5, addContactToList)); + * // => Allows adding up to 4 contacts to the list. + */ + function before(n, func) { + var result; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + n = toInteger(n); + return function() { + if (--n > 0) { + result = func.apply(this, arguments); + } + if (n <= 1) { + func = undefined; + } + return result; + }; + } + + /** + * Creates a function that invokes `func` with the `this` binding of `thisArg` + * and `partials` prepended to the arguments it receives. + * + * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for partially applied arguments. + * + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" + * property of bound functions. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * + * var object = { 'user': 'fred' }; + * + * var bound = _.bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * // Bound with placeholders. + * var bound = _.bind(greet, object, _, '!'); + * bound('hi'); + * // => 'hi fred!' + */ + var bind = baseRest(function(func, thisArg, partials) { + var bitmask = WRAP_BIND_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bind)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(func, bitmask, thisArg, partials, holders); + }); + + /** + * Creates a function that invokes the method at `object[key]` with `partials` + * prepended to the arguments it receives. + * + * This method differs from `_.bind` by allowing bound functions to reference + * methods that may be redefined or don't yet exist. See + * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) + * for more details. + * + * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Function + * @param {Object} object The object to invoke the method on. + * @param {string} key The key of the method. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var object = { + * 'user': 'fred', + * 'greet': function(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * }; + * + * var bound = _.bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function(greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * var bound = _.bindKey(object, 'greet', _, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ + var bindKey = baseRest(function(object, key, partials) { + var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; + if (partials.length) { + var holders = replaceHolders(partials, getHolder(bindKey)); + bitmask |= WRAP_PARTIAL_FLAG; + } + return createWrap(key, bitmask, object, partials, holders); + }); + + /** + * Creates a function that accepts arguments of `func` and either invokes + * `func` returning its result, if at least `arity` number of arguments have + * been provided, or returns a function that accepts the remaining `func` + * arguments, and so on. The arity of `func` may be specified if `func.length` + * is not sufficient. + * + * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, + * may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curry(abc); + * + * curried(1)(2)(3); + * // => [1, 2, 3] + * + * curried(1, 2)(3); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(1)(_, 3)(2); + * // => [1, 2, 3] + */ + function curry(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curry.placeholder; + return result; + } + + /** + * This method is like `_.curry` except that arguments are applied to `func` + * in the manner of `_.partialRight` instead of `_.partial`. + * + * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for provided arguments. + * + * **Note:** This method doesn't set the "length" property of curried functions. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to curry. + * @param {number} [arity=func.length] The arity of `func`. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the new curried function. + * @example + * + * var abc = function(a, b, c) { + * return [a, b, c]; + * }; + * + * var curried = _.curryRight(abc); + * + * curried(3)(2)(1); + * // => [1, 2, 3] + * + * curried(2, 3)(1); + * // => [1, 2, 3] + * + * curried(1, 2, 3); + * // => [1, 2, 3] + * + * // Curried with placeholders. + * curried(3)(1, _)(2); + * // => [1, 2, 3] + */ + function curryRight(func, arity, guard) { + arity = guard ? undefined : arity; + var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); + result.placeholder = curryRight.placeholder; + return result; + } + + /** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ + function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); + } + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; + } + + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } + + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } + + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + + /** + * Defers invoking the `func` until the current call stack has cleared. Any + * additional arguments are provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to defer. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { + * console.log(text); + * }, 'deferred'); + * // => Logs 'deferred' after one millisecond. + */ + var defer = baseRest(function(func, args) { + return baseDelay(func, 1, args); + }); + + /** + * Invokes `func` after `wait` milliseconds. Any additional arguments are + * provided to `func` when it's invoked. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to delay. + * @param {number} wait The number of milliseconds to delay invocation. + * @param {...*} [args] The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * @example + * + * _.delay(function(text) { + * console.log(text); + * }, 1000, 'later'); + * // => Logs 'later' after one second. + */ + var delay = baseRest(function(func, wait, args) { + return baseDelay(func, toNumber(wait) || 0, args); + }); + + /** + * Creates a function that invokes `func` with arguments reversed. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to flip arguments for. + * @returns {Function} Returns the new flipped function. + * @example + * + * var flipped = _.flip(function() { + * return _.toArray(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ + function flip(func) { + return createWrap(func, WRAP_FLIP_FLAG); + } + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /** + * Creates a function that negates the result of the predicate `func`. The + * `func` predicate is invoked with the `this` binding and arguments of the + * created function. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} predicate The predicate to negate. + * @returns {Function} Returns the new negated function. + * @example + * + * function isEven(n) { + * return n % 2 == 0; + * } + * + * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); + * // => [1, 3, 5] + */ + function negate(predicate) { + if (typeof predicate != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + + /** + * Creates a function that is restricted to invoking `func` once. Repeat calls + * to the function return the value of the first invocation. The `func` is + * invoked with the `this` binding and arguments of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new restricted function. + * @example + * + * var initialize = _.once(createApplication); + * initialize(); + * initialize(); + * // => `createApplication` is invoked once + */ + function once(func) { + return before(2, func); + } + + /** + * Creates a function that invokes `func` with its arguments transformed. + * + * @static + * @since 4.0.0 + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms=[_.identity]] + * The argument transforms. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var func = _.overArgs(function(x, y) { + * return [x, y]; + * }, [square, doubled]); + * + * func(9, 3); + * // => [81, 6] + * + * func(10, 5); + * // => [100, 10] + */ + var overArgs = castRest(function(func, transforms) { + transforms = (transforms.length == 1 && isArray(transforms[0])) + ? arrayMap(transforms[0], baseUnary(getIteratee())) + : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); + + var funcsLength = transforms.length; + return baseRest(function(args) { + var index = -1, + length = nativeMin(args.length, funcsLength); + + while (++index < length) { + args[index] = transforms[index].call(this, args[index]); + } + return apply(func, this, args); + }); + }); + + /** + * Creates a function that invokes `func` with `partials` prepended to the + * arguments it receives. This method is like `_.bind` except it does **not** + * alter the `this` binding. + * + * The `_.partial.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 0.2.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var sayHelloTo = _.partial(greet, 'hello'); + * sayHelloTo('fred'); + * // => 'hello fred' + * + * // Partially applied with placeholders. + * var greetFred = _.partial(greet, _, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + */ + var partial = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partial)); + return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); + }); + + /** + * This method is like `_.partial` except that partially applied arguments + * are appended to the arguments it receives. + * + * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic + * builds, may be used as a placeholder for partially applied arguments. + * + * **Note:** This method doesn't set the "length" property of partially + * applied functions. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Function + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [partials] The arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * function greet(greeting, name) { + * return greeting + ' ' + name; + * } + * + * var greetFred = _.partialRight(greet, 'fred'); + * greetFred('hi'); + * // => 'hi fred' + * + * // Partially applied with placeholders. + * var sayHelloTo = _.partialRight(greet, 'hello', _); + * sayHelloTo('fred'); + * // => 'hello fred' + */ + var partialRight = baseRest(function(func, partials) { + var holders = replaceHolders(partials, getHolder(partialRight)); + return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); + }); + + /** + * Creates a function that invokes `func` with arguments arranged according + * to the specified `indexes` where the argument value at the first index is + * provided as the first argument, the argument value at the second index is + * provided as the second argument, and so on. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Function + * @param {Function} func The function to rearrange arguments for. + * @param {...(number|number[])} indexes The arranged argument indexes. + * @returns {Function} Returns the new function. + * @example + * + * var rearged = _.rearg(function(a, b, c) { + * return [a, b, c]; + * }, [2, 0, 1]); + * + * rearged('b', 'c', 'a') + * // => ['a', 'b', 'c'] + */ + var rearg = flatRest(function(func, indexes) { + return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); + }); + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as + * an array. + * + * **Note:** This method is based on the + * [rest parameter](https://mdn.io/rest_parameters). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.rest(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function rest(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start === undefined ? start : toInteger(start); + return baseRest(func, start); + } + + /** + * Creates a function that invokes `func` with the `this` binding of the + * create function and an array of arguments much like + * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). + * + * **Note:** This method is based on the + * [spread operator](https://mdn.io/spread_operator). + * + * @static + * @memberOf _ + * @since 3.2.0 + * @category Function + * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ + function spread(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = start == null ? 0 : nativeMax(toInteger(start), 0); + return baseRest(function(args) { + var array = args[start], + otherArgs = castSlice(args, 0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); + } + + /** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ + function throttle(func, wait, options) { + var leading = true, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing + }); + } + + /** + * Creates a function that accepts up to one argument, ignoring any + * additional arguments. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Function + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + * @example + * + * _.map(['6', '8', '10'], _.unary(parseInt)); + * // => [6, 8, 10] + */ + function unary(func) { + return ary(func, 1); + } + + /** + * Creates a function that provides `value` to `wrapper` as its first + * argument. Any additional arguments provided to the function are appended + * to those provided to the `wrapper`. The wrapper is invoked with the `this` + * binding of the created function. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {*} value The value to wrap. + * @param {Function} [wrapper=identity] The wrapper function. + * @returns {Function} Returns the new function. + * @example + * + * var p = _.wrap(_.escape, function(func, text) { + * return '

' + func(text) + '

'; + * }); + * + * p('fred, barney, & pebbles'); + * // => '

fred, barney, & pebbles

' + */ + function wrap(value, wrapper) { + return partial(castFunction(wrapper), value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Casts `value` as an array if it's not one. + * + * @static + * @memberOf _ + * @since 4.4.0 + * @category Lang + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast array. + * @example + * + * _.castArray(1); + * // => [1] + * + * _.castArray({ 'a': 1 }); + * // => [{ 'a': 1 }] + * + * _.castArray('abc'); + * // => ['abc'] + * + * _.castArray(null); + * // => [null] + * + * _.castArray(undefined); + * // => [undefined] + * + * _.castArray(); + * // => [] + * + * var array = [1, 2, 3]; + * console.log(_.castArray(array) === array); + * // => true + */ + function castArray() { + if (!arguments.length) { + return []; + } + var value = arguments[0]; + return isArray(value) ? value : [value]; + } + + /** + * Creates a shallow clone of `value`. + * + * **Note:** This method is loosely based on the + * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) + * and supports cloning arrays, array buffers, booleans, date objects, maps, + * numbers, `Object` objects, regexes, sets, strings, symbols, and typed + * arrays. The own enumerable properties of `arguments` objects are cloned + * as plain objects. An empty object is returned for uncloneable values such + * as error objects, functions, DOM nodes, and WeakMaps. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + * @see _.cloneDeep + * @example + * + * var objects = [{ 'a': 1 }, { 'b': 2 }]; + * + * var shallow = _.clone(objects); + * console.log(shallow[0] === objects[0]); + * // => true + */ + function clone(value) { + return baseClone(value, CLONE_SYMBOLS_FLAG); + } + + /** + * This method is like `_.clone` except that it accepts `customizer` which + * is invoked to produce the cloned value. If `customizer` returns `undefined`, + * cloning is handled by the method instead. The `customizer` is invoked with + * up to four arguments; (value [, index|key, object, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the cloned value. + * @see _.cloneDeepWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(false); + * } + * } + * + * var el = _.cloneWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 0 + */ + function cloneWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * 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); + } + + /** + * This method is like `_.cloneWith` except that it recursively clones `value`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to recursively clone. + * @param {Function} [customizer] The function to customize cloning. + * @returns {*} Returns the deep cloned value. + * @see _.cloneWith + * @example + * + * function customizer(value) { + * if (_.isElement(value)) { + * return value.cloneNode(true); + * } + * } + * + * var el = _.cloneDeepWith(document.body, customizer); + * + * console.log(el === document.body); + * // => false + * console.log(el.nodeName); + * // => 'BODY' + * console.log(el.childNodes.length); + * // => 20 + */ + function cloneDeepWith(value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); + } + + /** + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. + * + * @static + * @memberOf _ + * @since 4.14.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); + * // => true + * + * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); + * // => false + */ + function conformsTo(object, source) { + return source == null || baseConformsTo(object, source, keys(source)); + } + + /** + * 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); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, + * else `false`. + * @see _.lt + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + var gt = createRelationalOperation(baseGt); + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to + * `other`, else `false`. + * @see _.lte + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + var gte = createRelationalOperation(function(value, other) { + return value >= other; + }); + + /** + * 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.call(value, 'callee') && + !propertyIsEnumerable.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; + + /** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. + * @example + * + * _.isArrayBuffer(new ArrayBuffer(2)); + * // => true + * + * _.isArrayBuffer(new Array(2)); + * // => false + */ + var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; + + /** + * 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); + } + + /** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ + function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); + } + + /** + * Checks if `value` is classified as a boolean primitive or object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. + * @example + * + * _.isBoolean(false); + * // => true + * + * _.isBoolean(null); + * // => false + */ + function isBoolean(value) { + return value === true || value === false || + (isObjectLike(value) && baseGetTag(value) == boolTag); + } + + /** + * 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; + + /** + * Checks if `value` is classified as a `Date` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a date object, else `false`. + * @example + * + * _.isDate(new Date); + * // => true + * + * _.isDate('Mon April 23 2012'); + * // => false + */ + var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; + + /** + * Checks if `value` is likely a DOM element. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + * + * _.isElement(''); + * // => false + */ + function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); + } + + /** + * Checks if `value` is an empty object, collection, map, or set. + * + * Objects are considered empty if they have no own enumerable string keyed + * properties. + * + * Array-like values such as `arguments` objects, arrays, buffers, strings, or + * jQuery-like collections are considered empty if they have a `length` of `0`. + * Similarly, maps and sets are considered empty if they have a `size` of `0`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is empty, else `false`. + * @example + * + * _.isEmpty(null); + * // => true + * + * _.isEmpty(true); + * // => true + * + * _.isEmpty(1); + * // => true + * + * _.isEmpty([1, 2, 3]); + * // => false + * + * _.isEmpty({ 'a': 1 }); + * // => false + */ + function isEmpty(value) { + if (value == null) { + return true; + } + if (isArrayLike(value) && + (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + isBuffer(value) || isTypedArray(value) || isArguments(value))) { + return !value.length; + } + var tag = getTag(value); + if (tag == mapTag || tag == setTag) { + return !value.size; + } + if (isPrototype(value)) { + return !baseKeys(value).length; + } + for (var key in value) { + if (hasOwnProperty.call(value, key)) { + return false; + } + } + return true; + } + + /** + * 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); + } + + /** + * This method is like `_.isEqual` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with up to + * six arguments: (objValue, othValue [, index|key, object, other, stack]). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, othValue) { + * if (isGreeting(objValue) && isGreeting(othValue)) { + * return true; + * } + * } + * + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; + * + * _.isEqualWith(array, other, customizer); + * // => true + */ + function isEqualWith(value, other, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + var result = customizer ? customizer(value, other) : undefined; + return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; + } + + /** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ + function isError(value) { + if (!isObjectLike(value)) { + return false; + } + var tag = baseGetTag(value); + return tag == errorTag || tag == domExcTag || + (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); + } + + /** + * Checks if `value` is a finite primitive number. + * + * **Note:** This method is based on + * [`Number.isFinite`](https://mdn.io/Number/isFinite). + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. + * @example + * + * _.isFinite(3); + * // => true + * + * _.isFinite(Number.MIN_VALUE); + * // => true + * + * _.isFinite(Infinity); + * // => false + * + * _.isFinite('3'); + * // => false + */ + function isFinite(value) { + return typeof value == 'number' && nativeIsFinite(value); + } + + /** + * 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 || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is an integer. + * + * **Note:** This method is based on + * [`Number.isInteger`](https://mdn.io/Number/isInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an integer, else `false`. + * @example + * + * _.isInteger(3); + * // => true + * + * _.isInteger(Number.MIN_VALUE); + * // => false + * + * _.isInteger(Infinity); + * // => false + * + * _.isInteger('3'); + * // => false + */ + function isInteger(value) { + return typeof value == 'number' && value == toInteger(value); + } + + /** + * 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 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'); + } + + /** + * 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 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; + + /** + * Performs a partial deep comparison between `object` and `source` to + * determine if `object` contains equivalent property values. + * + * **Note:** This method is equivalent to `_.matches` when `source` is + * partially applied. + * + * Partial comparisons will match empty array and empty object `source` + * values against any array or object value, respectively. See `_.isEqual` + * for a list of supported value comparisons. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * + * _.isMatch(object, { 'b': 2 }); + * // => true + * + * _.isMatch(object, { 'b': 1 }); + * // => false + */ + function isMatch(object, source) { + return object === source || baseIsMatch(object, source, getMatchData(source)); + } + + /** + * This method is like `_.isMatch` except that it accepts `customizer` which + * is invoked to compare values. If `customizer` returns `undefined`, comparisons + * are handled by the method instead. The `customizer` is invoked with five + * arguments: (objValue, srcValue, index|key, object, source). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + * @example + * + * function isGreeting(value) { + * return /^h(?:i|ello)$/.test(value); + * } + * + * function customizer(objValue, srcValue) { + * if (isGreeting(objValue) && isGreeting(srcValue)) { + * return true; + * } + * } + * + * var object = { 'greeting': 'hello' }; + * var source = { 'greeting': 'hi' }; + * + * _.isMatchWith(object, source, customizer); + * // => true + */ + function isMatchWith(object, source, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return baseIsMatch(object, source, getMatchData(source), customizer); + } + + /** + * Checks if `value` is `NaN`. + * + * **Note:** This method is based on + * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as + * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for + * `undefined` and other non-number values. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @example + * + * _.isNaN(NaN); + * // => true + * + * _.isNaN(new Number(NaN)); + * // => true + * + * isNaN(undefined); + * // => true + * + * _.isNaN(undefined); + * // => false + */ + function isNaN(value) { + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some + // ActiveX objects in IE. + return isNumber(value) && value != +value; + } + + /** + * Checks if `value` is a pristine native function. + * + * **Note:** This method can't reliably detect native functions in the presence + * of the core-js package because core-js circumvents this kind of detection. + * Despite multiple requests, the core-js maintainer has made it clear: any + * attempt to fix the detection will be obstructed. As a result, we're left + * with little choice but to throw an error. Unfortunately, this also affects + * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), + * which rely on core-js. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (isMaskable(value)) { + throw new Error(CORE_ERROR_TEXT); + } + return baseIsNative(value); + } + + /** + * Checks if `value` is `null`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `null`, else `false`. + * @example + * + * _.isNull(null); + * // => true + * + * _.isNull(void 0); + * // => false + */ + function isNull(value) { + return value === null; + } + + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + function isNil(value) { + return value == null; + } + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are + * classified as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a number, else `false`. + * @example + * + * _.isNumber(3); + * // => true + * + * _.isNumber(Number.MIN_VALUE); + * // => true + * + * _.isNumber(Infinity); + * // => true + * + * _.isNumber('3'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || + (isObjectLike(value) && baseGetTag(value) == numberTag); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * @static + * @memberOf _ + * @since 0.8.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + function isPlainObject(value) { + if (!isObjectLike(value) || baseGetTag(value) != objectTag) { + return false; + } + var proto = getPrototype(value); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor == 'function' && Ctor instanceof Ctor && + funcToString.call(Ctor) == objectCtorString; + } + + /** + * Checks if `value` is classified as a `RegExp` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. + * @example + * + * _.isRegExp(/abc/); + * // => true + * + * _.isRegExp('/abc/'); + * // => false + */ + var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; + + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on + * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + function isSafeInteger(value) { + return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; + } + + /** + * 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; + + /** + * Checks if `value` is classified as a `String` primitive or object. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a string, else `false`. + * @example + * + * _.isString('abc'); + * // => true + * + * _.isString(1); + * // => false + */ + function isString(value) { + return typeof value == 'string' || + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * 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; + + /** + * Checks if `value` is `undefined`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. + * @example + * + * _.isUndefined(void 0); + * // => true + * + * _.isUndefined(null); + * // => false + */ + function isUndefined(value) { + return value === undefined; + } + + /** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ + function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; + } + + /** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ + function isWeakSet(value) { + return isObjectLike(value) && baseGetTag(value) == weakSetTag; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, + * else `false`. + * @see _.gt + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + var lt = createRelationalOperation(baseLt); + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @since 3.9.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to + * `other`, else `false`. + * @see _.gte + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + var lte = createRelationalOperation(function(value, other) { + return value <= other; + }); + + /** + * Converts `value` to an array. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * _.toArray({ 'a': 1, 'b': 2 }); + * // => [1, 2] + * + * _.toArray('abc'); + * // => ['a', 'b', 'c'] + * + * _.toArray(1); + * // => [] + * + * _.toArray(null); + * // => [] + */ + function toArray(value) { + if (!value) { + return []; + } + if (isArrayLike(value)) { + return isString(value) ? stringToArray(value) : copyArray(value); + } + if (symIterator && value[symIterator]) { + return iteratorToArray(value[symIterator]()); + } + var tag = getTag(value), + func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); + + return func(value); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to an integer suitable for use as the length of an + * array-like object. + * + * **Note:** This method is 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 convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toLength(3.2); + * // => 3 + * + * _.toLength(Number.MIN_VALUE); + * // => 0 + * + * _.toLength(Infinity); + * // => 4294967295 + * + * _.toLength('3.2'); + * // => 3 + */ + function toLength(value) { + return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a plain object flattening inherited enumerable string + * keyed properties of `value` to own properties of the plain object. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {Object} Returns the converted plain object. + * @example + * + * function Foo() { + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.assign({ 'a': 1 }, new Foo); + * // => { 'a': 1, 'b': 2 } + * + * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); + * // => { 'a': 1, 'b': 2, 'c': 3 } + */ + function toPlainObject(value) { + return copyObject(value, keysIn(value)); + } + + /** + * Converts `value` to a safe integer. A safe integer can be compared and + * represented correctly. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toSafeInteger(3.2); + * // => 3 + * + * _.toSafeInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toSafeInteger(Infinity); + * // => 9007199254740991 + * + * _.toSafeInteger('3.2'); + * // => 3 + */ + function toSafeInteger(value) { + return value + ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) + : (value === 0 ? value : 0); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable string keyed properties of source objects to the + * destination object. Source objects are applied from left to right. + * Subsequent sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object` and is loosely based on + * [`Object.assign`](https://mdn.io/Object/assign). + * + * @static + * @memberOf _ + * @since 0.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assignIn + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assign({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'c': 3 } + */ + var assign = createAssigner(function(object, source) { + if (isPrototype(source) || isArrayLike(source)) { + copyObject(source, keys(source), object); + return; + } + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + assignValue(object, key, source[key]); + } + } + }); + + /** + * This method is like `_.assign` except that it iterates over own and + * inherited source properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.assign + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * function Bar() { + * this.c = 3; + * } + * + * Foo.prototype.b = 2; + * Bar.prototype.d = 4; + * + * _.assignIn({ 'a': 0 }, new Foo, new Bar); + * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } + */ + var assignIn = createAssigner(function(object, source) { + copyObject(source, keysIn(source), object); + }); + + /** + * This method is like `_.assignIn` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias extendWith + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignInWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keysIn(source), object, customizer); + }); + + /** + * This method is like `_.assign` except that it accepts `customizer` + * which is invoked to produce the assigned values. If `customizer` returns + * `undefined`, assignment is handled by the method instead. The `customizer` + * is invoked with five arguments: (objValue, srcValue, key, object, source). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @see _.assignInWith + * @example + * + * function customizer(objValue, srcValue) { + * return _.isUndefined(objValue) ? srcValue : objValue; + * } + * + * var defaults = _.partialRight(_.assignWith, customizer); + * + * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var assignWith = createAssigner(function(object, source, srcIndex, customizer) { + copyObject(source, keys(source), object, customizer); + }); + + /** + * Creates an array of values corresponding to `paths` of `object`. + * + * @static + * @memberOf _ + * @since 1.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Array} Returns the picked values. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; + * + * _.at(object, ['a[0].b.c', 'a[1]']); + * // => [3, 4] + */ + var at = flatRest(baseAt); + + /** + * Creates an object that inherits from the `prototype` object. If a + * `properties` object is given, its own enumerable string keyed properties + * are assigned to the created object. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Object + * @param {Object} prototype The object to inherit from. + * @param {Object} [properties] The properties to assign to the object. + * @returns {Object} Returns the new object. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * function Circle() { + * Shape.call(this); + * } + * + * Circle.prototype = _.create(Shape.prototype, { + * 'constructor': Circle + * }); + * + * var circle = new Circle; + * circle instanceof Circle; + * // => true + * + * circle instanceof Shape; + * // => true + */ + function create(prototype, properties) { + var result = baseCreate(prototype); + return properties == null ? result : baseAssign(result, properties); + } + + /** + * Assigns own and inherited enumerable string keyed properties of source + * objects to the destination object for all destination properties that + * resolve to `undefined`. Source objects are applied from left to right. + * Once a property is set, additional values of the same property are ignored. + * + * **Note:** This method mutates `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaultsDeep + * @example + * + * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); + * // => { 'a': 1, 'b': 2 } + */ + var defaults = baseRest(function(object, sources) { + object = Object(object); + + var index = -1; + var length = sources.length; + var guard = length > 2 ? sources[2] : undefined; + + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + length = 1; + } + + while (++index < length) { + var source = sources[index]; + var props = keysIn(source); + var propsIndex = -1; + var propsLength = props.length; + + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value = object[key]; + + if (value === undefined || + (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { + object[key] = source[key]; + } + } + } + + return object; + }); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.10.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @see _.defaults + * @example + * + * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); + * // => { 'a': { 'b': 2, 'c': 3 } } + */ + var defaultsDeep = baseRest(function(args) { + args.push(undefined, customDefaultsMerge); + return apply(mergeWith, undefined, args); + }); + + /** + * This method is like `_.find` except that it returns the key of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findKey(users, function(o) { return o.age < 40; }); + * // => 'barney' (iteration order is not guaranteed) + * + * // The `_.matches` iteratee shorthand. + * _.findKey(users, { 'age': 1, 'active': true }); + * // => 'pebbles' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findKey(users, 'active'); + * // => 'barney' + */ + function findKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); + } + + /** + * This method is like `_.findKey` except that it iterates over elements of + * a collection in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @param {Function} [predicate=_.identity] The function invoked per iteration. + * @returns {string|undefined} Returns the key of the matched element, + * else `undefined`. + * @example + * + * var users = { + * 'barney': { 'age': 36, 'active': true }, + * 'fred': { 'age': 40, 'active': false }, + * 'pebbles': { 'age': 1, 'active': true } + * }; + * + * _.findLastKey(users, function(o) { return o.age < 40; }); + * // => returns 'pebbles' assuming `_.findKey` returns 'barney' + * + * // The `_.matches` iteratee shorthand. + * _.findLastKey(users, { 'age': 36, 'active': true }); + * // => 'barney' + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findLastKey(users, ['active', false]); + * // => 'fred' + * + * // The `_.property` iteratee shorthand. + * _.findLastKey(users, 'active'); + * // => 'pebbles' + */ + function findLastKey(object, predicate) { + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); + } + + /** + * Iterates over own and inherited enumerable string keyed properties of an + * object and invokes `iteratee` for each property. The iteratee is invoked + * with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forInRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forIn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). + */ + function forIn(object, iteratee) { + return object == null + ? object + : baseFor(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * This method is like `_.forIn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forIn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forInRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. + */ + function forInRight(object, iteratee) { + return object == null + ? object + : baseForRight(object, getIteratee(iteratee, 3), keysIn); + } + + /** + * Iterates over own enumerable string keyed properties of an object and + * invokes `iteratee` for each property. The iteratee is invoked with three + * arguments: (value, key, object). Iteratee functions may exit iteration + * early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 0.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwnRight + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwn(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ + function forOwn(object, iteratee) { + return object && baseForOwn(object, getIteratee(iteratee, 3)); + } + + /** + * This method is like `_.forOwn` except that it iterates over properties of + * `object` in the opposite order. + * + * @static + * @memberOf _ + * @since 2.0.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns `object`. + * @see _.forOwn + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.forOwnRight(new Foo, function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. + */ + function forOwnRight(object, iteratee) { + return object && baseForOwnRight(object, getIteratee(iteratee, 3)); + } + + /** + * Creates an array of function property names from own enumerable properties + * of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functionsIn + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functions(new Foo); + * // => ['a', 'b'] + */ + function functions(object) { + return object == null ? [] : baseFunctions(object, keys(object)); + } + + /** + * Creates an array of function property names from own and inherited + * enumerable properties of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to inspect. + * @returns {Array} Returns the function names. + * @see _.functions + * @example + * + * function Foo() { + * this.a = _.constant('a'); + * this.b = _.constant('b'); + * } + * + * Foo.prototype.c = _.constant('c'); + * + * _.functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ + function functionsIn(object) { + return object == null ? [] : baseFunctions(object, keysIn(object)); + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': 2 } }; + * var other = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b'); + * // => true + * + * _.has(object, ['a', 'b']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return object != null && hasPath(object, path, baseHas); + } + + /** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ + function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); + } + + /** + * Creates an object composed of the inverted keys and values of `object`. + * If `object` contains duplicate values, subsequent values overwrite + * property assignments of previous values. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Object + * @param {Object} object The object to invert. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invert(object); + * // => { '1': 'c', '2': 'b' } + */ + var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + result[value] = key; + }, constant(identity)); + + /** + * This method is like `_.invert` except that the inverted object is generated + * from the results of running each element of `object` thru `iteratee`. The + * corresponding inverted value of each inverted key is an array of keys + * responsible for generating the inverted value. The iteratee is invoked + * with one argument: (value). + * + * @static + * @memberOf _ + * @since 4.1.0 + * @category Object + * @param {Object} object The object to invert. + * @param {Function} [iteratee=_.identity] The iteratee invoked per element. + * @returns {Object} Returns the new inverted object. + * @example + * + * var object = { 'a': 1, 'b': 2, 'c': 1 }; + * + * _.invertBy(object); + * // => { '1': ['a', 'c'], '2': ['b'] } + * + * _.invertBy(object, function(value) { + * return 'group' + value; + * }); + * // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ + var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + + if (hasOwnProperty.call(result, value)) { + result[value].push(key); + } else { + result[value] = [key]; + } + }, getIteratee); + + /** + * Invokes the method at `path` of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + * @example + * + * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; + * + * _.invoke(object, 'a[0].b.c.slice', 1, 3); + * // => [2, 3] + */ + var invoke = baseRest(baseInvoke); + + /** + * 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 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 opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * string keyed property of `object` thru `iteratee`. The iteratee is invoked + * with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @since 3.8.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapValues + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + function mapKeys(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, iteratee(value, key, object), value); + }); + return result; + } + + /** + * Creates an object with the same keys as `object` and values generated + * by running each own enumerable string keyed property of `object` thru + * `iteratee`. The iteratee is invoked with three arguments: + * (value, key, object). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @returns {Object} Returns the new mapped object. + * @see _.mapKeys + * @example + * + * var users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * + * _.mapValues(users, function(o) { return o.age; }); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + * + * // The `_.property` iteratee shorthand. + * _.mapValues(users, 'age'); + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) + */ + function mapValues(object, iteratee) { + var result = {}; + iteratee = getIteratee(iteratee, 3); + + baseForOwn(object, function(value, key, object) { + baseAssignValue(result, key, iteratee(value, key, object)); + }); + return result; + } + + /** + * This method is like `_.assign` except that it recursively merges own and + * inherited enumerable string keyed properties of source objects into the + * destination object. Source properties that resolve to `undefined` are + * skipped if a destination value exists. Array and plain object properties + * are merged recursively. Other objects and value types are overridden by + * assignment. Source objects are applied from left to right. Subsequent + * sources overwrite property assignments of previous sources. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 0.5.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * var object = { + * 'a': [{ 'b': 2 }, { 'd': 4 }] + * }; + * + * var other = { + * 'a': [{ 'c': 3 }, { 'e': 5 }] + * }; + * + * _.merge(object, other); + * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } + */ + var merge = createAssigner(function(object, source, srcIndex) { + baseMerge(object, source, srcIndex); + }); + + /** + * This method is like `_.merge` except that it accepts `customizer` which + * is invoked to produce the merged values of the destination and source + * properties. If `customizer` returns `undefined`, merging is handled by the + * method instead. The `customizer` is invoked with six arguments: + * (objValue, srcValue, key, object, source, stack). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The destination object. + * @param {...Object} sources The source objects. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * function customizer(objValue, srcValue) { + * if (_.isArray(objValue)) { + * return objValue.concat(srcValue); + * } + * } + * + * var object = { 'a': [1], 'b': [2] }; + * var other = { 'a': [3], 'b': [4] }; + * + * _.mergeWith(object, other, customizer); + * // => { 'a': [1, 3], 'b': [2, 4] } + */ + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { + baseMerge(object, source, srcIndex, customizer); + }); + + /** + * The opposite of `_.pick`; this method creates an object composed of the + * own and inherited enumerable property paths of `object` that are not omitted. + * + * **Note:** This method is considerably slower than `_.pick`. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to omit. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omit(object, ['a', 'c']); + * // => { 'b': '2' } + */ + var omit = flatRest(function(object, paths) { + var result = {}; + if (object == null) { + return result; + } + var isDeep = false; + paths = arrayMap(paths, function(path) { + path = castPath(path, object); + isDeep || (isDeep = path.length > 1); + return path; + }); + copyObject(object, getAllKeysIn(object), result); + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } + var length = paths.length; + while (length--) { + baseUnset(result, paths[length]); + } + return result; + }); + + /** + * The opposite of `_.pickBy`; this method creates an object composed of + * the own and inherited enumerable string keyed properties of `object` that + * `predicate` doesn't return truthy for. The predicate is invoked with two + * arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.omitBy(object, _.isNumber); + * // => { 'b': '2' } + */ + function omitBy(object, predicate) { + return pickBy(object, negate(getIteratee(predicate))); + } + + /** + * Creates an object composed of the picked `object` properties. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {...(string|string[])} [paths] The property paths to pick. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pick(object, ['a', 'c']); + * // => { 'a': 1, 'c': 3 } + */ + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); + }); + + /** + * Creates an object composed of the `object` properties `predicate` returns + * truthy for. The predicate is invoked with two arguments: (value, key). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The source object. + * @param {Function} [predicate=_.identity] The function invoked per property. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'a': 1, 'b': '2', 'c': 3 }; + * + * _.pickBy(object, _.isNumber); + * // => { 'a': 1, 'c': 3 } + */ + function pickBy(object, predicate) { + if (object == null) { + return {}; + } + var props = arrayMap(getAllKeysIn(object), function(prop) { + return [prop]; + }); + predicate = getIteratee(predicate); + return basePickBy(object, props, function(value, path) { + return predicate(value, path[0]); + }); + } + + /** + * This method is like `_.get` except that if the resolved value is a + * function it's invoked with the `this` binding of its parent object and + * its result is returned. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; + * + * _.result(object, 'a[0].b.c1'); + * // => 3 + * + * _.result(object, 'a[0].b.c2'); + * // => 4 + * + * _.result(object, 'a[0].b.c3', 'default'); + * // => 'default' + * + * _.result(object, 'a[0].b.c3', _.constant('default')); + * // => 'default' + */ + function result(object, path, defaultValue) { + path = castPath(path, object); + + var index = -1, + length = path.length; + + // Ensure the loop is entered when path is empty. + if (!length) { + length = 1; + object = undefined; + } + while (++index < length) { + var value = object == null ? undefined : object[toKey(path[index])]; + if (value === undefined) { + index = length; + value = defaultValue; + } + object = isFunction(value) ? value.call(object) : value; + } + return object; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /** + * This method is like `_.set` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.setWith(object, '[0][1]', 'a', Object); + * // => { '0': { '1': 'a' } } + */ + function setWith(object, path, value, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseSet(object, path, value, customizer); + } + + /** + * Creates an array of own enumerable string keyed-value pairs for `object` + * which can be consumed by `_.fromPairs`. If `object` is a map or set, its + * entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entries + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairs(new Foo); + * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) + */ + var toPairs = createToPairs(keys); + + /** + * Creates an array of own and inherited enumerable string keyed-value pairs + * for `object` which can be consumed by `_.fromPairs`. If `object` is a map + * or set, its entries are returned. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @alias entriesIn + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the key-value pairs. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.toPairsIn(new Foo); + * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) + */ + var toPairsIn = createToPairs(keysIn); + + /** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ + function transform(object, iteratee, accumulator) { + var isArr = isArray(object), + isArrLike = isArr || isBuffer(object) || isTypedArray(object); + + iteratee = getIteratee(iteratee, 4); + if (accumulator == null) { + var Ctor = object && object.constructor; + if (isArrLike) { + accumulator = isArr ? new Ctor : []; + } + else if (isObject(object)) { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + else { + accumulator = {}; + } + } + (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; + } + + /** + * Removes the property at `path` of `object`. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to unset. + * @returns {boolean} Returns `true` if the property is deleted, else `false`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 7 } }] }; + * _.unset(object, 'a[0].b.c'); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + * + * _.unset(object, ['a', '0', 'b', 'c']); + * // => true + * + * console.log(object); + * // => { 'a': [{ 'b': {} }] }; + */ + function unset(object, path) { + return object == null ? true : baseUnset(object, path); + } + + /** + * This method is like `_.set` except that accepts `updater` to produce the + * value to set. Use `_.updateWith` to customize `path` creation. The `updater` + * is invoked with one argument: (value). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.update(object, 'a[0].b.c', function(n) { return n * n; }); + * console.log(object.a[0].b.c); + * // => 9 + * + * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); + * console.log(object.x[0].y.z); + * // => 0 + */ + function update(object, path, updater) { + return object == null ? object : baseUpdate(object, path, castFunction(updater)); + } + + /** + * This method is like `_.update` except that it accepts `customizer` which is + * invoked to produce the objects of `path`. If `customizer` returns `undefined` + * path creation is handled by the method instead. The `customizer` is invoked + * with three arguments: (nsValue, key, nsObject). + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 4.6.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {Function} updater The function to produce the updated value. + * @param {Function} [customizer] The function to customize assigned values. + * @returns {Object} Returns `object`. + * @example + * + * var object = {}; + * + * _.updateWith(object, '[0][1]', _.constant('a'), Object); + * // => { '0': { '1': 'a' } } + */ + function updateWith(object, path, updater, customizer) { + customizer = typeof customizer == 'function' ? customizer : undefined; + return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); + } + + /** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ + function values(object) { + return object == null ? [] : baseValues(object, keys(object)); + } + + /** + * Creates an array of the own and inherited enumerable string keyed property + * values 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 values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.valuesIn(new Foo); + * // => [1, 2, 3] (iteration order is not guaranteed) + */ + function valuesIn(object) { + return object == null ? [] : baseValues(object, keysIn(object)); + } + + /*------------------------------------------------------------------------*/ + + /** + * Clamps `number` within the inclusive `lower` and `upper` bounds. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Number + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + * @example + * + * _.clamp(-10, -5, 5); + * // => -5 + * + * _.clamp(10, -5, 5); + * // => 5 + */ + function clamp(number, lower, upper) { + if (upper === undefined) { + upper = lower; + lower = undefined; + } + if (upper !== undefined) { + upper = toNumber(upper); + upper = upper === upper ? upper : 0; + } + if (lower !== undefined) { + lower = toNumber(lower); + lower = lower === lower ? lower : 0; + } + return baseClamp(toNumber(number), lower, upper); + } + + /** + * Checks if `n` is between `start` and up to, but not including, `end`. If + * `end` is not specified, it's set to `start` with `start` then set to `0`. + * If `start` is greater than `end` the params are swapped to support + * negative ranges. + * + * @static + * @memberOf _ + * @since 3.3.0 + * @category Number + * @param {number} number The number to check. + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @returns {boolean} Returns `true` if `number` is in the range, else `false`. + * @see _.range, _.rangeRight + * @example + * + * _.inRange(3, 2, 4); + * // => true + * + * _.inRange(4, 8); + * // => true + * + * _.inRange(4, 2); + * // => false + * + * _.inRange(2, 2); + * // => false + * + * _.inRange(1.2, 2); + * // => true + * + * _.inRange(5.2, 4); + * // => false + * + * _.inRange(-3, -2, -6); + * // => true + */ + function inRange(number, start, end) { + start = toFinite(start); + if (end === undefined) { + end = start; + start = 0; + } else { + end = toFinite(end); + } + number = toNumber(number); + return baseInRange(number, start, end); + } + + /** + * Produces a random number between the inclusive `lower` and `upper` bounds. + * If only one argument is provided a number between `0` and the given number + * is returned. If `floating` is `true`, or either `lower` or `upper` are + * floats, a floating-point number is returned instead of an integer. + * + * **Note:** JavaScript follows the IEEE-754 standard for resolving + * floating-point values which can produce unexpected results. + * + * @static + * @memberOf _ + * @since 0.7.0 + * @category Number + * @param {number} [lower=0] The lower bound. + * @param {number} [upper=1] The upper bound. + * @param {boolean} [floating] Specify returning a floating-point number. + * @returns {number} Returns the random number. + * @example + * + * _.random(0, 5); + * // => an integer between 0 and 5 + * + * _.random(5); + * // => also an integer between 0 and 5 + * + * _.random(5, true); + * // => a floating-point number between 0 and 5 + * + * _.random(1.2, 5.2); + * // => a floating-point number between 1.2 and 5.2 + */ + function random(lower, upper, floating) { + if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { + upper = floating = undefined; + } + if (floating === undefined) { + if (typeof upper == 'boolean') { + floating = upper; + upper = undefined; + } + else if (typeof lower == 'boolean') { + floating = lower; + lower = undefined; + } + } + if (lower === undefined && upper === undefined) { + lower = 0; + upper = 1; + } + else { + lower = toFinite(lower); + if (upper === undefined) { + upper = lower; + lower = 0; + } else { + upper = toFinite(upper); + } + } + if (lower > upper) { + var temp = lower; + lower = upper; + upper = temp; + } + if (floating || lower % 1 || upper % 1) { + var rand = nativeRandom(); + return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); + } + return baseRandom(lower, upper); + } + + /*------------------------------------------------------------------------*/ + + /** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ + var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); + }); + + /** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ + function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); + } + + /** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ + function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); + } + + /** + * Checks if `string` ends with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=string.length] The position to search up to. + * @returns {boolean} Returns `true` if `string` ends with `target`, + * else `false`. + * @example + * + * _.endsWith('abc', 'c'); + * // => true + * + * _.endsWith('abc', 'b'); + * // => false + * + * _.endsWith('abc', 'b', 2); + * // => true + */ + function endsWith(string, target, position) { + string = toString(string); + target = baseToString(target); + + var length = string.length; + position = position === undefined + ? length + : baseClamp(toInteger(position), 0, length); + + var end = position; + position -= target.length; + return position >= 0 && string.slice(position, end) == target; + } + + /** + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. + * + * **Note:** No other characters are escaped. To escape additional + * characters use a third-party library like [_he_](https://mths.be/he). + * + * Though the ">" character is escaped for symmetry, characters like + * ">" and "/" don't need escaping in HTML and have no special meaning + * unless they're part of a tag or unquoted attribute value. See + * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) + * (under "semi-related fun fact") for more details. + * + * When working with HTML you should always + * [quote attribute values](http://wonko.com/post/html-escaping) to reduce + * XSS vectors. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ + function escape(string) { + string = toString(string); + return (string && reHasUnescapedHtml.test(string)) + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; + } + + /** + * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", + * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https://lodash\.com/\)' + */ + function escapeRegExp(string) { + string = toString(string); + return (string && reHasRegExpChar.test(string)) + ? string.replace(reRegExpChar, '\\$&') + : string; + } + + /** + * Converts `string` to + * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the kebab cased string. + * @example + * + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' + * + * _.kebabCase('fooBar'); + * // => 'foo-bar' + * + * _.kebabCase('__FOO_BAR__'); + * // => 'foo-bar' + */ + var kebabCase = createCompounder(function(result, word, index) { + return result + (index ? '-' : '') + word.toLowerCase(); + }); + + /** + * Converts `string`, as space separated words, to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * _.lowerCase('--Foo-Bar--'); + * // => 'foo bar' + * + * _.lowerCase('fooBar'); + * // => 'foo bar' + * + * _.lowerCase('__FOO_BAR__'); + * // => 'foo bar' + */ + var lowerCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + word.toLowerCase(); + }); + + /** + * Converts the first character of `string` to lower case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.lowerFirst('Fred'); + * // => 'fred' + * + * _.lowerFirst('FRED'); + * // => 'fRED' + */ + var lowerFirst = createCaseFirst('toLowerCase'); + + /** + * Pads `string` on the left and right sides if it's shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ + function pad(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + if (!length || strLength >= length) { + return string; + } + var mid = (length - strLength) / 2; + return ( + createPadding(nativeFloor(mid), chars) + + string + + createPadding(nativeCeil(mid), chars) + ); + } + + /** + * Pads `string` on the right side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padEnd('abc', 6); + * // => 'abc ' + * + * _.padEnd('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padEnd('abc', 3); + * // => 'abc' + */ + function padEnd(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (string + createPadding(length - strLength, chars)) + : string; + } + + /** + * Pads `string` on the left side if it's shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padStart('abc', 6); + * // => ' abc' + * + * _.padStart('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padStart('abc', 3); + * // => 'abc' + */ + function padStart(string, length, chars) { + string = toString(string); + length = toInteger(length); + + var strLength = length ? stringSize(string) : 0; + return (length && strLength < length) + ? (createPadding(length - strLength, chars) + string) + : string; + } + + /** + * Converts `string` to an integer of the specified radix. If `radix` is + * `undefined` or `0`, a `radix` of `10` is used unless `value` is a + * hexadecimal, in which case a `radix` of `16` is used. + * + * **Note:** This method aligns with the + * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category String + * @param {string} string The string to convert. + * @param {number} [radix=10] The radix to interpret `value` by. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {number} Returns the converted integer. + * @example + * + * _.parseInt('08'); + * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] + */ + function parseInt(string, radix, guard) { + if (guard || radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } + return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); + } + + /** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=1] The number of times to repeat the string. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ + function repeat(string, n, guard) { + if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + return baseRepeat(toString(string), n); + } + + /** + * Replaces matches for `pattern` in `string` with `replacement`. + * + * **Note:** This method is based on + * [`String#replace`](https://mdn.io/String/replace). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to modify. + * @param {RegExp|string} pattern The pattern to replace. + * @param {Function|string} replacement The match replacement. + * @returns {string} Returns the modified string. + * @example + * + * _.replace('Hi Fred', 'Fred', 'Barney'); + * // => 'Hi Barney' + */ + function replace() { + var args = arguments, + string = toString(args[0]); + + return args.length < 3 ? string : string.replace(args[1], args[2]); + } + + /** + * Converts `string` to + * [snake case](https://en.wikipedia.org/wiki/Snake_case). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the snake cased string. + * @example + * + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' + * + * _.snakeCase('fooBar'); + * // => 'foo_bar' + * + * _.snakeCase('--FOO-BAR--'); + * // => 'foo_bar' + */ + var snakeCase = createCompounder(function(result, word, index) { + return result + (index ? '_' : '') + word.toLowerCase(); + }); + + /** + * Splits `string` by `separator`. + * + * **Note:** This method is based on + * [`String#split`](https://mdn.io/String/split). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to split. + * @param {RegExp|string} separator The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * @example + * + * _.split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ + function split(string, separator, limit) { + if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { + separator = limit = undefined; + } + limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; + if (!limit) { + return []; + } + string = toString(string); + if (string && ( + typeof separator == 'string' || + (separator != null && !isRegExp(separator)) + )) { + separator = baseToString(separator); + if (!separator && hasUnicode(string)) { + return castSlice(stringToArray(string), 0, limit); + } + } + return string.split(separator, limit); + } + + /** + * Converts `string` to + * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). + * + * @static + * @memberOf _ + * @since 3.1.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the start cased string. + * @example + * + * _.startCase('--foo-bar--'); + * // => 'Foo Bar' + * + * _.startCase('fooBar'); + * // => 'Foo Bar' + * + * _.startCase('__FOO_BAR__'); + * // => 'FOO BAR' + */ + var startCase = createCompounder(function(result, word, index) { + return result + (index ? ' ' : '') + upperFirst(word); + }); + + /** + * Checks if `string` starts with the given target string. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {string} [target] The string to search for. + * @param {number} [position=0] The position to search from. + * @returns {boolean} Returns `true` if `string` starts with `target`, + * else `false`. + * @example + * + * _.startsWith('abc', 'a'); + * // => true + * + * _.startsWith('abc', 'b'); + * // => false + * + * _.startsWith('abc', 'b', 1); + * // => true + */ + function startsWith(string, target, position) { + string = toString(string); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + + target = baseToString(target); + return string.slice(position, position + target.length) == target; + } + + /** + * Creates a compiled template function that can interpolate data properties + * in "interpolate" delimiters, HTML-escape interpolated data properties in + * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data + * properties may be accessed as free variables in the template. If a setting + * object is given, it takes precedence over `_.templateSettings` values. + * + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category String + * @param {string} [string=''] The template string. + * @param {Object} [options={}] The options object. + * @param {RegExp} [options.escape=_.templateSettings.escape] + * The HTML "escape" delimiter. + * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] + * The "evaluate" delimiter. + * @param {Object} [options.imports=_.templateSettings.imports] + * An object to import into the template as free variables. + * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] + * The "interpolate" delimiter. + * @param {string} [options.sourceURL='lodash.templateSources[n]'] + * The sourceURL of the compiled template. + * @param {string} [options.variable='obj'] + * The data object variable name. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Function} Returns the compiled template function. + * @example + * + * // Use the "interpolate" delimiter to create a compiled template. + * var compiled = _.template('hello <%= user %>!'); + * compiled({ 'user': 'fred' }); + * // => 'hello fred!' + * + * // Use the HTML "escape" delimiter to escape data property values. + * var compiled = _.template('<%- value %>'); + * compiled({ 'value': ' + + + + + + +``` + +In this way, all the exported members are available under `PIXI.live2d` namespace, such as `PIXI.live2d.Live2DModel`. + +## Basic usage + +```javascript +import * as PIXI from 'pixi.js'; +import { Live2DModel } from 'pixi-live2d-display'; + +// expose PIXI to window so that this plugin is able to +// reference window.PIXI.Ticker to automatically update Live2D models +window.PIXI = PIXI; + +(async function () { + const app = new PIXI.Application({ + view: document.getElementById('canvas'), + }); + + const model = await Live2DModel.from('shizuku.model.json'); + + app.stage.addChild(model); + + // transforms + model.x = 100; + model.y = 100; + model.rotation = Math.PI; + model.skew.x = Math.PI; + model.scale.set(2, 2); + model.anchor.set(0.5, 0.5); + + // interaction + model.on('hit', (hitAreas) => { + if (hitAreas.includes('body')) { + model.motion('tap_body'); + } + }); +})(); +``` + +## Package importing + +When importing Pixi packages on-demand, you may need to manually register some plugins to enable optional features. + +```javascript +import { Application } from '@pixi/app'; +import { Ticker, TickerPlugin } from '@pixi/ticker'; +import { InteractionManager } from '@pixi/interaction'; +import { Live2DModel } from 'pixi-live2d-display'; + +// register Ticker for Live2DModel +Live2DModel.registerTicker(Ticker); + +// register Ticker for Application +Application.registerPlugin(TickerPlugin); + +// register InteractionManager to make Live2D models interactive +Renderer.registerPlugin('interaction', InteractionManager); + +(async function () { + const app = new Application({ + view: document.getElementById('canvas'), + }); + + const model = await Live2DModel.from('shizuku.model.json'); + + app.stage.addChild(model); +})(); +``` + +--- + +The example Live2D models, Shizuku (Cubism 2.1) and Haru (Cubism 4), are redistributed under +Live2D's [Free Material License](https://www.live2d.com/eula/live2d-free-material-license-agreement_en.html). diff --git a/live2d/node_modules/pixi-live2d-display/README.zh.md b/live2d/node_modules/pixi-live2d-display/README.zh.md new file mode 100644 index 0000000..1275c7c --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/README.zh.md @@ -0,0 +1,172 @@ +# pixi-live2d-display + +![GitHub package.json version](https://img.shields.io/github/package-json/v/guansss/pixi-live2d-display?style=flat-square) +![Cubism version](https://img.shields.io/badge/Cubism-2/3/4-ff69b4?style=flat-square) +![GitHub Workflow Status](https://img.shields.io/github/workflow/status/guansss/pixi-live2d-display/Test%20CI?style=flat-square) + +> :warning: 该 readme 版本为 v0.4.0,如果要找 v0.3.1 版本的话, 请查看[这里](https://github.com/guansss/pixi-live2d-display/blob/dfa7f764f241c1c802e92a7ab490206369746efd/README.md). + +为 [PixiJS](https://github.com/pixijs/pixi.js) v6 提供的 Live2D 插件 + +此项目旨在成为 web 平台上的通用 Live2D 框架。由于 Live2D 的官方框架非常复杂且不可靠,这个项目已将其重写以提供统一且简单的 API,使你可以从较高的层次来控制 Live2D 模型而无需了解其内部的工作原理 + +#### 特性 + +- 支持所有版本的 Live2D 模型 +- 支持 PIXI.RenderTexture 和 PIXI.Filter +- Pixi 风格的变换 API:position, scale, rotation, skew, anchor +- 自动交互:鼠标跟踪, 点击命中检测 +- 比官方框架更好的动作预约逻辑 +- 从上传的文件或 zip 文件中加载 (实验性功能) +- 完善的类型定义 - 我们都喜欢类型! + +#### 要求 + +- PixiJS:>6 +- 浏览器:WebGL, ES6 + +#### 示例 + +- [基础示例](https://codepen.io/guansss/pen/oNzoNoz/left?editors=1010) +- [交互示例](https://codepen.io/guansss/pen/KKgXBOP/left?editors=0010) +- [渲染纹理与滤镜示例](https://codepen.io/guansss/pen/qBaMNQV/left?editors=1010) +- [Live2D Viewer Online](https://guansss.github.io/live2d-viewer-web/) + +#### 文档 + +- [文档](https://guansss.github.io/pixi-live2d-display)(暂无中文翻译) +- [API 文档](https://guansss.github.io/pixi-live2d-display/api/index.html) + +## Cubism + +Cubism 是 Live2D SDK 的名称,目前有 3 个版本:Cubism 2.1、Cubism 3、Cubism 4,其中 Cubism 4 可以与 Cubism 3 的模型兼容 + +该插件使用 Cubism 2.1 和 Cubism 4,从而支持所有版本的 Live2D 模型 + +#### Cubism Core + +在使用该插件之前,你需要加载 Cubism 运行时,也就是 Cubism Core + +Cubism 4 需要加载 `live2dcubismcore.min.js`,可以从 [Cubism 4 SDK](https://www.live2d.com/download/cubism-sdk/download-web/) +里解压出来,或者直接引用[这个链接](https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js) +(_链接偶尔会挂掉,不要在生产版本中使用!_) + +Cubism 2.1 需要加载 `live2d.min.js`,[从 2019/9/4 起](https://help.live2d.com/en/other/other_20/) +,官方已经不再提供该版本 SDK 的下载,但是可以从 [这里](https://github.com/dylanNew/live2d/tree/master/webgl/Live2D/lib) +找到,以及你大概想要的 [CDN 链接](https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js) + +#### 单独的打包文件 + +该插件为每个 Cubism 版本提供了单独的打包文件,从而在你只想使用其中一个版本的时候减少需要加载文件的大小。 + +具体来说,为两种版本分别提供了 `cubism2.js` 和 `cubism4.js`,以及一个同时包含了两种版本的 `index.js` + +注意,如果你想同时支持 Cubism 2.1 和 Cubism 4 的话,请使用 `index.js`,_而不要同时使用_ `cubism2.js` 和 `cubism4.js` + +为了更明确一点,这里列出使用这些文件的方法: + +- 使用 `cubism2.js`+`live2d.min.js` 以支持 Cubism 2.1 模型 +- 使用 `cubism4.js`+`live2dcubismcore.min.js` 以支持 Cubism 3 和 Cubism 4 模型 +- 使用 `index.js`+`live2d.min.js`+`live2dcubismcore.min.js` 以支持所有版本的模型 + +## 安装 + +#### 通过 npm + +```sh +npm install pixi-live2d-display +``` + +```js +import { Live2DModel } from 'pixi-live2d-display'; + +// 如果只需要 Cubism 2.1 +import { Live2DModel } from 'pixi-live2d-display/cubism2'; + +// 如果只需要 Cubism 4 +import { Live2DModel } from 'pixi-live2d-display/cubism4'; +``` + +#### 通过 CDN + +```html + + + + + + + +``` + +通过这种方式加载的话,所有成员都会被导出到 `PIXI.live2d` 命名空间下,比如 `PIXI.live2d.Live2DModel` + +## 基础使用 + +```javascript +import * as PIXI from 'pixi.js'; +import { Live2DModel } from 'pixi-live2d-display'; + +// 将 PIXI 暴露到 window 上,这样插件就可以通过 window.PIXI.Ticker 来自动更新模型 +window.PIXI = PIXI; + +(async function () { + const app = new PIXI.Application({ + view: document.getElementById('canvas'), + }); + + const model = await Live2DModel.from('shizuku.model.json'); + + app.stage.addChild(model); + + // 变换 + model.x = 100; + model.y = 100; + model.rotation = Math.PI; + model.skew.x = Math.PI; + model.scale.set(2, 2); + model.anchor.set(0.5, 0.5); + + // 交互 + model.on('hit', (hitAreas) => { + if (hitAreas.includes('body')) { + model.motion('tap_body'); + } + }); +})(); +``` + +## 包导入 + +当按需导入 Pixi 的包时,需要手动注册相应的组件来启用可选功能 + +```javascript +import { Application } from '@pixi/app'; +import { Ticker } from '@pixi/ticker'; +import { InteractionManager } from '@pixi/interaction'; +import { Live2DModel } from 'pixi-live2d-display'; + +// 为 Live2DModel 注册 Ticker +Live2DModel.registerTicker(Ticker); + +// 为 Application 注册 Ticker +Application.registerPlugin(TickerPlugin); + +// 注册 InteractionManager 以支持 Live2D 模型的自动交互 +Renderer.registerPlugin('interaction', InteractionManager); + +(async function () { + const app = new Application({ + view: document.getElementById('canvas'), + }); + + const model = await Live2DModel.from('shizuku.model.json'); + + app.stage.addChild(model); +})(); +``` + +--- + +示例的 Live2D 模型 Shizuku (Cubism 2.1) 和 Haru (Cubism 4) 遵守 Live2D 的 +[Free Material License](https://www.live2d.com/eula/live2d-free-material-license-agreement_en.html) diff --git a/live2d/node_modules/pixi-live2d-display/core/README.md b/live2d/node_modules/pixi-live2d-display/core/README.md new file mode 100644 index 0000000..ad38374 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/core/README.md @@ -0,0 +1,32 @@ +# Live2D Cubism Core + +Live2D runtime libraries. All the files listed below must be placed in this folder when developing this project. + +Run `yarn setup` to get these files set up automatically. + +### Cubism 2.1 + +#### `live2d.d.ts` + +Unofficial declaration file of Cubism 2.1 core library. Already provided. + +#### `live2d.min.js` + +Cubism 2.1 core library. It's no longer downloadable from the official site, but can be +found [here](https://github.com/dylanNew/live2d/tree/master/webgl/Live2D/lib). + +### Cubism 4 + +To get these files, download the SDK [here](https://www.live2d.com/download/cubism-sdk/download-web/), then extract them from the `Core` directory. + +#### `live2dcubismcore.d.ts` + +Official declaration file of Cubism 4. + +#### `live2dcubismcore.min.js` + +Cubism Core features, and some wrapper features. + +#### `live2dcubismcore.js` (optional) + +Cubism Core features, and some wrapper features. Non-minified. diff --git a/live2d/node_modules/pixi-live2d-display/core/live2d.d.ts b/live2d/node_modules/pixi-live2d-display/core/live2d.d.ts new file mode 100644 index 0000000..0283512 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/core/live2d.d.ts @@ -0,0 +1,179 @@ +/** + * Unofficial declaration file of Cubism 2.1 core library. + * + * @see {@link http://doc.live2d.com/api/core/cpp2.0j/} + */ + +declare class Live2D { + static setGL(gl: WebGLRenderingContext, index?: number): void; + + static getError(): unknown | undefined; +} + +declare class Live2DModelWebGL { + static loadModel(buffer: ArrayBuffer): Live2DModelWebGL; + + private constructor(); + + drawParamWebGL: Live2DObfuscated.DrawParamWebGL; + + getModelContext(): Live2DObfuscated.ModelContext; + + /** + * @return The width of model's Live2D drawing canvas but NOT the html canvas element. + */ + getCanvasWidth(): number; + + /** + * @return The height of model's Live2D drawing canvas but NOT the html canvas element. + */ + getCanvasHeight(): number; + + setTexture(index: number, texture: WebGLTexture): void; + + setMatrix(matrix: ArrayLike): void; + + setParamFloat(id: string | number, value: number, weight?: number): unknown; + + addToParamFloat(id: string | number, value: number, weight?: number): unknown; + + multParamFloat(id: string | number, value: number, weight?: number): unknown; + + setPartsOpacity(id: string | number, value: number): unknown; + + getPartsOpacity(id: string | number): number; + + getParamFloat(id: string | number): number; + + getParamIndex(id: string): number; + + getPartsDataIndex(id: string): number; + + getDrawDataIndex(id: string): number; + + getTransformedPoints(index: number): Float32Array; + + loadParam(): void; + + saveParam(): void; + + update(): void; + + draw(): void; +} + +declare class AMotion { + setFadeIn(time: number): unknown; + + setFadeOut(time: number): unknown; + + updateParam(model: Live2DModelWebGL, entry: Live2DObfuscated.MotionQueueEnt): void + + updateParamExe(model: Live2DModelWebGL, time: number, weight: number, MotionQueueEnt: unknown): unknown; +} + +declare class Live2DMotion extends AMotion { + private constructor(); + + static loadMotion(buffer: ArrayBuffer): Live2DMotion; +} + +declare class MotionQueueManager { + motions: unknown[]; + + /** + * @return The size of internal motion arrays. + */ + startMotion(motion: AMotion, neverUsedArg?: boolean): number; + + stopAllMotions(): void; + + isFinished(): boolean; + + /** + * @return True if parameters are updated by any motion. + */ + updateParam(model: Live2DModelWebGL): boolean; +} + +declare class PhysicsHair { + static Src: { + SRC_TO_X: string; + SRC_TO_Y: string; + SRC_TO_G_ANGLE: string; + }; + static Target: { + TARGET_FROM_ANGLE: string; + TARGET_FROM_ANGLE_V: string; + }; + + setup(length: number, regist: number, mass: number): unknown; + + addSrcParam(type: string, id: string, scale: number, weight: number): unknown; + + addTargetParam(type: string, id: string, scale: number, weight: number): unknown; + + update(model: Live2DModelWebGL, time: number): unknown; +} + +declare class PartsDataID { + static getID(id: string): string; +} + +declare class DrawDataID { + id: string; +} + +/** + * Members that have been obfuscated. + */ +declare namespace Live2DObfuscated { + class MotionQueueEnt { + isFinished(): boolean; + } + + class DrawParamWebGL { + gl: WebGLRenderingContext; + glno: number; + + firstDraw: boolean; + + culling: boolean; + + setGL(gl: WebGLRenderingContext): void; + } + + class ModelContext { + clipManager: ClipManager; + + /** + * This is basically `DrawData[]`, but not reliable since it's an obfuscated property. + * Always check the type before using it! + */ + _$aS?: unknown; // DrawData[] + + getDrawData(index: number): DrawData | null; + } + + class IDrawData { + getDrawDataID(): DrawDataID; + } + + class DrawData extends IDrawData { + getNumPoints?(): unknown; + + draw(aN: unknown, aK: unknown, aI: Unknown_aB): void; + } + + class Unknown_aB { + baseOpacity: number; + } + + class ClipManager { + curFrameNo: number; + + getMaskRenderTexture(): number; + + setupClip(modelContext: ModelContext, drawParam: DrawParamWebGL): void; + } +} diff --git a/live2d/node_modules/pixi-live2d-display/cubism/.vscode/extensions.json b/live2d/node_modules/pixi-live2d-display/cubism/.vscode/extensions.json new file mode 100644 index 0000000..fda5ad5 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/cubism/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "editorconfig.editorconfig" + ] +} diff --git a/live2d/node_modules/pixi-live2d-display/cubism/.vscode/tasks.json b/live2d/node_modules/pixi-live2d-display/cubism/.vscode/tasks.json new file mode 100644 index 0000000..7cd3fff --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/cubism/.vscode/tasks.json @@ -0,0 +1,39 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "install", + "problemMatcher": [] + }, + { + "type": "npm", + "script": "build", + "group": "build", + "problemMatcher": [] + }, + { + "type": "npm", + "script": "test", + "group": "test", + "problemMatcher": [] + }, + { + "type": "npm", + "script": "lint", + "group": "test", + "problemMatcher": [] + }, + { + "type": "npm", + "script": "lint:fix", + "group": "test", + "problemMatcher": [] + }, + { + "type": "npm", + "script": "clear", + "problemMatcher": [] + } + ] +} diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism2.es.js b/live2d/node_modules/pixi-live2d-display/dist/cubism2.es.js new file mode 100644 index 0000000..0d40d5d --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism2.es.js @@ -0,0 +1,2122 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +import { EventEmitter, url } from "@pixi/utils"; +import { Matrix, Transform, Point, ObservablePoint } from "@pixi/math"; +import { Texture } from "@pixi/core"; +import { Container } from "@pixi/display"; +const LOGICAL_WIDTH = 2; +const LOGICAL_HEIGHT = 2; +var CubismConfig; +((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; +})(CubismConfig || (CubismConfig = {})); +var config; +((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = CubismConfig; +})(config || (config = {})); +const VERSION = "0.4.0"; +const logger = { + log(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } +}; +function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; +} +function rand(min, max) { + return Math.random() * (max - min) + min; +} +function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } +} +function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } +} +function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); +} +function folderName(url2) { + let lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url2 = url2.slice(0, lastSlashIndex); + } + lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url2 = url2.slice(lastSlashIndex + 1); + } + return url2; +} +function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } +} +class ExpressionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self = this; + self.definitions = void 0; + self.expressions = void 0; + } +} +const EPSILON = 0.01; +const MAX_SPEED = 40 / 7.5; +const ACCELERATION_TIME = 1 / (0.15 * 1e3); +class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } +} +class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } +} +var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; +})(MotionPriority || {}); +class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } +} +const TAG$2 = "SoundManager"; +const VOLUME = 0.5; +class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } +} +SoundManager.audios = []; +SoundManager._volume = VOLUME; +var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; +})(MotionPreloadStrategy || {}); +class MotionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self = this; + self.definitions = void 0; + self.motionGroups = void 0; + } +} +const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; +class InternalModel extends EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new Matrix(); + this.drawingMatrix = new Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self = this; + const size = this.getSize(); + self.originalWidth = size[0]; + self.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self.width = this.originalWidth * this.localTransform.a; + self.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } +} +const TAG$1 = "XHRLoader"; +class NetworkError extends Error { + constructor(message, url2, status, aborted = false) { + super(message); + this.url = url2; + this.status = status; + this.aborted = aborted; + } +} +const _XHRLoader = class { + static createXHR(target, url2, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url2); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url2}`); + onerror(new NetworkError("Network error.", url2, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url2, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } +}; +let XHRLoader = _XHRLoader; +XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); +XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); +XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); +}; +function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } +} +class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } +} +Live2DLoader.middlewares = [XHRLoader.loader]; +function createTexture(url2, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (Texture.fromURL) { + return Texture.fromURL(url2, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = Texture.from(url2, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; +} +const TAG = "Live2DFactory"; +const urlToJSON = (context, next) => __async(void 0, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); +}); +const jsonToSettings = (context, next) => __async(void 0, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); +}); +const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); +}; +const setupOptionals = (context, next) => __async(void 0, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } +}); +const setupEssentials = (context, next) => __async(void 0, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url2 = context.settings.resolveURL(tex); + return createTexture(url2, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } +}); +const createInternalModel = (context, next) => __async(void 0, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); +}); +const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } +}; +let Live2DFactory = _Live2DFactory; +Live2DFactory.runtimes = []; +Live2DFactory.urlToJSON = urlToJSON; +Live2DFactory.jsonToSettings = jsonToSettings; +Live2DFactory.waitUntilReady = waitUntilReady; +Live2DFactory.setupOptionals = setupOptionals; +Live2DFactory.setupEssentials = setupEssentials; +Live2DFactory.createInternalModel = createInternalModel; +Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel +]; +Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); +Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); +MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); +}; +ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); +}; +class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } +} +function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); +} +function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); +} +class Live2DTransform extends Transform { +} +const tempPoint = new Point(); +const tempMatrix = new Matrix(); +let tickerRef; +class Live2DModel extends Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } +} +applyMixins(Live2DModel, [InteractionMixin]); +const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } +}; +let FileLoader = _FileLoader; +FileLoader.filesMap = {}; +FileLoader.factory = (context, next) => __async(void 0, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url2) { + return _FileLoader.resolveURL(this._objectURL, url2); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); +const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url2) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } +}; +let ZipLoader = _ZipLoader; +ZipLoader.ZIP_PROTOCOL = "zip://"; +ZipLoader.uid = 0; +ZipLoader.factory = (context, next) => __async(void 0, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); +if (!window.Live2D) { + throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded."); +} +const originalUpdateParam = Live2DMotion.prototype.updateParam; +Live2DMotion.prototype.updateParam = function(model, entry) { + originalUpdateParam.call(this, model, entry); + if (entry.isFinished() && this.onFinishHandler) { + this.onFinishHandler(this); + delete this.onFinishHandler; + } +}; +class Live2DExpression extends AMotion { + constructor(json) { + super(); + this.params = []; + this.setFadeIn(json.fade_in > 0 ? json.fade_in : config.expressionFadingDuration); + this.setFadeOut(json.fade_out > 0 ? json.fade_out : config.expressionFadingDuration); + if (Array.isArray(json.params)) { + json.params.forEach((param) => { + const calc = param.calc || "add"; + if (calc === "add") { + const defaultValue = param.def || 0; + param.val -= defaultValue; + } else if (calc === "mult") { + const defaultValue = param.def || 1; + param.val /= defaultValue; + } + this.params.push({ + calc, + val: param.val, + id: param.id + }); + }); + } + } + updateParamExe(model, time, weight, motionQueueEnt) { + this.params.forEach((param) => { + model.setParamFloat(param.id, param.val * weight); + }); + } +} +class Cubism2ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new MotionQueueManager(); + this.definitions = (_a = this.settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.name === name); + } + getExpressionFile(definition) { + return definition.file; + } + createExpression(data, definition) { + return new Live2DExpression(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, dt) { + return this.queueManager.updateParam(model); + } +} +class Cubism2MotionManager extends MotionManager { + constructor(settings, options) { + super(settings, options); + this.groups = { idle: "idle" }; + this.motionDataType = "arraybuffer"; + this.queueManager = new MotionQueueManager(); + this.definitions = this.settings.motions; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism2ExpressionManager(this.settings, options); + } + } + isFinished() { + return this.queueManager.isFinished(); + } + createMotion(data, group, definition) { + const motion = Live2DMotion.loadMotion(data); + const defaultFadingDuration = group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration; + motion.setFadeIn(definition.fade_in > 0 ? definition.fade_in : defaultFadingDuration); + motion.setFadeOut(definition.fade_out > 0 ? definition.fade_out : defaultFadingDuration); + return motion; + } + getMotionFile(definition) { + return definition.file; + } + getMotionName(definition) { + return definition.file; + } + getSoundFile(definition) { + return definition.sound; + } + _startMotion(motion, onFinish) { + motion.onFinishHandler = onFinish; + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.updateParam(model); + } + destroy() { + super.destroy(); + this.queueManager = void 0; + } +} +class Live2DEyeBlink { + constructor(coreModel) { + this.coreModel = coreModel; + this.blinkInterval = 4e3; + this.closingDuration = 100; + this.closedDuration = 50; + this.openingDuration = 150; + this.eyeState = 0; + this.eyeParamValue = 1; + this.closedTimer = 0; + this.nextBlinkTimeLeft = this.blinkInterval; + this.leftParam = coreModel.getParamIndex("PARAM_EYE_L_OPEN"); + this.rightParam = coreModel.getParamIndex("PARAM_EYE_R_OPEN"); + } + setEyeParams(value) { + this.eyeParamValue = clamp(value, 0, 1); + this.coreModel.setParamFloat(this.leftParam, this.eyeParamValue); + this.coreModel.setParamFloat(this.rightParam, this.eyeParamValue); + } + update(dt) { + switch (this.eyeState) { + case 0: + this.nextBlinkTimeLeft -= dt; + if (this.nextBlinkTimeLeft < 0) { + this.eyeState = 1; + this.nextBlinkTimeLeft = this.blinkInterval + this.closingDuration + this.closedDuration + this.openingDuration + rand(0, 2e3); + } + break; + case 1: + this.setEyeParams(this.eyeParamValue + dt / this.closingDuration); + if (this.eyeParamValue <= 0) { + this.eyeState = 2; + this.closedTimer = 0; + } + break; + case 2: + this.closedTimer += dt; + if (this.closedTimer >= this.closedDuration) { + this.eyeState = 3; + } + break; + case 3: + this.setEyeParams(this.eyeParamValue + dt / this.openingDuration); + if (this.eyeParamValue >= 1) { + this.eyeState = 0; + } + } + } +} +const tempMatrixArray = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 +]); +class Cubism2InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.textureFlipY = true; + this.drawDataCount = 0; + this.disableCulling = false; + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism2MotionManager(settings, options); + this.eyeBlink = new Live2DEyeBlink(coreModel); + this.eyeballXParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_X"); + this.eyeballYParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_Y"); + this.angleXParamIndex = coreModel.getParamIndex("PARAM_ANGLE_X"); + this.angleYParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Y"); + this.angleZParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Z"); + this.bodyAngleXParamIndex = coreModel.getParamIndex("PARAM_BODY_ANGLE_X"); + this.breathParamIndex = coreModel.getParamIndex("PARAM_BREATH"); + this.init(); + } + init() { + super.init(); + if (this.settings.initParams) { + this.settings.initParams.forEach(({ id, value }) => this.coreModel.setParamFloat(id, value)); + } + if (this.settings.initOpacities) { + this.settings.initOpacities.forEach(({ id, value }) => this.coreModel.setPartsOpacity(id, value)); + } + this.coreModel.saveParam(); + const arr = this.coreModel.getModelContext()._$aS; + if (arr == null ? void 0 : arr.length) { + this.drawDataCount = arr.length; + } + let culling = this.coreModel.drawParamWebGL.culling; + Object.defineProperty(this.coreModel.drawParamWebGL, "culling", { + set: (v) => culling = v, + get: () => this.disableCulling ? false : culling + }); + const clipManager = this.coreModel.getModelContext().clipManager; + const originalSetupClip = clipManager.setupClip; + clipManager.setupClip = (modelContext, drawParam) => { + originalSetupClip.call(clipManager, modelContext, drawParam); + drawParam.gl.viewport(...this.viewport); + }; + } + getSize() { + return [this.coreModel.getCanvasWidth(), this.coreModel.getCanvasHeight()]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + let commonKey = key; + if (key === "center_x") { + commonKey = "centerX"; + } else if (key === "center_y") { + commonKey = "centerY"; + } + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + updateWebGLContext(gl, glContextID) { + const drawParamWebGL = this.coreModel.drawParamWebGL; + drawParamWebGL.firstDraw = true; + drawParamWebGL.setGL(gl); + drawParamWebGL.glno = glContextID; + for (const prop in drawParamWebGL) { + if (drawParamWebGL.hasOwnProperty(prop) && drawParamWebGL[prop] instanceof WebGLBuffer) { + drawParamWebGL[prop] = null; + } + } + const clipManager = this.coreModel.getModelContext().clipManager; + clipManager.curFrameNo = glContextID; + const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + clipManager.getMaskRenderTexture(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + bindTexture(index, texture) { + this.coreModel.setTexture(index, texture); + } + getHitAreaDefs() { + var _a; + return ((_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.id, + name: hitArea.name, + index: this.coreModel.getDrawDataIndex(hitArea.id) + }))) || []; + } + getDrawableIDs() { + const modelContext = this.coreModel.getModelContext(); + const ids = []; + for (let i = 0; i < this.drawDataCount; i++) { + const drawData = modelContext.getDrawData(i); + if (drawData) { + ids.push(drawData.getDrawDataID().id); + } + } + return ids; + } + getDrawableIndex(id) { + return this.coreModel.getDrawDataIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawDataIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + return this.coreModel.getTransformedPoints(drawIndex).slice(); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParam(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.update(dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt, now); + (_c = this.physics) == null ? void 0 : _c.update(now); + (_d = this.pose) == null ? void 0 : _d.update(dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParam(); + } + updateFocus() { + this.coreModel.addToParamFloat(this.eyeballXParamIndex, this.focusController.x); + this.coreModel.addToParamFloat(this.eyeballYParamIndex, this.focusController.y); + this.coreModel.addToParamFloat(this.angleXParamIndex, this.focusController.x * 30); + this.coreModel.addToParamFloat(this.angleYParamIndex, this.focusController.y * 30); + this.coreModel.addToParamFloat(this.angleZParamIndex, this.focusController.x * this.focusController.y * -30); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + const t = now / 1e3 * 2 * Math.PI; + this.coreModel.addToParamFloat(this.angleXParamIndex, 15 * Math.sin(t / 6.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleYParamIndex, 8 * Math.sin(t / 3.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleZParamIndex, 10 * Math.sin(t / 5.5345) * 0.5); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, 4 * Math.sin(t / 15.5345) * 0.5); + this.coreModel.setParamFloat(this.breathParamIndex, 0.5 + 0.5 * Math.sin(t / 3.2345)); + } + draw(gl) { + const disableCulling = this.disableCulling; + if (gl.getParameter(gl.FRAMEBUFFER_BINDING)) { + this.disableCulling = true; + } + const matrix = this.drawingMatrix; + tempMatrixArray[0] = matrix.a; + tempMatrixArray[1] = matrix.b; + tempMatrixArray[4] = matrix.c; + tempMatrixArray[5] = matrix.d; + tempMatrixArray[12] = matrix.tx; + tempMatrixArray[13] = matrix.ty; + this.coreModel.setMatrix(tempMatrixArray); + this.coreModel.draw(); + this.disableCulling = disableCulling; + } + destroy() { + super.destroy(); + this.coreModel = void 0; + } +} +class Cubism2ModelSettings extends ModelSettings { + constructor(json) { + super(json); + this.motions = {}; + if (!Cubism2ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + this.moc = json.model; + copyArray("string", json, this, "textures", "textures"); + this.copy(json); + } + static isValidJSON(json) { + var _a; + return !!json && typeof json.model === "string" && ((_a = json.textures) == null ? void 0 : _a.length) > 0 && json.textures.every((item) => typeof item === "string"); + } + copy(json) { + copyProperty("string", json, this, "name", "name"); + copyProperty("string", json, this, "pose", "pose"); + copyProperty("string", json, this, "physics", "physics"); + copyProperty("object", json, this, "layout", "layout"); + copyProperty("object", json, this, "motions", "motions"); + copyArray("object", json, this, "hit_areas", "hitAreas"); + copyArray("object", json, this, "expressions", "expressions"); + copyArray("object", json, this, "init_params", "initParams"); + copyArray("object", json, this, "init_opacities", "initOpacities"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].file = replace(motions[i].file, `motions.${group}[${i}].file`); + if (motions[i].sound !== void 0) { + motions[i].sound = replace(motions[i].sound, `motions.${group}[${i}].sound`); + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].file = replace(this.expressions[i].file, `expressions[${i}].file`); + } + } + } +} +const SRC_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE +}; +const TARGET_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE +}; +class Live2DPhysics { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.physicsHairs = []; + if (json.physics_hair) { + this.physicsHairs = json.physics_hair.map((definition) => { + const physicsHair = new PhysicsHair(); + physicsHair.setup(definition.setup.length, definition.setup.regist, definition.setup.mass); + definition.src.forEach(({ id, ptype, scale, weight }) => { + const type = SRC_TYPE_MAP[ptype]; + if (type) { + physicsHair.addSrcParam(type, id, scale, weight); + } + }); + definition.targets.forEach(({ id, ptype, scale, weight }) => { + const type = TARGET_TYPE_MAP[ptype]; + if (type) { + physicsHair.addTargetParam(type, id, scale, weight); + } + }); + return physicsHair; + }); + } + } + update(elapsed) { + this.physicsHairs.forEach((physicsHair) => physicsHair.update(this.coreModel, elapsed)); + } +} +class Live2DPartsParam { + constructor(id) { + this.id = id; + this.paramIndex = -1; + this.partsIndex = -1; + this.link = []; + } + initIndex(model) { + this.paramIndex = model.getParamIndex("VISIBLE:" + this.id); + this.partsIndex = model.getPartsDataIndex(PartsDataID.getID(this.id)); + model.setParamFloat(this.paramIndex, 1); + } +} +class Live2DPose { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.opacityAnimDuration = 500; + this.partsGroups = []; + if (json.parts_visible) { + this.partsGroups = json.parts_visible.map(({ group }) => group.map(({ id, link }) => { + const parts = new Live2DPartsParam(id); + if (link) { + parts.link = link.map((l) => new Live2DPartsParam(l)); + } + return parts; + })); + this.init(); + } + } + init() { + this.partsGroups.forEach((group) => { + group.forEach((parts) => { + parts.initIndex(this.coreModel); + if (parts.paramIndex >= 0) { + const visible = this.coreModel.getParamFloat(parts.paramIndex) !== 0; + this.coreModel.setPartsOpacity(parts.partsIndex, visible ? 1 : 0); + this.coreModel.setParamFloat(parts.paramIndex, visible ? 1 : 0); + if (parts.link.length > 0) { + parts.link.forEach((p) => p.initIndex(this.coreModel)); + } + } + }); + }); + } + normalizePartsOpacityGroup(partsGroup, dt) { + const model = this.coreModel; + const phi = 0.5; + const maxBackOpacity = 0.15; + let visibleOpacity = 1; + let visibleIndex = partsGroup.findIndex(({ paramIndex, partsIndex }) => partsIndex >= 0 && model.getParamFloat(paramIndex) !== 0); + if (visibleIndex >= 0) { + const originalOpacity = model.getPartsOpacity(partsGroup[visibleIndex].partsIndex); + visibleOpacity = clamp(originalOpacity + dt / this.opacityAnimDuration, 0, 1); + } else { + visibleIndex = 0; + visibleOpacity = 1; + } + partsGroup.forEach(({ partsIndex }, index) => { + if (partsIndex >= 0) { + if (visibleIndex == index) { + model.setPartsOpacity(partsIndex, visibleOpacity); + } else { + let opacity = model.getPartsOpacity(partsIndex); + let a1; + if (visibleOpacity < phi) { + a1 = visibleOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - visibleOpacity) * phi / (1 - phi); + } + let backOp = (1 - a1) * (1 - visibleOpacity); + if (backOp > maxBackOpacity) { + a1 = 1 - maxBackOpacity / (1 - visibleOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartsOpacity(partsIndex, opacity); + } + } + }); + } + copyOpacity(partsGroup) { + const model = this.coreModel; + partsGroup.forEach(({ partsIndex, link }) => { + if (partsIndex >= 0 && link) { + const opacity = model.getPartsOpacity(partsIndex); + link.forEach(({ partsIndex: partsIndex2 }) => { + if (partsIndex2 >= 0) { + model.setPartsOpacity(partsIndex2, opacity); + } + }); + } + }); + } + update(dt) { + this.partsGroups.forEach((partGroup) => { + this.normalizePartsOpacityGroup(partGroup, dt); + this.copyOpacity(partGroup); + }); + } +} +Live2DFactory.registerRuntime({ + version: 2, + test(source) { + return source instanceof Cubism2ModelSettings || Cubism2ModelSettings.isValidJSON(source); + }, + ready() { + return Promise.resolve(); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 3) { + return false; + } + const view = new Int8Array(modelData, 0, 3); + return String.fromCharCode(...view) === "moc"; + }, + createModelSettings(json) { + return new Cubism2ModelSettings(json); + }, + createCoreModel(data) { + const model = Live2DModelWebGL.loadModel(data); + const error = Live2D.getError(); + if (error) + throw error; + return model; + }, + createInternalModel(coreModel, settings, options) { + return new Cubism2InternalModel(coreModel, settings, options); + }, + createPose(coreModel, data) { + return new Live2DPose(coreModel, data); + }, + createPhysics(coreModel, data) { + return new Live2DPhysics(coreModel, data); + } +}); +export { Cubism2ExpressionManager, Cubism2InternalModel, Cubism2ModelSettings, Cubism2MotionManager, ExpressionManager, FileLoader, FocusController, InteractionMixin, InternalModel, LOGICAL_HEIGHT, LOGICAL_WIDTH, Live2DExpression, Live2DEyeBlink, Live2DFactory, Live2DLoader, Live2DModel, Live2DPhysics, Live2DPose, Live2DTransform, ModelSettings, MotionManager, MotionPreloadStrategy, MotionPriority, MotionState, SoundManager, VERSION, XHRLoader, ZipLoader, applyMixins, clamp, config, copyArray, copyProperty, folderName, logger, rand, remove }; diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism2.js b/live2d/node_modules/pixi-live2d-display/dist/cubism2.js new file mode 100644 index 0000000..c3db490 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism2.js @@ -0,0 +1,2159 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@pixi/utils"), require("@pixi/math"), require("@pixi/core"), require("@pixi/display")) : typeof define === "function" && define.amd ? define(["exports", "@pixi/utils", "@pixi/math", "@pixi/core", "@pixi/display"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory((global.PIXI = global.PIXI || {}, global.PIXI.live2d = global.PIXI.live2d || {}), global.PIXI.utils, global.PIXI, global.PIXI, global.PIXI)); +})(this, function(exports2, utils, math, core, display) { + "use strict"; + const LOGICAL_WIDTH = 2; + const LOGICAL_HEIGHT = 2; + var CubismConfig; + ((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; + })(CubismConfig || (CubismConfig = {})); + exports2.config = void 0; + ((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = CubismConfig; + })(exports2.config || (exports2.config = {})); + const VERSION = "0.4.0"; + const logger = { + log(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } + }; + function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; + } + function rand(min, max) { + return Math.random() * (max - min) + min; + } + function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } + } + function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } + } + function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); + } + function folderName(url) { + let lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url = url.slice(0, lastSlashIndex); + } + lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url = url.slice(lastSlashIndex + 1); + } + return url; + } + function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } + } + class ExpressionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self2 = this; + self2.definitions = void 0; + self2.expressions = void 0; + } + } + const EPSILON = 0.01; + const MAX_SPEED = 40 / 7.5; + const ACCELERATION_TIME = 1 / (0.15 * 1e3); + class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } + } + class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return utils.url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } + } + var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; + })(MotionPriority || {}); + class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !exports2.config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } + } + const TAG$2 = "SoundManager"; + const VOLUME = 0.5; + class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } + } + SoundManager.audios = []; + SoundManager._volume = VOLUME; + var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; + })(MotionPreloadStrategy || {}); + class MotionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (exports2.config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (exports2.config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self2 = this; + self2.definitions = void 0; + self2.motionGroups = void 0; + } + } + const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; + class InternalModel extends utils.EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new math.Matrix(); + this.drawingMatrix = new math.Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self2 = this; + const size = this.getSize(); + self2.originalWidth = size[0]; + self2.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self2.width = this.originalWidth * this.localTransform.a; + self2.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } + } + const TAG$1 = "XHRLoader"; + class NetworkError extends Error { + constructor(message, url, status, aborted = false) { + super(message); + this.url = url; + this.status = status; + this.aborted = aborted; + } + } + const _XHRLoader = class { + static createXHR(target, url, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url}`); + onerror(new NetworkError("Network error.", url, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } + }; + let XHRLoader = _XHRLoader; + XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); + XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); + }; + function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } + } + class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } + } + Live2DLoader.middlewares = [XHRLoader.loader]; + function createTexture(url, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (core.Texture.fromURL) { + return core.Texture.fromURL(url, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = core.Texture.from(url, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; + } + const TAG = "Live2DFactory"; + const urlToJSON = (context, next) => __async(this, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); + }); + const jsonToSettings = (context, next) => __async(this, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); + }); + const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); + }; + const setupOptionals = (context, next) => __async(this, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } + }); + const setupEssentials = (context, next) => __async(this, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url = context.settings.resolveURL(tex); + return createTexture(url, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } + }); + const createInternalModel = (context, next) => __async(this, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); + }); + const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } + }; + let Live2DFactory = _Live2DFactory; + Live2DFactory.runtimes = []; + Live2DFactory.urlToJSON = urlToJSON; + Live2DFactory.jsonToSettings = jsonToSettings; + Live2DFactory.waitUntilReady = waitUntilReady; + Live2DFactory.setupOptionals = setupOptionals; + Live2DFactory.setupEssentials = setupEssentials; + Live2DFactory.createInternalModel = createInternalModel; + Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel + ]; + Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); + Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); + MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); + }; + ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); + }; + class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } + } + function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); + } + function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); + } + class Live2DTransform extends math.Transform { + } + const tempPoint = new math.Point(); + const tempMatrix = new math.Matrix(); + let tickerRef; + class Live2DModel extends display.Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new math.ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } + } + applyMixins(Live2DModel, [InteractionMixin]); + const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } + }; + let FileLoader = _FileLoader; + FileLoader.filesMap = {}; + FileLoader.factory = (context, next) => __async(this, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url) { + return _FileLoader.resolveURL(this._objectURL, url); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); + const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } + }; + let ZipLoader = _ZipLoader; + ZipLoader.ZIP_PROTOCOL = "zip://"; + ZipLoader.uid = 0; + ZipLoader.factory = (context, next) => __async(this, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); + if (!window.Live2D) { + throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded."); + } + const originalUpdateParam = Live2DMotion.prototype.updateParam; + Live2DMotion.prototype.updateParam = function(model, entry) { + originalUpdateParam.call(this, model, entry); + if (entry.isFinished() && this.onFinishHandler) { + this.onFinishHandler(this); + delete this.onFinishHandler; + } + }; + class Live2DExpression extends AMotion { + constructor(json) { + super(); + this.params = []; + this.setFadeIn(json.fade_in > 0 ? json.fade_in : exports2.config.expressionFadingDuration); + this.setFadeOut(json.fade_out > 0 ? json.fade_out : exports2.config.expressionFadingDuration); + if (Array.isArray(json.params)) { + json.params.forEach((param) => { + const calc = param.calc || "add"; + if (calc === "add") { + const defaultValue = param.def || 0; + param.val -= defaultValue; + } else if (calc === "mult") { + const defaultValue = param.def || 1; + param.val /= defaultValue; + } + this.params.push({ + calc, + val: param.val, + id: param.id + }); + }); + } + } + updateParamExe(model, time, weight, motionQueueEnt) { + this.params.forEach((param) => { + model.setParamFloat(param.id, param.val * weight); + }); + } + } + class Cubism2ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new MotionQueueManager(); + this.definitions = (_a = this.settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.name === name); + } + getExpressionFile(definition) { + return definition.file; + } + createExpression(data, definition) { + return new Live2DExpression(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, dt) { + return this.queueManager.updateParam(model); + } + } + class Cubism2MotionManager extends MotionManager { + constructor(settings, options) { + super(settings, options); + this.groups = { idle: "idle" }; + this.motionDataType = "arraybuffer"; + this.queueManager = new MotionQueueManager(); + this.definitions = this.settings.motions; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism2ExpressionManager(this.settings, options); + } + } + isFinished() { + return this.queueManager.isFinished(); + } + createMotion(data, group, definition) { + const motion = Live2DMotion.loadMotion(data); + const defaultFadingDuration = group === this.groups.idle ? exports2.config.idleMotionFadingDuration : exports2.config.motionFadingDuration; + motion.setFadeIn(definition.fade_in > 0 ? definition.fade_in : defaultFadingDuration); + motion.setFadeOut(definition.fade_out > 0 ? definition.fade_out : defaultFadingDuration); + return motion; + } + getMotionFile(definition) { + return definition.file; + } + getMotionName(definition) { + return definition.file; + } + getSoundFile(definition) { + return definition.sound; + } + _startMotion(motion, onFinish) { + motion.onFinishHandler = onFinish; + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.updateParam(model); + } + destroy() { + super.destroy(); + this.queueManager = void 0; + } + } + class Live2DEyeBlink { + constructor(coreModel) { + this.coreModel = coreModel; + this.blinkInterval = 4e3; + this.closingDuration = 100; + this.closedDuration = 50; + this.openingDuration = 150; + this.eyeState = 0; + this.eyeParamValue = 1; + this.closedTimer = 0; + this.nextBlinkTimeLeft = this.blinkInterval; + this.leftParam = coreModel.getParamIndex("PARAM_EYE_L_OPEN"); + this.rightParam = coreModel.getParamIndex("PARAM_EYE_R_OPEN"); + } + setEyeParams(value) { + this.eyeParamValue = clamp(value, 0, 1); + this.coreModel.setParamFloat(this.leftParam, this.eyeParamValue); + this.coreModel.setParamFloat(this.rightParam, this.eyeParamValue); + } + update(dt) { + switch (this.eyeState) { + case 0: + this.nextBlinkTimeLeft -= dt; + if (this.nextBlinkTimeLeft < 0) { + this.eyeState = 1; + this.nextBlinkTimeLeft = this.blinkInterval + this.closingDuration + this.closedDuration + this.openingDuration + rand(0, 2e3); + } + break; + case 1: + this.setEyeParams(this.eyeParamValue + dt / this.closingDuration); + if (this.eyeParamValue <= 0) { + this.eyeState = 2; + this.closedTimer = 0; + } + break; + case 2: + this.closedTimer += dt; + if (this.closedTimer >= this.closedDuration) { + this.eyeState = 3; + } + break; + case 3: + this.setEyeParams(this.eyeParamValue + dt / this.openingDuration); + if (this.eyeParamValue >= 1) { + this.eyeState = 0; + } + } + } + } + const tempMatrixArray = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + class Cubism2InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.textureFlipY = true; + this.drawDataCount = 0; + this.disableCulling = false; + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism2MotionManager(settings, options); + this.eyeBlink = new Live2DEyeBlink(coreModel); + this.eyeballXParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_X"); + this.eyeballYParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_Y"); + this.angleXParamIndex = coreModel.getParamIndex("PARAM_ANGLE_X"); + this.angleYParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Y"); + this.angleZParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Z"); + this.bodyAngleXParamIndex = coreModel.getParamIndex("PARAM_BODY_ANGLE_X"); + this.breathParamIndex = coreModel.getParamIndex("PARAM_BREATH"); + this.init(); + } + init() { + super.init(); + if (this.settings.initParams) { + this.settings.initParams.forEach(({ id, value }) => this.coreModel.setParamFloat(id, value)); + } + if (this.settings.initOpacities) { + this.settings.initOpacities.forEach(({ id, value }) => this.coreModel.setPartsOpacity(id, value)); + } + this.coreModel.saveParam(); + const arr = this.coreModel.getModelContext()._$aS; + if (arr == null ? void 0 : arr.length) { + this.drawDataCount = arr.length; + } + let culling = this.coreModel.drawParamWebGL.culling; + Object.defineProperty(this.coreModel.drawParamWebGL, "culling", { + set: (v) => culling = v, + get: () => this.disableCulling ? false : culling + }); + const clipManager = this.coreModel.getModelContext().clipManager; + const originalSetupClip = clipManager.setupClip; + clipManager.setupClip = (modelContext, drawParam) => { + originalSetupClip.call(clipManager, modelContext, drawParam); + drawParam.gl.viewport(...this.viewport); + }; + } + getSize() { + return [this.coreModel.getCanvasWidth(), this.coreModel.getCanvasHeight()]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + let commonKey = key; + if (key === "center_x") { + commonKey = "centerX"; + } else if (key === "center_y") { + commonKey = "centerY"; + } + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + updateWebGLContext(gl, glContextID) { + const drawParamWebGL = this.coreModel.drawParamWebGL; + drawParamWebGL.firstDraw = true; + drawParamWebGL.setGL(gl); + drawParamWebGL.glno = glContextID; + for (const prop in drawParamWebGL) { + if (drawParamWebGL.hasOwnProperty(prop) && drawParamWebGL[prop] instanceof WebGLBuffer) { + drawParamWebGL[prop] = null; + } + } + const clipManager = this.coreModel.getModelContext().clipManager; + clipManager.curFrameNo = glContextID; + const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + clipManager.getMaskRenderTexture(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + bindTexture(index, texture) { + this.coreModel.setTexture(index, texture); + } + getHitAreaDefs() { + var _a; + return ((_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.id, + name: hitArea.name, + index: this.coreModel.getDrawDataIndex(hitArea.id) + }))) || []; + } + getDrawableIDs() { + const modelContext = this.coreModel.getModelContext(); + const ids = []; + for (let i = 0; i < this.drawDataCount; i++) { + const drawData = modelContext.getDrawData(i); + if (drawData) { + ids.push(drawData.getDrawDataID().id); + } + } + return ids; + } + getDrawableIndex(id) { + return this.coreModel.getDrawDataIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawDataIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + return this.coreModel.getTransformedPoints(drawIndex).slice(); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParam(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.update(dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt, now); + (_c = this.physics) == null ? void 0 : _c.update(now); + (_d = this.pose) == null ? void 0 : _d.update(dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParam(); + } + updateFocus() { + this.coreModel.addToParamFloat(this.eyeballXParamIndex, this.focusController.x); + this.coreModel.addToParamFloat(this.eyeballYParamIndex, this.focusController.y); + this.coreModel.addToParamFloat(this.angleXParamIndex, this.focusController.x * 30); + this.coreModel.addToParamFloat(this.angleYParamIndex, this.focusController.y * 30); + this.coreModel.addToParamFloat(this.angleZParamIndex, this.focusController.x * this.focusController.y * -30); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + const t = now / 1e3 * 2 * Math.PI; + this.coreModel.addToParamFloat(this.angleXParamIndex, 15 * Math.sin(t / 6.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleYParamIndex, 8 * Math.sin(t / 3.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleZParamIndex, 10 * Math.sin(t / 5.5345) * 0.5); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, 4 * Math.sin(t / 15.5345) * 0.5); + this.coreModel.setParamFloat(this.breathParamIndex, 0.5 + 0.5 * Math.sin(t / 3.2345)); + } + draw(gl) { + const disableCulling = this.disableCulling; + if (gl.getParameter(gl.FRAMEBUFFER_BINDING)) { + this.disableCulling = true; + } + const matrix = this.drawingMatrix; + tempMatrixArray[0] = matrix.a; + tempMatrixArray[1] = matrix.b; + tempMatrixArray[4] = matrix.c; + tempMatrixArray[5] = matrix.d; + tempMatrixArray[12] = matrix.tx; + tempMatrixArray[13] = matrix.ty; + this.coreModel.setMatrix(tempMatrixArray); + this.coreModel.draw(); + this.disableCulling = disableCulling; + } + destroy() { + super.destroy(); + this.coreModel = void 0; + } + } + class Cubism2ModelSettings extends ModelSettings { + constructor(json) { + super(json); + this.motions = {}; + if (!Cubism2ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + this.moc = json.model; + copyArray("string", json, this, "textures", "textures"); + this.copy(json); + } + static isValidJSON(json) { + var _a; + return !!json && typeof json.model === "string" && ((_a = json.textures) == null ? void 0 : _a.length) > 0 && json.textures.every((item) => typeof item === "string"); + } + copy(json) { + copyProperty("string", json, this, "name", "name"); + copyProperty("string", json, this, "pose", "pose"); + copyProperty("string", json, this, "physics", "physics"); + copyProperty("object", json, this, "layout", "layout"); + copyProperty("object", json, this, "motions", "motions"); + copyArray("object", json, this, "hit_areas", "hitAreas"); + copyArray("object", json, this, "expressions", "expressions"); + copyArray("object", json, this, "init_params", "initParams"); + copyArray("object", json, this, "init_opacities", "initOpacities"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].file = replace(motions[i].file, `motions.${group}[${i}].file`); + if (motions[i].sound !== void 0) { + motions[i].sound = replace(motions[i].sound, `motions.${group}[${i}].sound`); + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].file = replace(this.expressions[i].file, `expressions[${i}].file`); + } + } + } + } + const SRC_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE + }; + const TARGET_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE + }; + class Live2DPhysics { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.physicsHairs = []; + if (json.physics_hair) { + this.physicsHairs = json.physics_hair.map((definition) => { + const physicsHair = new PhysicsHair(); + physicsHair.setup(definition.setup.length, definition.setup.regist, definition.setup.mass); + definition.src.forEach(({ id, ptype, scale, weight }) => { + const type = SRC_TYPE_MAP[ptype]; + if (type) { + physicsHair.addSrcParam(type, id, scale, weight); + } + }); + definition.targets.forEach(({ id, ptype, scale, weight }) => { + const type = TARGET_TYPE_MAP[ptype]; + if (type) { + physicsHair.addTargetParam(type, id, scale, weight); + } + }); + return physicsHair; + }); + } + } + update(elapsed) { + this.physicsHairs.forEach((physicsHair) => physicsHair.update(this.coreModel, elapsed)); + } + } + class Live2DPartsParam { + constructor(id) { + this.id = id; + this.paramIndex = -1; + this.partsIndex = -1; + this.link = []; + } + initIndex(model) { + this.paramIndex = model.getParamIndex("VISIBLE:" + this.id); + this.partsIndex = model.getPartsDataIndex(PartsDataID.getID(this.id)); + model.setParamFloat(this.paramIndex, 1); + } + } + class Live2DPose { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.opacityAnimDuration = 500; + this.partsGroups = []; + if (json.parts_visible) { + this.partsGroups = json.parts_visible.map(({ group }) => group.map(({ id, link }) => { + const parts = new Live2DPartsParam(id); + if (link) { + parts.link = link.map((l) => new Live2DPartsParam(l)); + } + return parts; + })); + this.init(); + } + } + init() { + this.partsGroups.forEach((group) => { + group.forEach((parts) => { + parts.initIndex(this.coreModel); + if (parts.paramIndex >= 0) { + const visible = this.coreModel.getParamFloat(parts.paramIndex) !== 0; + this.coreModel.setPartsOpacity(parts.partsIndex, visible ? 1 : 0); + this.coreModel.setParamFloat(parts.paramIndex, visible ? 1 : 0); + if (parts.link.length > 0) { + parts.link.forEach((p) => p.initIndex(this.coreModel)); + } + } + }); + }); + } + normalizePartsOpacityGroup(partsGroup, dt) { + const model = this.coreModel; + const phi = 0.5; + const maxBackOpacity = 0.15; + let visibleOpacity = 1; + let visibleIndex = partsGroup.findIndex(({ paramIndex, partsIndex }) => partsIndex >= 0 && model.getParamFloat(paramIndex) !== 0); + if (visibleIndex >= 0) { + const originalOpacity = model.getPartsOpacity(partsGroup[visibleIndex].partsIndex); + visibleOpacity = clamp(originalOpacity + dt / this.opacityAnimDuration, 0, 1); + } else { + visibleIndex = 0; + visibleOpacity = 1; + } + partsGroup.forEach(({ partsIndex }, index) => { + if (partsIndex >= 0) { + if (visibleIndex == index) { + model.setPartsOpacity(partsIndex, visibleOpacity); + } else { + let opacity = model.getPartsOpacity(partsIndex); + let a1; + if (visibleOpacity < phi) { + a1 = visibleOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - visibleOpacity) * phi / (1 - phi); + } + let backOp = (1 - a1) * (1 - visibleOpacity); + if (backOp > maxBackOpacity) { + a1 = 1 - maxBackOpacity / (1 - visibleOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartsOpacity(partsIndex, opacity); + } + } + }); + } + copyOpacity(partsGroup) { + const model = this.coreModel; + partsGroup.forEach(({ partsIndex, link }) => { + if (partsIndex >= 0 && link) { + const opacity = model.getPartsOpacity(partsIndex); + link.forEach(({ partsIndex: partsIndex2 }) => { + if (partsIndex2 >= 0) { + model.setPartsOpacity(partsIndex2, opacity); + } + }); + } + }); + } + update(dt) { + this.partsGroups.forEach((partGroup) => { + this.normalizePartsOpacityGroup(partGroup, dt); + this.copyOpacity(partGroup); + }); + } + } + Live2DFactory.registerRuntime({ + version: 2, + test(source) { + return source instanceof Cubism2ModelSettings || Cubism2ModelSettings.isValidJSON(source); + }, + ready() { + return Promise.resolve(); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 3) { + return false; + } + const view = new Int8Array(modelData, 0, 3); + return String.fromCharCode(...view) === "moc"; + }, + createModelSettings(json) { + return new Cubism2ModelSettings(json); + }, + createCoreModel(data) { + const model = Live2DModelWebGL.loadModel(data); + const error = Live2D.getError(); + if (error) + throw error; + return model; + }, + createInternalModel(coreModel, settings, options) { + return new Cubism2InternalModel(coreModel, settings, options); + }, + createPose(coreModel, data) { + return new Live2DPose(coreModel, data); + }, + createPhysics(coreModel, data) { + return new Live2DPhysics(coreModel, data); + } + }); + exports2.Cubism2ExpressionManager = Cubism2ExpressionManager; + exports2.Cubism2InternalModel = Cubism2InternalModel; + exports2.Cubism2ModelSettings = Cubism2ModelSettings; + exports2.Cubism2MotionManager = Cubism2MotionManager; + exports2.ExpressionManager = ExpressionManager; + exports2.FileLoader = FileLoader; + exports2.FocusController = FocusController; + exports2.InteractionMixin = InteractionMixin; + exports2.InternalModel = InternalModel; + exports2.LOGICAL_HEIGHT = LOGICAL_HEIGHT; + exports2.LOGICAL_WIDTH = LOGICAL_WIDTH; + exports2.Live2DExpression = Live2DExpression; + exports2.Live2DEyeBlink = Live2DEyeBlink; + exports2.Live2DFactory = Live2DFactory; + exports2.Live2DLoader = Live2DLoader; + exports2.Live2DModel = Live2DModel; + exports2.Live2DPhysics = Live2DPhysics; + exports2.Live2DPose = Live2DPose; + exports2.Live2DTransform = Live2DTransform; + exports2.ModelSettings = ModelSettings; + exports2.MotionManager = MotionManager; + exports2.MotionPreloadStrategy = MotionPreloadStrategy; + exports2.MotionPriority = MotionPriority; + exports2.MotionState = MotionState; + exports2.SoundManager = SoundManager; + exports2.VERSION = VERSION; + exports2.XHRLoader = XHRLoader; + exports2.ZipLoader = ZipLoader; + exports2.applyMixins = applyMixins; + exports2.clamp = clamp; + exports2.copyArray = copyArray; + exports2.copyProperty = copyProperty; + exports2.folderName = folderName; + exports2.logger = logger; + exports2.rand = rand; + exports2.remove = remove; + Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); +}); diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism2.min.js b/live2d/node_modules/pixi-live2d-display/dist/cubism2.min.js new file mode 100644 index 0000000..706efff --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism2.min.js @@ -0,0 +1 @@ +var __pow=Math.pow,__async=(t,e,s)=>new Promise(((i,r)=>{var o=t=>{try{a(s.next(t))}catch(e){r(e)}},n=t=>{try{a(s.throw(t))}catch(e){r(e)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(o,n);a((s=s.apply(t,e)).next())}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pixi/utils"),require("@pixi/math"),require("@pixi/core"),require("@pixi/display")):"function"==typeof define&&define.amd?define(["exports","@pixi/utils","@pixi/math","@pixi/core","@pixi/display"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).PIXI=t.PIXI||{},t.PIXI.live2d=t.PIXI.live2d||{}),t.PIXI.utils,t.PIXI,t.PIXI,t.PIXI)}(this,(function(t,e,s,i,r){"use strict";var o,n,a;(n=o||(o={})).supportMoreMaskDivisions=!0,n.setOpacityFromMotion=!1,t.config=void 0,(a=t.config||(t.config={})).LOG_LEVEL_VERBOSE=0,a.LOG_LEVEL_WARNING=1,a.LOG_LEVEL_ERROR=2,a.LOG_LEVEL_NONE=999,a.logLevel=a.LOG_LEVEL_WARNING,a.sound=!0,a.motionSync=!0,a.motionFadingDuration=500,a.idleMotionFadingDuration=2e3,a.expressionFadingDuration=500,a.preserveExpressionOnMotion=!0,a.cubism4=o;const l={log(e,...s){t.config.logLevel<=t.config.LOG_LEVEL_VERBOSE&&console.log(`[${e}]`,...s)},warn(e,...s){t.config.logLevel<=t.config.LOG_LEVEL_WARNING&&console.warn(`[${e}]`,...s)},error(e,...s){t.config.logLevel<=t.config.LOG_LEVEL_ERROR&&console.error(`[${e}]`,...s)}};function d(t,e,s){return ts?s:t}function h(t,e){return Math.random()*(e-t)+t}function c(t,e,s,i,r){const o=e[i];null!==o&&typeof o===t&&(s[r]=o)}function u(t,e,s,i,r){const o=e[i];Array.isArray(o)&&(s[r]=o.filter((e=>null!==e&&typeof e===t)))}function p(t,e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((s=>{"constructor"!==s&&Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(e.prototype,s))}))}))}function g(t){let e=t.lastIndexOf("/");return-1!=e&&(t=t.slice(0,e)),e=t.lastIndexOf("/"),-1!==e&&(t=t.slice(e+1)),t}function m(t,e){const s=t.indexOf(e);-1!==s&&t.splice(s,1)}class f extends e.EventEmitter{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return __async(this,null,(function*(){if(!this.definitions[t])return void l.warn(this.tag,`Undefined expression at [${t}]`);if(null===this.expressions[t])return void l.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e}))}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return __async(this,null,(function*(){if(this.definitions.length){const t=[];for(let e=0;e-1&&tl&&(o*=l/a,n*=l/a),this.vx+=o,this.vy+=n;const d=Math.sqrt(__pow(this.vx,2)+__pow(this.vy,2)),h=.5*(Math.sqrt(__pow(l,2)+8*l*i)-l);d>h&&(this.vx*=h/d,this.vy*=h/d),this.x+=this.vx,this.y+=this.vy}}class M{constructor(t){this.json=t;let e=t.url;if("string"!=typeof e)throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=g(this.url)}resolveURL(t){return e.url.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),void 0!==this.pose&&(this.pose=t(this.pose,"pose")),void 0!==this.physics&&(this.physics=t(this.physics,"physics"));for(let e=0;e(t.push(e),e))),t}validateFiles(t){const e=(e,s)=>{const i=this.resolveURL(e);if(!t.includes(i)){if(s)throw new Error(`File "${e}" is defined in settings, but doesn't exist in given files`);return!1}return!0};[this.moc,...this.textures].forEach((t=>e(t,!0)));return this.getDefinedFiles().filter((t=>e(t,!1)))}}var x=(t=>(t[t.NONE=0]="NONE",t[t.IDLE=1]="IDLE",t[t.NORMAL=2]="NORMAL",t[t.FORCE=3]="FORCE",t))(x||{});class v{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,s){if(s<=0)return l.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return l.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return l.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(1===s){if(0!==this.currentPriority)return l.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(void 0!==this.reservedIdleGroup)return l.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(s<3){if(s<=this.currentPriority)return l.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(s<=this.reservePriority)return l.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,s)}return!0}start(t,e,s,i){if(1===i){if(this.setReservedIdle(void 0,void 0),0!==this.currentPriority)return l.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,s)),!1}else{if(e!==this.reservedGroup||s!==this.reservedIndex)return l.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,s)),!1;this.setReserved(void 0,void 0,0)}return!!t&&(this.setCurrent(e,s,i),!0)}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,s){this.currentPriority=s,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,s){this.reservePriority=s,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return void 0===this.currentGroup&&void 0===this.reservedIdleGroup}shouldOverrideExpression(){return!t.config.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){return`\n group = "${t}", index = ${e}\n`+["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"].map((t=>"["+t+"] "+this[t])).join("\n")}return""}}class P{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach((t=>t.volume=this._volume))}static add(t,e,s){const i=new Audio(t);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",(()=>{this.dispose(i),null==e||e()})),i.addEventListener("error",(e=>{this.dispose(i),l.warn("SoundManager",`Error occurred on "${t}"`,e.error),null==s||s(e.error)})),this.audios.push(i),i}static play(t){return new Promise(((e,s)=>{var i;null==(i=t.play())||i.catch((e=>{t.dispatchEvent(new ErrorEvent("error",{error:e})),s(e)})),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)}))}static dispose(t){t.pause(),t.removeAttribute("src"),m(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}P.audios=[],P._volume=.5;var w=(t=>(t.ALL="ALL",t.IDLE="IDLE",t.NONE="NONE",t))(w||{});class _ extends e.EventEmitter{constructor(t,e){super(),this.motionGroups={},this.state=new v,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){(null==t?void 0:t.idleMotionGroup)&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const s of Object.keys(this.definitions))this.motionGroups[s]=[];let e;switch(null==t?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;default:e=[this.groups.idle]}for(const s of e)if(this.definitions[s])for(let t=0;tthis.currentAudio=void 0),(()=>this.currentAudio=void 0)),this.currentAudio=n}catch(d){l.warn(this.tag,"Failed to create audio",t,d)}}const a=yield this.loadMotion(e,s);if(n){const e=P.play(n).catch((t=>l.warn(this.tag,"Failed to play audio",n.src,t)));t.config.motionSync&&(yield e)}return this.state.start(a,e,s,i)?(l.log(this.tag,"Start motion:",this.getMotionName(o)),this.emit("motionStart",e,s,n),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(a),!0):(n&&(P.dispose(n),this.currentAudio=void 0),!1)}))}startRandomMotion(t,e){return __async(this,null,(function*(){const s=this.definitions[t];if(null==s?void 0:s.length){const i=[];for(let e=0;et.index>=0));for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter((s=>this.isHit(s,t,e)))}isHit(t,e,s){if(!this.hitAreas[t])return!1;const i=this.hitAreas[t].index,r=this.getDrawableBounds(i,E);return r.x<=e&&e<=r.x+r.width&&r.y<=s&&s<=r.y+r.height}getDrawableBounds(t,e){const s=this.getDrawableVertices(t);let i=s[0],r=s[0],o=s[1],n=s[1];for(let a=0;a{200!==o.status&&0!==o.status||!o.response?o.onerror():i(o.response)},o.onerror=()=>{l.warn("XHRLoader",`Failed to load resource as ${o.responseType} (Status ${o.status}): ${e}`),r(new L("Network error.",e,o.status))},o.onabort=()=>r(new L("Aborted.",e,o.status,!0)),o.onloadend=()=>{var e;b.allXhrSet.delete(o),t&&(null==(e=b.xhrMap.get(t))||e.delete(o))},o}static cancelXHRs(){var t;null==(t=b.xhrMap.get(this))||t.forEach((t=>{t.abort(),b.allXhrSet.delete(t)})),b.xhrMap.delete(this)}static release(){b.allXhrSet.forEach((t=>t.abort())),b.allXhrSet.clear(),b.xhrMap=new WeakMap}};let T=b;function O(t,e){let s=-1;return function i(r,o){if(o)return Promise.reject(o);if(r<=s)return Promise.reject(new Error("next() called multiple times"));s=r;const n=t[r];if(!n)return Promise.resolve();try{return Promise.resolve(n(e,i.bind(null,r+1)))}catch(a){return Promise.reject(a)}}(0)}T.xhrMap=new WeakMap,T.allXhrSet=new Set,T.loader=(t,e)=>new Promise(((e,s)=>{b.createXHR(t.target,t.settings?t.settings.resolveURL(t.url):t.url,t.type,(s=>{t.result=s,e()}),s).send()}));class R{static load(t){return O(this.middlewares,t).then((()=>t.result))}}R.middlewares=[T.loader];const F="Live2DFactory",A=(t,e)=>__async(this,null,(function*(){if("string"==typeof t.source){const e=yield R.load({url:t.source,type:"json",target:t.live2dModel});e.url=t.source,t.source=e,t.live2dModel.emit("settingsJSONLoaded",e)}return e()})),D=(t,e)=>__async(this,null,(function*(){if(t.source instanceof M)return t.settings=t.source,e();if("object"==typeof t.source){const s=N.findRuntime(t.source);if(s){const i=s.createModelSettings(t.source);return t.settings=i,t.live2dModel.emit("settingsLoaded",i),e()}}throw new TypeError("Unknown settings format.")})),C=(t,e)=>{if(t.settings){const s=N.findRuntime(t.settings);if(s)return s.ready().then(e)}return e()},S=(t,e)=>__async(this,null,(function*(){yield e();const s=t.internalModel;if(s){const e=t.settings,i=N.findRuntime(e);if(i){const r=[];e.pose&&r.push(R.load({settings:e,url:e.pose,type:"json",target:s}).then((e=>{s.pose=i.createPose(s.coreModel,e),t.live2dModel.emit("poseLoaded",s.pose)})).catch((e=>{t.live2dModel.emit("poseLoadError",e),l.warn(F,"Failed to load pose.",e)}))),e.physics&&r.push(R.load({settings:e,url:e.physics,type:"json",target:s}).then((e=>{s.physics=i.createPhysics(s.coreModel,e),t.live2dModel.emit("physicsLoaded",s.physics)})).catch((e=>{t.live2dModel.emit("physicsLoadError",e),l.warn(F,"Failed to load physics.",e)}))),r.length&&(yield Promise.all(r))}}})),G=(t,e)=>__async(this,null,(function*(){if(!t.settings)throw new TypeError("Missing settings.");{const s=t.live2dModel,r=t.settings.textures.map((e=>function(t,e={}){const s={resourceOptions:{crossorigin:e.crossOrigin}};if(i.Texture.fromURL)return i.Texture.fromURL(t,s).catch((t=>{if(t instanceof Error)throw t;const e=new Error("Texture loading error");throw e.event=t,e}));s.resourceOptions.autoLoad=!1;const r=i.Texture.from(t,s);if(r.baseTexture.valid)return Promise.resolve(r);const o=r.baseTexture.resource;return null!=o._live2d_load||(o._live2d_load=new Promise(((t,e)=>{const s=t=>{o.source.removeEventListener("error",s);const i=new Error("Texture loading error");i.event=t,e(i)};o.source.addEventListener("error",s),o.load().then((()=>t(r))).catch(s)}))),o._live2d_load}(t.settings.resolveURL(e),{crossOrigin:t.options.crossOrigin})));if(yield e(),!t.internalModel)throw new TypeError("Missing internal model.");s.internalModel=t.internalModel,s.emit("modelLoaded",t.internalModel),s.textures=yield Promise.all(r),s.emit("textureLoaded",s.textures)}})),U=(t,e)=>__async(this,null,(function*(){const s=t.settings;if(s instanceof M){const i=N.findRuntime(s);if(!i)throw new TypeError("Unknown model settings.");const r=yield R.load({settings:s,url:s.moc,type:"arraybuffer",target:t.live2dModel});if(!i.isValidMoc(r))throw new Error("Invalid moc data");const o=i.createCoreModel(r);return t.internalModel=i.createInternalModel(o,s,t.options),e()}throw new TypeError("Missing settings.")})),k=class{static registerRuntime(t){k.runtimes.push(t),k.runtimes.sort(((t,e)=>e.version-t.version))}static findRuntime(t){for(const e of k.runtimes)if(e.test(t))return e}static setupLive2DModel(t,e,s){return __async(this,null,(function*(){const i=new Promise((e=>t.once("textureLoaded",e))),r=new Promise((e=>t.once("modelLoaded",e))),o=Promise.all([i,r]).then((()=>t.emit("ready")));yield O(k.live2DModelMiddlewares,{live2dModel:t,source:e,options:s||{}}),yield o,t.emit("load")}))}static loadMotion(t,e,s){var i;const r=i=>t.emit("motionLoadError",e,s,i);try{const o=null==(i=t.definitions[e])?void 0:i[s];if(!o)return Promise.resolve(void 0);t.listeners("destroy").includes(k.releaseTasks)||t.once("destroy",k.releaseTasks);let n=k.motionTasksMap.get(t);n||(n={},k.motionTasksMap.set(t,n));let a=n[e];a||(a=[],n[e]=a);const d=t.getMotionFile(o);return null!=a[s]||(a[s]=R.load({url:d,settings:t.settings,type:t.motionDataType,target:t}).then((i=>{var r;const n=null==(r=k.motionTasksMap.get(t))?void 0:r[e];n&&delete n[s];const a=t.createMotion(i,e,o);return t.emit("motionLoaded",e,s,a),a})).catch((e=>{l.warn(t.tag,`Failed to load motion: ${d}\n`,e),r(e)}))),a[s]}catch(o){l.warn(t.tag,`Failed to load motion at "${e}"[${s}]\n`,o),r(o)}return Promise.resolve(void 0)}static loadExpression(t,e){const s=s=>t.emit("expressionLoadError",e,s);try{const i=t.definitions[e];if(!i)return Promise.resolve(void 0);t.listeners("destroy").includes(k.releaseTasks)||t.once("destroy",k.releaseTasks);let r=k.expressionTasksMap.get(t);r||(r=[],k.expressionTasksMap.set(t,r));const o=t.getExpressionFile(i);return null!=r[e]||(r[e]=R.load({url:o,settings:t.settings,type:"json",target:t}).then((s=>{const r=k.expressionTasksMap.get(t);r&&delete r[e];const o=t.createExpression(s,i);return t.emit("expressionLoaded",e,o),o})).catch((e=>{l.warn(t.tag,`Failed to load expression: ${o}\n`,e),s(e)}))),r[e]}catch(i){l.warn(t.tag,`Failed to load expression at [${e}]\n`,i),s(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof _?k.motionTasksMap.delete(this):k.expressionTasksMap.delete(this)}};let N=k;N.runtimes=[],N.urlToJSON=A,N.jsonToSettings=D,N.waitUntilReady=C,N.setupOptionals=S,N.setupEssentials=G,N.createInternalModel=U,N.live2DModelMiddlewares=[A,D,C,S,G,U],N.motionTasksMap=new WeakMap,N.expressionTasksMap=new WeakMap,_.prototype._loadMotion=function(t,e){return N.loadMotion(this,t,e)},f.prototype._loadExpression=function(t){return N.loadExpression(this,t)};class j{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",X,this):this.off("pointertap",X,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",H,this)))}unregisterInteraction(){var t;this.interactionManager&&(null==(t=this.interactionManager)||t.off("pointermove",H,this),this.interactionManager=void 0)}}function X(t){this.tap(t.data.global.x,t.data.global.y)}function H(t){this.focus(t.data.global.x,t.data.global.y)}class W extends s.Transform{}const $=new s.Point,V=new s.Matrix;let q;class B extends r.Container{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new W,this.anchor=new s.ObservablePoint(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",(()=>this.init(t)))}static from(t,e){const s=new this(e);return N.setupLive2DModel(s,t,e).then((()=>s))}static fromSync(t,e){const s=new this(e);return N.setupLive2DModel(s,t,e).then(null==e?void 0:e.onLoad).catch(null==e?void 0:e.onError),s}static registerTicker(t){q=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;q||(q=null==(e=window.PIXI)?void 0:e.Ticker),t?this._destroyed||(q?(q.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):l.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(null==q||q.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,s){return void 0===e?this.internalModel.motionManager.startRandomMotion(t,s):this.internalModel.motionManager.startMotion(t,e,s)}expression(t){return this.internalModel.motionManager.expressionManager?void 0===t?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,s=!1){$.x=t,$.y=e,this.toModelPosition($,$,!0);let i=$.x/this.internalModel.originalWidth*2-1,r=$.y/this.internalModel.originalHeight*2-1,o=Math.atan2(r,i);this.internalModel.focusController.focus(Math.cos(o),-Math.sin(o),s)}tap(t,e){const s=this.hitTest(t,e);s.length&&(l.log(this.tag,"Hit",s),this.emit("hit",s))}hitTest(t,e){return $.x=t,$.y=e,this.toModelPosition($,$),this.internalModel.hitTest($.x,$.y)}toModelPosition(t,e=t.clone(),s){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(q.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let r=0;re.destroy(t.baseTexture))),this.internalModel.destroy(),super.destroy(t)}}p(B,[j]);const Y=class{static resolveURL(t,e){var s;const i=null==(s=Y.filesMap[t])?void 0:s[e];if(void 0===i)throw new Error("Cannot find this file from uploaded files: "+e);return i}static upload(t,s){return __async(this,null,(function*(){const i={};for(const r of s.getDefinedFiles()){const o=decodeURI(e.url.resolve(s.url,r)),n=t.find((t=>t.webkitRelativePath===o));n&&(i[r]=URL.createObjectURL(n))}Y.filesMap[s._objectURL]=i}))}static createSettings(t){return __async(this,null,(function*(){const e=t.find((t=>t.name.endsWith("model.json")||t.name.endsWith("model3.json")));if(!e)throw new TypeError("Settings file not found");const s=yield Y.readText(e),i=JSON.parse(s);i.url=e.webkitRelativePath;const r=N.findRuntime(i);if(!r)throw new Error("Unknown settings JSON");const o=r.createModelSettings(i);return o._objectURL=URL.createObjectURL(e),o}))}static readText(t){return __async(this,null,(function*(){return new Promise(((e,s)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=s,i.readAsText(t,"utf8")}))}))}};let z=Y;z.filesMap={},z.factory=(t,e)=>__async(this,null,(function*(){if(Array.isArray(t.source)&&t.source[0]instanceof File){const e=t.source;let s=e.settings;if(s){if(!s._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings')}else s=yield Y.createSettings(e);s.validateFiles(e.map((t=>encodeURI(t.webkitRelativePath)))),yield Y.upload(e,s),s.resolveURL=function(t){return Y.resolveURL(this._objectURL,t)},t.source=s,t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){const t=this.settings._objectURL;if(URL.revokeObjectURL(t),Y.filesMap[t])for(const e of Object.values(Y.filesMap[t]))URL.revokeObjectURL(e);delete Y.filesMap[t]}))}))}return e()})),N.live2DModelMiddlewares.unshift(z.factory);const J=class{static unzip(t,s){return __async(this,null,(function*(){const i=yield J.getFilePaths(t),r=[];for(const t of s.getDefinedFiles()){const o=decodeURI(e.url.resolve(s.url,t));i.includes(o)&&r.push(o)}const o=yield J.getFiles(t,r);for(let t=0;tt.endsWith("model.json")||t.endsWith("model3.json")));if(!e)throw new Error("Settings file not found");const s=yield J.readText(t,e);if(!s)throw new Error("Empty settings file: "+e);const i=JSON.parse(s);i.url=e;const r=N.findRuntime(i);if(!r)throw new Error("Unknown settings JSON");return r.createModelSettings(i)}))}static zipReader(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFilePaths(t){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFiles(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static readText(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static releaseReader(t){}};let Z=J;if(Z.ZIP_PROTOCOL="zip://",Z.uid=0,Z.factory=(t,e)=>__async(this,null,(function*(){const s=t.source;let i,r,o;if("string"==typeof s&&(s.endsWith(".zip")||s.startsWith(J.ZIP_PROTOCOL))?(i=s.startsWith(J.ZIP_PROTOCOL)?s.slice(J.ZIP_PROTOCOL.length):s,r=yield R.load({url:i,type:"blob",target:t.live2dModel})):Array.isArray(s)&&1===s.length&&s[0]instanceof File&&s[0].name.endsWith(".zip")&&(r=s[0],i=URL.createObjectURL(r),o=s.settings),r){if(!r.size)throw new Error("Empty zip file");const e=yield J.zipReader(r,i);o||(o=yield J.createSettings(e)),o._objectURL=J.ZIP_PROTOCOL+J.uid+"/"+o.url;const s=yield J.unzip(e,o);s.settings=o,t.source=s,i.startsWith("blob:")&&t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){URL.revokeObjectURL(i)}))})),J.releaseReader(e)}return e()})),N.live2DModelMiddlewares.unshift(Z.factory),!window.Live2D)throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded.");const Q=Live2DMotion.prototype.updateParam;Live2DMotion.prototype.updateParam=function(t,e){Q.call(this,t,e),e.isFinished()&&this.onFinishHandler&&(this.onFinishHandler(this),delete this.onFinishHandler)};class K extends AMotion{constructor(e){super(),this.params=[],this.setFadeIn(e.fade_in>0?e.fade_in:t.config.expressionFadingDuration),this.setFadeOut(e.fade_out>0?e.fade_out:t.config.expressionFadingDuration),Array.isArray(e.params)&&e.params.forEach((t=>{const e=t.calc||"add";if("add"===e){const e=t.def||0;t.val-=e}else if("mult"===e){const e=t.def||1;t.val/=e}this.params.push({calc:e,val:t.val,id:t.id})}))}updateParamExe(t,e,s,i){this.params.forEach((e=>{t.setParamFloat(e.id,e.val*s)}))}}class tt extends f{constructor(t,e){var s;super(t,e),this.queueManager=new MotionQueueManager,this.definitions=null!=(s=this.settings.expressions)?s:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex((e=>e.name===t))}getExpressionFile(t){return t.file}createExpression(t,e){return new K(t)}_setExpression(t){return this.queueManager.startMotion(t)}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}}class et extends _{constructor(t,e){super(t,e),this.groups={idle:"idle"},this.motionDataType="arraybuffer",this.queueManager=new MotionQueueManager,this.definitions=this.settings.motions,this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new tt(this.settings,t))}isFinished(){return this.queueManager.isFinished()}createMotion(e,s,i){const r=Live2DMotion.loadMotion(e),o=s===this.groups.idle?t.config.idleMotionFadingDuration:t.config.motionFadingDuration;return r.setFadeIn(i.fade_in>0?i.fade_in:o),r.setFadeOut(i.fade_out>0?i.fade_out:o),r}getMotionFile(t){return t.file}getMotionName(t){return t.file}getSoundFile(t){return t.sound}_startMotion(t,e){return t.onFinishHandler=e,this.queueManager.stopAllMotions(),this.queueManager.startMotion(t)}_stopAllMotions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}destroy(){super.destroy(),this.queueManager=void 0}}class st{constructor(t){this.coreModel=t,this.blinkInterval=4e3,this.closingDuration=100,this.closedDuration=50,this.openingDuration=150,this.eyeState=0,this.eyeParamValue=1,this.closedTimer=0,this.nextBlinkTimeLeft=this.blinkInterval,this.leftParam=t.getParamIndex("PARAM_EYE_L_OPEN"),this.rightParam=t.getParamIndex("PARAM_EYE_R_OPEN")}setEyeParams(t){this.eyeParamValue=d(t,0,1),this.coreModel.setParamFloat(this.leftParam,this.eyeParamValue),this.coreModel.setParamFloat(this.rightParam,this.eyeParamValue)}update(t){switch(this.eyeState){case 0:this.nextBlinkTimeLeft-=t,this.nextBlinkTimeLeft<0&&(this.eyeState=1,this.nextBlinkTimeLeft=this.blinkInterval+this.closingDuration+this.closedDuration+this.openingDuration+h(0,2e3));break;case 1:this.setEyeParams(this.eyeParamValue+t/this.closingDuration),this.eyeParamValue<=0&&(this.eyeState=2,this.closedTimer=0);break;case 2:this.closedTimer+=t,this.closedTimer>=this.closedDuration&&(this.eyeState=3);break;case 3:this.setEyeParams(this.eyeParamValue+t/this.openingDuration),this.eyeParamValue>=1&&(this.eyeState=0)}}}const it=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class rt extends I{constructor(t,e,s){super(),this.textureFlipY=!0,this.drawDataCount=0,this.disableCulling=!1,this.coreModel=t,this.settings=e,this.motionManager=new et(e,s),this.eyeBlink=new st(t),this.eyeballXParamIndex=t.getParamIndex("PARAM_EYE_BALL_X"),this.eyeballYParamIndex=t.getParamIndex("PARAM_EYE_BALL_Y"),this.angleXParamIndex=t.getParamIndex("PARAM_ANGLE_X"),this.angleYParamIndex=t.getParamIndex("PARAM_ANGLE_Y"),this.angleZParamIndex=t.getParamIndex("PARAM_ANGLE_Z"),this.bodyAngleXParamIndex=t.getParamIndex("PARAM_BODY_ANGLE_X"),this.breathParamIndex=t.getParamIndex("PARAM_BREATH"),this.init()}init(){super.init(),this.settings.initParams&&this.settings.initParams.forEach((({id:t,value:e})=>this.coreModel.setParamFloat(t,e))),this.settings.initOpacities&&this.settings.initOpacities.forEach((({id:t,value:e})=>this.coreModel.setPartsOpacity(t,e))),this.coreModel.saveParam();const t=this.coreModel.getModelContext()._$aS;(null==t?void 0:t.length)&&(this.drawDataCount=t.length);let e=this.coreModel.drawParamWebGL.culling;Object.defineProperty(this.coreModel.drawParamWebGL,"culling",{set:t=>e=t,get:()=>!this.disableCulling&&e});const s=this.coreModel.getModelContext().clipManager,i=s.setupClip;s.setupClip=(t,e)=>{i.call(s,t,e),e.gl.viewport(...this.viewport)}}getSize(){return[this.coreModel.getCanvasWidth(),this.coreModel.getCanvasHeight()]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){let s=e;"center_x"===e?s="centerX":"center_y"===e&&(s="centerY"),t[s]=this.settings.layout[e]}return t}updateWebGLContext(t,e){const s=this.coreModel.drawParamWebGL;s.firstDraw=!0,s.setGL(t),s.glno=e;for(const o in s)s.hasOwnProperty(o)&&s[o]instanceof WebGLBuffer&&(s[o]=null);const i=this.coreModel.getModelContext().clipManager;i.curFrameNo=e;const r=t.getParameter(t.FRAMEBUFFER_BINDING);i.getMaskRenderTexture(),t.bindFramebuffer(t.FRAMEBUFFER,r)}bindTexture(t,e){this.coreModel.setTexture(t,e)}getHitAreaDefs(){var t;return(null==(t=this.settings.hitAreas)?void 0:t.map((t=>({id:t.id,name:t.name,index:this.coreModel.getDrawDataIndex(t.id)}))))||[]}getDrawableIDs(){const t=this.coreModel.getModelContext(),e=[];for(let s=0;s0&&t.textures.every((t=>"string"==typeof t))}copy(t){c("string",t,this,"name","name"),c("string",t,this,"pose","pose"),c("string",t,this,"physics","physics"),c("object",t,this,"layout","layout"),c("object",t,this,"motions","motions"),u("object",t,this,"hit_areas","hitAreas"),u("object",t,this,"expressions","expressions"),u("object",t,this,"init_params","initParams"),u("object",t,this,"init_opacities","initOpacities")}replaceFiles(t){super.replaceFiles(t);for(const[e,s]of Object.entries(this.motions))for(let i=0;i{const e=new PhysicsHair;return e.setup(t.setup.length,t.setup.regist,t.setup.mass),t.src.forEach((({id:t,ptype:s,scale:i,weight:r})=>{const o=nt[s];o&&e.addSrcParam(o,t,i,r)})),t.targets.forEach((({id:t,ptype:s,scale:i,weight:r})=>{const o=at[s];o&&e.addTargetParam(o,t,i,r)})),e})))}update(t){this.physicsHairs.forEach((e=>e.update(this.coreModel,t)))}}class dt{constructor(t){this.id=t,this.paramIndex=-1,this.partsIndex=-1,this.link=[]}initIndex(t){this.paramIndex=t.getParamIndex("VISIBLE:"+this.id),this.partsIndex=t.getPartsDataIndex(PartsDataID.getID(this.id)),t.setParamFloat(this.paramIndex,1)}}class ht{constructor(t,e){this.coreModel=t,this.opacityAnimDuration=500,this.partsGroups=[],e.parts_visible&&(this.partsGroups=e.parts_visible.map((({group:t})=>t.map((({id:t,link:e})=>{const s=new dt(t);return e&&(s.link=e.map((t=>new dt(t)))),s})))),this.init())}init(){this.partsGroups.forEach((t=>{t.forEach((t=>{if(t.initIndex(this.coreModel),t.paramIndex>=0){const e=0!==this.coreModel.getParamFloat(t.paramIndex);this.coreModel.setPartsOpacity(t.partsIndex,e?1:0),this.coreModel.setParamFloat(t.paramIndex,e?1:0),t.link.length>0&&t.link.forEach((t=>t.initIndex(this.coreModel)))}}))}))}normalizePartsOpacityGroup(t,e){const s=this.coreModel,i=.5;let r=1,o=t.findIndex((({paramIndex:t,partsIndex:e})=>e>=0&&0!==s.getParamFloat(t)));if(o>=0){const i=s.getPartsOpacity(t[o].partsIndex);r=d(i+e/this.opacityAnimDuration,0,1)}else o=0,r=1;t.forEach((({partsIndex:t},e)=>{if(t>=0)if(o==e)s.setPartsOpacity(t,r);else{let e,o=s.getPartsOpacity(t);e=r.15&&(e=1-.15/(1-r)),o>e&&(o=e),s.setPartsOpacity(t,o)}}))}copyOpacity(t){const e=this.coreModel;t.forEach((({partsIndex:t,link:s})=>{if(t>=0&&s){const i=e.getPartsOpacity(t);s.forEach((({partsIndex:t})=>{t>=0&&e.setPartsOpacity(t,i)}))}}))}update(t){this.partsGroups.forEach((e=>{this.normalizePartsOpacityGroup(e,t),this.copyOpacity(e)}))}}N.registerRuntime({version:2,test:t=>t instanceof ot||ot.isValidJSON(t),ready:()=>Promise.resolve(),isValidMoc(t){if(t.byteLength<3)return!1;const e=new Int8Array(t,0,3);return"moc"===String.fromCharCode(...e)},createModelSettings:t=>new ot(t),createCoreModel(t){const e=Live2DModelWebGL.loadModel(t),s=Live2D.getError();if(s)throw s;return e},createInternalModel:(t,e,s)=>new rt(t,e,s),createPose:(t,e)=>new ht(t,e),createPhysics:(t,e)=>new lt(t,e)}),t.Cubism2ExpressionManager=tt,t.Cubism2InternalModel=rt,t.Cubism2ModelSettings=ot,t.Cubism2MotionManager=et,t.ExpressionManager=f,t.FileLoader=z,t.FocusController=y,t.InteractionMixin=j,t.InternalModel=I,t.LOGICAL_HEIGHT=2,t.LOGICAL_WIDTH=2,t.Live2DExpression=K,t.Live2DEyeBlink=st,t.Live2DFactory=N,t.Live2DLoader=R,t.Live2DModel=B,t.Live2DPhysics=lt,t.Live2DPose=ht,t.Live2DTransform=W,t.ModelSettings=M,t.MotionManager=_,t.MotionPreloadStrategy=w,t.MotionPriority=x,t.MotionState=v,t.SoundManager=P,t.VERSION="0.4.0",t.XHRLoader=T,t.ZipLoader=Z,t.applyMixins=p,t.clamp=d,t.copyArray=u,t.copyProperty=c,t.folderName=g,t.logger=l,t.rand=h,t.remove=m,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism4.es.js b/live2d/node_modules/pixi-live2d-display/dist/cubism4.es.js new file mode 100644 index 0000000..f21619f --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism4.es.js @@ -0,0 +1,5557 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +import { EventEmitter, url } from "@pixi/utils"; +import { Matrix, Transform, Point, ObservablePoint } from "@pixi/math"; +import { Texture } from "@pixi/core"; +import { Container } from "@pixi/display"; +class CubismBreath { + constructor() { + this._breathParameters = []; + this._currentTime = 0; + } + static create() { + return new CubismBreath(); + } + setParameters(breathParameters) { + this._breathParameters = breathParameters; + } + getParameters() { + return this._breathParameters; + } + updateParameters(model, deltaTimeSeconds) { + this._currentTime += deltaTimeSeconds; + const t = this._currentTime * 2 * 3.14159; + for (let i = 0; i < this._breathParameters.length; ++i) { + const data = this._breathParameters[i]; + model.addParameterValueById(data.parameterId, data.offset + data.peak * Math.sin(t / data.cycle), data.weight); + } + } +} +class BreathParameterData { + constructor(parameterId, offset, peak, cycle, weight) { + this.parameterId = parameterId == void 0 ? void 0 : parameterId; + this.offset = offset == void 0 ? 0 : offset; + this.peak = peak == void 0 ? 0 : peak; + this.cycle = cycle == void 0 ? 0 : cycle; + this.weight = weight == void 0 ? 0 : weight; + } +} +const _CubismEyeBlink = class { + static create(modelSetting) { + return new _CubismEyeBlink(modelSetting); + } + setBlinkingInterval(blinkingInterval) { + this._blinkingIntervalSeconds = blinkingInterval; + } + setBlinkingSetting(closing, closed, opening) { + this._closingSeconds = closing; + this._closedSeconds = closed; + this._openingSeconds = opening; + } + setParameterIds(parameterIds) { + this._parameterIds = parameterIds; + } + getParameterIds() { + return this._parameterIds; + } + updateParameters(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + let parameterValue; + let t = 0; + switch (this._blinkingState) { + case EyeState.EyeState_Closing: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Closed; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1 - t; + break; + case EyeState.EyeState_Closed: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closedSeconds; + if (t >= 1) { + this._blinkingState = EyeState.EyeState_Opening; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 0; + break; + case EyeState.EyeState_Opening: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._openingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + } + parameterValue = t; + break; + case EyeState.EyeState_Interval: + if (this._nextBlinkingTime < this._userTimeSeconds) { + this._blinkingState = EyeState.EyeState_Closing; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1; + break; + case EyeState.EyeState_First: + default: + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + parameterValue = 1; + break; + } + if (!_CubismEyeBlink.CloseIfZero) { + parameterValue = -parameterValue; + } + for (let i = 0; i < this._parameterIds.length; ++i) { + model.setParameterValueById(this._parameterIds[i], parameterValue); + } + } + constructor(modelSetting) { + var _a, _b; + this._blinkingState = EyeState.EyeState_First; + this._nextBlinkingTime = 0; + this._stateStartTimeSeconds = 0; + this._blinkingIntervalSeconds = 4; + this._closingSeconds = 0.1; + this._closedSeconds = 0.05; + this._openingSeconds = 0.15; + this._userTimeSeconds = 0; + this._parameterIds = []; + if (modelSetting == null) { + return; + } + this._parameterIds = (_b = (_a = modelSetting.getEyeBlinkParameters()) == null ? void 0 : _a.slice()) != null ? _b : this._parameterIds; + } + determinNextBlinkingTiming() { + const r = Math.random(); + return this._userTimeSeconds + r * (2 * this._blinkingIntervalSeconds - 1); + } +}; +let CubismEyeBlink = _CubismEyeBlink; +CubismEyeBlink.CloseIfZero = true; +var EyeState = /* @__PURE__ */ ((EyeState2) => { + EyeState2[EyeState2["EyeState_First"] = 0] = "EyeState_First"; + EyeState2[EyeState2["EyeState_Interval"] = 1] = "EyeState_Interval"; + EyeState2[EyeState2["EyeState_Closing"] = 2] = "EyeState_Closing"; + EyeState2[EyeState2["EyeState_Closed"] = 3] = "EyeState_Closed"; + EyeState2[EyeState2["EyeState_Opening"] = 4] = "EyeState_Opening"; + return EyeState2; +})(EyeState || {}); +const Epsilon = 1e-3; +const DefaultFadeInSeconds = 0.5; +class CubismPose { + static create(pose3json) { + const ret = new CubismPose(); + if (typeof pose3json.FadeInTime === "number") { + ret._fadeTimeSeconds = pose3json.FadeInTime; + if (ret._fadeTimeSeconds <= 0) { + ret._fadeTimeSeconds = DefaultFadeInSeconds; + } + } + const poseListInfo = pose3json.Groups; + const poseCount = poseListInfo.length; + for (let poseIndex = 0; poseIndex < poseCount; ++poseIndex) { + const idListInfo = poseListInfo[poseIndex]; + const idCount = idListInfo.length; + let groupCount = 0; + for (let groupIndex = 0; groupIndex < idCount; ++groupIndex) { + const partInfo = idListInfo[groupIndex]; + const partData = new PartData(); + partData.partId = partInfo.Id; + const linkListInfo = partInfo.Link; + if (linkListInfo) { + const linkCount = linkListInfo.length; + for (let linkIndex = 0; linkIndex < linkCount; ++linkIndex) { + const linkPart = new PartData(); + linkPart.partId = linkListInfo[linkIndex]; + partData.link.push(linkPart); + } + } + ret._partGroups.push(partData); + ++groupCount; + } + ret._partGroupCounts.push(groupCount); + } + return ret; + } + updateParameters(model, deltaTimeSeconds) { + if (model != this._lastModel) { + this.reset(model); + } + this._lastModel = model; + if (deltaTimeSeconds < 0) { + deltaTimeSeconds = 0; + } + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; i++) { + const partGroupCount = this._partGroupCounts[i]; + this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount); + beginIndex += partGroupCount; + } + this.copyPartOpacities(model); + } + reset(model) { + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; ++i) { + const groupCount = this._partGroupCounts[i]; + for (let j = beginIndex; j < beginIndex + groupCount; ++j) { + this._partGroups[j].initialize(model); + const partsIndex = this._partGroups[j].partIndex; + const paramIndex = this._partGroups[j].parameterIndex; + if (partsIndex < 0) { + continue; + } + model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1 : 0); + model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1 : 0); + for (let k = 0; k < this._partGroups[j].link.length; ++k) { + this._partGroups[j].link[k].initialize(model); + } + } + beginIndex += groupCount; + } + } + copyPartOpacities(model) { + for (let groupIndex = 0; groupIndex < this._partGroups.length; ++groupIndex) { + const partData = this._partGroups[groupIndex]; + if (partData.link.length == 0) { + continue; + } + const partIndex = this._partGroups[groupIndex].partIndex; + const opacity = model.getPartOpacityByIndex(partIndex); + for (let linkIndex = 0; linkIndex < partData.link.length; ++linkIndex) { + const linkPart = partData.link[linkIndex]; + const linkPartIndex = linkPart.partIndex; + if (linkPartIndex < 0) { + continue; + } + model.setPartOpacityByIndex(linkPartIndex, opacity); + } + } + } + doFade(model, deltaTimeSeconds, beginIndex, partGroupCount) { + let visiblePartIndex = -1; + let newOpacity = 1; + const phi = 0.5; + const backOpacityThreshold = 0.15; + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partIndex = this._partGroups[i].partIndex; + const paramIndex = this._partGroups[i].parameterIndex; + if (model.getParameterValueByIndex(paramIndex) > Epsilon) { + if (visiblePartIndex >= 0) { + break; + } + visiblePartIndex = i; + newOpacity = model.getPartOpacityByIndex(partIndex); + newOpacity += deltaTimeSeconds / this._fadeTimeSeconds; + if (newOpacity > 1) { + newOpacity = 1; + } + } + } + if (visiblePartIndex < 0) { + visiblePartIndex = 0; + newOpacity = 1; + } + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partsIndex = this._partGroups[i].partIndex; + if (visiblePartIndex == i) { + model.setPartOpacityByIndex(partsIndex, newOpacity); + } else { + let opacity = model.getPartOpacityByIndex(partsIndex); + let a1; + if (newOpacity < phi) { + a1 = newOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - newOpacity) * phi / (1 - phi); + } + const backOpacity = (1 - a1) * (1 - newOpacity); + if (backOpacity > backOpacityThreshold) { + a1 = 1 - backOpacityThreshold / (1 - newOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartOpacityByIndex(partsIndex, opacity); + } + } + } + constructor() { + this._fadeTimeSeconds = DefaultFadeInSeconds; + this._lastModel = void 0; + this._partGroups = []; + this._partGroupCounts = []; + } +} +class PartData { + constructor(v) { + this.parameterIndex = 0; + this.partIndex = 0; + this.partId = ""; + this.link = []; + if (v != void 0) { + this.assignment(v); + } + } + assignment(v) { + this.partId = v.partId; + this.link = v.link.map((link) => link.clone()); + return this; + } + initialize(model) { + this.parameterIndex = model.getParameterIndex(this.partId); + this.partIndex = model.getPartIndex(this.partId); + model.setParameterValueByIndex(this.parameterIndex, 1); + } + clone() { + const clonePartData = new PartData(); + clonePartData.partId = this.partId; + clonePartData.parameterIndex = this.parameterIndex; + clonePartData.partIndex = this.partIndex; + clonePartData.link = this.link.map((link) => link.clone()); + return clonePartData; + } +} +class CubismVector2 { + constructor(x, y) { + this.x = x || 0; + this.y = y || 0; + } + add(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x + vector2.x; + ret.y = this.y + vector2.y; + return ret; + } + substract(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x - vector2.x; + ret.y = this.y - vector2.y; + return ret; + } + multiply(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x * vector2.x; + ret.y = this.y * vector2.y; + return ret; + } + multiplyByScaler(scalar) { + return this.multiply(new CubismVector2(scalar, scalar)); + } + division(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x / vector2.x; + ret.y = this.y / vector2.y; + return ret; + } + divisionByScalar(scalar) { + return this.division(new CubismVector2(scalar, scalar)); + } + getLength() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } + getDistanceWith(a) { + return Math.sqrt((this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)); + } + dot(a) { + return this.x * a.x + this.y * a.y; + } + normalize() { + const length = Math.pow(this.x * this.x + this.y * this.y, 0.5); + this.x = this.x / length; + this.y = this.y / length; + } + isEqual(rhs) { + return this.x == rhs.x && this.y == rhs.y; + } + isNotEqual(rhs) { + return !this.isEqual(rhs); + } +} +const _CubismMath = class { + static range(value, min, max) { + if (value < min) { + value = min; + } else if (value > max) { + value = max; + } + return value; + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static abs(x) { + return Math.abs(x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static cbrt(x) { + if (x === 0) { + return x; + } + let cx = x; + const isNegativeNumber = cx < 0; + if (isNegativeNumber) { + cx = -cx; + } + let ret; + if (cx === Infinity) { + ret = Infinity; + } else { + ret = Math.exp(Math.log(cx) / 3); + ret = (cx / (ret * ret) + 2 * ret) / 3; + } + return isNegativeNumber ? -ret : ret; + } + static getEasingSine(value) { + if (value < 0) { + return 0; + } else if (value > 1) { + return 1; + } + return 0.5 - 0.5 * this.cos(value * Math.PI); + } + static max(left, right) { + return left > right ? left : right; + } + static min(left, right) { + return left > right ? right : left; + } + static degreesToRadian(degrees) { + return degrees / 180 * Math.PI; + } + static radianToDegrees(radian) { + return radian * 180 / Math.PI; + } + static directionToRadian(from, to) { + const q1 = Math.atan2(to.y, to.x); + const q2 = Math.atan2(from.y, from.x); + let ret = q1 - q2; + while (ret < -Math.PI) { + ret += Math.PI * 2; + } + while (ret > Math.PI) { + ret -= Math.PI * 2; + } + return ret; + } + static directionToDegrees(from, to) { + const radian = this.directionToRadian(from, to); + let degree = this.radianToDegrees(radian); + if (to.x - from.x > 0) { + degree = -degree; + } + return degree; + } + static radianToDirection(totalAngle) { + const ret = new CubismVector2(); + ret.x = this.sin(totalAngle); + ret.y = this.cos(totalAngle); + return ret; + } + static quadraticEquation(a, b, c) { + if (this.abs(a) < _CubismMath.Epsilon) { + if (this.abs(b) < _CubismMath.Epsilon) { + return -c; + } + return -c / b; + } + return -(b + this.sqrt(b * b - 4 * a * c)) / (2 * a); + } + static cardanoAlgorithmForBezier(a, b, c, d) { + if (this.sqrt(a) < _CubismMath.Epsilon) { + return this.range(this.quadraticEquation(b, c, d), 0, 1); + } + const ba = b / a; + const ca = c / a; + const da = d / a; + const p = (3 * ca - ba * ba) / 3; + const p3 = p / 3; + const q = (2 * ba * ba * ba - 9 * ba * ca + 27 * da) / 27; + const q2 = q / 2; + const discriminant = q2 * q2 + p3 * p3 * p3; + const center = 0.5; + const threshold = center + 0.01; + if (discriminant < 0) { + const mp3 = -p / 3; + const mp33 = mp3 * mp3 * mp3; + const r = this.sqrt(mp33); + const t = -q / (2 * r); + const cosphi = this.range(t, -1, 1); + const phi = Math.acos(cosphi); + const crtr = this.cbrt(r); + const t1 = 2 * crtr; + const root12 = t1 * this.cos(phi / 3) - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = t1 * this.cos((phi + 2 * Math.PI) / 3) - ba / 3; + if (this.abs(root2 - center) < threshold) { + return this.range(root2, 0, 1); + } + const root3 = t1 * this.cos((phi + 4 * Math.PI) / 3) - ba / 3; + return this.range(root3, 0, 1); + } + if (discriminant == 0) { + let u12; + if (q2 < 0) { + u12 = this.cbrt(-q2); + } else { + u12 = -this.cbrt(q2); + } + const root12 = 2 * u12 - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = -u12 - ba / 3; + return this.range(root2, 0, 1); + } + const sd = this.sqrt(discriminant); + const u1 = this.cbrt(sd - q2); + const v1 = this.cbrt(sd + q2); + const root1 = u1 - v1 - ba / 3; + return this.range(root1, 0, 1); + } + constructor() { + } +}; +let CubismMath = _CubismMath; +CubismMath.Epsilon = 1e-5; +class CubismMatrix44 { + constructor() { + this._tr = new Float32Array(16); + this.loadIdentity(); + } + static multiply(a, b, dst) { + const c = new Float32Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]); + const n = 4; + for (let i = 0; i < n; ++i) { + for (let j = 0; j < n; ++j) { + for (let k = 0; k < n; ++k) { + c[j + i * 4] += a[k + i * 4] * b[j + k * 4]; + } + } + } + for (let i = 0; i < 16; ++i) { + dst[i] = c[i]; + } + } + loadIdentity() { + const c = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + this.setMatrix(c); + } + setMatrix(tr) { + for (let i = 0; i < 16; ++i) { + this._tr[i] = tr[i]; + } + } + getArray() { + return this._tr; + } + getScaleX() { + return this._tr[0]; + } + getScaleY() { + return this._tr[5]; + } + getTranslateX() { + return this._tr[12]; + } + getTranslateY() { + return this._tr[13]; + } + transformX(src) { + return this._tr[0] * src + this._tr[12]; + } + transformY(src) { + return this._tr[5] * src + this._tr[13]; + } + invertTransformX(src) { + return (src - this._tr[12]) / this._tr[0]; + } + invertTransformY(src) { + return (src - this._tr[13]) / this._tr[5]; + } + translateRelative(x, y) { + const tr1 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + x, + y, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + translate(x, y) { + this._tr[12] = x; + this._tr[13] = y; + } + translateX(x) { + this._tr[12] = x; + } + translateY(y) { + this._tr[13] = y; + } + scaleRelative(x, y) { + const tr1 = new Float32Array([ + x, + 0, + 0, + 0, + 0, + y, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + scale(x, y) { + this._tr[0] = x; + this._tr[5] = y; + } + multiplyByMatrix(m) { + CubismMatrix44.multiply(m.getArray(), this._tr, this._tr); + } + clone() { + const cloneMatrix = new CubismMatrix44(); + for (let i = 0; i < this._tr.length; i++) { + cloneMatrix._tr[i] = this._tr[i]; + } + return cloneMatrix; + } +} +class CubismRenderer { + initialize(model) { + this._model = model; + } + drawModel() { + if (this.getModel() == null) + return; + this.doDrawModel(); + } + setMvpMatrix(matrix44) { + this._mvpMatrix4x4.setMatrix(matrix44.getArray()); + } + getMvpMatrix() { + return this._mvpMatrix4x4; + } + setModelColor(red, green, blue, alpha) { + if (red < 0) { + red = 0; + } else if (red > 1) { + red = 1; + } + if (green < 0) { + green = 0; + } else if (green > 1) { + green = 1; + } + if (blue < 0) { + blue = 0; + } else if (blue > 1) { + blue = 1; + } + if (alpha < 0) { + alpha = 0; + } else if (alpha > 1) { + alpha = 1; + } + this._modelColor.R = red; + this._modelColor.G = green; + this._modelColor.B = blue; + this._modelColor.A = alpha; + } + getModelColor() { + return Object.assign({}, this._modelColor); + } + setIsPremultipliedAlpha(enable) { + this._isPremultipliedAlpha = enable; + } + isPremultipliedAlpha() { + return this._isPremultipliedAlpha; + } + setIsCulling(culling) { + this._isCulling = culling; + } + isCulling() { + return this._isCulling; + } + setAnisotropy(n) { + this._anisortopy = n; + } + getAnisotropy() { + return this._anisortopy; + } + getModel() { + return this._model; + } + constructor() { + this._isCulling = false; + this._isPremultipliedAlpha = false; + this._anisortopy = 0; + this._modelColor = new CubismTextureColor(); + this._mvpMatrix4x4 = new CubismMatrix44(); + this._mvpMatrix4x4.loadIdentity(); + } +} +var CubismBlendMode = /* @__PURE__ */ ((CubismBlendMode2) => { + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Normal"] = 0] = "CubismBlendMode_Normal"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Additive"] = 1] = "CubismBlendMode_Additive"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Multiplicative"] = 2] = "CubismBlendMode_Multiplicative"; + return CubismBlendMode2; +})(CubismBlendMode || {}); +class CubismTextureColor { + constructor() { + this.R = 1; + this.G = 1; + this.B = 1; + this.A = 1; + } +} +let s_isStarted = false; +let s_isInitialized = false; +let s_option = void 0; +const Constant = { + vertexOffset: 0, + vertexStep: 2 +}; +class CubismFramework { + static startUp(option) { + if (s_isStarted) { + CubismLogInfo("CubismFramework.startUp() is already done."); + return s_isStarted; + } + if (Live2DCubismCore._isStarted) { + s_isStarted = true; + return true; + } + Live2DCubismCore._isStarted = true; + s_option = option; + if (s_option) { + Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction); + } + s_isStarted = true; + if (s_isStarted) { + const version = Live2DCubismCore.Version.csmGetVersion(); + const major = (version & 4278190080) >> 24; + const minor = (version & 16711680) >> 16; + const patch = version & 65535; + const versionNumber = version; + CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`, ("00" + major).slice(-2), ("00" + minor).slice(-2), ("0000" + patch).slice(-4), versionNumber); + } + CubismLogInfo("CubismFramework.startUp() is complete."); + return s_isStarted; + } + static cleanUp() { + s_isStarted = false; + s_isInitialized = false; + s_option = void 0; + } + static initialize() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (s_isInitialized) { + CubismLogWarning("CubismFramework.initialize() skipped, already initialized."); + return; + } + s_isInitialized = true; + CubismLogInfo("CubismFramework.initialize() is complete."); + } + static dispose() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (!s_isInitialized) { + CubismLogWarning("CubismFramework.dispose() skipped, not initialized."); + return; + } + CubismRenderer.staticRelease(); + s_isInitialized = false; + CubismLogInfo("CubismFramework.dispose() is complete."); + } + static isStarted() { + return s_isStarted; + } + static isInitialized() { + return s_isInitialized; + } + static coreLogFunction(message) { + if (!Live2DCubismCore.Logging.csmGetLogFunction()) { + return; + } + Live2DCubismCore.Logging.csmGetLogFunction()(message); + } + static getLoggingLevel() { + if (s_option != null) { + return s_option.loggingLevel; + } + return LogLevel.LogLevel_Off; + } + constructor() { + } +} +var LogLevel = /* @__PURE__ */ ((LogLevel2) => { + LogLevel2[LogLevel2["LogLevel_Verbose"] = 0] = "LogLevel_Verbose"; + LogLevel2[LogLevel2["LogLevel_Debug"] = 1] = "LogLevel_Debug"; + LogLevel2[LogLevel2["LogLevel_Info"] = 2] = "LogLevel_Info"; + LogLevel2[LogLevel2["LogLevel_Warning"] = 3] = "LogLevel_Warning"; + LogLevel2[LogLevel2["LogLevel_Error"] = 4] = "LogLevel_Error"; + LogLevel2[LogLevel2["LogLevel_Off"] = 5] = "LogLevel_Off"; + return LogLevel2; +})(LogLevel || {}); +const CSM_ASSERT = () => { +}; +function CubismLogVerbose(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Verbose, "[CSM][V]" + fmt + "\n", args); +} +function CubismLogDebug(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Debug, "[CSM][D]" + fmt + "\n", args); +} +function CubismLogInfo(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Info, "[CSM][I]" + fmt + "\n", args); +} +function CubismLogWarning(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Warning, "[CSM][W]" + fmt + "\n", args); +} +function CubismLogError(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Error, "[CSM][E]" + fmt + "\n", args); +} +class CubismDebug { + static print(logLevel, format, args) { + if (logLevel < CubismFramework.getLoggingLevel()) { + return; + } + const logPrint = CubismFramework.coreLogFunction; + if (!logPrint) + return; + const buffer = format.replace(/{(\d+)}/g, (m, k) => { + return args[k]; + }); + logPrint(buffer); + } + static dumpBytes(logLevel, data, length) { + for (let i = 0; i < length; i++) { + if (i % 16 == 0 && i > 0) + this.print(logLevel, "\n"); + else if (i % 8 == 0 && i > 0) + this.print(logLevel, " "); + this.print(logLevel, "{0} ", [data[i] & 255]); + } + this.print(logLevel, "\n"); + } + constructor() { + } +} +class CubismModel { + update() { + this._model.update(); + this._model.drawables.resetDynamicFlags(); + } + getCanvasWidth() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit; + } + getCanvasHeight() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit; + } + saveParameters() { + const parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + for (let i = 0; i < parameterCount; ++i) { + if (i < savedParameterCount) { + this._savedParameters[i] = this._parameterValues[i]; + } else { + this._savedParameters.push(this._parameterValues[i]); + } + } + } + getModel() { + return this._model; + } + getPartIndex(partId) { + let partIndex; + const partCount = this._model.parts.count; + for (partIndex = 0; partIndex < partCount; ++partIndex) { + if (partId == this._partIds[partIndex]) { + return partIndex; + } + } + if (partId in this._notExistPartId) { + return this._notExistPartId[partId]; + } + partIndex = partCount + this._notExistPartId.length; + this._notExistPartId[partId] = partIndex; + this._notExistPartOpacities[partIndex] = 0; + return partIndex; + } + getPartCount() { + return this._model.parts.count; + } + setPartOpacityByIndex(partIndex, opacity) { + if (partIndex in this._notExistPartOpacities) { + this._notExistPartOpacities[partIndex] = opacity; + return; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + this._partOpacities[partIndex] = opacity; + } + setPartOpacityById(partId, opacity) { + const index = this.getPartIndex(partId); + if (index < 0) { + return; + } + this.setPartOpacityByIndex(index, opacity); + } + getPartOpacityByIndex(partIndex) { + if (partIndex in this._notExistPartOpacities) { + return this._notExistPartOpacities[partIndex]; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + return this._partOpacities[partIndex]; + } + getPartOpacityById(partId) { + const index = this.getPartIndex(partId); + if (index < 0) { + return 0; + } + return this.getPartOpacityByIndex(index); + } + getParameterIndex(parameterId) { + let parameterIndex; + const idCount = this._model.parameters.count; + for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) { + if (parameterId != this._parameterIds[parameterIndex]) { + continue; + } + return parameterIndex; + } + if (parameterId in this._notExistParameterId) { + return this._notExistParameterId[parameterId]; + } + parameterIndex = this._model.parameters.count + Object.keys(this._notExistParameterId).length; + this._notExistParameterId[parameterId] = parameterIndex; + this._notExistParameterValues[parameterIndex] = 0; + return parameterIndex; + } + getParameterCount() { + return this._model.parameters.count; + } + getParameterMaximumValue(parameterIndex) { + return this._model.parameters.maximumValues[parameterIndex]; + } + getParameterMinimumValue(parameterIndex) { + return this._model.parameters.minimumValues[parameterIndex]; + } + getParameterDefaultValue(parameterIndex) { + return this._model.parameters.defaultValues[parameterIndex]; + } + getParameterValueByIndex(parameterIndex) { + if (parameterIndex in this._notExistParameterValues) { + return this._notExistParameterValues[parameterIndex]; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + return this._parameterValues[parameterIndex]; + } + getParameterValueById(parameterId) { + const parameterIndex = this.getParameterIndex(parameterId); + return this.getParameterValueByIndex(parameterIndex); + } + setParameterValueByIndex(parameterIndex, value, weight = 1) { + if (parameterIndex in this._notExistParameterValues) { + this._notExistParameterValues[parameterIndex] = weight == 1 ? value : this._notExistParameterValues[parameterIndex] * (1 - weight) + value * weight; + return; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + if (this._model.parameters.maximumValues[parameterIndex] < value) { + value = this._model.parameters.maximumValues[parameterIndex]; + } + if (this._model.parameters.minimumValues[parameterIndex] > value) { + value = this._model.parameters.minimumValues[parameterIndex]; + } + this._parameterValues[parameterIndex] = weight == 1 ? value : this._parameterValues[parameterIndex] = this._parameterValues[parameterIndex] * (1 - weight) + value * weight; + } + setParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.setParameterValueByIndex(index, value, weight); + } + addParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) + value * weight); + } + addParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.addParameterValueByIndex(index, value, weight); + } + multiplyParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.multiplyParameterValueByIndex(index, value, weight); + } + multiplyParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) * (1 + (value - 1) * weight)); + } + getDrawableIds() { + return this._drawableIds.slice(); + } + getDrawableIndex(drawableId) { + const drawableCount = this._model.drawables.count; + for (let drawableIndex = 0; drawableIndex < drawableCount; ++drawableIndex) { + if (this._drawableIds[drawableIndex] == drawableId) { + return drawableIndex; + } + } + return -1; + } + getDrawableCount() { + return this._model.drawables.count; + } + getDrawableId(drawableIndex) { + return this._model.drawables.ids[drawableIndex]; + } + getDrawableRenderOrders() { + return this._model.drawables.renderOrders; + } + getDrawableTextureIndices(drawableIndex) { + return this._model.drawables.textureIndices[drawableIndex]; + } + getDrawableDynamicFlagVertexPositionsDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableVertexIndexCount(drawableIndex) { + return this._model.drawables.indexCounts[drawableIndex]; + } + getDrawableVertexCount(drawableIndex) { + return this._model.drawables.vertexCounts[drawableIndex]; + } + getDrawableVertices(drawableIndex) { + return this.getDrawableVertexPositions(drawableIndex); + } + getDrawableVertexIndices(drawableIndex) { + return this._model.drawables.indices[drawableIndex]; + } + getDrawableVertexPositions(drawableIndex) { + return this._model.drawables.vertexPositions[drawableIndex]; + } + getDrawableVertexUvs(drawableIndex) { + return this._model.drawables.vertexUvs[drawableIndex]; + } + getDrawableOpacity(drawableIndex) { + return this._model.drawables.opacities[drawableIndex]; + } + getDrawableCulling(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); + } + getDrawableBlendMode(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Additive : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Multiplicative : CubismBlendMode.CubismBlendMode_Normal; + } + getDrawableInvertedMaskBit(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]); + } + getDrawableMasks() { + return this._model.drawables.masks; + } + getDrawableMaskCounts() { + return this._model.drawables.maskCounts; + } + isUsingMasking() { + for (let d = 0; d < this._model.drawables.count; ++d) { + if (this._model.drawables.maskCounts[d] <= 0) { + continue; + } + return true; + } + return false; + } + getDrawableDynamicFlagIsVisible(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagVisibilityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagOpacityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasOpacityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagRenderOrderDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(dynamicFlags[drawableIndex]); + } + loadParameters() { + let parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + if (parameterCount > savedParameterCount) { + parameterCount = savedParameterCount; + } + for (let i = 0; i < parameterCount; ++i) { + this._parameterValues[i] = this._savedParameters[i]; + } + } + initialize() { + this._parameterValues = this._model.parameters.values; + this._partOpacities = this._model.parts.opacities; + this._parameterMaximumValues = this._model.parameters.maximumValues; + this._parameterMinimumValues = this._model.parameters.minimumValues; + { + const parameterIds = this._model.parameters.ids; + const parameterCount = this._model.parameters.count; + for (let i = 0; i < parameterCount; ++i) { + this._parameterIds.push(parameterIds[i]); + } + } + { + const partIds = this._model.parts.ids; + const partCount = this._model.parts.count; + for (let i = 0; i < partCount; ++i) { + this._partIds.push(partIds[i]); + } + } + { + const drawableIds = this._model.drawables.ids; + const drawableCount = this._model.drawables.count; + for (let i = 0; i < drawableCount; ++i) { + this._drawableIds.push(drawableIds[i]); + } + } + } + constructor(model) { + this._model = model; + this._savedParameters = []; + this._parameterIds = []; + this._drawableIds = []; + this._partIds = []; + this._notExistPartId = {}; + this._notExistParameterId = {}; + this._notExistParameterValues = {}; + this._notExistPartOpacities = {}; + this.initialize(); + } + release() { + this._model.release(); + this._model = void 0; + } +} +class CubismMoc { + static create(mocBytes) { + const moc = Live2DCubismCore.Moc.fromArrayBuffer(mocBytes); + if (moc) { + return new CubismMoc(moc); + } + throw new Error("Unknown error"); + } + createModel() { + let cubismModel; + const model = Live2DCubismCore.Model.fromMoc(this._moc); + if (model) { + cubismModel = new CubismModel(model); + ++this._modelCount; + return cubismModel; + } + throw new Error("Unknown error"); + } + deleteModel(model) { + if (model != null) { + --this._modelCount; + } + } + constructor(moc) { + this._moc = moc; + this._modelCount = 0; + } + release() { + this._moc._release(); + this._moc = void 0; + } +} +class CubismModelUserDataJson { + constructor(json, size) { + this._json = json; + } + release() { + this._json = void 0; + } + getUserDataCount() { + return this._json.Meta.UserDataCount; + } + getTotalUserDataSize() { + return this._json.Meta.TotalUserDataSize; + } + getUserDataTargetType(i) { + return this._json.UserData[i].Target; + } + getUserDataId(i) { + return this._json.UserData[i].Id; + } + getUserDataValue(i) { + return this._json.UserData[i].Value; + } +} +const ArtMesh = "ArtMesh"; +class CubismModelUserData { + static create(json, size) { + const ret = new CubismModelUserData(); + ret.parseUserData(json, size); + return ret; + } + getArtMeshUserDatas() { + return this._artMeshUserDataNode; + } + parseUserData(data, size) { + let json = new CubismModelUserDataJson(data, size); + const typeOfArtMesh = ArtMesh; + const nodeCount = json.getUserDataCount(); + for (let i = 0; i < nodeCount; i++) { + const addNode = { + targetId: json.getUserDataId(i), + targetType: json.getUserDataTargetType(i), + value: json.getUserDataValue(i) + }; + this._userDataNodes.push(addNode); + if (addNode.targetType == typeOfArtMesh) { + this._artMeshUserDataNode.push(addNode); + } + } + json.release(); + } + constructor() { + this._userDataNodes = []; + this._artMeshUserDataNode = []; + } + release() { + this._userDataNodes = null; + } +} +class ACubismMotion { + constructor() { + this._fadeInSeconds = -1; + this._fadeOutSeconds = -1; + this._weight = 1; + this._offsetSeconds = 0; + this._firedEventValues = []; + } + release() { + this._weight = 0; + } + updateParameters(model, motionQueueEntry, userTimeSeconds) { + if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) { + return; + } + if (!motionQueueEntry.isStarted()) { + motionQueueEntry.setIsStarted(true); + motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + const duration = this.getDuration(); + if (motionQueueEntry.getEndTime() < 0) { + motionQueueEntry.setEndTime(duration <= 0 ? -1 : motionQueueEntry.getStartTime() + duration); + } + } + let fadeWeight = this._weight; + const fadeIn = this._fadeInSeconds == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const fadeOut = this._fadeOutSeconds == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + fadeWeight = fadeWeight * fadeIn * fadeOut; + motionQueueEntry.setState(userTimeSeconds, fadeWeight); + this.doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry); + if (motionQueueEntry.getEndTime() > 0 && motionQueueEntry.getEndTime() < userTimeSeconds) { + motionQueueEntry.setIsFinished(true); + } + } + setFadeInTime(fadeInSeconds) { + this._fadeInSeconds = fadeInSeconds; + } + setFadeOutTime(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + } + getFadeOutTime() { + return this._fadeOutSeconds; + } + getFadeInTime() { + return this._fadeInSeconds; + } + setWeight(weight) { + this._weight = weight; + } + getWeight() { + return this._weight; + } + getDuration() { + return -1; + } + getLoopDuration() { + return -1; + } + setOffsetTime(offsetSeconds) { + this._offsetSeconds = offsetSeconds; + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + return this._firedEventValues; + } + setFinishedMotionHandler(onFinishedMotionHandler) { + this._onFinishedMotion = onFinishedMotionHandler; + } + getFinishedMotionHandler() { + return this._onFinishedMotion; + } +} +const DefaultFadeTime = 1; +class CubismExpressionMotion extends ACubismMotion { + constructor() { + super(); + this._parameters = []; + } + static create(json) { + const expression = new CubismExpressionMotion(); + const fadeInTime = json.FadeInTime; + const fadeOutTime = json.FadeOutTime; + expression.setFadeInTime(fadeInTime !== void 0 ? fadeInTime : DefaultFadeTime); + expression.setFadeOutTime(fadeOutTime !== void 0 ? fadeOutTime : DefaultFadeTime); + const parameters = json.Parameters || []; + for (let i = 0; i < parameters.length; ++i) { + const param = parameters[i]; + const parameterId = param.Id; + const value = param.Value; + let blendType; + switch (param.Blend) { + case "Multiply": + blendType = ExpressionBlendType.ExpressionBlendType_Multiply; + break; + case "Overwrite": + blendType = ExpressionBlendType.ExpressionBlendType_Overwrite; + break; + case "Add": + default: + blendType = ExpressionBlendType.ExpressionBlendType_Add; + break; + } + const item = { + parameterId, + blendType, + value + }; + expression._parameters.push(item); + } + return expression; + } + doUpdateParameters(model, userTimeSeconds, weight, motionQueueEntry) { + for (let i = 0; i < this._parameters.length; ++i) { + const parameter = this._parameters[i]; + switch (parameter.blendType) { + case ExpressionBlendType.ExpressionBlendType_Add: { + model.addParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Multiply: { + model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Overwrite: { + model.setParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + } + } + } +} +var ExpressionBlendType = /* @__PURE__ */ ((ExpressionBlendType2) => { + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Add"] = 0] = "ExpressionBlendType_Add"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Multiply"] = 1] = "ExpressionBlendType_Multiply"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Overwrite"] = 2] = "ExpressionBlendType_Overwrite"; + return ExpressionBlendType2; +})(ExpressionBlendType || {}); +var CubismConfig; +((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; +})(CubismConfig || (CubismConfig = {})); +var CubismMotionCurveTarget = /* @__PURE__ */ ((CubismMotionCurveTarget2) => { + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Model"] = 0] = "CubismMotionCurveTarget_Model"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Parameter"] = 1] = "CubismMotionCurveTarget_Parameter"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_PartOpacity"] = 2] = "CubismMotionCurveTarget_PartOpacity"; + return CubismMotionCurveTarget2; +})(CubismMotionCurveTarget || {}); +var CubismMotionSegmentType = /* @__PURE__ */ ((CubismMotionSegmentType2) => { + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Linear"] = 0] = "CubismMotionSegmentType_Linear"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Bezier"] = 1] = "CubismMotionSegmentType_Bezier"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Stepped"] = 2] = "CubismMotionSegmentType_Stepped"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_InverseStepped"] = 3] = "CubismMotionSegmentType_InverseStepped"; + return CubismMotionSegmentType2; +})(CubismMotionSegmentType || {}); +class CubismMotionPoint { + constructor(time = 0, value = 0) { + this.time = time; + this.value = value; + } +} +class CubismMotionSegment { + constructor() { + this.basePointIndex = 0; + this.segmentType = 0; + } +} +class CubismMotionCurve { + constructor() { + this.id = ""; + this.type = 0; + this.segmentCount = 0; + this.baseSegmentIndex = 0; + this.fadeInTime = 0; + this.fadeOutTime = 0; + } +} +class CubismMotionEvent { + constructor() { + this.fireTime = 0; + this.value = ""; + } +} +class CubismMotionData { + constructor() { + this.duration = 0; + this.loop = false; + this.curveCount = 0; + this.eventCount = 0; + this.fps = 0; + this.curves = []; + this.segments = []; + this.points = []; + this.events = []; + } +} +class CubismMotionJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getMotionDuration() { + return this._json.Meta.Duration; + } + isMotionLoop() { + return this._json.Meta.Loop || false; + } + getEvaluationOptionFlag(flagType) { + if (EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted == flagType) { + return !!this._json.Meta.AreBeziersRestricted; + } + return false; + } + getMotionCurveCount() { + return this._json.Meta.CurveCount; + } + getMotionFps() { + return this._json.Meta.Fps; + } + getMotionTotalSegmentCount() { + return this._json.Meta.TotalSegmentCount; + } + getMotionTotalPointCount() { + return this._json.Meta.TotalPointCount; + } + getMotionFadeInTime() { + return this._json.Meta.FadeInTime; + } + getMotionFadeOutTime() { + return this._json.Meta.FadeOutTime; + } + getMotionCurveTarget(curveIndex) { + return this._json.Curves[curveIndex].Target; + } + getMotionCurveId(curveIndex) { + return this._json.Curves[curveIndex].Id; + } + getMotionCurveFadeInTime(curveIndex) { + return this._json.Curves[curveIndex].FadeInTime; + } + getMotionCurveFadeOutTime(curveIndex) { + return this._json.Curves[curveIndex].FadeOutTime; + } + getMotionCurveSegmentCount(curveIndex) { + return this._json.Curves[curveIndex].Segments.length; + } + getMotionCurveSegment(curveIndex, segmentIndex) { + return this._json.Curves[curveIndex].Segments[segmentIndex]; + } + getEventCount() { + return this._json.Meta.UserDataCount || 0; + } + getTotalEventValueSize() { + return this._json.Meta.TotalUserDataSize; + } + getEventTime(userDataIndex) { + return this._json.UserData[userDataIndex].Time; + } + getEventValue(userDataIndex) { + return this._json.UserData[userDataIndex].Value; + } +} +var EvaluationOptionFlag = /* @__PURE__ */ ((EvaluationOptionFlag2) => { + EvaluationOptionFlag2[EvaluationOptionFlag2["EvaluationOptionFlag_AreBeziersRistricted"] = 0] = "EvaluationOptionFlag_AreBeziersRistricted"; + return EvaluationOptionFlag2; +})(EvaluationOptionFlag || {}); +const EffectNameEyeBlink = "EyeBlink"; +const EffectNameLipSync = "LipSync"; +const TargetNameModel = "Model"; +const TargetNameParameter = "Parameter"; +const TargetNamePartOpacity = "PartOpacity"; +const UseOldBeziersCurveMotion = false; +function lerpPoints(a, b, t) { + const result = new CubismMotionPoint(); + result.time = a.time + (b.time - a.time) * t; + result.value = a.value + (b.value - a.value) * t; + return result; +} +function linearEvaluate(points, time) { + let t = (time - points[0].time) / (points[1].time - points[0].time); + if (t < 0) { + t = 0; + } + return points[0].value + (points[1].value - points[0].value) * t; +} +function bezierEvaluate(points, time) { + let t = (time - points[0].time) / (points[3].time - points[0].time); + if (t < 0) { + t = 0; + } + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; +} +function bezierEvaluateCardanoInterpretation(points, time) { + const x = time; + const x1 = points[0].time; + const x2 = points[3].time; + const cx1 = points[1].time; + const cx2 = points[2].time; + const a = x2 - 3 * cx2 + 3 * cx1 - x1; + const b = 3 * cx2 - 6 * cx1 + 3 * x1; + const c = 3 * cx1 - 3 * x1; + const d = x1 - x; + const t = CubismMath.cardanoAlgorithmForBezier(a, b, c, d); + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; +} +function steppedEvaluate(points, time) { + return points[0].value; +} +function inverseSteppedEvaluate(points, time) { + return points[1].value; +} +function evaluateCurve(motionData, index, time) { + const curve = motionData.curves[index]; + let target = -1; + const totalSegmentCount = curve.baseSegmentIndex + curve.segmentCount; + let pointPosition = 0; + for (let i = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { + pointPosition = motionData.segments[i].basePointIndex + (motionData.segments[i].segmentType == CubismMotionSegmentType.CubismMotionSegmentType_Bezier ? 3 : 1); + if (motionData.points[pointPosition].time > time) { + target = i; + break; + } + } + if (target == -1) { + return motionData.points[pointPosition].value; + } + const segment = motionData.segments[target]; + return segment.evaluate(motionData.points.slice(segment.basePointIndex), time); +} +class CubismMotion extends ACubismMotion { + constructor() { + super(); + this._eyeBlinkParameterIds = []; + this._lipSyncParameterIds = []; + this._sourceFrameRate = 30; + this._loopDurationSeconds = -1; + this._isLoop = false; + this._isLoopFadeIn = true; + this._lastWeight = 0; + } + static create(json, onFinishedMotionHandler) { + const ret = new CubismMotion(); + ret.parse(json); + ret._sourceFrameRate = ret._motionData.fps; + ret._loopDurationSeconds = ret._motionData.duration; + ret._onFinishedMotion = onFinishedMotionHandler; + return ret; + } + doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry) { + if (this._modelCurveIdEyeBlink == null) { + this._modelCurveIdEyeBlink = EffectNameEyeBlink; + } + if (this._modelCurveIdLipSync == null) { + this._modelCurveIdLipSync = EffectNameLipSync; + } + let timeOffsetSeconds = userTimeSeconds - motionQueueEntry.getStartTime(); + if (timeOffsetSeconds < 0) { + timeOffsetSeconds = 0; + } + let lipSyncValue = Number.MAX_VALUE; + let eyeBlinkValue = Number.MAX_VALUE; + const MaxTargetSize = 64; + let lipSyncFlags = 0; + let eyeBlinkFlags = 0; + if (this._eyeBlinkParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many eye blink targets : {0}", this._eyeBlinkParameterIds.length); + } + if (this._lipSyncParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many lip sync targets : {0}", this._lipSyncParameterIds.length); + } + const tmpFadeIn = this._fadeInSeconds <= 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const tmpFadeOut = this._fadeOutSeconds <= 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + let value; + let c, parameterIndex; + let time = timeOffsetSeconds; + if (this._isLoop) { + while (time > this._motionData.duration) { + time -= this._motionData.duration; + } + } + const curves = this._motionData.curves; + for (c = 0; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (curves[c].id == this._modelCurveIdEyeBlink) { + eyeBlinkValue = value; + } else if (curves[c].id == this._modelCurveIdLipSync) { + lipSyncValue = value; + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; ++c) { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + const sourceValue = model.getParameterValueByIndex(parameterIndex); + value = evaluateCurve(this._motionData, c, time); + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + if (this._eyeBlinkParameterIds[i] == curves[c].id) { + value *= eyeBlinkValue; + eyeBlinkFlags |= 1 << i; + break; + } + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + if (this._lipSyncParameterIds[i] == curves[c].id) { + value += lipSyncValue; + lipSyncFlags |= 1 << i; + break; + } + } + } + let v; + if (curves[c].fadeInTime < 0 && curves[c].fadeOutTime < 0) { + v = sourceValue + (value - sourceValue) * fadeWeight; + } else { + let fin; + let fout; + if (curves[c].fadeInTime < 0) { + fin = tmpFadeIn; + } else { + fin = curves[c].fadeInTime == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / curves[c].fadeInTime); + } + if (curves[c].fadeOutTime < 0) { + fout = tmpFadeOut; + } else { + fout = curves[c].fadeOutTime == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / curves[c].fadeOutTime); + } + const paramWeight = this._weight * fin * fout; + v = sourceValue + (value - sourceValue) * paramWeight; + } + model.setParameterValueByIndex(parameterIndex, v, 1); + } + { + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._eyeBlinkParameterIds[i]); + if (eyeBlinkFlags >> i & 1) { + continue; + } + const v = sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._eyeBlinkParameterIds[i], v); + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._lipSyncParameterIds[i]); + if (lipSyncFlags >> i & 1) { + continue; + } + const v = sourceValue + (lipSyncValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._lipSyncParameterIds[i], v); + } + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (CubismConfig.setOpacityFromMotion) { + model.setPartOpacityById(curves[c].id, value); + } else { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + model.setParameterValueByIndex(parameterIndex, value); + } + } + if (timeOffsetSeconds >= this._motionData.duration) { + if (this._isLoop) { + motionQueueEntry.setStartTime(userTimeSeconds); + if (this._isLoopFadeIn) { + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + } + } else { + if (this._onFinishedMotion) { + this._onFinishedMotion(this); + } + motionQueueEntry.setIsFinished(true); + } + } + this._lastWeight = fadeWeight; + } + setIsLoop(loop) { + this._isLoop = loop; + } + isLoop() { + return this._isLoop; + } + setIsLoopFadeIn(loopFadeIn) { + this._isLoopFadeIn = loopFadeIn; + } + isLoopFadeIn() { + return this._isLoopFadeIn; + } + getDuration() { + return this._isLoop ? -1 : this._loopDurationSeconds; + } + getLoopDuration() { + return this._loopDurationSeconds; + } + setParameterFadeInTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeInTime = value; + return; + } + } + } + setParameterFadeOutTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeOutTime = value; + return; + } + } + } + getParameterFadeInTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeInTime; + } + } + return -1; + } + getParameterFadeOutTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeOutTime; + } + } + return -1; + } + setEffectIds(eyeBlinkParameterIds, lipSyncParameterIds) { + this._eyeBlinkParameterIds = eyeBlinkParameterIds; + this._lipSyncParameterIds = lipSyncParameterIds; + } + release() { + this._motionData = void 0; + } + parse(motionJson) { + this._motionData = new CubismMotionData(); + let json = new CubismMotionJson(motionJson); + this._motionData.duration = json.getMotionDuration(); + this._motionData.loop = json.isMotionLoop(); + this._motionData.curveCount = json.getMotionCurveCount(); + this._motionData.fps = json.getMotionFps(); + this._motionData.eventCount = json.getEventCount(); + const areBeziersRestructed = json.getEvaluationOptionFlag(EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted); + const fadeInSeconds = json.getMotionFadeInTime(); + const fadeOutSeconds = json.getMotionFadeOutTime(); + if (fadeInSeconds !== void 0) { + this._fadeInSeconds = fadeInSeconds < 0 ? 1 : fadeInSeconds; + } else { + this._fadeInSeconds = 1; + } + if (fadeOutSeconds !== void 0) { + this._fadeOutSeconds = fadeOutSeconds < 0 ? 1 : fadeOutSeconds; + } else { + this._fadeOutSeconds = 1; + } + this._motionData.curves = Array.from({ length: this._motionData.curveCount }).map(() => new CubismMotionCurve()); + this._motionData.segments = Array.from({ length: json.getMotionTotalSegmentCount() }).map(() => new CubismMotionSegment()); + this._motionData.events = Array.from({ length: this._motionData.eventCount }).map(() => new CubismMotionEvent()); + this._motionData.points = []; + let totalPointCount = 0; + let totalSegmentCount = 0; + for (let curveCount = 0; curveCount < this._motionData.curveCount; ++curveCount) { + const curve = this._motionData.curves[curveCount]; + switch (json.getMotionCurveTarget(curveCount)) { + case TargetNameModel: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + break; + case TargetNameParameter: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; + break; + case TargetNamePartOpacity: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; + break; + default: + CubismLogWarning('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!'); + } + curve.id = json.getMotionCurveId(curveCount); + curve.baseSegmentIndex = totalSegmentCount; + const fadeInTime = json.getMotionCurveFadeInTime(curveCount); + const fadeOutTime = json.getMotionCurveFadeOutTime(curveCount); + curve.fadeInTime = fadeInTime !== void 0 ? fadeInTime : -1; + curve.fadeOutTime = fadeOutTime !== void 0 ? fadeOutTime : -1; + for (let segmentPosition = 0; segmentPosition < json.getMotionCurveSegmentCount(curveCount); ) { + if (segmentPosition == 0) { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition), json.getMotionCurveSegment(curveCount, segmentPosition + 1)); + totalPointCount += 1; + segmentPosition += 2; + } else { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount - 1; + } + const segment = json.getMotionCurveSegment(curveCount, segmentPosition); + switch (segment) { + case CubismMotionSegmentType.CubismMotionSegmentType_Linear: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear; + this._motionData.segments[totalSegmentCount].evaluate = linearEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier; + if (areBeziersRestructed || UseOldBeziersCurveMotion) { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluate; + } else { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluateCardanoInterpretation; + } + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + this._motionData.points[totalPointCount + 1] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 3), json.getMotionCurveSegment(curveCount, segmentPosition + 4)); + this._motionData.points[totalPointCount + 2] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 5), json.getMotionCurveSegment(curveCount, segmentPosition + 6)); + totalPointCount += 3; + segmentPosition += 7; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped; + this._motionData.segments[totalSegmentCount].evaluate = steppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; + this._motionData.segments[totalSegmentCount].evaluate = inverseSteppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + } + ++curve.segmentCount; + ++totalSegmentCount; + } + this._motionData.curves.push(curve); + } + for (let userdatacount = 0; userdatacount < json.getEventCount(); ++userdatacount) { + this._motionData.events[userdatacount].fireTime = json.getEventTime(userdatacount); + this._motionData.events[userdatacount].value = json.getEventValue(userdatacount); + } + json.release(); + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + this._firedEventValues.length = 0; + for (let u = 0; u < this._motionData.eventCount; ++u) { + if (this._motionData.events[u].fireTime > beforeCheckTimeSeconds && this._motionData.events[u].fireTime <= motionTimeSeconds) { + this._firedEventValues.push(this._motionData.events[u].value); + } + } + return this._firedEventValues; + } +} +class CubismMotionQueueEntry { + constructor() { + this._autoDelete = false; + this._available = true; + this._finished = false; + this._started = false; + this._startTimeSeconds = -1; + this._fadeInStartTimeSeconds = 0; + this._endTimeSeconds = -1; + this._stateTimeSeconds = 0; + this._stateWeight = 0; + this._lastEventCheckSeconds = 0; + this._motionQueueEntryHandle = this; + this._fadeOutSeconds = 0; + this._isTriggeredFadeOut = false; + } + release() { + if (this._autoDelete && this._motion) { + this._motion.release(); + } + } + setFadeOut(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + this._isTriggeredFadeOut = true; + } + startFadeOut(fadeOutSeconds, userTimeSeconds) { + const newEndTimeSeconds = userTimeSeconds + fadeOutSeconds; + this._isTriggeredFadeOut = true; + if (this._endTimeSeconds < 0 || newEndTimeSeconds < this._endTimeSeconds) { + this._endTimeSeconds = newEndTimeSeconds; + } + } + isFinished() { + return this._finished; + } + isStarted() { + return this._started; + } + getStartTime() { + return this._startTimeSeconds; + } + getFadeInStartTime() { + return this._fadeInStartTimeSeconds; + } + getEndTime() { + return this._endTimeSeconds; + } + setStartTime(startTime) { + this._startTimeSeconds = startTime; + } + setFadeInStartTime(startTime) { + this._fadeInStartTimeSeconds = startTime; + } + setEndTime(endTime) { + this._endTimeSeconds = endTime; + } + setIsFinished(f) { + this._finished = f; + } + setIsStarted(f) { + this._started = f; + } + isAvailable() { + return this._available; + } + setIsAvailable(v) { + this._available = v; + } + setState(timeSeconds, weight) { + this._stateTimeSeconds = timeSeconds; + this._stateWeight = weight; + } + getStateTime() { + return this._stateTimeSeconds; + } + getStateWeight() { + return this._stateWeight; + } + getLastCheckEventSeconds() { + return this._lastEventCheckSeconds; + } + setLastCheckEventSeconds(checkSeconds) { + this._lastEventCheckSeconds = checkSeconds; + } + isTriggeredFadeOut() { + return this._isTriggeredFadeOut; + } + getFadeOutSeconds() { + return this._fadeOutSeconds; + } +} +class CubismMotionQueueManager { + constructor() { + this._userTimeSeconds = 0; + this._eventCustomData = null; + this._motions = []; + } + release() { + for (let i = 0; i < this._motions.length; ++i) { + if (this._motions[i]) { + this._motions[i].release(); + } + } + this._motions = void 0; + } + startMotion(motion, autoDelete, userTimeSeconds) { + if (motion == null) { + return InvalidMotionQueueEntryHandleValue; + } + let motionQueueEntry; + for (let i = 0; i < this._motions.length; ++i) { + motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + motionQueueEntry.setFadeOut(motionQueueEntry._motion.getFadeOutTime()); + } + motionQueueEntry = new CubismMotionQueueEntry(); + motionQueueEntry._autoDelete = autoDelete; + motionQueueEntry._motion = motion; + this._motions.push(motionQueueEntry); + return motionQueueEntry._motionQueueEntryHandle; + } + isFinished() { + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + if (!motionQueueEntry.isFinished()) { + return false; + } + i++; + } + return true; + } + isFinishedByHandle(motionQueueEntryNumber) { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber && !motionQueueEntry.isFinished()) { + return false; + } + } + return true; + } + stopAllMotions() { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry != null) { + motionQueueEntry.release(); + } + } + this._motions = []; + } + getCubismMotionQueueEntry(motionQueueEntryNumber) { + return this._motions.find((entry) => entry != null && entry._motionQueueEntryHandle == motionQueueEntryNumber); + } + setEventCallback(callback, customData = null) { + this._eventCallBack = callback; + this._eventCustomData = customData; + } + doUpdateMotion(model, userTimeSeconds) { + let updated = false; + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + motion.updateParameters(model, motionQueueEntry, userTimeSeconds); + updated = true; + const firedList = motion.getFiredEvent(motionQueueEntry.getLastCheckEventSeconds() - motionQueueEntry.getStartTime(), userTimeSeconds - motionQueueEntry.getStartTime()); + for (let i2 = 0; i2 < firedList.length; ++i2) { + this._eventCallBack(this, firedList[i2], this._eventCustomData); + } + motionQueueEntry.setLastCheckEventSeconds(userTimeSeconds); + if (motionQueueEntry.isFinished()) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + } else { + if (motionQueueEntry.isTriggeredFadeOut()) { + motionQueueEntry.startFadeOut(motionQueueEntry.getFadeOutSeconds(), userTimeSeconds); + } + i++; + } + } + return updated; + } +} +const InvalidMotionQueueEntryHandleValue = -1; +class CubismMotionManager extends CubismMotionQueueManager { + constructor() { + super(); + this._currentPriority = 0; + this._reservePriority = 0; + } + getCurrentPriority() { + return this._currentPriority; + } + getReservePriority() { + return this._reservePriority; + } + setReservePriority(val) { + this._reservePriority = val; + } + startMotionPriority(motion, autoDelete, priority) { + if (priority == this._reservePriority) { + this._reservePriority = 0; + } + this._currentPriority = priority; + return super.startMotion(motion, autoDelete, this._userTimeSeconds); + } + updateMotion(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + const updated = super.doUpdateMotion(model, this._userTimeSeconds); + if (this.isFinished()) { + this._currentPriority = 0; + } + return updated; + } + reserveMotion(priority) { + if (priority <= this._reservePriority || priority <= this._currentPriority) { + return false; + } + this._reservePriority = priority; + return true; + } +} +var CubismPhysicsTargetType = /* @__PURE__ */ ((CubismPhysicsTargetType2) => { + CubismPhysicsTargetType2[CubismPhysicsTargetType2["CubismPhysicsTargetType_Parameter"] = 0] = "CubismPhysicsTargetType_Parameter"; + return CubismPhysicsTargetType2; +})(CubismPhysicsTargetType || {}); +var CubismPhysicsSource = /* @__PURE__ */ ((CubismPhysicsSource2) => { + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_X"] = 0] = "CubismPhysicsSource_X"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Y"] = 1] = "CubismPhysicsSource_Y"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Angle"] = 2] = "CubismPhysicsSource_Angle"; + return CubismPhysicsSource2; +})(CubismPhysicsSource || {}); +class PhysicsJsonEffectiveForces { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } +} +class CubismPhysicsParticle { + constructor() { + this.initialPosition = new CubismVector2(0, 0); + this.position = new CubismVector2(0, 0); + this.lastPosition = new CubismVector2(0, 0); + this.lastGravity = new CubismVector2(0, 0); + this.force = new CubismVector2(0, 0); + this.velocity = new CubismVector2(0, 0); + } +} +class CubismPhysicsSubRig { + constructor() { + this.normalizationPosition = {}; + this.normalizationAngle = {}; + } +} +class CubismPhysicsInput { + constructor() { + this.source = {}; + } +} +class CubismPhysicsOutput { + constructor() { + this.destination = {}; + this.translationScale = new CubismVector2(0, 0); + } +} +class CubismPhysicsRig { + constructor() { + this.settings = []; + this.inputs = []; + this.outputs = []; + this.particles = []; + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } +} +class CubismPhysicsJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getGravity() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Gravity.X; + ret.y = this._json.Meta.EffectiveForces.Gravity.Y; + return ret; + } + getWind() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Wind.X; + ret.y = this._json.Meta.EffectiveForces.Wind.Y; + return ret; + } + getSubRigCount() { + return this._json.Meta.PhysicsSettingCount; + } + getTotalInputCount() { + return this._json.Meta.TotalInputCount; + } + getTotalOutputCount() { + return this._json.Meta.TotalOutputCount; + } + getVertexCount() { + return this._json.Meta.VertexCount; + } + getNormalizationPositionMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Minimum; + } + getNormalizationPositionMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Maximum; + } + getNormalizationPositionDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Default; + } + getNormalizationAngleMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Minimum; + } + getNormalizationAngleMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Maximum; + } + getNormalizationAngleDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Default; + } + getInputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input.length; + } + getInputWeight(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Weight; + } + getInputReflect(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Reflect; + } + getInputType(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Type; + } + getInputSourceId(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Source.Id; + } + getOutputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output.length; + } + getOutputVertexIndex(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].VertexIndex; + } + getOutputAngleScale(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Scale; + } + getOutputWeight(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Weight; + } + getOutputDestinationId(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Destination.Id; + } + getOutputType(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Type; + } + getOutputReflect(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Reflect; + } + getParticleCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices.length; + } + getParticleMobility(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Mobility; + } + getParticleDelay(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Delay; + } + getParticleAcceleration(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Acceleration; + } + getParticleRadius(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Radius; + } + getParticlePosition(physicsSettingIndex, vertexIndex) { + const ret = new CubismVector2(0, 0); + ret.x = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.X; + ret.y = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.Y; + return ret; + } +} +const PhysicsTypeTagX = "X"; +const PhysicsTypeTagY = "Y"; +const PhysicsTypeTagAngle = "Angle"; +const AirResistance = 5; +const MaximumWeight = 100; +const MovementThreshold = 1e-3; +class CubismPhysics { + static create(json) { + const ret = new CubismPhysics(); + ret.parse(json); + ret._physicsRig.gravity.y = 0; + return ret; + } + evaluate(model, deltaTimeSeconds) { + let totalAngle; + let weight; + let radAngle; + let outputValue; + const totalTranslation = new CubismVector2(); + let currentSetting; + let currentInput; + let currentOutput; + let currentParticles; + let parameterValue; + let parameterMaximumValue; + let parameterMinimumValue; + let parameterDefaultValue; + parameterValue = model.getModel().parameters.values; + parameterMaximumValue = model.getModel().parameters.maximumValues; + parameterMinimumValue = model.getModel().parameters.minimumValues; + parameterDefaultValue = model.getModel().parameters.defaultValues; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + totalAngle = { angle: 0 }; + totalTranslation.x = 0; + totalTranslation.y = 0; + currentSetting = this._physicsRig.settings[settingIndex]; + currentInput = this._physicsRig.inputs.slice(currentSetting.baseInputIndex); + currentOutput = this._physicsRig.outputs.slice(currentSetting.baseOutputIndex); + currentParticles = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + for (let i = 0; i < currentSetting.inputCount; ++i) { + weight = currentInput[i].weight / MaximumWeight; + if (currentInput[i].sourceParameterIndex == -1) { + currentInput[i].sourceParameterIndex = model.getParameterIndex(currentInput[i].source.id); + } + currentInput[i].getNormalizedParameterValue(totalTranslation, totalAngle, parameterValue[currentInput[i].sourceParameterIndex], parameterMinimumValue[currentInput[i].sourceParameterIndex], parameterMaximumValue[currentInput[i].sourceParameterIndex], parameterDefaultValue[currentInput[i].sourceParameterIndex], currentSetting.normalizationPosition, currentSetting.normalizationAngle, currentInput[i].reflect, weight); + } + radAngle = CubismMath.degreesToRadian(-totalAngle.angle); + totalTranslation.x = totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle); + totalTranslation.y = totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle); + updateParticles(currentParticles, currentSetting.particleCount, totalTranslation, totalAngle.angle, this._options.wind, MovementThreshold * currentSetting.normalizationPosition.maximum, deltaTimeSeconds, AirResistance); + for (let i = 0; i < currentSetting.outputCount; ++i) { + const particleIndex = currentOutput[i].vertexIndex; + if (particleIndex < 1 || particleIndex >= currentSetting.particleCount) { + break; + } + if (currentOutput[i].destinationParameterIndex == -1) { + currentOutput[i].destinationParameterIndex = model.getParameterIndex(currentOutput[i].destination.id); + } + const translation = new CubismVector2(); + translation.x = currentParticles[particleIndex].position.x - currentParticles[particleIndex - 1].position.x; + translation.y = currentParticles[particleIndex].position.y - currentParticles[particleIndex - 1].position.y; + outputValue = currentOutput[i].getValue(translation, currentParticles, particleIndex, currentOutput[i].reflect, this._options.gravity); + const destinationParameterIndex = currentOutput[i].destinationParameterIndex; + const outParameterValue = !Float32Array.prototype.slice && "subarray" in Float32Array.prototype ? JSON.parse(JSON.stringify(parameterValue.subarray(destinationParameterIndex))) : parameterValue.slice(destinationParameterIndex); + updateOutputParameterValue(outParameterValue, parameterMinimumValue[destinationParameterIndex], parameterMaximumValue[destinationParameterIndex], outputValue, currentOutput[i]); + for (let offset = destinationParameterIndex, outParamIndex = 0; offset < parameterValue.length; offset++, outParamIndex++) { + parameterValue[offset] = outParameterValue[outParamIndex]; + } + } + } + } + setOptions(options) { + this._options = options; + } + getOption() { + return this._options; + } + constructor() { + this._options = new Options(); + this._options.gravity.y = -1; + this._options.gravity.x = 0; + this._options.wind.x = 0; + this._options.wind.y = 0; + } + release() { + this._physicsRig = void 0; + } + parse(physicsJson) { + this._physicsRig = new CubismPhysicsRig(); + let json = new CubismPhysicsJson(physicsJson); + this._physicsRig.gravity = json.getGravity(); + this._physicsRig.wind = json.getWind(); + this._physicsRig.subRigCount = json.getSubRigCount(); + let inputIndex = 0, outputIndex = 0, particleIndex = 0; + for (let i = 0; i < this._physicsRig.subRigCount; ++i) { + const setting = new CubismPhysicsSubRig(); + setting.normalizationPosition.minimum = json.getNormalizationPositionMinimumValue(i); + setting.normalizationPosition.maximum = json.getNormalizationPositionMaximumValue(i); + setting.normalizationPosition.defalut = json.getNormalizationPositionDefaultValue(i); + setting.normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i); + setting.normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i); + setting.normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i); + setting.inputCount = json.getInputCount(i); + setting.baseInputIndex = inputIndex; + inputIndex += setting.inputCount; + for (let j = 0; j < setting.inputCount; ++j) { + const input = new CubismPhysicsInput(); + input.sourceParameterIndex = -1; + input.weight = json.getInputWeight(i, j); + input.reflect = json.getInputReflect(i, j); + switch (json.getInputType(i, j)) { + case PhysicsTypeTagX: + input.type = CubismPhysicsSource.CubismPhysicsSource_X; + input.getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + break; + case PhysicsTypeTagY: + input.type = CubismPhysicsSource.CubismPhysicsSource_Y; + input.getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + break; + case PhysicsTypeTagAngle: + input.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + input.getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + break; + } + input.source.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + input.source.id = json.getInputSourceId(i, j); + this._physicsRig.inputs.push(input); + } + setting.outputCount = json.getOutputCount(i); + setting.baseOutputIndex = outputIndex; + outputIndex += setting.outputCount; + for (let j = 0; j < setting.outputCount; ++j) { + const output = new CubismPhysicsOutput(); + output.destinationParameterIndex = -1; + output.vertexIndex = json.getOutputVertexIndex(i, j); + output.angleScale = json.getOutputAngleScale(i, j); + output.weight = json.getOutputWeight(i, j); + output.destination.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + output.destination.id = json.getOutputDestinationId(i, j); + switch (json.getOutputType(i, j)) { + case PhysicsTypeTagX: + output.type = CubismPhysicsSource.CubismPhysicsSource_X; + output.getValue = getOutputTranslationX; + output.getScale = getOutputScaleTranslationX; + break; + case PhysicsTypeTagY: + output.type = CubismPhysicsSource.CubismPhysicsSource_Y; + output.getValue = getOutputTranslationY; + output.getScale = getOutputScaleTranslationY; + break; + case PhysicsTypeTagAngle: + output.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + output.getValue = getOutputAngle; + output.getScale = getOutputScaleAngle; + break; + } + output.reflect = json.getOutputReflect(i, j); + this._physicsRig.outputs.push(output); + } + setting.particleCount = json.getParticleCount(i); + setting.baseParticleIndex = particleIndex; + particleIndex += setting.particleCount; + for (let j = 0; j < setting.particleCount; ++j) { + const particle = new CubismPhysicsParticle(); + particle.mobility = json.getParticleMobility(i, j); + particle.delay = json.getParticleDelay(i, j); + particle.acceleration = json.getParticleAcceleration(i, j); + particle.radius = json.getParticleRadius(i, j); + particle.position = json.getParticlePosition(i, j); + this._physicsRig.particles.push(particle); + } + this._physicsRig.settings.push(setting); + } + this.initialize(); + json.release(); + } + initialize() { + let strand; + let currentSetting; + let radius; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + currentSetting = this._physicsRig.settings[settingIndex]; + strand = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + strand[0].initialPosition = new CubismVector2(0, 0); + strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); + strand[0].lastGravity = new CubismVector2(0, -1); + strand[0].lastGravity.y *= -1; + strand[0].velocity = new CubismVector2(0, 0); + strand[0].force = new CubismVector2(0, 0); + for (let i = 1; i < currentSetting.particleCount; ++i) { + radius = new CubismVector2(0, 0); + radius.y = strand[i].radius; + strand[i].initialPosition = new CubismVector2(strand[i - 1].initialPosition.x + radius.x, strand[i - 1].initialPosition.y + radius.y); + strand[i].position = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastPosition = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastGravity = new CubismVector2(0, -1); + strand[i].lastGravity.y *= -1; + strand[i].velocity = new CubismVector2(0, 0); + strand[i].force = new CubismVector2(0, 0); + } + } + } +} +class Options { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } +} +function getInputTranslationXFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.x += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; +} +function getInputTranslationYFromNormalizedParamterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.y += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; +} +function getInputAngleFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizaitionPosition, normalizationAngle, isInverted, weight) { + targetAngle.angle += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationAngle.minimum, normalizationAngle.maximum, normalizationAngle.defalut, isInverted) * weight; +} +function getOutputTranslationX(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.x; + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getOutputTranslationY(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.y; + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getOutputAngle(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue; + if (particleIndex >= 2) { + parentGravity = particles[particleIndex - 1].position.substract(particles[particleIndex - 2].position); + } else { + parentGravity = parentGravity.multiplyByScaler(-1); + } + outputValue = CubismMath.directionToRadian(parentGravity, translation); + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getRangeValue(min, max) { + return Math.abs(Math.max(min, max) - Math.min(min, max)); +} +function getDefaultValue(min, max) { + const minValue = Math.min(min, max); + return minValue + getRangeValue(min, max) / 2; +} +function getOutputScaleTranslationX(translationScale, angleScale) { + return translationScale.x; +} +function getOutputScaleTranslationY(translationScale, angleScale) { + return translationScale.y; +} +function getOutputScaleAngle(translationScale, angleScale) { + return angleScale; +} +function updateParticles(strand, strandCount, totalTranslation, totalAngle, windDirection, thresholdValue, deltaTimeSeconds, airResistance) { + let totalRadian; + let delay; + let radian; + let currentGravity; + let direction = new CubismVector2(0, 0); + let velocity = new CubismVector2(0, 0); + let force = new CubismVector2(0, 0); + let newDirection = new CubismVector2(0, 0); + strand[0].position = new CubismVector2(totalTranslation.x, totalTranslation.y); + totalRadian = CubismMath.degreesToRadian(totalAngle); + currentGravity = CubismMath.radianToDirection(totalRadian); + currentGravity.normalize(); + for (let i = 1; i < strandCount; ++i) { + strand[i].force = currentGravity.multiplyByScaler(strand[i].acceleration).add(windDirection); + strand[i].lastPosition = new CubismVector2(strand[i].position.x, strand[i].position.y); + delay = strand[i].delay * deltaTimeSeconds * 30; + direction = strand[i].position.substract(strand[i - 1].position); + radian = CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) / airResistance; + direction.x = CubismMath.cos(radian) * direction.x - direction.y * CubismMath.sin(radian); + direction.y = CubismMath.sin(radian) * direction.x + direction.y * CubismMath.cos(radian); + strand[i].position = strand[i - 1].position.add(direction); + velocity = strand[i].velocity.multiplyByScaler(delay); + force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay); + strand[i].position = strand[i].position.add(velocity).add(force); + newDirection = strand[i].position.substract(strand[i - 1].position); + newDirection.normalize(); + strand[i].position = strand[i - 1].position.add(newDirection.multiplyByScaler(strand[i].radius)); + if (CubismMath.abs(strand[i].position.x) < thresholdValue) { + strand[i].position.x = 0; + } + if (delay != 0) { + strand[i].velocity = strand[i].position.substract(strand[i].lastPosition); + strand[i].velocity = strand[i].velocity.divisionByScalar(delay); + strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); + } + strand[i].force = new CubismVector2(0, 0); + strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); + } +} +function updateOutputParameterValue(parameterValue, parameterValueMinimum, parameterValueMaximum, translation, output) { + let outputScale; + let value; + let weight; + outputScale = output.getScale(output.translationScale, output.angleScale); + value = translation * outputScale; + if (value < parameterValueMinimum) { + if (value < output.valueBelowMinimum) { + output.valueBelowMinimum = value; + } + value = parameterValueMinimum; + } else if (value > parameterValueMaximum) { + if (value > output.valueExceededMaximum) { + output.valueExceededMaximum = value; + } + value = parameterValueMaximum; + } + weight = output.weight / MaximumWeight; + if (weight >= 1) { + parameterValue[0] = value; + } else { + value = parameterValue[0] * (1 - weight) + value * weight; + parameterValue[0] = value; + } +} +function normalizeParameterValue(value, parameterMinimum, parameterMaximum, parameterDefault, normalizedMinimum, normalizedMaximum, normalizedDefault, isInverted) { + let result = 0; + const maxValue = CubismMath.max(parameterMaximum, parameterMinimum); + if (maxValue < value) { + value = maxValue; + } + const minValue = CubismMath.min(parameterMaximum, parameterMinimum); + if (minValue > value) { + value = minValue; + } + const minNormValue = CubismMath.min(normalizedMinimum, normalizedMaximum); + const maxNormValue = CubismMath.max(normalizedMinimum, normalizedMaximum); + const middleNormValue = normalizedDefault; + const middleValue = getDefaultValue(minValue, maxValue); + const paramValue = value - middleValue; + switch (Math.sign(paramValue)) { + case 1: { + const nLength = maxNormValue - middleNormValue; + const pLength = maxValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case -1: { + const nLength = minNormValue - middleNormValue; + const pLength = minValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case 0: { + result = middleNormValue; + break; + } + } + return isInverted ? result : result * -1; +} +class csmRect { + constructor(x = 0, y = 0, w = 0, h = 0) { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + } + getCenterX() { + return this.x + 0.5 * this.width; + } + getCenterY() { + return this.y + 0.5 * this.height; + } + getRight() { + return this.x + this.width; + } + getBottom() { + return this.y + this.height; + } + setRect(r) { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + } + expand(w, h) { + this.x -= w; + this.y -= h; + this.width += w * 2; + this.height += h * 2; + } +} +const ColorChannelCount = 4; +const shaderCount = 10; +let s_instance; +let s_viewport; +let s_fbo; +class CubismClippingManager_WebGL { + getChannelFlagAsColor(channelNo) { + return this._channelColors[channelNo]; + } + getMaskRenderTexture() { + let ret = 0; + if (this._maskTexture && this._maskTexture.texture != 0) { + this._maskTexture.frameNo = this._currentFrameNo; + ret = this._maskTexture.texture; + } + if (ret == 0) { + const size = this._clippingMaskBufferSize; + this._colorBuffer = this.gl.createTexture(); + this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); + this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, size, size, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + ret = this.gl.createFramebuffer(); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); + this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._colorBuffer, 0); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + this._maskTexture = new CubismRenderTextureResource(this._currentFrameNo, ret); + } + return ret; + } + setGL(gl) { + this.gl = gl; + } + calcClippedDrawTotalBounds(model, clippingContext) { + let clippedDrawTotalMinX = Number.MAX_VALUE; + let clippedDrawTotalMinY = Number.MAX_VALUE; + let clippedDrawTotalMaxX = Number.MIN_VALUE; + let clippedDrawTotalMaxY = Number.MIN_VALUE; + const clippedDrawCount = clippingContext._clippedDrawableIndexList.length; + for (let clippedDrawableIndex = 0; clippedDrawableIndex < clippedDrawCount; clippedDrawableIndex++) { + const drawableIndex = clippingContext._clippedDrawableIndexList[clippedDrawableIndex]; + const drawableVertexCount = model.getDrawableVertexCount(drawableIndex); + const drawableVertexes = model.getDrawableVertices(drawableIndex); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = Number.MIN_VALUE; + let maxY = Number.MIN_VALUE; + const loop = drawableVertexCount * Constant.vertexStep; + for (let pi = Constant.vertexOffset; pi < loop; pi += Constant.vertexStep) { + const x = drawableVertexes[pi]; + const y = drawableVertexes[pi + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + if (minX == Number.MAX_VALUE) { + continue; + } + if (minX < clippedDrawTotalMinX) { + clippedDrawTotalMinX = minX; + } + if (minY < clippedDrawTotalMinY) { + clippedDrawTotalMinY = minY; + } + if (maxX > clippedDrawTotalMaxX) { + clippedDrawTotalMaxX = maxX; + } + if (maxY > clippedDrawTotalMaxY) { + clippedDrawTotalMaxY = maxY; + } + if (clippedDrawTotalMinX == Number.MAX_VALUE) { + clippingContext._allClippedDrawRect.x = 0; + clippingContext._allClippedDrawRect.y = 0; + clippingContext._allClippedDrawRect.width = 0; + clippingContext._allClippedDrawRect.height = 0; + clippingContext._isUsing = false; + } else { + clippingContext._isUsing = true; + const w = clippedDrawTotalMaxX - clippedDrawTotalMinX; + const h = clippedDrawTotalMaxY - clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX; + clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.width = w; + clippingContext._allClippedDrawRect.height = h; + } + } + } + constructor() { + this._maskRenderTexture = null; + this._colorBuffer = null; + this._currentFrameNo = 0; + this._clippingMaskBufferSize = 256; + this._clippingContextListForMask = []; + this._clippingContextListForDraw = []; + this._channelColors = []; + this._tmpBoundsOnModel = new csmRect(); + this._tmpMatrix = new CubismMatrix44(); + this._tmpMatrixForMask = new CubismMatrix44(); + this._tmpMatrixForDraw = new CubismMatrix44(); + let tmp = new CubismTextureColor(); + tmp.R = 1; + tmp.G = 0; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 1; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 1; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 0; + tmp.A = 1; + this._channelColors.push(tmp); + } + release() { + var _a, _b, _c; + const self = this; + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + if (this._clippingContextListForMask[i]) { + (_a = this._clippingContextListForMask[i]) == null ? void 0 : _a.release(); + } + } + self._clippingContextListForMask = void 0; + self._clippingContextListForDraw = void 0; + if (this._maskTexture) { + (_b = this.gl) == null ? void 0 : _b.deleteFramebuffer(this._maskTexture.texture); + self._maskTexture = void 0; + } + self._channelColors = void 0; + (_c = this.gl) == null ? void 0 : _c.deleteTexture(this._colorBuffer); + this._colorBuffer = null; + } + initialize(model, drawableCount, drawableMasks, drawableMaskCounts) { + for (let i = 0; i < drawableCount; i++) { + if (drawableMaskCounts[i] <= 0) { + this._clippingContextListForDraw.push(null); + continue; + } + let clippingContext = this.findSameClip(drawableMasks[i], drawableMaskCounts[i]); + if (clippingContext == null) { + clippingContext = new CubismClippingContext(this, drawableMasks[i], drawableMaskCounts[i]); + this._clippingContextListForMask.push(clippingContext); + } + clippingContext.addClippedDrawable(i); + this._clippingContextListForDraw.push(clippingContext); + } + } + setupClippingContext(model, renderer) { + this._currentFrameNo++; + let usingClipCount = 0; + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const cc = this._clippingContextListForMask[clipIndex]; + this.calcClippedDrawTotalBounds(model, cc); + if (cc._isUsing) { + usingClipCount++; + } + } + if (usingClipCount > 0) { + this.gl.viewport(0, 0, this._clippingMaskBufferSize, this._clippingMaskBufferSize); + this._maskRenderTexture = this.getMaskRenderTexture(); + renderer.getMvpMatrix(); + renderer.preDraw(); + this.setupLayoutBounds(usingClipCount); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + this.gl.clearColor(1, 1, 1, 1); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const clipContext = this._clippingContextListForMask[clipIndex]; + const allClipedDrawRect = clipContext._allClippedDrawRect; + const layoutBoundsOnTex01 = clipContext._layoutBounds; + const MARGIN = 0.05; + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand(allClipedDrawRect.width * MARGIN, allClipedDrawRect.height * MARGIN); + const scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + const scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(-1, -1); + this._tmpMatrix.scaleRelative(2, 2); + } + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()); + } + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); + } + clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); + clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); + const clipDrawCount = clipContext._clippingIdCount; + for (let i = 0; i < clipDrawCount; i++) { + const clipDrawIndex = clipContext._clippingIdList[i]; + if (!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)) { + continue; + } + renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false); + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh(model.getDrawableTextureIndices(clipDrawIndex), model.getDrawableVertexIndexCount(clipDrawIndex), model.getDrawableVertexCount(clipDrawIndex), model.getDrawableVertexIndices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex), CubismBlendMode.CubismBlendMode_Normal, false); + } + } + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + renderer.setClippingContextBufferForMask(null); + this.gl.viewport(s_viewport[0], s_viewport[1], s_viewport[2], s_viewport[3]); + } + } + findSameClip(drawableMasks, drawableMaskCounts) { + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + const clippingContext = this._clippingContextListForMask[i]; + const count = clippingContext._clippingIdCount; + if (count != drawableMaskCounts) { + continue; + } + let sameCount = 0; + for (let j = 0; j < count; j++) { + const clipId = clippingContext._clippingIdList[j]; + for (let k = 0; k < count; k++) { + if (drawableMasks[k] == clipId) { + sameCount++; + break; + } + } + } + if (sameCount == count) { + return clippingContext; + } + } + return null; + } + setupLayoutBounds(usingClipCount) { + let div = usingClipCount / ColorChannelCount; + let mod = usingClipCount % ColorChannelCount; + div = ~~div; + mod = ~~mod; + let curClipIndex = 0; + for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + const layoutCount = div + (channelNo < mod ? 1 : 0); + if (layoutCount == 0) + ; + else if (layoutCount == 1) { + const clipContext = this._clippingContextListForMask[curClipIndex++]; + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0; + clipContext._layoutBounds.y = 0; + clipContext._layoutBounds.width = 1; + clipContext._layoutBounds.height = 1; + } else if (layoutCount == 2) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + xpos = ~~xpos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1; + } + } else if (layoutCount <= 4) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + let ypos = i / 2; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + } + } else if (layoutCount <= 9) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 3; + let ypos = i / 3; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 3; + cc._layoutBounds.y = ypos / 3; + cc._layoutBounds.width = 1 / 3; + cc._layoutBounds.height = 1 / 3; + } + } else if (CubismConfig.supportMoreMaskDivisions && layoutCount <= 16) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 4; + let ypos = i / 4; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 4; + cc._layoutBounds.y = ypos / 4; + cc._layoutBounds.width = 1 / 4; + cc._layoutBounds.height = 1 / 4; + } + } else { + CubismLogError("not supported mask count : {0}", layoutCount); + } + } + } + getColorBuffer() { + return this._colorBuffer; + } + getClippingContextListForDraw() { + return this._clippingContextListForDraw; + } + setClippingMaskBufferSize(size) { + this._clippingMaskBufferSize = size; + } + getClippingMaskBufferSize() { + return this._clippingMaskBufferSize; + } +} +class CubismRenderTextureResource { + constructor(frameNo, texture) { + this.frameNo = frameNo; + this.texture = texture; + } +} +class CubismClippingContext { + constructor(manager, clippingDrawableIndices, clipCount) { + this._isUsing = false; + this._owner = manager; + this._clippingIdList = clippingDrawableIndices; + this._clippingIdCount = clipCount; + this._allClippedDrawRect = new csmRect(); + this._layoutBounds = new csmRect(); + this._clippedDrawableIndexList = []; + this._matrixForMask = new CubismMatrix44(); + this._matrixForDraw = new CubismMatrix44(); + } + release() { + const self = this; + self._layoutBounds = void 0; + self._allClippedDrawRect = void 0; + self._clippedDrawableIndexList = void 0; + } + addClippedDrawable(drawableIndex) { + this._clippedDrawableIndexList.push(drawableIndex); + } + getClippingManager() { + return this._owner; + } + setGl(gl) { + this._owner.setGL(gl); + } +} +class CubismShader_WebGL { + static getInstance() { + if (s_instance == null) { + s_instance = new CubismShader_WebGL(); + return s_instance; + } + return s_instance; + } + static deleteInstance() { + if (s_instance) { + s_instance.release(); + s_instance = void 0; + } + } + constructor() { + this._shaderSets = []; + } + release() { + this.releaseShaderProgram(); + } + setupShaderProgram(renderer, textureId, vertexCount, vertexArray, indexArray, uvArray, bufferData, opacity, colorBlendMode, baseColor, isPremultipliedAlpha, matrix4x4, invertedMask) { + if (!isPremultipliedAlpha) { + CubismLogError("NoPremultipliedAlpha is not allowed"); + } + if (this._shaderSets.length == 0) { + this.generateShaders(); + } + let SRC_COLOR; + let DST_COLOR; + let SRC_ALPHA; + let DST_ALPHA; + const clippingContextBufferForMask = renderer.getClippingContextBufferForMask(); + if (clippingContextBufferForMask != null) { + const shaderSet = this._shaderSets[ShaderNames.ShaderNames_SetupMask]; + this.gl.useProgram(shaderSet.shaderProgram); + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + const channelNo = clippingContextBufferForMask._layoutChannelNo; + const colorChannel = clippingContextBufferForMask.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForMask._matrixForMask.getArray()); + const rect = clippingContextBufferForMask._layoutBounds; + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, rect.x * 2 - 1, rect.y * 2 - 1, rect.getRight() * 2 - 1, rect.getBottom() * 2 - 1); + SRC_COLOR = this.gl.ZERO; + DST_COLOR = this.gl.ONE_MINUS_SRC_COLOR; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + } else { + const clippingContextBufferForDraw = renderer.getClippingContextBufferForDraw(); + const masked = clippingContextBufferForDraw != null; + const offset = masked ? invertedMask ? 2 : 1 : 0; + let shaderSet; + switch (colorBlendMode) { + case CubismBlendMode.CubismBlendMode_Normal: + default: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ONE; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + break; + case CubismBlendMode.CubismBlendMode_Additive: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_AddPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + case CubismBlendMode.CubismBlendMode_Multiplicative: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_MultPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.DST_COLOR; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + } + this.gl.useProgram(shaderSet.shaderProgram); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + if (clippingContextBufferForDraw != null) { + this.gl.activeTexture(this.gl.TEXTURE1); + const tex = clippingContextBufferForDraw.getClippingManager().getColorBuffer(); + this.gl.bindTexture(this.gl.TEXTURE_2D, tex); + this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForDraw._matrixForDraw.getArray()); + const channelNo = clippingContextBufferForDraw._layoutChannelNo; + const colorChannel = clippingContextBufferForDraw.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); + } + if (bufferData.index == null) { + bufferData.index = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, bufferData.index); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, indexArray, this.gl.DYNAMIC_DRAW); + this.gl.blendFuncSeparate(SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA); + } + releaseShaderProgram() { + for (let i = 0; i < this._shaderSets.length; i++) { + this.gl.deleteProgram(this._shaderSets[i].shaderProgram); + this._shaderSets[i].shaderProgram = 0; + } + this._shaderSets = []; + } + generateShaders() { + for (let i = 0; i < shaderCount; i++) { + this._shaderSets.push({}); + } + this._shaderSets[0].shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask); + this._shaderSets[1].shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha); + this._shaderSets[2].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha); + this._shaderSets[3].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskInvertedPremultipliedAlpha); + this._shaderSets[4].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[5].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[6].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[7].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[8].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[9].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[0].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_position"); + this._shaderSets[0].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_texCoord"); + this._shaderSets[0].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "s_texture0"); + this._shaderSets[0].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_clipMatrix"); + this._shaderSets[0].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_channelFlag"); + this._shaderSets[0].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_baseColor"); + this._shaderSets[1].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_position"); + this._shaderSets[1].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_texCoord"); + this._shaderSets[1].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "s_texture0"); + this._shaderSets[1].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_matrix"); + this._shaderSets[1].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_baseColor"); + this._shaderSets[2].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_position"); + this._shaderSets[2].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_texCoord"); + this._shaderSets[2].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture0"); + this._shaderSets[2].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture1"); + this._shaderSets[2].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_matrix"); + this._shaderSets[2].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_clipMatrix"); + this._shaderSets[2].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_channelFlag"); + this._shaderSets[2].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_baseColor"); + this._shaderSets[3].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_position"); + this._shaderSets[3].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_texCoord"); + this._shaderSets[3].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture0"); + this._shaderSets[3].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture1"); + this._shaderSets[3].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_matrix"); + this._shaderSets[3].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_clipMatrix"); + this._shaderSets[3].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_channelFlag"); + this._shaderSets[3].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_baseColor"); + this._shaderSets[4].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_position"); + this._shaderSets[4].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_texCoord"); + this._shaderSets[4].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "s_texture0"); + this._shaderSets[4].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_matrix"); + this._shaderSets[4].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_baseColor"); + this._shaderSets[5].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_position"); + this._shaderSets[5].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_texCoord"); + this._shaderSets[5].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture0"); + this._shaderSets[5].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture1"); + this._shaderSets[5].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_matrix"); + this._shaderSets[5].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_clipMatrix"); + this._shaderSets[5].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_channelFlag"); + this._shaderSets[5].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_baseColor"); + this._shaderSets[6].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_position"); + this._shaderSets[6].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_texCoord"); + this._shaderSets[6].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture0"); + this._shaderSets[6].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture1"); + this._shaderSets[6].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_matrix"); + this._shaderSets[6].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_clipMatrix"); + this._shaderSets[6].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_channelFlag"); + this._shaderSets[6].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_baseColor"); + this._shaderSets[7].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_position"); + this._shaderSets[7].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_texCoord"); + this._shaderSets[7].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "s_texture0"); + this._shaderSets[7].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_matrix"); + this._shaderSets[7].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_baseColor"); + this._shaderSets[8].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_position"); + this._shaderSets[8].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_texCoord"); + this._shaderSets[8].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture0"); + this._shaderSets[8].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture1"); + this._shaderSets[8].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_matrix"); + this._shaderSets[8].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_clipMatrix"); + this._shaderSets[8].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_channelFlag"); + this._shaderSets[8].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_baseColor"); + this._shaderSets[9].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_position"); + this._shaderSets[9].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_texCoord"); + this._shaderSets[9].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture0"); + this._shaderSets[9].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture1"); + this._shaderSets[9].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_matrix"); + this._shaderSets[9].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_clipMatrix"); + this._shaderSets[9].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_channelFlag"); + this._shaderSets[9].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_baseColor"); + } + loadShaderProgram(vertexShaderSource, fragmentShaderSource) { + let shaderProgram = this.gl.createProgram(); + let vertShader = this.compileShaderSource(this.gl.VERTEX_SHADER, vertexShaderSource); + if (!vertShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + let fragShader = this.compileShaderSource(this.gl.FRAGMENT_SHADER, fragmentShaderSource); + if (!fragShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + this.gl.attachShader(shaderProgram, vertShader); + this.gl.attachShader(shaderProgram, fragShader); + this.gl.linkProgram(shaderProgram); + const linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); + if (!linkStatus) { + CubismLogError("Failed to link program: {0}", shaderProgram); + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + if (shaderProgram) { + this.gl.deleteProgram(shaderProgram); + } + return 0; + } + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + return shaderProgram; + } + compileShaderSource(shaderType, shaderSource) { + const source = shaderSource; + const shader = this.gl.createShader(shaderType); + this.gl.shaderSource(shader, source); + this.gl.compileShader(shader); + if (!shader) { + const log = this.gl.getShaderInfoLog(shader); + CubismLogError("Shader compile log: {0} ", log); + } + const status = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); + if (!status) { + this.gl.deleteShader(shader); + return null; + } + return shader; + } + setGl(gl) { + this.gl = gl; + } +} +var ShaderNames = /* @__PURE__ */ ((ShaderNames2) => { + ShaderNames2[ShaderNames2["ShaderNames_SetupMask"] = 0] = "ShaderNames_SetupMask"; + ShaderNames2[ShaderNames2["ShaderNames_NormalPremultipliedAlpha"] = 1] = "ShaderNames_NormalPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NormalMaskedPremultipliedAlpha"] = 2] = "ShaderNames_NormalMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NomralMaskedInvertedPremultipliedAlpha"] = 3] = "ShaderNames_NomralMaskedInvertedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddPremultipliedAlpha"] = 4] = "ShaderNames_AddPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlpha"] = 5] = "ShaderNames_AddMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlphaInverted"] = 6] = "ShaderNames_AddMaskedPremultipliedAlphaInverted"; + ShaderNames2[ShaderNames2["ShaderNames_MultPremultipliedAlpha"] = 7] = "ShaderNames_MultPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlpha"] = 8] = "ShaderNames_MultMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlphaInverted"] = 9] = "ShaderNames_MultMaskedPremultipliedAlphaInverted"; + return ShaderNames2; +})(ShaderNames || {}); +const vertexShaderSrcSetupMask = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const fragmentShaderSrcsetupMask = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}"; +const vertexShaderSrc = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const vertexShaderSrcMasked = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const fragmentShaderSrcPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}"; +const fragmentShaderSrcMaskPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}"; +const fragmentShaderSrcMaskInvertedPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}"; +class CubismRenderer_WebGL extends CubismRenderer { + constructor() { + super(); + this._clippingContextBufferForMask = null; + this._clippingContextBufferForDraw = null; + this._clippingManager = new CubismClippingManager_WebGL(); + this.firstDraw = true; + this._textures = {}; + this._sortedDrawableIndexList = []; + this._bufferData = { + vertex: null, + uv: null, + index: null + }; + } + initialize(model) { + if (model.isUsingMasking()) { + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.initialize(model, model.getDrawableCount(), model.getDrawableMasks(), model.getDrawableMaskCounts()); + } + for (let i = model.getDrawableCount() - 1; i >= 0; i--) { + this._sortedDrawableIndexList[i] = 0; + } + super.initialize(model); + } + bindTexture(modelTextureNo, glTexture) { + this._textures[modelTextureNo] = glTexture; + } + getBindedTextures() { + return this._textures; + } + setClippingMaskBufferSize(size) { + this._clippingManager.release(); + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.setClippingMaskBufferSize(size); + this._clippingManager.initialize(this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), this.getModel().getDrawableMaskCounts()); + } + getClippingMaskBufferSize() { + return this._clippingManager.getClippingMaskBufferSize(); + } + release() { + var _a, _b, _c; + const self = this; + this._clippingManager.release(); + self._clippingManager = void 0; + (_a = this.gl) == null ? void 0 : _a.deleteBuffer(this._bufferData.vertex); + this._bufferData.vertex = null; + (_b = this.gl) == null ? void 0 : _b.deleteBuffer(this._bufferData.uv); + this._bufferData.uv = null; + (_c = this.gl) == null ? void 0 : _c.deleteBuffer(this._bufferData.index); + this._bufferData.index = null; + self._bufferData = void 0; + self._textures = void 0; + } + doDrawModel() { + this.preDraw(); + if (this._clippingManager != null) { + this._clippingManager.setupClippingContext(this.getModel(), this); + } + const drawableCount = this.getModel().getDrawableCount(); + const renderOrder = this.getModel().getDrawableRenderOrders(); + for (let i = 0; i < drawableCount; ++i) { + const order = renderOrder[i]; + this._sortedDrawableIndexList[order] = i; + } + for (let i = 0; i < drawableCount; ++i) { + const drawableIndex = this._sortedDrawableIndexList[i]; + if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) { + continue; + } + this.setClippingContextBufferForDraw(this._clippingManager != null ? this._clippingManager.getClippingContextListForDraw()[drawableIndex] : null); + this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); + this.drawMesh(this.getModel().getDrawableTextureIndices(drawableIndex), this.getModel().getDrawableVertexIndexCount(drawableIndex), this.getModel().getDrawableVertexCount(drawableIndex), this.getModel().getDrawableVertexIndices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableBlendMode(drawableIndex), this.getModel().getDrawableInvertedMaskBit(drawableIndex)); + } + } + drawMesh(textureNo, indexCount, vertexCount, indexArray, vertexArray, uvArray, opacity, colorBlendMode, invertedMask) { + if (this.isCulling()) { + this.gl.enable(this.gl.CULL_FACE); + } else { + this.gl.disable(this.gl.CULL_FACE); + } + this.gl.frontFace(this.gl.CCW); + const modelColorRGBA = this.getModelColor(); + if (this.getClippingContextBufferForMask() == null) { + modelColorRGBA.A *= opacity; + if (this.isPremultipliedAlpha()) { + modelColorRGBA.R *= modelColorRGBA.A; + modelColorRGBA.G *= modelColorRGBA.A; + modelColorRGBA.B *= modelColorRGBA.A; + } + } + let drawtexture = null; + if (this._textures[textureNo] != null) { + drawtexture = this._textures[textureNo]; + } + CubismShader_WebGL.getInstance().setupShaderProgram(this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this._bufferData, opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), this.getMvpMatrix(), invertedMask); + this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); + this.gl.useProgram(null); + this.setClippingContextBufferForDraw(null); + this.setClippingContextBufferForMask(null); + } + static doStaticRelease() { + CubismShader_WebGL.deleteInstance(); + } + setRenderState(fbo, viewport) { + s_fbo = fbo; + s_viewport = viewport; + } + preDraw() { + if (this.firstDraw) { + this.firstDraw = false; + this._anisortopy = this.gl.getExtension("EXT_texture_filter_anisotropic") || this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic"); + } + this.gl.disable(this.gl.SCISSOR_TEST); + this.gl.disable(this.gl.STENCIL_TEST); + this.gl.disable(this.gl.DEPTH_TEST); + this.gl.frontFace(this.gl.CW); + this.gl.enable(this.gl.BLEND); + this.gl.colorMask(true, true, true, true); + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null); + } + setClippingContextBufferForMask(clip) { + this._clippingContextBufferForMask = clip; + } + getClippingContextBufferForMask() { + return this._clippingContextBufferForMask; + } + setClippingContextBufferForDraw(clip) { + this._clippingContextBufferForDraw = clip; + } + getClippingContextBufferForDraw() { + return this._clippingContextBufferForDraw; + } + startUp(gl) { + this.gl = gl; + this._clippingManager.setGL(gl); + CubismShader_WebGL.getInstance().setGl(gl); + } +} +CubismRenderer.staticRelease = () => { + CubismRenderer_WebGL.doStaticRelease(); +}; +class CubismModelSettingsJson { + constructor(json) { + this.groups = json.Groups; + this.hitAreas = json.HitAreas; + this.layout = json.Layout; + this.moc = json.FileReferences.Moc; + this.expressions = json.FileReferences.Expressions; + this.motions = json.FileReferences.Motions; + this.textures = json.FileReferences.Textures; + this.physics = json.FileReferences.Physics; + this.pose = json.FileReferences.Pose; + } + getEyeBlinkParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "EyeBlink")) == null ? void 0 : _b.Ids; + } + getLipSyncParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "LipSync")) == null ? void 0 : _b.Ids; + } +} +const HitAreaPrefix = "HitArea"; +const HitAreaHead = "Head"; +const HitAreaBody = "Body"; +const PartsIdCore = "Parts01Core"; +const PartsArmPrefix = "Parts01Arm_"; +const PartsArmLPrefix = "Parts01ArmL_"; +const PartsArmRPrefix = "Parts01ArmR_"; +const ParamAngleX = "ParamAngleX"; +const ParamAngleY = "ParamAngleY"; +const ParamAngleZ = "ParamAngleZ"; +const ParamEyeLOpen = "ParamEyeLOpen"; +const ParamEyeLSmile = "ParamEyeLSmile"; +const ParamEyeROpen = "ParamEyeROpen"; +const ParamEyeRSmile = "ParamEyeRSmile"; +const ParamEyeBallX = "ParamEyeBallX"; +const ParamEyeBallY = "ParamEyeBallY"; +const ParamEyeBallForm = "ParamEyeBallForm"; +const ParamBrowLY = "ParamBrowLY"; +const ParamBrowRY = "ParamBrowRY"; +const ParamBrowLX = "ParamBrowLX"; +const ParamBrowRX = "ParamBrowRX"; +const ParamBrowLAngle = "ParamBrowLAngle"; +const ParamBrowRAngle = "ParamBrowRAngle"; +const ParamBrowLForm = "ParamBrowLForm"; +const ParamBrowRForm = "ParamBrowRForm"; +const ParamMouthForm = "ParamMouthForm"; +const ParamMouthOpenY = "ParamMouthOpenY"; +const ParamCheek = "ParamCheek"; +const ParamBodyAngleX = "ParamBodyAngleX"; +const ParamBodyAngleY = "ParamBodyAngleY"; +const ParamBodyAngleZ = "ParamBodyAngleZ"; +const ParamBreath = "ParamBreath"; +const ParamArmLA = "ParamArmLA"; +const ParamArmRA = "ParamArmRA"; +const ParamArmLB = "ParamArmLB"; +const ParamArmRB = "ParamArmRB"; +const ParamHandL = "ParamHandL"; +const ParamHandR = "ParamHandR"; +const ParamHairFront = "ParamHairFront"; +const ParamHairSide = "ParamHairSide"; +const ParamHairBack = "ParamHairBack"; +const ParamHairFluffy = "ParamHairFluffy"; +const ParamShoulderY = "ParamShoulderY"; +const ParamBustX = "ParamBustX"; +const ParamBustY = "ParamBustY"; +const ParamBaseX = "ParamBaseX"; +const ParamBaseY = "ParamBaseY"; +const ParamNONE = "NONE:"; +const LOGICAL_WIDTH = 2; +const LOGICAL_HEIGHT = 2; +var config; +((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = CubismConfig; +})(config || (config = {})); +const VERSION = "0.4.0"; +const logger = { + log(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } +}; +function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; +} +function rand(min, max) { + return Math.random() * (max - min) + min; +} +function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } +} +function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } +} +function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); +} +function folderName(url2) { + let lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url2 = url2.slice(0, lastSlashIndex); + } + lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url2 = url2.slice(lastSlashIndex + 1); + } + return url2; +} +function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } +} +class ExpressionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self = this; + self.definitions = void 0; + self.expressions = void 0; + } +} +const EPSILON = 0.01; +const MAX_SPEED = 40 / 7.5; +const ACCELERATION_TIME = 1 / (0.15 * 1e3); +class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } +} +class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } +} +var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; +})(MotionPriority || {}); +class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } +} +const TAG$2 = "SoundManager"; +const VOLUME = 0.5; +class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } +} +SoundManager.audios = []; +SoundManager._volume = VOLUME; +var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; +})(MotionPreloadStrategy || {}); +class MotionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self = this; + self.definitions = void 0; + self.motionGroups = void 0; + } +} +const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; +class InternalModel extends EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new Matrix(); + this.drawingMatrix = new Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self = this; + const size = this.getSize(); + self.originalWidth = size[0]; + self.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self.width = this.originalWidth * this.localTransform.a; + self.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } +} +const TAG$1 = "XHRLoader"; +class NetworkError extends Error { + constructor(message, url2, status, aborted = false) { + super(message); + this.url = url2; + this.status = status; + this.aborted = aborted; + } +} +const _XHRLoader = class { + static createXHR(target, url2, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url2); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url2}`); + onerror(new NetworkError("Network error.", url2, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url2, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } +}; +let XHRLoader = _XHRLoader; +XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); +XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); +XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); +}; +function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } +} +class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } +} +Live2DLoader.middlewares = [XHRLoader.loader]; +function createTexture(url2, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (Texture.fromURL) { + return Texture.fromURL(url2, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = Texture.from(url2, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; +} +const TAG = "Live2DFactory"; +const urlToJSON = (context, next) => __async(void 0, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); +}); +const jsonToSettings = (context, next) => __async(void 0, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); +}); +const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); +}; +const setupOptionals = (context, next) => __async(void 0, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } +}); +const setupEssentials = (context, next) => __async(void 0, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url2 = context.settings.resolveURL(tex); + return createTexture(url2, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } +}); +const createInternalModel = (context, next) => __async(void 0, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); +}); +const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } +}; +let Live2DFactory = _Live2DFactory; +Live2DFactory.runtimes = []; +Live2DFactory.urlToJSON = urlToJSON; +Live2DFactory.jsonToSettings = jsonToSettings; +Live2DFactory.waitUntilReady = waitUntilReady; +Live2DFactory.setupOptionals = setupOptionals; +Live2DFactory.setupEssentials = setupEssentials; +Live2DFactory.createInternalModel = createInternalModel; +Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel +]; +Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); +Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); +MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); +}; +ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); +}; +class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } +} +function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); +} +function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); +} +class Live2DTransform extends Transform { +} +const tempPoint = new Point(); +const tempMatrix$1 = new Matrix(); +let tickerRef; +class Live2DModel extends Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix$1.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } +} +applyMixins(Live2DModel, [InteractionMixin]); +const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } +}; +let FileLoader = _FileLoader; +FileLoader.filesMap = {}; +FileLoader.factory = (context, next) => __async(void 0, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url2) { + return _FileLoader.resolveURL(this._objectURL, url2); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); +const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url2) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } +}; +let ZipLoader = _ZipLoader; +ZipLoader.ZIP_PROTOCOL = "zip://"; +ZipLoader.uid = 0; +ZipLoader.factory = (context, next) => __async(void 0, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); +if (!window.Live2DCubismCore) { + throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded."); +} +class Cubism4ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.Name === name); + } + getExpressionFile(definition) { + return definition.File; + } + createExpression(data, definition) { + return CubismExpressionMotion.create(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion, false, performance.now()); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } +} +class Cubism4ModelSettings extends ModelSettings { + constructor(json) { + super(json); + if (!Cubism4ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + Object.assign(this, new CubismModelSettingsJson(json)); + } + static isValidJSON(json) { + var _a; + return !!(json == null ? void 0 : json.FileReferences) && typeof json.FileReferences.Moc === "string" && ((_a = json.FileReferences.Textures) == null ? void 0 : _a.length) > 0 && json.FileReferences.Textures.every((item) => typeof item === "string"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + if (this.motions) { + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].File = replace(motions[i].File, `motions.${group}[${i}].File`); + if (motions[i].Sound !== void 0) { + motions[i].Sound = replace(motions[i].Sound, `motions.${group}[${i}].Sound`); + } + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].File = replace(this.expressions[i].File, `expressions[${i}].File`); + } + } + } +} +applyMixins(Cubism4ModelSettings, [CubismModelSettingsJson]); +class Cubism4MotionManager extends MotionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.groups = { idle: "Idle" }; + this.motionDataType = "json"; + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.motions) != null ? _a : {}; + this.eyeBlinkIds = settings.getEyeBlinkParameters() || []; + this.lipSyncIds = settings.getLipSyncParameters() || []; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism4ExpressionManager(this.settings, options); + } + this.queueManager.setEventCallback((caller, eventValue, customData) => { + this.emit("motion:" + eventValue); + }); + } + isFinished() { + return this.queueManager.isFinished(); + } + _startMotion(motion, onFinish) { + motion.setFinishedMotionHandler(onFinish); + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion, false, performance.now()); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + createMotion(data, group, definition) { + const motion = CubismMotion.create(data); + const json = new CubismMotionJson(data); + const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3; + if (json.getMotionFadeInTime() === void 0) { + motion.setFadeInTime(definition.FadeInTime > 0 ? definition.FadeInTime : defaultFadingDuration); + } + if (json.getMotionFadeOutTime() === void 0) { + motion.setFadeOutTime(definition.FadeOutTime > 0 ? definition.FadeOutTime : defaultFadingDuration); + } + motion.setEffectIds(this.eyeBlinkIds, this.lipSyncIds); + return motion; + } + getMotionFile(definition) { + return definition.File; + } + getMotionName(definition) { + return definition.File; + } + getSoundFile(definition) { + return definition.Sound; + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + destroy() { + super.destroy(); + this.queueManager.release(); + this.queueManager = void 0; + } +} +const tempMatrix = new CubismMatrix44(); +class Cubism4InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.lipSync = true; + this.breath = CubismBreath.create(); + this.renderer = new CubismRenderer_WebGL(); + this.idParamAngleX = ParamAngleX; + this.idParamAngleY = ParamAngleY; + this.idParamAngleZ = ParamAngleZ; + this.idParamEyeBallX = ParamEyeBallX; + this.idParamEyeBallY = ParamEyeBallY; + this.idParamBodyAngleX = ParamBodyAngleX; + this.idParamBreath = ParamBreath; + this.pixelsPerUnit = 1; + this.centeringTransform = new Matrix(); + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism4MotionManager(settings, options); + this.init(); + } + init() { + var _a; + super.init(); + if (((_a = this.settings.getEyeBlinkParameters()) == null ? void 0 : _a.length) > 0) { + this.eyeBlink = CubismEyeBlink.create(this.settings); + } + this.breath.setParameters([ + new BreathParameterData(this.idParamAngleX, 0, 15, 6.5345, 0.5), + new BreathParameterData(this.idParamAngleY, 0, 8, 3.5345, 0.5), + new BreathParameterData(this.idParamAngleZ, 0, 10, 5.5345, 0.5), + new BreathParameterData(this.idParamBodyAngleX, 0, 4, 15.5345, 0.5), + new BreathParameterData(this.idParamBreath, 0, 0.5, 3.2345, 0.5) + ]); + this.renderer.initialize(this.coreModel); + this.renderer.setIsPremultipliedAlpha(true); + } + getSize() { + return [this.coreModel.getModel().canvasinfo.CanvasWidth, this.coreModel.getModel().canvasinfo.CanvasHeight]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + const commonKey = key.charAt(0).toLowerCase() + key.slice(1); + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + setupLayout() { + super.setupLayout(); + this.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit; + this.centeringTransform.scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2); + } + updateWebGLContext(gl, glContextID) { + this.renderer.firstDraw = true; + this.renderer._bufferData = { + vertex: null, + uv: null, + index: null + }; + this.renderer.startUp(gl); + this.renderer._clippingManager._currentFrameNo = glContextID; + this.renderer._clippingManager._maskTexture = void 0; + CubismShader_WebGL.getInstance()._shaderSets = []; + } + bindTexture(index, texture) { + this.renderer.bindTexture(index, texture); + } + getHitAreaDefs() { + var _a, _b; + return (_b = (_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.Id, + name: hitArea.Name, + index: this.coreModel.getDrawableIndex(hitArea.Id) + }))) != null ? _b : []; + } + getDrawableIDs() { + return this.coreModel.getDrawableIds(); + } + getDrawableIndex(id) { + return this.coreModel.getDrawableIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawableIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + const arr = this.coreModel.getDrawableVertices(drawIndex).slice(); + for (let i = 0; i < arr.length; i += 2) { + arr[i] = arr[i] * this.pixelsPerUnit + this.originalWidth / 2; + arr[i + 1] = -arr[i + 1] * this.pixelsPerUnit + this.originalHeight / 2; + } + return arr; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(transform); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + dt /= 1e3; + now /= 1e3; + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParameters(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.updateParameters(model, dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt * 1e3, now * 1e3); + (_c = this.physics) == null ? void 0 : _c.evaluate(model, dt); + (_d = this.pose) == null ? void 0 : _d.updateParameters(model, dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParameters(); + } + updateFocus() { + this.coreModel.addParameterValueById(this.idParamEyeBallX, this.focusController.x); + this.coreModel.addParameterValueById(this.idParamEyeBallY, this.focusController.y); + this.coreModel.addParameterValueById(this.idParamAngleX, this.focusController.x * 30); + this.coreModel.addParameterValueById(this.idParamAngleY, this.focusController.y * 30); + this.coreModel.addParameterValueById(this.idParamAngleZ, this.focusController.x * this.focusController.y * -30); + this.coreModel.addParameterValueById(this.idParamBodyAngleX, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + var _a; + (_a = this.breath) == null ? void 0 : _a.updateParameters(this.coreModel, dt / 1e3); + } + draw(gl) { + const matrix = this.drawingMatrix; + const array = tempMatrix.getArray(); + array[0] = matrix.a; + array[1] = matrix.b; + array[4] = -matrix.c; + array[5] = -matrix.d; + array[12] = matrix.tx; + array[13] = matrix.ty; + this.renderer.setMvpMatrix(tempMatrix); + this.renderer.setRenderState(gl.getParameter(gl.FRAMEBUFFER_BINDING), this.viewport); + this.renderer.drawModel(); + } + destroy() { + super.destroy(); + this.renderer.release(); + this.coreModel.release(); + this.renderer = void 0; + this.coreModel = void 0; + } +} +let startupPromise; +let startupRetries = 20; +function cubism4Ready() { + if (CubismFramework.isStarted()) { + return Promise.resolve(); + } + startupPromise != null ? startupPromise : startupPromise = new Promise((resolve, reject) => { + function startUpWithRetry() { + try { + startUpCubism4(); + resolve(); + } catch (e) { + startupRetries--; + if (startupRetries < 0) { + const err = new Error("Failed to start up Cubism 4 framework."); + err.cause = e; + reject(err); + return; + } + logger.log("Cubism4", "Startup failed, retrying 10ms later..."); + setTimeout(startUpWithRetry, 10); + } + } + startUpWithRetry(); + }); + return startupPromise; +} +function startUpCubism4(options) { + options = Object.assign({ + logFunction: console.log, + loggingLevel: LogLevel.LogLevel_Verbose + }, options); + CubismFramework.startUp(options); + CubismFramework.initialize(); +} +Live2DFactory.registerRuntime({ + version: 4, + ready: cubism4Ready, + test(source) { + return source instanceof Cubism4ModelSettings || Cubism4ModelSettings.isValidJSON(source); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 4) { + return false; + } + const view = new Int8Array(modelData, 0, 4); + return String.fromCharCode(...view) === "MOC3"; + }, + createModelSettings(json) { + return new Cubism4ModelSettings(json); + }, + createCoreModel(data) { + const moc = CubismMoc.create(data); + try { + const model = moc.createModel(); + model.__moc = moc; + return model; + } catch (e) { + try { + moc.release(); + } catch (ignored) { + } + throw e; + } + }, + createInternalModel(coreModel, settings, options) { + const model = new Cubism4InternalModel(coreModel, settings, options); + const coreModelWithMoc = coreModel; + if (coreModelWithMoc.__moc) { + model.__moc = coreModelWithMoc.__moc; + delete coreModelWithMoc.__moc; + model.once("destroy", releaseMoc); + } + return model; + }, + createPhysics(coreModel, data) { + return CubismPhysics.create(data); + }, + createPose(coreModel, data) { + return CubismPose.create(data); + } +}); +function releaseMoc() { + var _a; + (_a = this.__moc) == null ? void 0 : _a.release(); +} +export { ACubismMotion, BreathParameterData, CSM_ASSERT, Constant, Cubism4ExpressionManager, Cubism4InternalModel, Cubism4ModelSettings, Cubism4MotionManager, CubismBlendMode, CubismBreath, CubismClippingContext, CubismClippingManager_WebGL, CubismConfig, CubismDebug, CubismExpressionMotion, CubismEyeBlink, CubismFramework, CubismLogDebug, CubismLogError, CubismLogInfo, CubismLogVerbose, CubismLogWarning, CubismMath, CubismMatrix44, CubismMoc, CubismModel, CubismModelSettingsJson, CubismModelUserData, CubismModelUserDataJson, CubismMotion, CubismMotionCurve, CubismMotionCurveTarget, CubismMotionData, CubismMotionEvent, CubismMotionJson, CubismMotionManager, CubismMotionPoint, CubismMotionQueueEntry, CubismMotionQueueManager, CubismMotionSegment, CubismMotionSegmentType, CubismPhysics, CubismPhysicsInput, CubismPhysicsJson, CubismPhysicsOutput, CubismPhysicsParticle, CubismPhysicsRig, CubismPhysicsSource, CubismPhysicsSubRig, CubismPhysicsTargetType, CubismPose, CubismRenderTextureResource, CubismRenderer, CubismRenderer_WebGL, CubismShader_WebGL, CubismTextureColor, CubismVector2, EvaluationOptionFlag, ExpressionBlendType, ExpressionManager, EyeState, FileLoader, FocusController, HitAreaBody, HitAreaHead, HitAreaPrefix, InteractionMixin, InternalModel, InvalidMotionQueueEntryHandleValue, LOGICAL_HEIGHT, LOGICAL_WIDTH, Live2DFactory, Live2DLoader, Live2DModel, Live2DTransform, LogLevel, ModelSettings, MotionManager, MotionPreloadStrategy, MotionPriority, MotionState, Options, ParamAngleX, ParamAngleY, ParamAngleZ, ParamArmLA, ParamArmLB, ParamArmRA, ParamArmRB, ParamBaseX, ParamBaseY, ParamBodyAngleX, ParamBodyAngleY, ParamBodyAngleZ, ParamBreath, ParamBrowLAngle, ParamBrowLForm, ParamBrowLX, ParamBrowLY, ParamBrowRAngle, ParamBrowRForm, ParamBrowRX, ParamBrowRY, ParamBustX, ParamBustY, ParamCheek, ParamEyeBallForm, ParamEyeBallX, ParamEyeBallY, ParamEyeLOpen, ParamEyeLSmile, ParamEyeROpen, ParamEyeRSmile, ParamHairBack, ParamHairFluffy, ParamHairFront, ParamHairSide, ParamHandL, ParamHandR, ParamMouthForm, ParamMouthOpenY, ParamNONE, ParamShoulderY, PartData, PartsArmLPrefix, PartsArmPrefix, PartsArmRPrefix, PartsIdCore, PhysicsJsonEffectiveForces, ShaderNames, SoundManager, VERSION, XHRLoader, ZipLoader, applyMixins, clamp, config, copyArray, copyProperty, csmRect, cubism4Ready, folderName, fragmentShaderSrcMaskInvertedPremultipliedAlpha, fragmentShaderSrcMaskPremultipliedAlpha, fragmentShaderSrcPremultipliedAlpha, fragmentShaderSrcsetupMask, logger, rand, remove, startUpCubism4, vertexShaderSrc, vertexShaderSrcMasked, vertexShaderSrcSetupMask }; diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism4.js b/live2d/node_modules/pixi-live2d-display/dist/cubism4.js new file mode 100644 index 0000000..03c1fb2 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism4.js @@ -0,0 +1,5709 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@pixi/utils"), require("@pixi/math"), require("@pixi/core"), require("@pixi/display")) : typeof define === "function" && define.amd ? define(["exports", "@pixi/utils", "@pixi/math", "@pixi/core", "@pixi/display"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory((global.PIXI = global.PIXI || {}, global.PIXI.live2d = global.PIXI.live2d || {}), global.PIXI.utils, global.PIXI, global.PIXI, global.PIXI)); +})(this, function(exports2, utils, math, core, display) { + "use strict"; + class CubismBreath { + constructor() { + this._breathParameters = []; + this._currentTime = 0; + } + static create() { + return new CubismBreath(); + } + setParameters(breathParameters) { + this._breathParameters = breathParameters; + } + getParameters() { + return this._breathParameters; + } + updateParameters(model, deltaTimeSeconds) { + this._currentTime += deltaTimeSeconds; + const t = this._currentTime * 2 * 3.14159; + for (let i = 0; i < this._breathParameters.length; ++i) { + const data = this._breathParameters[i]; + model.addParameterValueById(data.parameterId, data.offset + data.peak * Math.sin(t / data.cycle), data.weight); + } + } + } + class BreathParameterData { + constructor(parameterId, offset, peak, cycle, weight) { + this.parameterId = parameterId == void 0 ? void 0 : parameterId; + this.offset = offset == void 0 ? 0 : offset; + this.peak = peak == void 0 ? 0 : peak; + this.cycle = cycle == void 0 ? 0 : cycle; + this.weight = weight == void 0 ? 0 : weight; + } + } + const _CubismEyeBlink = class { + static create(modelSetting) { + return new _CubismEyeBlink(modelSetting); + } + setBlinkingInterval(blinkingInterval) { + this._blinkingIntervalSeconds = blinkingInterval; + } + setBlinkingSetting(closing, closed, opening) { + this._closingSeconds = closing; + this._closedSeconds = closed; + this._openingSeconds = opening; + } + setParameterIds(parameterIds) { + this._parameterIds = parameterIds; + } + getParameterIds() { + return this._parameterIds; + } + updateParameters(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + let parameterValue; + let t = 0; + switch (this._blinkingState) { + case EyeState.EyeState_Closing: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Closed; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1 - t; + break; + case EyeState.EyeState_Closed: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closedSeconds; + if (t >= 1) { + this._blinkingState = EyeState.EyeState_Opening; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 0; + break; + case EyeState.EyeState_Opening: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._openingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + } + parameterValue = t; + break; + case EyeState.EyeState_Interval: + if (this._nextBlinkingTime < this._userTimeSeconds) { + this._blinkingState = EyeState.EyeState_Closing; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1; + break; + case EyeState.EyeState_First: + default: + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + parameterValue = 1; + break; + } + if (!_CubismEyeBlink.CloseIfZero) { + parameterValue = -parameterValue; + } + for (let i = 0; i < this._parameterIds.length; ++i) { + model.setParameterValueById(this._parameterIds[i], parameterValue); + } + } + constructor(modelSetting) { + var _a, _b; + this._blinkingState = EyeState.EyeState_First; + this._nextBlinkingTime = 0; + this._stateStartTimeSeconds = 0; + this._blinkingIntervalSeconds = 4; + this._closingSeconds = 0.1; + this._closedSeconds = 0.05; + this._openingSeconds = 0.15; + this._userTimeSeconds = 0; + this._parameterIds = []; + if (modelSetting == null) { + return; + } + this._parameterIds = (_b = (_a = modelSetting.getEyeBlinkParameters()) == null ? void 0 : _a.slice()) != null ? _b : this._parameterIds; + } + determinNextBlinkingTiming() { + const r = Math.random(); + return this._userTimeSeconds + r * (2 * this._blinkingIntervalSeconds - 1); + } + }; + let CubismEyeBlink = _CubismEyeBlink; + CubismEyeBlink.CloseIfZero = true; + var EyeState = /* @__PURE__ */ ((EyeState2) => { + EyeState2[EyeState2["EyeState_First"] = 0] = "EyeState_First"; + EyeState2[EyeState2["EyeState_Interval"] = 1] = "EyeState_Interval"; + EyeState2[EyeState2["EyeState_Closing"] = 2] = "EyeState_Closing"; + EyeState2[EyeState2["EyeState_Closed"] = 3] = "EyeState_Closed"; + EyeState2[EyeState2["EyeState_Opening"] = 4] = "EyeState_Opening"; + return EyeState2; + })(EyeState || {}); + const Epsilon = 1e-3; + const DefaultFadeInSeconds = 0.5; + class CubismPose { + static create(pose3json) { + const ret = new CubismPose(); + if (typeof pose3json.FadeInTime === "number") { + ret._fadeTimeSeconds = pose3json.FadeInTime; + if (ret._fadeTimeSeconds <= 0) { + ret._fadeTimeSeconds = DefaultFadeInSeconds; + } + } + const poseListInfo = pose3json.Groups; + const poseCount = poseListInfo.length; + for (let poseIndex = 0; poseIndex < poseCount; ++poseIndex) { + const idListInfo = poseListInfo[poseIndex]; + const idCount = idListInfo.length; + let groupCount = 0; + for (let groupIndex = 0; groupIndex < idCount; ++groupIndex) { + const partInfo = idListInfo[groupIndex]; + const partData = new PartData(); + partData.partId = partInfo.Id; + const linkListInfo = partInfo.Link; + if (linkListInfo) { + const linkCount = linkListInfo.length; + for (let linkIndex = 0; linkIndex < linkCount; ++linkIndex) { + const linkPart = new PartData(); + linkPart.partId = linkListInfo[linkIndex]; + partData.link.push(linkPart); + } + } + ret._partGroups.push(partData); + ++groupCount; + } + ret._partGroupCounts.push(groupCount); + } + return ret; + } + updateParameters(model, deltaTimeSeconds) { + if (model != this._lastModel) { + this.reset(model); + } + this._lastModel = model; + if (deltaTimeSeconds < 0) { + deltaTimeSeconds = 0; + } + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; i++) { + const partGroupCount = this._partGroupCounts[i]; + this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount); + beginIndex += partGroupCount; + } + this.copyPartOpacities(model); + } + reset(model) { + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; ++i) { + const groupCount = this._partGroupCounts[i]; + for (let j = beginIndex; j < beginIndex + groupCount; ++j) { + this._partGroups[j].initialize(model); + const partsIndex = this._partGroups[j].partIndex; + const paramIndex = this._partGroups[j].parameterIndex; + if (partsIndex < 0) { + continue; + } + model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1 : 0); + model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1 : 0); + for (let k = 0; k < this._partGroups[j].link.length; ++k) { + this._partGroups[j].link[k].initialize(model); + } + } + beginIndex += groupCount; + } + } + copyPartOpacities(model) { + for (let groupIndex = 0; groupIndex < this._partGroups.length; ++groupIndex) { + const partData = this._partGroups[groupIndex]; + if (partData.link.length == 0) { + continue; + } + const partIndex = this._partGroups[groupIndex].partIndex; + const opacity = model.getPartOpacityByIndex(partIndex); + for (let linkIndex = 0; linkIndex < partData.link.length; ++linkIndex) { + const linkPart = partData.link[linkIndex]; + const linkPartIndex = linkPart.partIndex; + if (linkPartIndex < 0) { + continue; + } + model.setPartOpacityByIndex(linkPartIndex, opacity); + } + } + } + doFade(model, deltaTimeSeconds, beginIndex, partGroupCount) { + let visiblePartIndex = -1; + let newOpacity = 1; + const phi = 0.5; + const backOpacityThreshold = 0.15; + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partIndex = this._partGroups[i].partIndex; + const paramIndex = this._partGroups[i].parameterIndex; + if (model.getParameterValueByIndex(paramIndex) > Epsilon) { + if (visiblePartIndex >= 0) { + break; + } + visiblePartIndex = i; + newOpacity = model.getPartOpacityByIndex(partIndex); + newOpacity += deltaTimeSeconds / this._fadeTimeSeconds; + if (newOpacity > 1) { + newOpacity = 1; + } + } + } + if (visiblePartIndex < 0) { + visiblePartIndex = 0; + newOpacity = 1; + } + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partsIndex = this._partGroups[i].partIndex; + if (visiblePartIndex == i) { + model.setPartOpacityByIndex(partsIndex, newOpacity); + } else { + let opacity = model.getPartOpacityByIndex(partsIndex); + let a1; + if (newOpacity < phi) { + a1 = newOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - newOpacity) * phi / (1 - phi); + } + const backOpacity = (1 - a1) * (1 - newOpacity); + if (backOpacity > backOpacityThreshold) { + a1 = 1 - backOpacityThreshold / (1 - newOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartOpacityByIndex(partsIndex, opacity); + } + } + } + constructor() { + this._fadeTimeSeconds = DefaultFadeInSeconds; + this._lastModel = void 0; + this._partGroups = []; + this._partGroupCounts = []; + } + } + class PartData { + constructor(v) { + this.parameterIndex = 0; + this.partIndex = 0; + this.partId = ""; + this.link = []; + if (v != void 0) { + this.assignment(v); + } + } + assignment(v) { + this.partId = v.partId; + this.link = v.link.map((link) => link.clone()); + return this; + } + initialize(model) { + this.parameterIndex = model.getParameterIndex(this.partId); + this.partIndex = model.getPartIndex(this.partId); + model.setParameterValueByIndex(this.parameterIndex, 1); + } + clone() { + const clonePartData = new PartData(); + clonePartData.partId = this.partId; + clonePartData.parameterIndex = this.parameterIndex; + clonePartData.partIndex = this.partIndex; + clonePartData.link = this.link.map((link) => link.clone()); + return clonePartData; + } + } + class CubismVector2 { + constructor(x, y) { + this.x = x || 0; + this.y = y || 0; + } + add(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x + vector2.x; + ret.y = this.y + vector2.y; + return ret; + } + substract(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x - vector2.x; + ret.y = this.y - vector2.y; + return ret; + } + multiply(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x * vector2.x; + ret.y = this.y * vector2.y; + return ret; + } + multiplyByScaler(scalar) { + return this.multiply(new CubismVector2(scalar, scalar)); + } + division(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x / vector2.x; + ret.y = this.y / vector2.y; + return ret; + } + divisionByScalar(scalar) { + return this.division(new CubismVector2(scalar, scalar)); + } + getLength() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } + getDistanceWith(a) { + return Math.sqrt((this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)); + } + dot(a) { + return this.x * a.x + this.y * a.y; + } + normalize() { + const length = Math.pow(this.x * this.x + this.y * this.y, 0.5); + this.x = this.x / length; + this.y = this.y / length; + } + isEqual(rhs) { + return this.x == rhs.x && this.y == rhs.y; + } + isNotEqual(rhs) { + return !this.isEqual(rhs); + } + } + const _CubismMath = class { + static range(value, min, max) { + if (value < min) { + value = min; + } else if (value > max) { + value = max; + } + return value; + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static abs(x) { + return Math.abs(x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static cbrt(x) { + if (x === 0) { + return x; + } + let cx = x; + const isNegativeNumber = cx < 0; + if (isNegativeNumber) { + cx = -cx; + } + let ret; + if (cx === Infinity) { + ret = Infinity; + } else { + ret = Math.exp(Math.log(cx) / 3); + ret = (cx / (ret * ret) + 2 * ret) / 3; + } + return isNegativeNumber ? -ret : ret; + } + static getEasingSine(value) { + if (value < 0) { + return 0; + } else if (value > 1) { + return 1; + } + return 0.5 - 0.5 * this.cos(value * Math.PI); + } + static max(left, right) { + return left > right ? left : right; + } + static min(left, right) { + return left > right ? right : left; + } + static degreesToRadian(degrees) { + return degrees / 180 * Math.PI; + } + static radianToDegrees(radian) { + return radian * 180 / Math.PI; + } + static directionToRadian(from, to) { + const q1 = Math.atan2(to.y, to.x); + const q2 = Math.atan2(from.y, from.x); + let ret = q1 - q2; + while (ret < -Math.PI) { + ret += Math.PI * 2; + } + while (ret > Math.PI) { + ret -= Math.PI * 2; + } + return ret; + } + static directionToDegrees(from, to) { + const radian = this.directionToRadian(from, to); + let degree = this.radianToDegrees(radian); + if (to.x - from.x > 0) { + degree = -degree; + } + return degree; + } + static radianToDirection(totalAngle) { + const ret = new CubismVector2(); + ret.x = this.sin(totalAngle); + ret.y = this.cos(totalAngle); + return ret; + } + static quadraticEquation(a, b, c) { + if (this.abs(a) < _CubismMath.Epsilon) { + if (this.abs(b) < _CubismMath.Epsilon) { + return -c; + } + return -c / b; + } + return -(b + this.sqrt(b * b - 4 * a * c)) / (2 * a); + } + static cardanoAlgorithmForBezier(a, b, c, d) { + if (this.sqrt(a) < _CubismMath.Epsilon) { + return this.range(this.quadraticEquation(b, c, d), 0, 1); + } + const ba = b / a; + const ca = c / a; + const da = d / a; + const p = (3 * ca - ba * ba) / 3; + const p3 = p / 3; + const q = (2 * ba * ba * ba - 9 * ba * ca + 27 * da) / 27; + const q2 = q / 2; + const discriminant = q2 * q2 + p3 * p3 * p3; + const center = 0.5; + const threshold = center + 0.01; + if (discriminant < 0) { + const mp3 = -p / 3; + const mp33 = mp3 * mp3 * mp3; + const r = this.sqrt(mp33); + const t = -q / (2 * r); + const cosphi = this.range(t, -1, 1); + const phi = Math.acos(cosphi); + const crtr = this.cbrt(r); + const t1 = 2 * crtr; + const root12 = t1 * this.cos(phi / 3) - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = t1 * this.cos((phi + 2 * Math.PI) / 3) - ba / 3; + if (this.abs(root2 - center) < threshold) { + return this.range(root2, 0, 1); + } + const root3 = t1 * this.cos((phi + 4 * Math.PI) / 3) - ba / 3; + return this.range(root3, 0, 1); + } + if (discriminant == 0) { + let u12; + if (q2 < 0) { + u12 = this.cbrt(-q2); + } else { + u12 = -this.cbrt(q2); + } + const root12 = 2 * u12 - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = -u12 - ba / 3; + return this.range(root2, 0, 1); + } + const sd = this.sqrt(discriminant); + const u1 = this.cbrt(sd - q2); + const v1 = this.cbrt(sd + q2); + const root1 = u1 - v1 - ba / 3; + return this.range(root1, 0, 1); + } + constructor() { + } + }; + let CubismMath = _CubismMath; + CubismMath.Epsilon = 1e-5; + class CubismMatrix44 { + constructor() { + this._tr = new Float32Array(16); + this.loadIdentity(); + } + static multiply(a, b, dst) { + const c = new Float32Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]); + const n = 4; + for (let i = 0; i < n; ++i) { + for (let j = 0; j < n; ++j) { + for (let k = 0; k < n; ++k) { + c[j + i * 4] += a[k + i * 4] * b[j + k * 4]; + } + } + } + for (let i = 0; i < 16; ++i) { + dst[i] = c[i]; + } + } + loadIdentity() { + const c = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + this.setMatrix(c); + } + setMatrix(tr) { + for (let i = 0; i < 16; ++i) { + this._tr[i] = tr[i]; + } + } + getArray() { + return this._tr; + } + getScaleX() { + return this._tr[0]; + } + getScaleY() { + return this._tr[5]; + } + getTranslateX() { + return this._tr[12]; + } + getTranslateY() { + return this._tr[13]; + } + transformX(src) { + return this._tr[0] * src + this._tr[12]; + } + transformY(src) { + return this._tr[5] * src + this._tr[13]; + } + invertTransformX(src) { + return (src - this._tr[12]) / this._tr[0]; + } + invertTransformY(src) { + return (src - this._tr[13]) / this._tr[5]; + } + translateRelative(x, y) { + const tr1 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + x, + y, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + translate(x, y) { + this._tr[12] = x; + this._tr[13] = y; + } + translateX(x) { + this._tr[12] = x; + } + translateY(y) { + this._tr[13] = y; + } + scaleRelative(x, y) { + const tr1 = new Float32Array([ + x, + 0, + 0, + 0, + 0, + y, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + scale(x, y) { + this._tr[0] = x; + this._tr[5] = y; + } + multiplyByMatrix(m) { + CubismMatrix44.multiply(m.getArray(), this._tr, this._tr); + } + clone() { + const cloneMatrix = new CubismMatrix44(); + for (let i = 0; i < this._tr.length; i++) { + cloneMatrix._tr[i] = this._tr[i]; + } + return cloneMatrix; + } + } + class CubismRenderer { + initialize(model) { + this._model = model; + } + drawModel() { + if (this.getModel() == null) + return; + this.doDrawModel(); + } + setMvpMatrix(matrix44) { + this._mvpMatrix4x4.setMatrix(matrix44.getArray()); + } + getMvpMatrix() { + return this._mvpMatrix4x4; + } + setModelColor(red, green, blue, alpha) { + if (red < 0) { + red = 0; + } else if (red > 1) { + red = 1; + } + if (green < 0) { + green = 0; + } else if (green > 1) { + green = 1; + } + if (blue < 0) { + blue = 0; + } else if (blue > 1) { + blue = 1; + } + if (alpha < 0) { + alpha = 0; + } else if (alpha > 1) { + alpha = 1; + } + this._modelColor.R = red; + this._modelColor.G = green; + this._modelColor.B = blue; + this._modelColor.A = alpha; + } + getModelColor() { + return Object.assign({}, this._modelColor); + } + setIsPremultipliedAlpha(enable) { + this._isPremultipliedAlpha = enable; + } + isPremultipliedAlpha() { + return this._isPremultipliedAlpha; + } + setIsCulling(culling) { + this._isCulling = culling; + } + isCulling() { + return this._isCulling; + } + setAnisotropy(n) { + this._anisortopy = n; + } + getAnisotropy() { + return this._anisortopy; + } + getModel() { + return this._model; + } + constructor() { + this._isCulling = false; + this._isPremultipliedAlpha = false; + this._anisortopy = 0; + this._modelColor = new CubismTextureColor(); + this._mvpMatrix4x4 = new CubismMatrix44(); + this._mvpMatrix4x4.loadIdentity(); + } + } + var CubismBlendMode = /* @__PURE__ */ ((CubismBlendMode2) => { + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Normal"] = 0] = "CubismBlendMode_Normal"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Additive"] = 1] = "CubismBlendMode_Additive"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Multiplicative"] = 2] = "CubismBlendMode_Multiplicative"; + return CubismBlendMode2; + })(CubismBlendMode || {}); + class CubismTextureColor { + constructor() { + this.R = 1; + this.G = 1; + this.B = 1; + this.A = 1; + } + } + let s_isStarted = false; + let s_isInitialized = false; + let s_option = void 0; + const Constant = { + vertexOffset: 0, + vertexStep: 2 + }; + class CubismFramework { + static startUp(option) { + if (s_isStarted) { + CubismLogInfo("CubismFramework.startUp() is already done."); + return s_isStarted; + } + if (Live2DCubismCore._isStarted) { + s_isStarted = true; + return true; + } + Live2DCubismCore._isStarted = true; + s_option = option; + if (s_option) { + Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction); + } + s_isStarted = true; + if (s_isStarted) { + const version = Live2DCubismCore.Version.csmGetVersion(); + const major = (version & 4278190080) >> 24; + const minor = (version & 16711680) >> 16; + const patch = version & 65535; + const versionNumber = version; + CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`, ("00" + major).slice(-2), ("00" + minor).slice(-2), ("0000" + patch).slice(-4), versionNumber); + } + CubismLogInfo("CubismFramework.startUp() is complete."); + return s_isStarted; + } + static cleanUp() { + s_isStarted = false; + s_isInitialized = false; + s_option = void 0; + } + static initialize() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (s_isInitialized) { + CubismLogWarning("CubismFramework.initialize() skipped, already initialized."); + return; + } + s_isInitialized = true; + CubismLogInfo("CubismFramework.initialize() is complete."); + } + static dispose() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (!s_isInitialized) { + CubismLogWarning("CubismFramework.dispose() skipped, not initialized."); + return; + } + CubismRenderer.staticRelease(); + s_isInitialized = false; + CubismLogInfo("CubismFramework.dispose() is complete."); + } + static isStarted() { + return s_isStarted; + } + static isInitialized() { + return s_isInitialized; + } + static coreLogFunction(message) { + if (!Live2DCubismCore.Logging.csmGetLogFunction()) { + return; + } + Live2DCubismCore.Logging.csmGetLogFunction()(message); + } + static getLoggingLevel() { + if (s_option != null) { + return s_option.loggingLevel; + } + return LogLevel.LogLevel_Off; + } + constructor() { + } + } + var LogLevel = /* @__PURE__ */ ((LogLevel2) => { + LogLevel2[LogLevel2["LogLevel_Verbose"] = 0] = "LogLevel_Verbose"; + LogLevel2[LogLevel2["LogLevel_Debug"] = 1] = "LogLevel_Debug"; + LogLevel2[LogLevel2["LogLevel_Info"] = 2] = "LogLevel_Info"; + LogLevel2[LogLevel2["LogLevel_Warning"] = 3] = "LogLevel_Warning"; + LogLevel2[LogLevel2["LogLevel_Error"] = 4] = "LogLevel_Error"; + LogLevel2[LogLevel2["LogLevel_Off"] = 5] = "LogLevel_Off"; + return LogLevel2; + })(LogLevel || {}); + const CSM_ASSERT = () => { + }; + function CubismLogVerbose(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Verbose, "[CSM][V]" + fmt + "\n", args); + } + function CubismLogDebug(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Debug, "[CSM][D]" + fmt + "\n", args); + } + function CubismLogInfo(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Info, "[CSM][I]" + fmt + "\n", args); + } + function CubismLogWarning(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Warning, "[CSM][W]" + fmt + "\n", args); + } + function CubismLogError(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Error, "[CSM][E]" + fmt + "\n", args); + } + class CubismDebug { + static print(logLevel, format, args) { + if (logLevel < CubismFramework.getLoggingLevel()) { + return; + } + const logPrint = CubismFramework.coreLogFunction; + if (!logPrint) + return; + const buffer = format.replace(/{(\d+)}/g, (m, k) => { + return args[k]; + }); + logPrint(buffer); + } + static dumpBytes(logLevel, data, length) { + for (let i = 0; i < length; i++) { + if (i % 16 == 0 && i > 0) + this.print(logLevel, "\n"); + else if (i % 8 == 0 && i > 0) + this.print(logLevel, " "); + this.print(logLevel, "{0} ", [data[i] & 255]); + } + this.print(logLevel, "\n"); + } + constructor() { + } + } + class CubismModel { + update() { + this._model.update(); + this._model.drawables.resetDynamicFlags(); + } + getCanvasWidth() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit; + } + getCanvasHeight() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit; + } + saveParameters() { + const parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + for (let i = 0; i < parameterCount; ++i) { + if (i < savedParameterCount) { + this._savedParameters[i] = this._parameterValues[i]; + } else { + this._savedParameters.push(this._parameterValues[i]); + } + } + } + getModel() { + return this._model; + } + getPartIndex(partId) { + let partIndex; + const partCount = this._model.parts.count; + for (partIndex = 0; partIndex < partCount; ++partIndex) { + if (partId == this._partIds[partIndex]) { + return partIndex; + } + } + if (partId in this._notExistPartId) { + return this._notExistPartId[partId]; + } + partIndex = partCount + this._notExistPartId.length; + this._notExistPartId[partId] = partIndex; + this._notExistPartOpacities[partIndex] = 0; + return partIndex; + } + getPartCount() { + return this._model.parts.count; + } + setPartOpacityByIndex(partIndex, opacity) { + if (partIndex in this._notExistPartOpacities) { + this._notExistPartOpacities[partIndex] = opacity; + return; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + this._partOpacities[partIndex] = opacity; + } + setPartOpacityById(partId, opacity) { + const index = this.getPartIndex(partId); + if (index < 0) { + return; + } + this.setPartOpacityByIndex(index, opacity); + } + getPartOpacityByIndex(partIndex) { + if (partIndex in this._notExistPartOpacities) { + return this._notExistPartOpacities[partIndex]; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + return this._partOpacities[partIndex]; + } + getPartOpacityById(partId) { + const index = this.getPartIndex(partId); + if (index < 0) { + return 0; + } + return this.getPartOpacityByIndex(index); + } + getParameterIndex(parameterId) { + let parameterIndex; + const idCount = this._model.parameters.count; + for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) { + if (parameterId != this._parameterIds[parameterIndex]) { + continue; + } + return parameterIndex; + } + if (parameterId in this._notExistParameterId) { + return this._notExistParameterId[parameterId]; + } + parameterIndex = this._model.parameters.count + Object.keys(this._notExistParameterId).length; + this._notExistParameterId[parameterId] = parameterIndex; + this._notExistParameterValues[parameterIndex] = 0; + return parameterIndex; + } + getParameterCount() { + return this._model.parameters.count; + } + getParameterMaximumValue(parameterIndex) { + return this._model.parameters.maximumValues[parameterIndex]; + } + getParameterMinimumValue(parameterIndex) { + return this._model.parameters.minimumValues[parameterIndex]; + } + getParameterDefaultValue(parameterIndex) { + return this._model.parameters.defaultValues[parameterIndex]; + } + getParameterValueByIndex(parameterIndex) { + if (parameterIndex in this._notExistParameterValues) { + return this._notExistParameterValues[parameterIndex]; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + return this._parameterValues[parameterIndex]; + } + getParameterValueById(parameterId) { + const parameterIndex = this.getParameterIndex(parameterId); + return this.getParameterValueByIndex(parameterIndex); + } + setParameterValueByIndex(parameterIndex, value, weight = 1) { + if (parameterIndex in this._notExistParameterValues) { + this._notExistParameterValues[parameterIndex] = weight == 1 ? value : this._notExistParameterValues[parameterIndex] * (1 - weight) + value * weight; + return; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + if (this._model.parameters.maximumValues[parameterIndex] < value) { + value = this._model.parameters.maximumValues[parameterIndex]; + } + if (this._model.parameters.minimumValues[parameterIndex] > value) { + value = this._model.parameters.minimumValues[parameterIndex]; + } + this._parameterValues[parameterIndex] = weight == 1 ? value : this._parameterValues[parameterIndex] = this._parameterValues[parameterIndex] * (1 - weight) + value * weight; + } + setParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.setParameterValueByIndex(index, value, weight); + } + addParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) + value * weight); + } + addParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.addParameterValueByIndex(index, value, weight); + } + multiplyParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.multiplyParameterValueByIndex(index, value, weight); + } + multiplyParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) * (1 + (value - 1) * weight)); + } + getDrawableIds() { + return this._drawableIds.slice(); + } + getDrawableIndex(drawableId) { + const drawableCount = this._model.drawables.count; + for (let drawableIndex = 0; drawableIndex < drawableCount; ++drawableIndex) { + if (this._drawableIds[drawableIndex] == drawableId) { + return drawableIndex; + } + } + return -1; + } + getDrawableCount() { + return this._model.drawables.count; + } + getDrawableId(drawableIndex) { + return this._model.drawables.ids[drawableIndex]; + } + getDrawableRenderOrders() { + return this._model.drawables.renderOrders; + } + getDrawableTextureIndices(drawableIndex) { + return this._model.drawables.textureIndices[drawableIndex]; + } + getDrawableDynamicFlagVertexPositionsDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableVertexIndexCount(drawableIndex) { + return this._model.drawables.indexCounts[drawableIndex]; + } + getDrawableVertexCount(drawableIndex) { + return this._model.drawables.vertexCounts[drawableIndex]; + } + getDrawableVertices(drawableIndex) { + return this.getDrawableVertexPositions(drawableIndex); + } + getDrawableVertexIndices(drawableIndex) { + return this._model.drawables.indices[drawableIndex]; + } + getDrawableVertexPositions(drawableIndex) { + return this._model.drawables.vertexPositions[drawableIndex]; + } + getDrawableVertexUvs(drawableIndex) { + return this._model.drawables.vertexUvs[drawableIndex]; + } + getDrawableOpacity(drawableIndex) { + return this._model.drawables.opacities[drawableIndex]; + } + getDrawableCulling(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); + } + getDrawableBlendMode(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Additive : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Multiplicative : CubismBlendMode.CubismBlendMode_Normal; + } + getDrawableInvertedMaskBit(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]); + } + getDrawableMasks() { + return this._model.drawables.masks; + } + getDrawableMaskCounts() { + return this._model.drawables.maskCounts; + } + isUsingMasking() { + for (let d = 0; d < this._model.drawables.count; ++d) { + if (this._model.drawables.maskCounts[d] <= 0) { + continue; + } + return true; + } + return false; + } + getDrawableDynamicFlagIsVisible(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagVisibilityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagOpacityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasOpacityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagRenderOrderDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(dynamicFlags[drawableIndex]); + } + loadParameters() { + let parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + if (parameterCount > savedParameterCount) { + parameterCount = savedParameterCount; + } + for (let i = 0; i < parameterCount; ++i) { + this._parameterValues[i] = this._savedParameters[i]; + } + } + initialize() { + this._parameterValues = this._model.parameters.values; + this._partOpacities = this._model.parts.opacities; + this._parameterMaximumValues = this._model.parameters.maximumValues; + this._parameterMinimumValues = this._model.parameters.minimumValues; + { + const parameterIds = this._model.parameters.ids; + const parameterCount = this._model.parameters.count; + for (let i = 0; i < parameterCount; ++i) { + this._parameterIds.push(parameterIds[i]); + } + } + { + const partIds = this._model.parts.ids; + const partCount = this._model.parts.count; + for (let i = 0; i < partCount; ++i) { + this._partIds.push(partIds[i]); + } + } + { + const drawableIds = this._model.drawables.ids; + const drawableCount = this._model.drawables.count; + for (let i = 0; i < drawableCount; ++i) { + this._drawableIds.push(drawableIds[i]); + } + } + } + constructor(model) { + this._model = model; + this._savedParameters = []; + this._parameterIds = []; + this._drawableIds = []; + this._partIds = []; + this._notExistPartId = {}; + this._notExistParameterId = {}; + this._notExistParameterValues = {}; + this._notExistPartOpacities = {}; + this.initialize(); + } + release() { + this._model.release(); + this._model = void 0; + } + } + class CubismMoc { + static create(mocBytes) { + const moc = Live2DCubismCore.Moc.fromArrayBuffer(mocBytes); + if (moc) { + return new CubismMoc(moc); + } + throw new Error("Unknown error"); + } + createModel() { + let cubismModel; + const model = Live2DCubismCore.Model.fromMoc(this._moc); + if (model) { + cubismModel = new CubismModel(model); + ++this._modelCount; + return cubismModel; + } + throw new Error("Unknown error"); + } + deleteModel(model) { + if (model != null) { + --this._modelCount; + } + } + constructor(moc) { + this._moc = moc; + this._modelCount = 0; + } + release() { + this._moc._release(); + this._moc = void 0; + } + } + class CubismModelUserDataJson { + constructor(json, size) { + this._json = json; + } + release() { + this._json = void 0; + } + getUserDataCount() { + return this._json.Meta.UserDataCount; + } + getTotalUserDataSize() { + return this._json.Meta.TotalUserDataSize; + } + getUserDataTargetType(i) { + return this._json.UserData[i].Target; + } + getUserDataId(i) { + return this._json.UserData[i].Id; + } + getUserDataValue(i) { + return this._json.UserData[i].Value; + } + } + const ArtMesh = "ArtMesh"; + class CubismModelUserData { + static create(json, size) { + const ret = new CubismModelUserData(); + ret.parseUserData(json, size); + return ret; + } + getArtMeshUserDatas() { + return this._artMeshUserDataNode; + } + parseUserData(data, size) { + let json = new CubismModelUserDataJson(data, size); + const typeOfArtMesh = ArtMesh; + const nodeCount = json.getUserDataCount(); + for (let i = 0; i < nodeCount; i++) { + const addNode = { + targetId: json.getUserDataId(i), + targetType: json.getUserDataTargetType(i), + value: json.getUserDataValue(i) + }; + this._userDataNodes.push(addNode); + if (addNode.targetType == typeOfArtMesh) { + this._artMeshUserDataNode.push(addNode); + } + } + json.release(); + } + constructor() { + this._userDataNodes = []; + this._artMeshUserDataNode = []; + } + release() { + this._userDataNodes = null; + } + } + class ACubismMotion { + constructor() { + this._fadeInSeconds = -1; + this._fadeOutSeconds = -1; + this._weight = 1; + this._offsetSeconds = 0; + this._firedEventValues = []; + } + release() { + this._weight = 0; + } + updateParameters(model, motionQueueEntry, userTimeSeconds) { + if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) { + return; + } + if (!motionQueueEntry.isStarted()) { + motionQueueEntry.setIsStarted(true); + motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + const duration = this.getDuration(); + if (motionQueueEntry.getEndTime() < 0) { + motionQueueEntry.setEndTime(duration <= 0 ? -1 : motionQueueEntry.getStartTime() + duration); + } + } + let fadeWeight = this._weight; + const fadeIn = this._fadeInSeconds == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const fadeOut = this._fadeOutSeconds == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + fadeWeight = fadeWeight * fadeIn * fadeOut; + motionQueueEntry.setState(userTimeSeconds, fadeWeight); + this.doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry); + if (motionQueueEntry.getEndTime() > 0 && motionQueueEntry.getEndTime() < userTimeSeconds) { + motionQueueEntry.setIsFinished(true); + } + } + setFadeInTime(fadeInSeconds) { + this._fadeInSeconds = fadeInSeconds; + } + setFadeOutTime(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + } + getFadeOutTime() { + return this._fadeOutSeconds; + } + getFadeInTime() { + return this._fadeInSeconds; + } + setWeight(weight) { + this._weight = weight; + } + getWeight() { + return this._weight; + } + getDuration() { + return -1; + } + getLoopDuration() { + return -1; + } + setOffsetTime(offsetSeconds) { + this._offsetSeconds = offsetSeconds; + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + return this._firedEventValues; + } + setFinishedMotionHandler(onFinishedMotionHandler) { + this._onFinishedMotion = onFinishedMotionHandler; + } + getFinishedMotionHandler() { + return this._onFinishedMotion; + } + } + const DefaultFadeTime = 1; + class CubismExpressionMotion extends ACubismMotion { + constructor() { + super(); + this._parameters = []; + } + static create(json) { + const expression = new CubismExpressionMotion(); + const fadeInTime = json.FadeInTime; + const fadeOutTime = json.FadeOutTime; + expression.setFadeInTime(fadeInTime !== void 0 ? fadeInTime : DefaultFadeTime); + expression.setFadeOutTime(fadeOutTime !== void 0 ? fadeOutTime : DefaultFadeTime); + const parameters = json.Parameters || []; + for (let i = 0; i < parameters.length; ++i) { + const param = parameters[i]; + const parameterId = param.Id; + const value = param.Value; + let blendType; + switch (param.Blend) { + case "Multiply": + blendType = ExpressionBlendType.ExpressionBlendType_Multiply; + break; + case "Overwrite": + blendType = ExpressionBlendType.ExpressionBlendType_Overwrite; + break; + case "Add": + default: + blendType = ExpressionBlendType.ExpressionBlendType_Add; + break; + } + const item = { + parameterId, + blendType, + value + }; + expression._parameters.push(item); + } + return expression; + } + doUpdateParameters(model, userTimeSeconds, weight, motionQueueEntry) { + for (let i = 0; i < this._parameters.length; ++i) { + const parameter = this._parameters[i]; + switch (parameter.blendType) { + case ExpressionBlendType.ExpressionBlendType_Add: { + model.addParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Multiply: { + model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Overwrite: { + model.setParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + } + } + } + } + var ExpressionBlendType = /* @__PURE__ */ ((ExpressionBlendType2) => { + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Add"] = 0] = "ExpressionBlendType_Add"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Multiply"] = 1] = "ExpressionBlendType_Multiply"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Overwrite"] = 2] = "ExpressionBlendType_Overwrite"; + return ExpressionBlendType2; + })(ExpressionBlendType || {}); + exports2.CubismConfig = void 0; + ((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; + })(exports2.CubismConfig || (exports2.CubismConfig = {})); + var CubismMotionCurveTarget = /* @__PURE__ */ ((CubismMotionCurveTarget2) => { + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Model"] = 0] = "CubismMotionCurveTarget_Model"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Parameter"] = 1] = "CubismMotionCurveTarget_Parameter"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_PartOpacity"] = 2] = "CubismMotionCurveTarget_PartOpacity"; + return CubismMotionCurveTarget2; + })(CubismMotionCurveTarget || {}); + var CubismMotionSegmentType = /* @__PURE__ */ ((CubismMotionSegmentType2) => { + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Linear"] = 0] = "CubismMotionSegmentType_Linear"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Bezier"] = 1] = "CubismMotionSegmentType_Bezier"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Stepped"] = 2] = "CubismMotionSegmentType_Stepped"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_InverseStepped"] = 3] = "CubismMotionSegmentType_InverseStepped"; + return CubismMotionSegmentType2; + })(CubismMotionSegmentType || {}); + class CubismMotionPoint { + constructor(time = 0, value = 0) { + this.time = time; + this.value = value; + } + } + class CubismMotionSegment { + constructor() { + this.basePointIndex = 0; + this.segmentType = 0; + } + } + class CubismMotionCurve { + constructor() { + this.id = ""; + this.type = 0; + this.segmentCount = 0; + this.baseSegmentIndex = 0; + this.fadeInTime = 0; + this.fadeOutTime = 0; + } + } + class CubismMotionEvent { + constructor() { + this.fireTime = 0; + this.value = ""; + } + } + class CubismMotionData { + constructor() { + this.duration = 0; + this.loop = false; + this.curveCount = 0; + this.eventCount = 0; + this.fps = 0; + this.curves = []; + this.segments = []; + this.points = []; + this.events = []; + } + } + class CubismMotionJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getMotionDuration() { + return this._json.Meta.Duration; + } + isMotionLoop() { + return this._json.Meta.Loop || false; + } + getEvaluationOptionFlag(flagType) { + if (EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted == flagType) { + return !!this._json.Meta.AreBeziersRestricted; + } + return false; + } + getMotionCurveCount() { + return this._json.Meta.CurveCount; + } + getMotionFps() { + return this._json.Meta.Fps; + } + getMotionTotalSegmentCount() { + return this._json.Meta.TotalSegmentCount; + } + getMotionTotalPointCount() { + return this._json.Meta.TotalPointCount; + } + getMotionFadeInTime() { + return this._json.Meta.FadeInTime; + } + getMotionFadeOutTime() { + return this._json.Meta.FadeOutTime; + } + getMotionCurveTarget(curveIndex) { + return this._json.Curves[curveIndex].Target; + } + getMotionCurveId(curveIndex) { + return this._json.Curves[curveIndex].Id; + } + getMotionCurveFadeInTime(curveIndex) { + return this._json.Curves[curveIndex].FadeInTime; + } + getMotionCurveFadeOutTime(curveIndex) { + return this._json.Curves[curveIndex].FadeOutTime; + } + getMotionCurveSegmentCount(curveIndex) { + return this._json.Curves[curveIndex].Segments.length; + } + getMotionCurveSegment(curveIndex, segmentIndex) { + return this._json.Curves[curveIndex].Segments[segmentIndex]; + } + getEventCount() { + return this._json.Meta.UserDataCount || 0; + } + getTotalEventValueSize() { + return this._json.Meta.TotalUserDataSize; + } + getEventTime(userDataIndex) { + return this._json.UserData[userDataIndex].Time; + } + getEventValue(userDataIndex) { + return this._json.UserData[userDataIndex].Value; + } + } + var EvaluationOptionFlag = /* @__PURE__ */ ((EvaluationOptionFlag2) => { + EvaluationOptionFlag2[EvaluationOptionFlag2["EvaluationOptionFlag_AreBeziersRistricted"] = 0] = "EvaluationOptionFlag_AreBeziersRistricted"; + return EvaluationOptionFlag2; + })(EvaluationOptionFlag || {}); + const EffectNameEyeBlink = "EyeBlink"; + const EffectNameLipSync = "LipSync"; + const TargetNameModel = "Model"; + const TargetNameParameter = "Parameter"; + const TargetNamePartOpacity = "PartOpacity"; + const UseOldBeziersCurveMotion = false; + function lerpPoints(a, b, t) { + const result = new CubismMotionPoint(); + result.time = a.time + (b.time - a.time) * t; + result.value = a.value + (b.value - a.value) * t; + return result; + } + function linearEvaluate(points, time) { + let t = (time - points[0].time) / (points[1].time - points[0].time); + if (t < 0) { + t = 0; + } + return points[0].value + (points[1].value - points[0].value) * t; + } + function bezierEvaluate(points, time) { + let t = (time - points[0].time) / (points[3].time - points[0].time); + if (t < 0) { + t = 0; + } + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; + } + function bezierEvaluateCardanoInterpretation(points, time) { + const x = time; + const x1 = points[0].time; + const x2 = points[3].time; + const cx1 = points[1].time; + const cx2 = points[2].time; + const a = x2 - 3 * cx2 + 3 * cx1 - x1; + const b = 3 * cx2 - 6 * cx1 + 3 * x1; + const c = 3 * cx1 - 3 * x1; + const d = x1 - x; + const t = CubismMath.cardanoAlgorithmForBezier(a, b, c, d); + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; + } + function steppedEvaluate(points, time) { + return points[0].value; + } + function inverseSteppedEvaluate(points, time) { + return points[1].value; + } + function evaluateCurve(motionData, index, time) { + const curve = motionData.curves[index]; + let target = -1; + const totalSegmentCount = curve.baseSegmentIndex + curve.segmentCount; + let pointPosition = 0; + for (let i = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { + pointPosition = motionData.segments[i].basePointIndex + (motionData.segments[i].segmentType == CubismMotionSegmentType.CubismMotionSegmentType_Bezier ? 3 : 1); + if (motionData.points[pointPosition].time > time) { + target = i; + break; + } + } + if (target == -1) { + return motionData.points[pointPosition].value; + } + const segment = motionData.segments[target]; + return segment.evaluate(motionData.points.slice(segment.basePointIndex), time); + } + class CubismMotion extends ACubismMotion { + constructor() { + super(); + this._eyeBlinkParameterIds = []; + this._lipSyncParameterIds = []; + this._sourceFrameRate = 30; + this._loopDurationSeconds = -1; + this._isLoop = false; + this._isLoopFadeIn = true; + this._lastWeight = 0; + } + static create(json, onFinishedMotionHandler) { + const ret = new CubismMotion(); + ret.parse(json); + ret._sourceFrameRate = ret._motionData.fps; + ret._loopDurationSeconds = ret._motionData.duration; + ret._onFinishedMotion = onFinishedMotionHandler; + return ret; + } + doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry) { + if (this._modelCurveIdEyeBlink == null) { + this._modelCurveIdEyeBlink = EffectNameEyeBlink; + } + if (this._modelCurveIdLipSync == null) { + this._modelCurveIdLipSync = EffectNameLipSync; + } + let timeOffsetSeconds = userTimeSeconds - motionQueueEntry.getStartTime(); + if (timeOffsetSeconds < 0) { + timeOffsetSeconds = 0; + } + let lipSyncValue = Number.MAX_VALUE; + let eyeBlinkValue = Number.MAX_VALUE; + const MaxTargetSize = 64; + let lipSyncFlags = 0; + let eyeBlinkFlags = 0; + if (this._eyeBlinkParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many eye blink targets : {0}", this._eyeBlinkParameterIds.length); + } + if (this._lipSyncParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many lip sync targets : {0}", this._lipSyncParameterIds.length); + } + const tmpFadeIn = this._fadeInSeconds <= 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const tmpFadeOut = this._fadeOutSeconds <= 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + let value; + let c, parameterIndex; + let time = timeOffsetSeconds; + if (this._isLoop) { + while (time > this._motionData.duration) { + time -= this._motionData.duration; + } + } + const curves = this._motionData.curves; + for (c = 0; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (curves[c].id == this._modelCurveIdEyeBlink) { + eyeBlinkValue = value; + } else if (curves[c].id == this._modelCurveIdLipSync) { + lipSyncValue = value; + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; ++c) { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + const sourceValue = model.getParameterValueByIndex(parameterIndex); + value = evaluateCurve(this._motionData, c, time); + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + if (this._eyeBlinkParameterIds[i] == curves[c].id) { + value *= eyeBlinkValue; + eyeBlinkFlags |= 1 << i; + break; + } + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + if (this._lipSyncParameterIds[i] == curves[c].id) { + value += lipSyncValue; + lipSyncFlags |= 1 << i; + break; + } + } + } + let v; + if (curves[c].fadeInTime < 0 && curves[c].fadeOutTime < 0) { + v = sourceValue + (value - sourceValue) * fadeWeight; + } else { + let fin; + let fout; + if (curves[c].fadeInTime < 0) { + fin = tmpFadeIn; + } else { + fin = curves[c].fadeInTime == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / curves[c].fadeInTime); + } + if (curves[c].fadeOutTime < 0) { + fout = tmpFadeOut; + } else { + fout = curves[c].fadeOutTime == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / curves[c].fadeOutTime); + } + const paramWeight = this._weight * fin * fout; + v = sourceValue + (value - sourceValue) * paramWeight; + } + model.setParameterValueByIndex(parameterIndex, v, 1); + } + { + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._eyeBlinkParameterIds[i]); + if (eyeBlinkFlags >> i & 1) { + continue; + } + const v = sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._eyeBlinkParameterIds[i], v); + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._lipSyncParameterIds[i]); + if (lipSyncFlags >> i & 1) { + continue; + } + const v = sourceValue + (lipSyncValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._lipSyncParameterIds[i], v); + } + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (exports2.CubismConfig.setOpacityFromMotion) { + model.setPartOpacityById(curves[c].id, value); + } else { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + model.setParameterValueByIndex(parameterIndex, value); + } + } + if (timeOffsetSeconds >= this._motionData.duration) { + if (this._isLoop) { + motionQueueEntry.setStartTime(userTimeSeconds); + if (this._isLoopFadeIn) { + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + } + } else { + if (this._onFinishedMotion) { + this._onFinishedMotion(this); + } + motionQueueEntry.setIsFinished(true); + } + } + this._lastWeight = fadeWeight; + } + setIsLoop(loop) { + this._isLoop = loop; + } + isLoop() { + return this._isLoop; + } + setIsLoopFadeIn(loopFadeIn) { + this._isLoopFadeIn = loopFadeIn; + } + isLoopFadeIn() { + return this._isLoopFadeIn; + } + getDuration() { + return this._isLoop ? -1 : this._loopDurationSeconds; + } + getLoopDuration() { + return this._loopDurationSeconds; + } + setParameterFadeInTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeInTime = value; + return; + } + } + } + setParameterFadeOutTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeOutTime = value; + return; + } + } + } + getParameterFadeInTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeInTime; + } + } + return -1; + } + getParameterFadeOutTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeOutTime; + } + } + return -1; + } + setEffectIds(eyeBlinkParameterIds, lipSyncParameterIds) { + this._eyeBlinkParameterIds = eyeBlinkParameterIds; + this._lipSyncParameterIds = lipSyncParameterIds; + } + release() { + this._motionData = void 0; + } + parse(motionJson) { + this._motionData = new CubismMotionData(); + let json = new CubismMotionJson(motionJson); + this._motionData.duration = json.getMotionDuration(); + this._motionData.loop = json.isMotionLoop(); + this._motionData.curveCount = json.getMotionCurveCount(); + this._motionData.fps = json.getMotionFps(); + this._motionData.eventCount = json.getEventCount(); + const areBeziersRestructed = json.getEvaluationOptionFlag(EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted); + const fadeInSeconds = json.getMotionFadeInTime(); + const fadeOutSeconds = json.getMotionFadeOutTime(); + if (fadeInSeconds !== void 0) { + this._fadeInSeconds = fadeInSeconds < 0 ? 1 : fadeInSeconds; + } else { + this._fadeInSeconds = 1; + } + if (fadeOutSeconds !== void 0) { + this._fadeOutSeconds = fadeOutSeconds < 0 ? 1 : fadeOutSeconds; + } else { + this._fadeOutSeconds = 1; + } + this._motionData.curves = Array.from({ length: this._motionData.curveCount }).map(() => new CubismMotionCurve()); + this._motionData.segments = Array.from({ length: json.getMotionTotalSegmentCount() }).map(() => new CubismMotionSegment()); + this._motionData.events = Array.from({ length: this._motionData.eventCount }).map(() => new CubismMotionEvent()); + this._motionData.points = []; + let totalPointCount = 0; + let totalSegmentCount = 0; + for (let curveCount = 0; curveCount < this._motionData.curveCount; ++curveCount) { + const curve = this._motionData.curves[curveCount]; + switch (json.getMotionCurveTarget(curveCount)) { + case TargetNameModel: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + break; + case TargetNameParameter: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; + break; + case TargetNamePartOpacity: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; + break; + default: + CubismLogWarning('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!'); + } + curve.id = json.getMotionCurveId(curveCount); + curve.baseSegmentIndex = totalSegmentCount; + const fadeInTime = json.getMotionCurveFadeInTime(curveCount); + const fadeOutTime = json.getMotionCurveFadeOutTime(curveCount); + curve.fadeInTime = fadeInTime !== void 0 ? fadeInTime : -1; + curve.fadeOutTime = fadeOutTime !== void 0 ? fadeOutTime : -1; + for (let segmentPosition = 0; segmentPosition < json.getMotionCurveSegmentCount(curveCount); ) { + if (segmentPosition == 0) { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition), json.getMotionCurveSegment(curveCount, segmentPosition + 1)); + totalPointCount += 1; + segmentPosition += 2; + } else { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount - 1; + } + const segment = json.getMotionCurveSegment(curveCount, segmentPosition); + switch (segment) { + case CubismMotionSegmentType.CubismMotionSegmentType_Linear: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear; + this._motionData.segments[totalSegmentCount].evaluate = linearEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier; + if (areBeziersRestructed || UseOldBeziersCurveMotion) { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluate; + } else { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluateCardanoInterpretation; + } + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + this._motionData.points[totalPointCount + 1] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 3), json.getMotionCurveSegment(curveCount, segmentPosition + 4)); + this._motionData.points[totalPointCount + 2] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 5), json.getMotionCurveSegment(curveCount, segmentPosition + 6)); + totalPointCount += 3; + segmentPosition += 7; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped; + this._motionData.segments[totalSegmentCount].evaluate = steppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; + this._motionData.segments[totalSegmentCount].evaluate = inverseSteppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + } + ++curve.segmentCount; + ++totalSegmentCount; + } + this._motionData.curves.push(curve); + } + for (let userdatacount = 0; userdatacount < json.getEventCount(); ++userdatacount) { + this._motionData.events[userdatacount].fireTime = json.getEventTime(userdatacount); + this._motionData.events[userdatacount].value = json.getEventValue(userdatacount); + } + json.release(); + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + this._firedEventValues.length = 0; + for (let u = 0; u < this._motionData.eventCount; ++u) { + if (this._motionData.events[u].fireTime > beforeCheckTimeSeconds && this._motionData.events[u].fireTime <= motionTimeSeconds) { + this._firedEventValues.push(this._motionData.events[u].value); + } + } + return this._firedEventValues; + } + } + class CubismMotionQueueEntry { + constructor() { + this._autoDelete = false; + this._available = true; + this._finished = false; + this._started = false; + this._startTimeSeconds = -1; + this._fadeInStartTimeSeconds = 0; + this._endTimeSeconds = -1; + this._stateTimeSeconds = 0; + this._stateWeight = 0; + this._lastEventCheckSeconds = 0; + this._motionQueueEntryHandle = this; + this._fadeOutSeconds = 0; + this._isTriggeredFadeOut = false; + } + release() { + if (this._autoDelete && this._motion) { + this._motion.release(); + } + } + setFadeOut(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + this._isTriggeredFadeOut = true; + } + startFadeOut(fadeOutSeconds, userTimeSeconds) { + const newEndTimeSeconds = userTimeSeconds + fadeOutSeconds; + this._isTriggeredFadeOut = true; + if (this._endTimeSeconds < 0 || newEndTimeSeconds < this._endTimeSeconds) { + this._endTimeSeconds = newEndTimeSeconds; + } + } + isFinished() { + return this._finished; + } + isStarted() { + return this._started; + } + getStartTime() { + return this._startTimeSeconds; + } + getFadeInStartTime() { + return this._fadeInStartTimeSeconds; + } + getEndTime() { + return this._endTimeSeconds; + } + setStartTime(startTime) { + this._startTimeSeconds = startTime; + } + setFadeInStartTime(startTime) { + this._fadeInStartTimeSeconds = startTime; + } + setEndTime(endTime) { + this._endTimeSeconds = endTime; + } + setIsFinished(f) { + this._finished = f; + } + setIsStarted(f) { + this._started = f; + } + isAvailable() { + return this._available; + } + setIsAvailable(v) { + this._available = v; + } + setState(timeSeconds, weight) { + this._stateTimeSeconds = timeSeconds; + this._stateWeight = weight; + } + getStateTime() { + return this._stateTimeSeconds; + } + getStateWeight() { + return this._stateWeight; + } + getLastCheckEventSeconds() { + return this._lastEventCheckSeconds; + } + setLastCheckEventSeconds(checkSeconds) { + this._lastEventCheckSeconds = checkSeconds; + } + isTriggeredFadeOut() { + return this._isTriggeredFadeOut; + } + getFadeOutSeconds() { + return this._fadeOutSeconds; + } + } + class CubismMotionQueueManager { + constructor() { + this._userTimeSeconds = 0; + this._eventCustomData = null; + this._motions = []; + } + release() { + for (let i = 0; i < this._motions.length; ++i) { + if (this._motions[i]) { + this._motions[i].release(); + } + } + this._motions = void 0; + } + startMotion(motion, autoDelete, userTimeSeconds) { + if (motion == null) { + return InvalidMotionQueueEntryHandleValue; + } + let motionQueueEntry; + for (let i = 0; i < this._motions.length; ++i) { + motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + motionQueueEntry.setFadeOut(motionQueueEntry._motion.getFadeOutTime()); + } + motionQueueEntry = new CubismMotionQueueEntry(); + motionQueueEntry._autoDelete = autoDelete; + motionQueueEntry._motion = motion; + this._motions.push(motionQueueEntry); + return motionQueueEntry._motionQueueEntryHandle; + } + isFinished() { + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + if (!motionQueueEntry.isFinished()) { + return false; + } + i++; + } + return true; + } + isFinishedByHandle(motionQueueEntryNumber) { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber && !motionQueueEntry.isFinished()) { + return false; + } + } + return true; + } + stopAllMotions() { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry != null) { + motionQueueEntry.release(); + } + } + this._motions = []; + } + getCubismMotionQueueEntry(motionQueueEntryNumber) { + return this._motions.find((entry) => entry != null && entry._motionQueueEntryHandle == motionQueueEntryNumber); + } + setEventCallback(callback, customData = null) { + this._eventCallBack = callback; + this._eventCustomData = customData; + } + doUpdateMotion(model, userTimeSeconds) { + let updated = false; + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + motion.updateParameters(model, motionQueueEntry, userTimeSeconds); + updated = true; + const firedList = motion.getFiredEvent(motionQueueEntry.getLastCheckEventSeconds() - motionQueueEntry.getStartTime(), userTimeSeconds - motionQueueEntry.getStartTime()); + for (let i2 = 0; i2 < firedList.length; ++i2) { + this._eventCallBack(this, firedList[i2], this._eventCustomData); + } + motionQueueEntry.setLastCheckEventSeconds(userTimeSeconds); + if (motionQueueEntry.isFinished()) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + } else { + if (motionQueueEntry.isTriggeredFadeOut()) { + motionQueueEntry.startFadeOut(motionQueueEntry.getFadeOutSeconds(), userTimeSeconds); + } + i++; + } + } + return updated; + } + } + const InvalidMotionQueueEntryHandleValue = -1; + class CubismMotionManager extends CubismMotionQueueManager { + constructor() { + super(); + this._currentPriority = 0; + this._reservePriority = 0; + } + getCurrentPriority() { + return this._currentPriority; + } + getReservePriority() { + return this._reservePriority; + } + setReservePriority(val) { + this._reservePriority = val; + } + startMotionPriority(motion, autoDelete, priority) { + if (priority == this._reservePriority) { + this._reservePriority = 0; + } + this._currentPriority = priority; + return super.startMotion(motion, autoDelete, this._userTimeSeconds); + } + updateMotion(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + const updated = super.doUpdateMotion(model, this._userTimeSeconds); + if (this.isFinished()) { + this._currentPriority = 0; + } + return updated; + } + reserveMotion(priority) { + if (priority <= this._reservePriority || priority <= this._currentPriority) { + return false; + } + this._reservePriority = priority; + return true; + } + } + var CubismPhysicsTargetType = /* @__PURE__ */ ((CubismPhysicsTargetType2) => { + CubismPhysicsTargetType2[CubismPhysicsTargetType2["CubismPhysicsTargetType_Parameter"] = 0] = "CubismPhysicsTargetType_Parameter"; + return CubismPhysicsTargetType2; + })(CubismPhysicsTargetType || {}); + var CubismPhysicsSource = /* @__PURE__ */ ((CubismPhysicsSource2) => { + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_X"] = 0] = "CubismPhysicsSource_X"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Y"] = 1] = "CubismPhysicsSource_Y"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Angle"] = 2] = "CubismPhysicsSource_Angle"; + return CubismPhysicsSource2; + })(CubismPhysicsSource || {}); + class PhysicsJsonEffectiveForces { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + } + class CubismPhysicsParticle { + constructor() { + this.initialPosition = new CubismVector2(0, 0); + this.position = new CubismVector2(0, 0); + this.lastPosition = new CubismVector2(0, 0); + this.lastGravity = new CubismVector2(0, 0); + this.force = new CubismVector2(0, 0); + this.velocity = new CubismVector2(0, 0); + } + } + class CubismPhysicsSubRig { + constructor() { + this.normalizationPosition = {}; + this.normalizationAngle = {}; + } + } + class CubismPhysicsInput { + constructor() { + this.source = {}; + } + } + class CubismPhysicsOutput { + constructor() { + this.destination = {}; + this.translationScale = new CubismVector2(0, 0); + } + } + class CubismPhysicsRig { + constructor() { + this.settings = []; + this.inputs = []; + this.outputs = []; + this.particles = []; + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + } + class CubismPhysicsJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getGravity() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Gravity.X; + ret.y = this._json.Meta.EffectiveForces.Gravity.Y; + return ret; + } + getWind() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Wind.X; + ret.y = this._json.Meta.EffectiveForces.Wind.Y; + return ret; + } + getSubRigCount() { + return this._json.Meta.PhysicsSettingCount; + } + getTotalInputCount() { + return this._json.Meta.TotalInputCount; + } + getTotalOutputCount() { + return this._json.Meta.TotalOutputCount; + } + getVertexCount() { + return this._json.Meta.VertexCount; + } + getNormalizationPositionMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Minimum; + } + getNormalizationPositionMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Maximum; + } + getNormalizationPositionDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Default; + } + getNormalizationAngleMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Minimum; + } + getNormalizationAngleMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Maximum; + } + getNormalizationAngleDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Default; + } + getInputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input.length; + } + getInputWeight(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Weight; + } + getInputReflect(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Reflect; + } + getInputType(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Type; + } + getInputSourceId(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Source.Id; + } + getOutputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output.length; + } + getOutputVertexIndex(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].VertexIndex; + } + getOutputAngleScale(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Scale; + } + getOutputWeight(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Weight; + } + getOutputDestinationId(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Destination.Id; + } + getOutputType(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Type; + } + getOutputReflect(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Reflect; + } + getParticleCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices.length; + } + getParticleMobility(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Mobility; + } + getParticleDelay(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Delay; + } + getParticleAcceleration(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Acceleration; + } + getParticleRadius(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Radius; + } + getParticlePosition(physicsSettingIndex, vertexIndex) { + const ret = new CubismVector2(0, 0); + ret.x = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.X; + ret.y = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.Y; + return ret; + } + } + const PhysicsTypeTagX = "X"; + const PhysicsTypeTagY = "Y"; + const PhysicsTypeTagAngle = "Angle"; + const AirResistance = 5; + const MaximumWeight = 100; + const MovementThreshold = 1e-3; + class CubismPhysics { + static create(json) { + const ret = new CubismPhysics(); + ret.parse(json); + ret._physicsRig.gravity.y = 0; + return ret; + } + evaluate(model, deltaTimeSeconds) { + let totalAngle; + let weight; + let radAngle; + let outputValue; + const totalTranslation = new CubismVector2(); + let currentSetting; + let currentInput; + let currentOutput; + let currentParticles; + let parameterValue; + let parameterMaximumValue; + let parameterMinimumValue; + let parameterDefaultValue; + parameterValue = model.getModel().parameters.values; + parameterMaximumValue = model.getModel().parameters.maximumValues; + parameterMinimumValue = model.getModel().parameters.minimumValues; + parameterDefaultValue = model.getModel().parameters.defaultValues; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + totalAngle = { angle: 0 }; + totalTranslation.x = 0; + totalTranslation.y = 0; + currentSetting = this._physicsRig.settings[settingIndex]; + currentInput = this._physicsRig.inputs.slice(currentSetting.baseInputIndex); + currentOutput = this._physicsRig.outputs.slice(currentSetting.baseOutputIndex); + currentParticles = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + for (let i = 0; i < currentSetting.inputCount; ++i) { + weight = currentInput[i].weight / MaximumWeight; + if (currentInput[i].sourceParameterIndex == -1) { + currentInput[i].sourceParameterIndex = model.getParameterIndex(currentInput[i].source.id); + } + currentInput[i].getNormalizedParameterValue(totalTranslation, totalAngle, parameterValue[currentInput[i].sourceParameterIndex], parameterMinimumValue[currentInput[i].sourceParameterIndex], parameterMaximumValue[currentInput[i].sourceParameterIndex], parameterDefaultValue[currentInput[i].sourceParameterIndex], currentSetting.normalizationPosition, currentSetting.normalizationAngle, currentInput[i].reflect, weight); + } + radAngle = CubismMath.degreesToRadian(-totalAngle.angle); + totalTranslation.x = totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle); + totalTranslation.y = totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle); + updateParticles(currentParticles, currentSetting.particleCount, totalTranslation, totalAngle.angle, this._options.wind, MovementThreshold * currentSetting.normalizationPosition.maximum, deltaTimeSeconds, AirResistance); + for (let i = 0; i < currentSetting.outputCount; ++i) { + const particleIndex = currentOutput[i].vertexIndex; + if (particleIndex < 1 || particleIndex >= currentSetting.particleCount) { + break; + } + if (currentOutput[i].destinationParameterIndex == -1) { + currentOutput[i].destinationParameterIndex = model.getParameterIndex(currentOutput[i].destination.id); + } + const translation = new CubismVector2(); + translation.x = currentParticles[particleIndex].position.x - currentParticles[particleIndex - 1].position.x; + translation.y = currentParticles[particleIndex].position.y - currentParticles[particleIndex - 1].position.y; + outputValue = currentOutput[i].getValue(translation, currentParticles, particleIndex, currentOutput[i].reflect, this._options.gravity); + const destinationParameterIndex = currentOutput[i].destinationParameterIndex; + const outParameterValue = !Float32Array.prototype.slice && "subarray" in Float32Array.prototype ? JSON.parse(JSON.stringify(parameterValue.subarray(destinationParameterIndex))) : parameterValue.slice(destinationParameterIndex); + updateOutputParameterValue(outParameterValue, parameterMinimumValue[destinationParameterIndex], parameterMaximumValue[destinationParameterIndex], outputValue, currentOutput[i]); + for (let offset = destinationParameterIndex, outParamIndex = 0; offset < parameterValue.length; offset++, outParamIndex++) { + parameterValue[offset] = outParameterValue[outParamIndex]; + } + } + } + } + setOptions(options) { + this._options = options; + } + getOption() { + return this._options; + } + constructor() { + this._options = new Options(); + this._options.gravity.y = -1; + this._options.gravity.x = 0; + this._options.wind.x = 0; + this._options.wind.y = 0; + } + release() { + this._physicsRig = void 0; + } + parse(physicsJson) { + this._physicsRig = new CubismPhysicsRig(); + let json = new CubismPhysicsJson(physicsJson); + this._physicsRig.gravity = json.getGravity(); + this._physicsRig.wind = json.getWind(); + this._physicsRig.subRigCount = json.getSubRigCount(); + let inputIndex = 0, outputIndex = 0, particleIndex = 0; + for (let i = 0; i < this._physicsRig.subRigCount; ++i) { + const setting = new CubismPhysicsSubRig(); + setting.normalizationPosition.minimum = json.getNormalizationPositionMinimumValue(i); + setting.normalizationPosition.maximum = json.getNormalizationPositionMaximumValue(i); + setting.normalizationPosition.defalut = json.getNormalizationPositionDefaultValue(i); + setting.normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i); + setting.normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i); + setting.normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i); + setting.inputCount = json.getInputCount(i); + setting.baseInputIndex = inputIndex; + inputIndex += setting.inputCount; + for (let j = 0; j < setting.inputCount; ++j) { + const input = new CubismPhysicsInput(); + input.sourceParameterIndex = -1; + input.weight = json.getInputWeight(i, j); + input.reflect = json.getInputReflect(i, j); + switch (json.getInputType(i, j)) { + case PhysicsTypeTagX: + input.type = CubismPhysicsSource.CubismPhysicsSource_X; + input.getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + break; + case PhysicsTypeTagY: + input.type = CubismPhysicsSource.CubismPhysicsSource_Y; + input.getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + break; + case PhysicsTypeTagAngle: + input.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + input.getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + break; + } + input.source.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + input.source.id = json.getInputSourceId(i, j); + this._physicsRig.inputs.push(input); + } + setting.outputCount = json.getOutputCount(i); + setting.baseOutputIndex = outputIndex; + outputIndex += setting.outputCount; + for (let j = 0; j < setting.outputCount; ++j) { + const output = new CubismPhysicsOutput(); + output.destinationParameterIndex = -1; + output.vertexIndex = json.getOutputVertexIndex(i, j); + output.angleScale = json.getOutputAngleScale(i, j); + output.weight = json.getOutputWeight(i, j); + output.destination.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + output.destination.id = json.getOutputDestinationId(i, j); + switch (json.getOutputType(i, j)) { + case PhysicsTypeTagX: + output.type = CubismPhysicsSource.CubismPhysicsSource_X; + output.getValue = getOutputTranslationX; + output.getScale = getOutputScaleTranslationX; + break; + case PhysicsTypeTagY: + output.type = CubismPhysicsSource.CubismPhysicsSource_Y; + output.getValue = getOutputTranslationY; + output.getScale = getOutputScaleTranslationY; + break; + case PhysicsTypeTagAngle: + output.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + output.getValue = getOutputAngle; + output.getScale = getOutputScaleAngle; + break; + } + output.reflect = json.getOutputReflect(i, j); + this._physicsRig.outputs.push(output); + } + setting.particleCount = json.getParticleCount(i); + setting.baseParticleIndex = particleIndex; + particleIndex += setting.particleCount; + for (let j = 0; j < setting.particleCount; ++j) { + const particle = new CubismPhysicsParticle(); + particle.mobility = json.getParticleMobility(i, j); + particle.delay = json.getParticleDelay(i, j); + particle.acceleration = json.getParticleAcceleration(i, j); + particle.radius = json.getParticleRadius(i, j); + particle.position = json.getParticlePosition(i, j); + this._physicsRig.particles.push(particle); + } + this._physicsRig.settings.push(setting); + } + this.initialize(); + json.release(); + } + initialize() { + let strand; + let currentSetting; + let radius; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + currentSetting = this._physicsRig.settings[settingIndex]; + strand = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + strand[0].initialPosition = new CubismVector2(0, 0); + strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); + strand[0].lastGravity = new CubismVector2(0, -1); + strand[0].lastGravity.y *= -1; + strand[0].velocity = new CubismVector2(0, 0); + strand[0].force = new CubismVector2(0, 0); + for (let i = 1; i < currentSetting.particleCount; ++i) { + radius = new CubismVector2(0, 0); + radius.y = strand[i].radius; + strand[i].initialPosition = new CubismVector2(strand[i - 1].initialPosition.x + radius.x, strand[i - 1].initialPosition.y + radius.y); + strand[i].position = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastPosition = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastGravity = new CubismVector2(0, -1); + strand[i].lastGravity.y *= -1; + strand[i].velocity = new CubismVector2(0, 0); + strand[i].force = new CubismVector2(0, 0); + } + } + } + } + class Options { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + } + function getInputTranslationXFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.x += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputTranslationYFromNormalizedParamterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.y += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputAngleFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizaitionPosition, normalizationAngle, isInverted, weight) { + targetAngle.angle += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationAngle.minimum, normalizationAngle.maximum, normalizationAngle.defalut, isInverted) * weight; + } + function getOutputTranslationX(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.x; + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getOutputTranslationY(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.y; + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getOutputAngle(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue; + if (particleIndex >= 2) { + parentGravity = particles[particleIndex - 1].position.substract(particles[particleIndex - 2].position); + } else { + parentGravity = parentGravity.multiplyByScaler(-1); + } + outputValue = CubismMath.directionToRadian(parentGravity, translation); + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getRangeValue(min, max) { + return Math.abs(Math.max(min, max) - Math.min(min, max)); + } + function getDefaultValue(min, max) { + const minValue = Math.min(min, max); + return minValue + getRangeValue(min, max) / 2; + } + function getOutputScaleTranslationX(translationScale, angleScale) { + return translationScale.x; + } + function getOutputScaleTranslationY(translationScale, angleScale) { + return translationScale.y; + } + function getOutputScaleAngle(translationScale, angleScale) { + return angleScale; + } + function updateParticles(strand, strandCount, totalTranslation, totalAngle, windDirection, thresholdValue, deltaTimeSeconds, airResistance) { + let totalRadian; + let delay; + let radian; + let currentGravity; + let direction = new CubismVector2(0, 0); + let velocity = new CubismVector2(0, 0); + let force = new CubismVector2(0, 0); + let newDirection = new CubismVector2(0, 0); + strand[0].position = new CubismVector2(totalTranslation.x, totalTranslation.y); + totalRadian = CubismMath.degreesToRadian(totalAngle); + currentGravity = CubismMath.radianToDirection(totalRadian); + currentGravity.normalize(); + for (let i = 1; i < strandCount; ++i) { + strand[i].force = currentGravity.multiplyByScaler(strand[i].acceleration).add(windDirection); + strand[i].lastPosition = new CubismVector2(strand[i].position.x, strand[i].position.y); + delay = strand[i].delay * deltaTimeSeconds * 30; + direction = strand[i].position.substract(strand[i - 1].position); + radian = CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) / airResistance; + direction.x = CubismMath.cos(radian) * direction.x - direction.y * CubismMath.sin(radian); + direction.y = CubismMath.sin(radian) * direction.x + direction.y * CubismMath.cos(radian); + strand[i].position = strand[i - 1].position.add(direction); + velocity = strand[i].velocity.multiplyByScaler(delay); + force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay); + strand[i].position = strand[i].position.add(velocity).add(force); + newDirection = strand[i].position.substract(strand[i - 1].position); + newDirection.normalize(); + strand[i].position = strand[i - 1].position.add(newDirection.multiplyByScaler(strand[i].radius)); + if (CubismMath.abs(strand[i].position.x) < thresholdValue) { + strand[i].position.x = 0; + } + if (delay != 0) { + strand[i].velocity = strand[i].position.substract(strand[i].lastPosition); + strand[i].velocity = strand[i].velocity.divisionByScalar(delay); + strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); + } + strand[i].force = new CubismVector2(0, 0); + strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); + } + } + function updateOutputParameterValue(parameterValue, parameterValueMinimum, parameterValueMaximum, translation, output) { + let outputScale; + let value; + let weight; + outputScale = output.getScale(output.translationScale, output.angleScale); + value = translation * outputScale; + if (value < parameterValueMinimum) { + if (value < output.valueBelowMinimum) { + output.valueBelowMinimum = value; + } + value = parameterValueMinimum; + } else if (value > parameterValueMaximum) { + if (value > output.valueExceededMaximum) { + output.valueExceededMaximum = value; + } + value = parameterValueMaximum; + } + weight = output.weight / MaximumWeight; + if (weight >= 1) { + parameterValue[0] = value; + } else { + value = parameterValue[0] * (1 - weight) + value * weight; + parameterValue[0] = value; + } + } + function normalizeParameterValue(value, parameterMinimum, parameterMaximum, parameterDefault, normalizedMinimum, normalizedMaximum, normalizedDefault, isInverted) { + let result = 0; + const maxValue = CubismMath.max(parameterMaximum, parameterMinimum); + if (maxValue < value) { + value = maxValue; + } + const minValue = CubismMath.min(parameterMaximum, parameterMinimum); + if (minValue > value) { + value = minValue; + } + const minNormValue = CubismMath.min(normalizedMinimum, normalizedMaximum); + const maxNormValue = CubismMath.max(normalizedMinimum, normalizedMaximum); + const middleNormValue = normalizedDefault; + const middleValue = getDefaultValue(minValue, maxValue); + const paramValue = value - middleValue; + switch (Math.sign(paramValue)) { + case 1: { + const nLength = maxNormValue - middleNormValue; + const pLength = maxValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case -1: { + const nLength = minNormValue - middleNormValue; + const pLength = minValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case 0: { + result = middleNormValue; + break; + } + } + return isInverted ? result : result * -1; + } + class csmRect { + constructor(x = 0, y = 0, w = 0, h = 0) { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + } + getCenterX() { + return this.x + 0.5 * this.width; + } + getCenterY() { + return this.y + 0.5 * this.height; + } + getRight() { + return this.x + this.width; + } + getBottom() { + return this.y + this.height; + } + setRect(r) { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + } + expand(w, h) { + this.x -= w; + this.y -= h; + this.width += w * 2; + this.height += h * 2; + } + } + const ColorChannelCount = 4; + const shaderCount = 10; + let s_instance; + let s_viewport; + let s_fbo; + class CubismClippingManager_WebGL { + getChannelFlagAsColor(channelNo) { + return this._channelColors[channelNo]; + } + getMaskRenderTexture() { + let ret = 0; + if (this._maskTexture && this._maskTexture.texture != 0) { + this._maskTexture.frameNo = this._currentFrameNo; + ret = this._maskTexture.texture; + } + if (ret == 0) { + const size = this._clippingMaskBufferSize; + this._colorBuffer = this.gl.createTexture(); + this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); + this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, size, size, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + ret = this.gl.createFramebuffer(); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); + this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._colorBuffer, 0); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + this._maskTexture = new CubismRenderTextureResource(this._currentFrameNo, ret); + } + return ret; + } + setGL(gl) { + this.gl = gl; + } + calcClippedDrawTotalBounds(model, clippingContext) { + let clippedDrawTotalMinX = Number.MAX_VALUE; + let clippedDrawTotalMinY = Number.MAX_VALUE; + let clippedDrawTotalMaxX = Number.MIN_VALUE; + let clippedDrawTotalMaxY = Number.MIN_VALUE; + const clippedDrawCount = clippingContext._clippedDrawableIndexList.length; + for (let clippedDrawableIndex = 0; clippedDrawableIndex < clippedDrawCount; clippedDrawableIndex++) { + const drawableIndex = clippingContext._clippedDrawableIndexList[clippedDrawableIndex]; + const drawableVertexCount = model.getDrawableVertexCount(drawableIndex); + const drawableVertexes = model.getDrawableVertices(drawableIndex); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = Number.MIN_VALUE; + let maxY = Number.MIN_VALUE; + const loop = drawableVertexCount * Constant.vertexStep; + for (let pi = Constant.vertexOffset; pi < loop; pi += Constant.vertexStep) { + const x = drawableVertexes[pi]; + const y = drawableVertexes[pi + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + if (minX == Number.MAX_VALUE) { + continue; + } + if (minX < clippedDrawTotalMinX) { + clippedDrawTotalMinX = minX; + } + if (minY < clippedDrawTotalMinY) { + clippedDrawTotalMinY = minY; + } + if (maxX > clippedDrawTotalMaxX) { + clippedDrawTotalMaxX = maxX; + } + if (maxY > clippedDrawTotalMaxY) { + clippedDrawTotalMaxY = maxY; + } + if (clippedDrawTotalMinX == Number.MAX_VALUE) { + clippingContext._allClippedDrawRect.x = 0; + clippingContext._allClippedDrawRect.y = 0; + clippingContext._allClippedDrawRect.width = 0; + clippingContext._allClippedDrawRect.height = 0; + clippingContext._isUsing = false; + } else { + clippingContext._isUsing = true; + const w = clippedDrawTotalMaxX - clippedDrawTotalMinX; + const h = clippedDrawTotalMaxY - clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX; + clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.width = w; + clippingContext._allClippedDrawRect.height = h; + } + } + } + constructor() { + this._maskRenderTexture = null; + this._colorBuffer = null; + this._currentFrameNo = 0; + this._clippingMaskBufferSize = 256; + this._clippingContextListForMask = []; + this._clippingContextListForDraw = []; + this._channelColors = []; + this._tmpBoundsOnModel = new csmRect(); + this._tmpMatrix = new CubismMatrix44(); + this._tmpMatrixForMask = new CubismMatrix44(); + this._tmpMatrixForDraw = new CubismMatrix44(); + let tmp = new CubismTextureColor(); + tmp.R = 1; + tmp.G = 0; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 1; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 1; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 0; + tmp.A = 1; + this._channelColors.push(tmp); + } + release() { + var _a, _b, _c; + const self2 = this; + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + if (this._clippingContextListForMask[i]) { + (_a = this._clippingContextListForMask[i]) == null ? void 0 : _a.release(); + } + } + self2._clippingContextListForMask = void 0; + self2._clippingContextListForDraw = void 0; + if (this._maskTexture) { + (_b = this.gl) == null ? void 0 : _b.deleteFramebuffer(this._maskTexture.texture); + self2._maskTexture = void 0; + } + self2._channelColors = void 0; + (_c = this.gl) == null ? void 0 : _c.deleteTexture(this._colorBuffer); + this._colorBuffer = null; + } + initialize(model, drawableCount, drawableMasks, drawableMaskCounts) { + for (let i = 0; i < drawableCount; i++) { + if (drawableMaskCounts[i] <= 0) { + this._clippingContextListForDraw.push(null); + continue; + } + let clippingContext = this.findSameClip(drawableMasks[i], drawableMaskCounts[i]); + if (clippingContext == null) { + clippingContext = new CubismClippingContext(this, drawableMasks[i], drawableMaskCounts[i]); + this._clippingContextListForMask.push(clippingContext); + } + clippingContext.addClippedDrawable(i); + this._clippingContextListForDraw.push(clippingContext); + } + } + setupClippingContext(model, renderer) { + this._currentFrameNo++; + let usingClipCount = 0; + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const cc = this._clippingContextListForMask[clipIndex]; + this.calcClippedDrawTotalBounds(model, cc); + if (cc._isUsing) { + usingClipCount++; + } + } + if (usingClipCount > 0) { + this.gl.viewport(0, 0, this._clippingMaskBufferSize, this._clippingMaskBufferSize); + this._maskRenderTexture = this.getMaskRenderTexture(); + renderer.getMvpMatrix(); + renderer.preDraw(); + this.setupLayoutBounds(usingClipCount); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + this.gl.clearColor(1, 1, 1, 1); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const clipContext = this._clippingContextListForMask[clipIndex]; + const allClipedDrawRect = clipContext._allClippedDrawRect; + const layoutBoundsOnTex01 = clipContext._layoutBounds; + const MARGIN = 0.05; + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand(allClipedDrawRect.width * MARGIN, allClipedDrawRect.height * MARGIN); + const scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + const scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(-1, -1); + this._tmpMatrix.scaleRelative(2, 2); + } + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()); + } + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); + } + clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); + clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); + const clipDrawCount = clipContext._clippingIdCount; + for (let i = 0; i < clipDrawCount; i++) { + const clipDrawIndex = clipContext._clippingIdList[i]; + if (!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)) { + continue; + } + renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false); + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh(model.getDrawableTextureIndices(clipDrawIndex), model.getDrawableVertexIndexCount(clipDrawIndex), model.getDrawableVertexCount(clipDrawIndex), model.getDrawableVertexIndices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex), CubismBlendMode.CubismBlendMode_Normal, false); + } + } + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + renderer.setClippingContextBufferForMask(null); + this.gl.viewport(s_viewport[0], s_viewport[1], s_viewport[2], s_viewport[3]); + } + } + findSameClip(drawableMasks, drawableMaskCounts) { + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + const clippingContext = this._clippingContextListForMask[i]; + const count = clippingContext._clippingIdCount; + if (count != drawableMaskCounts) { + continue; + } + let sameCount = 0; + for (let j = 0; j < count; j++) { + const clipId = clippingContext._clippingIdList[j]; + for (let k = 0; k < count; k++) { + if (drawableMasks[k] == clipId) { + sameCount++; + break; + } + } + } + if (sameCount == count) { + return clippingContext; + } + } + return null; + } + setupLayoutBounds(usingClipCount) { + let div = usingClipCount / ColorChannelCount; + let mod = usingClipCount % ColorChannelCount; + div = ~~div; + mod = ~~mod; + let curClipIndex = 0; + for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + const layoutCount = div + (channelNo < mod ? 1 : 0); + if (layoutCount == 0) + ; + else if (layoutCount == 1) { + const clipContext = this._clippingContextListForMask[curClipIndex++]; + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0; + clipContext._layoutBounds.y = 0; + clipContext._layoutBounds.width = 1; + clipContext._layoutBounds.height = 1; + } else if (layoutCount == 2) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + xpos = ~~xpos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1; + } + } else if (layoutCount <= 4) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + let ypos = i / 2; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + } + } else if (layoutCount <= 9) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 3; + let ypos = i / 3; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 3; + cc._layoutBounds.y = ypos / 3; + cc._layoutBounds.width = 1 / 3; + cc._layoutBounds.height = 1 / 3; + } + } else if (exports2.CubismConfig.supportMoreMaskDivisions && layoutCount <= 16) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 4; + let ypos = i / 4; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 4; + cc._layoutBounds.y = ypos / 4; + cc._layoutBounds.width = 1 / 4; + cc._layoutBounds.height = 1 / 4; + } + } else { + CubismLogError("not supported mask count : {0}", layoutCount); + } + } + } + getColorBuffer() { + return this._colorBuffer; + } + getClippingContextListForDraw() { + return this._clippingContextListForDraw; + } + setClippingMaskBufferSize(size) { + this._clippingMaskBufferSize = size; + } + getClippingMaskBufferSize() { + return this._clippingMaskBufferSize; + } + } + class CubismRenderTextureResource { + constructor(frameNo, texture) { + this.frameNo = frameNo; + this.texture = texture; + } + } + class CubismClippingContext { + constructor(manager, clippingDrawableIndices, clipCount) { + this._isUsing = false; + this._owner = manager; + this._clippingIdList = clippingDrawableIndices; + this._clippingIdCount = clipCount; + this._allClippedDrawRect = new csmRect(); + this._layoutBounds = new csmRect(); + this._clippedDrawableIndexList = []; + this._matrixForMask = new CubismMatrix44(); + this._matrixForDraw = new CubismMatrix44(); + } + release() { + const self2 = this; + self2._layoutBounds = void 0; + self2._allClippedDrawRect = void 0; + self2._clippedDrawableIndexList = void 0; + } + addClippedDrawable(drawableIndex) { + this._clippedDrawableIndexList.push(drawableIndex); + } + getClippingManager() { + return this._owner; + } + setGl(gl) { + this._owner.setGL(gl); + } + } + class CubismShader_WebGL { + static getInstance() { + if (s_instance == null) { + s_instance = new CubismShader_WebGL(); + return s_instance; + } + return s_instance; + } + static deleteInstance() { + if (s_instance) { + s_instance.release(); + s_instance = void 0; + } + } + constructor() { + this._shaderSets = []; + } + release() { + this.releaseShaderProgram(); + } + setupShaderProgram(renderer, textureId, vertexCount, vertexArray, indexArray, uvArray, bufferData, opacity, colorBlendMode, baseColor, isPremultipliedAlpha, matrix4x4, invertedMask) { + if (!isPremultipliedAlpha) { + CubismLogError("NoPremultipliedAlpha is not allowed"); + } + if (this._shaderSets.length == 0) { + this.generateShaders(); + } + let SRC_COLOR; + let DST_COLOR; + let SRC_ALPHA; + let DST_ALPHA; + const clippingContextBufferForMask = renderer.getClippingContextBufferForMask(); + if (clippingContextBufferForMask != null) { + const shaderSet = this._shaderSets[ShaderNames.ShaderNames_SetupMask]; + this.gl.useProgram(shaderSet.shaderProgram); + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + const channelNo = clippingContextBufferForMask._layoutChannelNo; + const colorChannel = clippingContextBufferForMask.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForMask._matrixForMask.getArray()); + const rect = clippingContextBufferForMask._layoutBounds; + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, rect.x * 2 - 1, rect.y * 2 - 1, rect.getRight() * 2 - 1, rect.getBottom() * 2 - 1); + SRC_COLOR = this.gl.ZERO; + DST_COLOR = this.gl.ONE_MINUS_SRC_COLOR; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + } else { + const clippingContextBufferForDraw = renderer.getClippingContextBufferForDraw(); + const masked = clippingContextBufferForDraw != null; + const offset = masked ? invertedMask ? 2 : 1 : 0; + let shaderSet; + switch (colorBlendMode) { + case CubismBlendMode.CubismBlendMode_Normal: + default: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ONE; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + break; + case CubismBlendMode.CubismBlendMode_Additive: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_AddPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + case CubismBlendMode.CubismBlendMode_Multiplicative: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_MultPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.DST_COLOR; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + } + this.gl.useProgram(shaderSet.shaderProgram); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + if (clippingContextBufferForDraw != null) { + this.gl.activeTexture(this.gl.TEXTURE1); + const tex = clippingContextBufferForDraw.getClippingManager().getColorBuffer(); + this.gl.bindTexture(this.gl.TEXTURE_2D, tex); + this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForDraw._matrixForDraw.getArray()); + const channelNo = clippingContextBufferForDraw._layoutChannelNo; + const colorChannel = clippingContextBufferForDraw.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); + } + if (bufferData.index == null) { + bufferData.index = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, bufferData.index); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, indexArray, this.gl.DYNAMIC_DRAW); + this.gl.blendFuncSeparate(SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA); + } + releaseShaderProgram() { + for (let i = 0; i < this._shaderSets.length; i++) { + this.gl.deleteProgram(this._shaderSets[i].shaderProgram); + this._shaderSets[i].shaderProgram = 0; + } + this._shaderSets = []; + } + generateShaders() { + for (let i = 0; i < shaderCount; i++) { + this._shaderSets.push({}); + } + this._shaderSets[0].shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask); + this._shaderSets[1].shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha); + this._shaderSets[2].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha); + this._shaderSets[3].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskInvertedPremultipliedAlpha); + this._shaderSets[4].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[5].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[6].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[7].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[8].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[9].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[0].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_position"); + this._shaderSets[0].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_texCoord"); + this._shaderSets[0].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "s_texture0"); + this._shaderSets[0].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_clipMatrix"); + this._shaderSets[0].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_channelFlag"); + this._shaderSets[0].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_baseColor"); + this._shaderSets[1].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_position"); + this._shaderSets[1].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_texCoord"); + this._shaderSets[1].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "s_texture0"); + this._shaderSets[1].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_matrix"); + this._shaderSets[1].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_baseColor"); + this._shaderSets[2].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_position"); + this._shaderSets[2].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_texCoord"); + this._shaderSets[2].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture0"); + this._shaderSets[2].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture1"); + this._shaderSets[2].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_matrix"); + this._shaderSets[2].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_clipMatrix"); + this._shaderSets[2].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_channelFlag"); + this._shaderSets[2].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_baseColor"); + this._shaderSets[3].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_position"); + this._shaderSets[3].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_texCoord"); + this._shaderSets[3].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture0"); + this._shaderSets[3].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture1"); + this._shaderSets[3].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_matrix"); + this._shaderSets[3].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_clipMatrix"); + this._shaderSets[3].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_channelFlag"); + this._shaderSets[3].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_baseColor"); + this._shaderSets[4].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_position"); + this._shaderSets[4].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_texCoord"); + this._shaderSets[4].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "s_texture0"); + this._shaderSets[4].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_matrix"); + this._shaderSets[4].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_baseColor"); + this._shaderSets[5].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_position"); + this._shaderSets[5].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_texCoord"); + this._shaderSets[5].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture0"); + this._shaderSets[5].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture1"); + this._shaderSets[5].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_matrix"); + this._shaderSets[5].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_clipMatrix"); + this._shaderSets[5].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_channelFlag"); + this._shaderSets[5].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_baseColor"); + this._shaderSets[6].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_position"); + this._shaderSets[6].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_texCoord"); + this._shaderSets[6].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture0"); + this._shaderSets[6].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture1"); + this._shaderSets[6].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_matrix"); + this._shaderSets[6].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_clipMatrix"); + this._shaderSets[6].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_channelFlag"); + this._shaderSets[6].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_baseColor"); + this._shaderSets[7].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_position"); + this._shaderSets[7].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_texCoord"); + this._shaderSets[7].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "s_texture0"); + this._shaderSets[7].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_matrix"); + this._shaderSets[7].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_baseColor"); + this._shaderSets[8].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_position"); + this._shaderSets[8].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_texCoord"); + this._shaderSets[8].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture0"); + this._shaderSets[8].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture1"); + this._shaderSets[8].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_matrix"); + this._shaderSets[8].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_clipMatrix"); + this._shaderSets[8].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_channelFlag"); + this._shaderSets[8].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_baseColor"); + this._shaderSets[9].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_position"); + this._shaderSets[9].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_texCoord"); + this._shaderSets[9].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture0"); + this._shaderSets[9].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture1"); + this._shaderSets[9].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_matrix"); + this._shaderSets[9].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_clipMatrix"); + this._shaderSets[9].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_channelFlag"); + this._shaderSets[9].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_baseColor"); + } + loadShaderProgram(vertexShaderSource, fragmentShaderSource) { + let shaderProgram = this.gl.createProgram(); + let vertShader = this.compileShaderSource(this.gl.VERTEX_SHADER, vertexShaderSource); + if (!vertShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + let fragShader = this.compileShaderSource(this.gl.FRAGMENT_SHADER, fragmentShaderSource); + if (!fragShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + this.gl.attachShader(shaderProgram, vertShader); + this.gl.attachShader(shaderProgram, fragShader); + this.gl.linkProgram(shaderProgram); + const linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); + if (!linkStatus) { + CubismLogError("Failed to link program: {0}", shaderProgram); + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + if (shaderProgram) { + this.gl.deleteProgram(shaderProgram); + } + return 0; + } + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + return shaderProgram; + } + compileShaderSource(shaderType, shaderSource) { + const source = shaderSource; + const shader = this.gl.createShader(shaderType); + this.gl.shaderSource(shader, source); + this.gl.compileShader(shader); + if (!shader) { + const log = this.gl.getShaderInfoLog(shader); + CubismLogError("Shader compile log: {0} ", log); + } + const status = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); + if (!status) { + this.gl.deleteShader(shader); + return null; + } + return shader; + } + setGl(gl) { + this.gl = gl; + } + } + var ShaderNames = /* @__PURE__ */ ((ShaderNames2) => { + ShaderNames2[ShaderNames2["ShaderNames_SetupMask"] = 0] = "ShaderNames_SetupMask"; + ShaderNames2[ShaderNames2["ShaderNames_NormalPremultipliedAlpha"] = 1] = "ShaderNames_NormalPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NormalMaskedPremultipliedAlpha"] = 2] = "ShaderNames_NormalMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NomralMaskedInvertedPremultipliedAlpha"] = 3] = "ShaderNames_NomralMaskedInvertedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddPremultipliedAlpha"] = 4] = "ShaderNames_AddPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlpha"] = 5] = "ShaderNames_AddMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlphaInverted"] = 6] = "ShaderNames_AddMaskedPremultipliedAlphaInverted"; + ShaderNames2[ShaderNames2["ShaderNames_MultPremultipliedAlpha"] = 7] = "ShaderNames_MultPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlpha"] = 8] = "ShaderNames_MultMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlphaInverted"] = 9] = "ShaderNames_MultMaskedPremultipliedAlphaInverted"; + return ShaderNames2; + })(ShaderNames || {}); + const vertexShaderSrcSetupMask = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const fragmentShaderSrcsetupMask = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}"; + const vertexShaderSrc = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const vertexShaderSrcMasked = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const fragmentShaderSrcPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}"; + const fragmentShaderSrcMaskPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}"; + const fragmentShaderSrcMaskInvertedPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}"; + class CubismRenderer_WebGL extends CubismRenderer { + constructor() { + super(); + this._clippingContextBufferForMask = null; + this._clippingContextBufferForDraw = null; + this._clippingManager = new CubismClippingManager_WebGL(); + this.firstDraw = true; + this._textures = {}; + this._sortedDrawableIndexList = []; + this._bufferData = { + vertex: null, + uv: null, + index: null + }; + } + initialize(model) { + if (model.isUsingMasking()) { + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.initialize(model, model.getDrawableCount(), model.getDrawableMasks(), model.getDrawableMaskCounts()); + } + for (let i = model.getDrawableCount() - 1; i >= 0; i--) { + this._sortedDrawableIndexList[i] = 0; + } + super.initialize(model); + } + bindTexture(modelTextureNo, glTexture) { + this._textures[modelTextureNo] = glTexture; + } + getBindedTextures() { + return this._textures; + } + setClippingMaskBufferSize(size) { + this._clippingManager.release(); + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.setClippingMaskBufferSize(size); + this._clippingManager.initialize(this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), this.getModel().getDrawableMaskCounts()); + } + getClippingMaskBufferSize() { + return this._clippingManager.getClippingMaskBufferSize(); + } + release() { + var _a, _b, _c; + const self2 = this; + this._clippingManager.release(); + self2._clippingManager = void 0; + (_a = this.gl) == null ? void 0 : _a.deleteBuffer(this._bufferData.vertex); + this._bufferData.vertex = null; + (_b = this.gl) == null ? void 0 : _b.deleteBuffer(this._bufferData.uv); + this._bufferData.uv = null; + (_c = this.gl) == null ? void 0 : _c.deleteBuffer(this._bufferData.index); + this._bufferData.index = null; + self2._bufferData = void 0; + self2._textures = void 0; + } + doDrawModel() { + this.preDraw(); + if (this._clippingManager != null) { + this._clippingManager.setupClippingContext(this.getModel(), this); + } + const drawableCount = this.getModel().getDrawableCount(); + const renderOrder = this.getModel().getDrawableRenderOrders(); + for (let i = 0; i < drawableCount; ++i) { + const order = renderOrder[i]; + this._sortedDrawableIndexList[order] = i; + } + for (let i = 0; i < drawableCount; ++i) { + const drawableIndex = this._sortedDrawableIndexList[i]; + if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) { + continue; + } + this.setClippingContextBufferForDraw(this._clippingManager != null ? this._clippingManager.getClippingContextListForDraw()[drawableIndex] : null); + this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); + this.drawMesh(this.getModel().getDrawableTextureIndices(drawableIndex), this.getModel().getDrawableVertexIndexCount(drawableIndex), this.getModel().getDrawableVertexCount(drawableIndex), this.getModel().getDrawableVertexIndices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableBlendMode(drawableIndex), this.getModel().getDrawableInvertedMaskBit(drawableIndex)); + } + } + drawMesh(textureNo, indexCount, vertexCount, indexArray, vertexArray, uvArray, opacity, colorBlendMode, invertedMask) { + if (this.isCulling()) { + this.gl.enable(this.gl.CULL_FACE); + } else { + this.gl.disable(this.gl.CULL_FACE); + } + this.gl.frontFace(this.gl.CCW); + const modelColorRGBA = this.getModelColor(); + if (this.getClippingContextBufferForMask() == null) { + modelColorRGBA.A *= opacity; + if (this.isPremultipliedAlpha()) { + modelColorRGBA.R *= modelColorRGBA.A; + modelColorRGBA.G *= modelColorRGBA.A; + modelColorRGBA.B *= modelColorRGBA.A; + } + } + let drawtexture = null; + if (this._textures[textureNo] != null) { + drawtexture = this._textures[textureNo]; + } + CubismShader_WebGL.getInstance().setupShaderProgram(this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this._bufferData, opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), this.getMvpMatrix(), invertedMask); + this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); + this.gl.useProgram(null); + this.setClippingContextBufferForDraw(null); + this.setClippingContextBufferForMask(null); + } + static doStaticRelease() { + CubismShader_WebGL.deleteInstance(); + } + setRenderState(fbo, viewport) { + s_fbo = fbo; + s_viewport = viewport; + } + preDraw() { + if (this.firstDraw) { + this.firstDraw = false; + this._anisortopy = this.gl.getExtension("EXT_texture_filter_anisotropic") || this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic"); + } + this.gl.disable(this.gl.SCISSOR_TEST); + this.gl.disable(this.gl.STENCIL_TEST); + this.gl.disable(this.gl.DEPTH_TEST); + this.gl.frontFace(this.gl.CW); + this.gl.enable(this.gl.BLEND); + this.gl.colorMask(true, true, true, true); + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null); + } + setClippingContextBufferForMask(clip) { + this._clippingContextBufferForMask = clip; + } + getClippingContextBufferForMask() { + return this._clippingContextBufferForMask; + } + setClippingContextBufferForDraw(clip) { + this._clippingContextBufferForDraw = clip; + } + getClippingContextBufferForDraw() { + return this._clippingContextBufferForDraw; + } + startUp(gl) { + this.gl = gl; + this._clippingManager.setGL(gl); + CubismShader_WebGL.getInstance().setGl(gl); + } + } + CubismRenderer.staticRelease = () => { + CubismRenderer_WebGL.doStaticRelease(); + }; + class CubismModelSettingsJson { + constructor(json) { + this.groups = json.Groups; + this.hitAreas = json.HitAreas; + this.layout = json.Layout; + this.moc = json.FileReferences.Moc; + this.expressions = json.FileReferences.Expressions; + this.motions = json.FileReferences.Motions; + this.textures = json.FileReferences.Textures; + this.physics = json.FileReferences.Physics; + this.pose = json.FileReferences.Pose; + } + getEyeBlinkParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "EyeBlink")) == null ? void 0 : _b.Ids; + } + getLipSyncParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "LipSync")) == null ? void 0 : _b.Ids; + } + } + const HitAreaPrefix = "HitArea"; + const HitAreaHead = "Head"; + const HitAreaBody = "Body"; + const PartsIdCore = "Parts01Core"; + const PartsArmPrefix = "Parts01Arm_"; + const PartsArmLPrefix = "Parts01ArmL_"; + const PartsArmRPrefix = "Parts01ArmR_"; + const ParamAngleX = "ParamAngleX"; + const ParamAngleY = "ParamAngleY"; + const ParamAngleZ = "ParamAngleZ"; + const ParamEyeLOpen = "ParamEyeLOpen"; + const ParamEyeLSmile = "ParamEyeLSmile"; + const ParamEyeROpen = "ParamEyeROpen"; + const ParamEyeRSmile = "ParamEyeRSmile"; + const ParamEyeBallX = "ParamEyeBallX"; + const ParamEyeBallY = "ParamEyeBallY"; + const ParamEyeBallForm = "ParamEyeBallForm"; + const ParamBrowLY = "ParamBrowLY"; + const ParamBrowRY = "ParamBrowRY"; + const ParamBrowLX = "ParamBrowLX"; + const ParamBrowRX = "ParamBrowRX"; + const ParamBrowLAngle = "ParamBrowLAngle"; + const ParamBrowRAngle = "ParamBrowRAngle"; + const ParamBrowLForm = "ParamBrowLForm"; + const ParamBrowRForm = "ParamBrowRForm"; + const ParamMouthForm = "ParamMouthForm"; + const ParamMouthOpenY = "ParamMouthOpenY"; + const ParamCheek = "ParamCheek"; + const ParamBodyAngleX = "ParamBodyAngleX"; + const ParamBodyAngleY = "ParamBodyAngleY"; + const ParamBodyAngleZ = "ParamBodyAngleZ"; + const ParamBreath = "ParamBreath"; + const ParamArmLA = "ParamArmLA"; + const ParamArmRA = "ParamArmRA"; + const ParamArmLB = "ParamArmLB"; + const ParamArmRB = "ParamArmRB"; + const ParamHandL = "ParamHandL"; + const ParamHandR = "ParamHandR"; + const ParamHairFront = "ParamHairFront"; + const ParamHairSide = "ParamHairSide"; + const ParamHairBack = "ParamHairBack"; + const ParamHairFluffy = "ParamHairFluffy"; + const ParamShoulderY = "ParamShoulderY"; + const ParamBustX = "ParamBustX"; + const ParamBustY = "ParamBustY"; + const ParamBaseX = "ParamBaseX"; + const ParamBaseY = "ParamBaseY"; + const ParamNONE = "NONE:"; + const LOGICAL_WIDTH = 2; + const LOGICAL_HEIGHT = 2; + exports2.config = void 0; + ((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = exports2.CubismConfig; + })(exports2.config || (exports2.config = {})); + const VERSION = "0.4.0"; + const logger = { + log(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } + }; + function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; + } + function rand(min, max) { + return Math.random() * (max - min) + min; + } + function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } + } + function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } + } + function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); + } + function folderName(url) { + let lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url = url.slice(0, lastSlashIndex); + } + lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url = url.slice(lastSlashIndex + 1); + } + return url; + } + function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } + } + class ExpressionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self2 = this; + self2.definitions = void 0; + self2.expressions = void 0; + } + } + const EPSILON = 0.01; + const MAX_SPEED = 40 / 7.5; + const ACCELERATION_TIME = 1 / (0.15 * 1e3); + class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } + } + class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return utils.url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } + } + var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; + })(MotionPriority || {}); + class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !exports2.config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } + } + const TAG$2 = "SoundManager"; + const VOLUME = 0.5; + class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } + } + SoundManager.audios = []; + SoundManager._volume = VOLUME; + var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; + })(MotionPreloadStrategy || {}); + class MotionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (exports2.config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (exports2.config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self2 = this; + self2.definitions = void 0; + self2.motionGroups = void 0; + } + } + const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; + class InternalModel extends utils.EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new math.Matrix(); + this.drawingMatrix = new math.Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self2 = this; + const size = this.getSize(); + self2.originalWidth = size[0]; + self2.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self2.width = this.originalWidth * this.localTransform.a; + self2.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } + } + const TAG$1 = "XHRLoader"; + class NetworkError extends Error { + constructor(message, url, status, aborted = false) { + super(message); + this.url = url; + this.status = status; + this.aborted = aborted; + } + } + const _XHRLoader = class { + static createXHR(target, url, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url}`); + onerror(new NetworkError("Network error.", url, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } + }; + let XHRLoader = _XHRLoader; + XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); + XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); + }; + function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } + } + class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } + } + Live2DLoader.middlewares = [XHRLoader.loader]; + function createTexture(url, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (core.Texture.fromURL) { + return core.Texture.fromURL(url, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = core.Texture.from(url, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; + } + const TAG = "Live2DFactory"; + const urlToJSON = (context, next) => __async(this, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); + }); + const jsonToSettings = (context, next) => __async(this, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); + }); + const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); + }; + const setupOptionals = (context, next) => __async(this, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } + }); + const setupEssentials = (context, next) => __async(this, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url = context.settings.resolveURL(tex); + return createTexture(url, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } + }); + const createInternalModel = (context, next) => __async(this, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); + }); + const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } + }; + let Live2DFactory = _Live2DFactory; + Live2DFactory.runtimes = []; + Live2DFactory.urlToJSON = urlToJSON; + Live2DFactory.jsonToSettings = jsonToSettings; + Live2DFactory.waitUntilReady = waitUntilReady; + Live2DFactory.setupOptionals = setupOptionals; + Live2DFactory.setupEssentials = setupEssentials; + Live2DFactory.createInternalModel = createInternalModel; + Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel + ]; + Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); + Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); + MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); + }; + ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); + }; + class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } + } + function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); + } + function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); + } + class Live2DTransform extends math.Transform { + } + const tempPoint = new math.Point(); + const tempMatrix$1 = new math.Matrix(); + let tickerRef; + class Live2DModel extends display.Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new math.ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix$1.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } + } + applyMixins(Live2DModel, [InteractionMixin]); + const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } + }; + let FileLoader = _FileLoader; + FileLoader.filesMap = {}; + FileLoader.factory = (context, next) => __async(this, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url) { + return _FileLoader.resolveURL(this._objectURL, url); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); + const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } + }; + let ZipLoader = _ZipLoader; + ZipLoader.ZIP_PROTOCOL = "zip://"; + ZipLoader.uid = 0; + ZipLoader.factory = (context, next) => __async(this, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); + if (!window.Live2DCubismCore) { + throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded."); + } + class Cubism4ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.Name === name); + } + getExpressionFile(definition) { + return definition.File; + } + createExpression(data, definition) { + return CubismExpressionMotion.create(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion, false, performance.now()); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + } + class Cubism4ModelSettings extends ModelSettings { + constructor(json) { + super(json); + if (!Cubism4ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + Object.assign(this, new CubismModelSettingsJson(json)); + } + static isValidJSON(json) { + var _a; + return !!(json == null ? void 0 : json.FileReferences) && typeof json.FileReferences.Moc === "string" && ((_a = json.FileReferences.Textures) == null ? void 0 : _a.length) > 0 && json.FileReferences.Textures.every((item) => typeof item === "string"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + if (this.motions) { + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].File = replace(motions[i].File, `motions.${group}[${i}].File`); + if (motions[i].Sound !== void 0) { + motions[i].Sound = replace(motions[i].Sound, `motions.${group}[${i}].Sound`); + } + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].File = replace(this.expressions[i].File, `expressions[${i}].File`); + } + } + } + } + applyMixins(Cubism4ModelSettings, [CubismModelSettingsJson]); + class Cubism4MotionManager extends MotionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.groups = { idle: "Idle" }; + this.motionDataType = "json"; + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.motions) != null ? _a : {}; + this.eyeBlinkIds = settings.getEyeBlinkParameters() || []; + this.lipSyncIds = settings.getLipSyncParameters() || []; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism4ExpressionManager(this.settings, options); + } + this.queueManager.setEventCallback((caller, eventValue, customData) => { + this.emit("motion:" + eventValue); + }); + } + isFinished() { + return this.queueManager.isFinished(); + } + _startMotion(motion, onFinish) { + motion.setFinishedMotionHandler(onFinish); + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion, false, performance.now()); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + createMotion(data, group, definition) { + const motion = CubismMotion.create(data); + const json = new CubismMotionJson(data); + const defaultFadingDuration = (group === this.groups.idle ? exports2.config.idleMotionFadingDuration : exports2.config.motionFadingDuration) / 1e3; + if (json.getMotionFadeInTime() === void 0) { + motion.setFadeInTime(definition.FadeInTime > 0 ? definition.FadeInTime : defaultFadingDuration); + } + if (json.getMotionFadeOutTime() === void 0) { + motion.setFadeOutTime(definition.FadeOutTime > 0 ? definition.FadeOutTime : defaultFadingDuration); + } + motion.setEffectIds(this.eyeBlinkIds, this.lipSyncIds); + return motion; + } + getMotionFile(definition) { + return definition.File; + } + getMotionName(definition) { + return definition.File; + } + getSoundFile(definition) { + return definition.Sound; + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + destroy() { + super.destroy(); + this.queueManager.release(); + this.queueManager = void 0; + } + } + const tempMatrix = new CubismMatrix44(); + class Cubism4InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.lipSync = true; + this.breath = CubismBreath.create(); + this.renderer = new CubismRenderer_WebGL(); + this.idParamAngleX = ParamAngleX; + this.idParamAngleY = ParamAngleY; + this.idParamAngleZ = ParamAngleZ; + this.idParamEyeBallX = ParamEyeBallX; + this.idParamEyeBallY = ParamEyeBallY; + this.idParamBodyAngleX = ParamBodyAngleX; + this.idParamBreath = ParamBreath; + this.pixelsPerUnit = 1; + this.centeringTransform = new math.Matrix(); + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism4MotionManager(settings, options); + this.init(); + } + init() { + var _a; + super.init(); + if (((_a = this.settings.getEyeBlinkParameters()) == null ? void 0 : _a.length) > 0) { + this.eyeBlink = CubismEyeBlink.create(this.settings); + } + this.breath.setParameters([ + new BreathParameterData(this.idParamAngleX, 0, 15, 6.5345, 0.5), + new BreathParameterData(this.idParamAngleY, 0, 8, 3.5345, 0.5), + new BreathParameterData(this.idParamAngleZ, 0, 10, 5.5345, 0.5), + new BreathParameterData(this.idParamBodyAngleX, 0, 4, 15.5345, 0.5), + new BreathParameterData(this.idParamBreath, 0, 0.5, 3.2345, 0.5) + ]); + this.renderer.initialize(this.coreModel); + this.renderer.setIsPremultipliedAlpha(true); + } + getSize() { + return [this.coreModel.getModel().canvasinfo.CanvasWidth, this.coreModel.getModel().canvasinfo.CanvasHeight]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + const commonKey = key.charAt(0).toLowerCase() + key.slice(1); + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + setupLayout() { + super.setupLayout(); + this.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit; + this.centeringTransform.scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2); + } + updateWebGLContext(gl, glContextID) { + this.renderer.firstDraw = true; + this.renderer._bufferData = { + vertex: null, + uv: null, + index: null + }; + this.renderer.startUp(gl); + this.renderer._clippingManager._currentFrameNo = glContextID; + this.renderer._clippingManager._maskTexture = void 0; + CubismShader_WebGL.getInstance()._shaderSets = []; + } + bindTexture(index, texture) { + this.renderer.bindTexture(index, texture); + } + getHitAreaDefs() { + var _a, _b; + return (_b = (_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.Id, + name: hitArea.Name, + index: this.coreModel.getDrawableIndex(hitArea.Id) + }))) != null ? _b : []; + } + getDrawableIDs() { + return this.coreModel.getDrawableIds(); + } + getDrawableIndex(id) { + return this.coreModel.getDrawableIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawableIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + const arr = this.coreModel.getDrawableVertices(drawIndex).slice(); + for (let i = 0; i < arr.length; i += 2) { + arr[i] = arr[i] * this.pixelsPerUnit + this.originalWidth / 2; + arr[i + 1] = -arr[i + 1] * this.pixelsPerUnit + this.originalHeight / 2; + } + return arr; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(transform); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + dt /= 1e3; + now /= 1e3; + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParameters(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.updateParameters(model, dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt * 1e3, now * 1e3); + (_c = this.physics) == null ? void 0 : _c.evaluate(model, dt); + (_d = this.pose) == null ? void 0 : _d.updateParameters(model, dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParameters(); + } + updateFocus() { + this.coreModel.addParameterValueById(this.idParamEyeBallX, this.focusController.x); + this.coreModel.addParameterValueById(this.idParamEyeBallY, this.focusController.y); + this.coreModel.addParameterValueById(this.idParamAngleX, this.focusController.x * 30); + this.coreModel.addParameterValueById(this.idParamAngleY, this.focusController.y * 30); + this.coreModel.addParameterValueById(this.idParamAngleZ, this.focusController.x * this.focusController.y * -30); + this.coreModel.addParameterValueById(this.idParamBodyAngleX, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + var _a; + (_a = this.breath) == null ? void 0 : _a.updateParameters(this.coreModel, dt / 1e3); + } + draw(gl) { + const matrix = this.drawingMatrix; + const array = tempMatrix.getArray(); + array[0] = matrix.a; + array[1] = matrix.b; + array[4] = -matrix.c; + array[5] = -matrix.d; + array[12] = matrix.tx; + array[13] = matrix.ty; + this.renderer.setMvpMatrix(tempMatrix); + this.renderer.setRenderState(gl.getParameter(gl.FRAMEBUFFER_BINDING), this.viewport); + this.renderer.drawModel(); + } + destroy() { + super.destroy(); + this.renderer.release(); + this.coreModel.release(); + this.renderer = void 0; + this.coreModel = void 0; + } + } + let startupPromise; + let startupRetries = 20; + function cubism4Ready() { + if (CubismFramework.isStarted()) { + return Promise.resolve(); + } + startupPromise != null ? startupPromise : startupPromise = new Promise((resolve, reject) => { + function startUpWithRetry() { + try { + startUpCubism4(); + resolve(); + } catch (e) { + startupRetries--; + if (startupRetries < 0) { + const err = new Error("Failed to start up Cubism 4 framework."); + err.cause = e; + reject(err); + return; + } + logger.log("Cubism4", "Startup failed, retrying 10ms later..."); + setTimeout(startUpWithRetry, 10); + } + } + startUpWithRetry(); + }); + return startupPromise; + } + function startUpCubism4(options) { + options = Object.assign({ + logFunction: console.log, + loggingLevel: LogLevel.LogLevel_Verbose + }, options); + CubismFramework.startUp(options); + CubismFramework.initialize(); + } + Live2DFactory.registerRuntime({ + version: 4, + ready: cubism4Ready, + test(source) { + return source instanceof Cubism4ModelSettings || Cubism4ModelSettings.isValidJSON(source); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 4) { + return false; + } + const view = new Int8Array(modelData, 0, 4); + return String.fromCharCode(...view) === "MOC3"; + }, + createModelSettings(json) { + return new Cubism4ModelSettings(json); + }, + createCoreModel(data) { + const moc = CubismMoc.create(data); + try { + const model = moc.createModel(); + model.__moc = moc; + return model; + } catch (e) { + try { + moc.release(); + } catch (ignored) { + } + throw e; + } + }, + createInternalModel(coreModel, settings, options) { + const model = new Cubism4InternalModel(coreModel, settings, options); + const coreModelWithMoc = coreModel; + if (coreModelWithMoc.__moc) { + model.__moc = coreModelWithMoc.__moc; + delete coreModelWithMoc.__moc; + model.once("destroy", releaseMoc); + } + return model; + }, + createPhysics(coreModel, data) { + return CubismPhysics.create(data); + }, + createPose(coreModel, data) { + return CubismPose.create(data); + } + }); + function releaseMoc() { + var _a; + (_a = this.__moc) == null ? void 0 : _a.release(); + } + exports2.ACubismMotion = ACubismMotion; + exports2.BreathParameterData = BreathParameterData; + exports2.CSM_ASSERT = CSM_ASSERT; + exports2.Constant = Constant; + exports2.Cubism4ExpressionManager = Cubism4ExpressionManager; + exports2.Cubism4InternalModel = Cubism4InternalModel; + exports2.Cubism4ModelSettings = Cubism4ModelSettings; + exports2.Cubism4MotionManager = Cubism4MotionManager; + exports2.CubismBlendMode = CubismBlendMode; + exports2.CubismBreath = CubismBreath; + exports2.CubismClippingContext = CubismClippingContext; + exports2.CubismClippingManager_WebGL = CubismClippingManager_WebGL; + exports2.CubismDebug = CubismDebug; + exports2.CubismExpressionMotion = CubismExpressionMotion; + exports2.CubismEyeBlink = CubismEyeBlink; + exports2.CubismFramework = CubismFramework; + exports2.CubismLogDebug = CubismLogDebug; + exports2.CubismLogError = CubismLogError; + exports2.CubismLogInfo = CubismLogInfo; + exports2.CubismLogVerbose = CubismLogVerbose; + exports2.CubismLogWarning = CubismLogWarning; + exports2.CubismMath = CubismMath; + exports2.CubismMatrix44 = CubismMatrix44; + exports2.CubismMoc = CubismMoc; + exports2.CubismModel = CubismModel; + exports2.CubismModelSettingsJson = CubismModelSettingsJson; + exports2.CubismModelUserData = CubismModelUserData; + exports2.CubismModelUserDataJson = CubismModelUserDataJson; + exports2.CubismMotion = CubismMotion; + exports2.CubismMotionCurve = CubismMotionCurve; + exports2.CubismMotionCurveTarget = CubismMotionCurveTarget; + exports2.CubismMotionData = CubismMotionData; + exports2.CubismMotionEvent = CubismMotionEvent; + exports2.CubismMotionJson = CubismMotionJson; + exports2.CubismMotionManager = CubismMotionManager; + exports2.CubismMotionPoint = CubismMotionPoint; + exports2.CubismMotionQueueEntry = CubismMotionQueueEntry; + exports2.CubismMotionQueueManager = CubismMotionQueueManager; + exports2.CubismMotionSegment = CubismMotionSegment; + exports2.CubismMotionSegmentType = CubismMotionSegmentType; + exports2.CubismPhysics = CubismPhysics; + exports2.CubismPhysicsInput = CubismPhysicsInput; + exports2.CubismPhysicsJson = CubismPhysicsJson; + exports2.CubismPhysicsOutput = CubismPhysicsOutput; + exports2.CubismPhysicsParticle = CubismPhysicsParticle; + exports2.CubismPhysicsRig = CubismPhysicsRig; + exports2.CubismPhysicsSource = CubismPhysicsSource; + exports2.CubismPhysicsSubRig = CubismPhysicsSubRig; + exports2.CubismPhysicsTargetType = CubismPhysicsTargetType; + exports2.CubismPose = CubismPose; + exports2.CubismRenderTextureResource = CubismRenderTextureResource; + exports2.CubismRenderer = CubismRenderer; + exports2.CubismRenderer_WebGL = CubismRenderer_WebGL; + exports2.CubismShader_WebGL = CubismShader_WebGL; + exports2.CubismTextureColor = CubismTextureColor; + exports2.CubismVector2 = CubismVector2; + exports2.EvaluationOptionFlag = EvaluationOptionFlag; + exports2.ExpressionBlendType = ExpressionBlendType; + exports2.ExpressionManager = ExpressionManager; + exports2.EyeState = EyeState; + exports2.FileLoader = FileLoader; + exports2.FocusController = FocusController; + exports2.HitAreaBody = HitAreaBody; + exports2.HitAreaHead = HitAreaHead; + exports2.HitAreaPrefix = HitAreaPrefix; + exports2.InteractionMixin = InteractionMixin; + exports2.InternalModel = InternalModel; + exports2.InvalidMotionQueueEntryHandleValue = InvalidMotionQueueEntryHandleValue; + exports2.LOGICAL_HEIGHT = LOGICAL_HEIGHT; + exports2.LOGICAL_WIDTH = LOGICAL_WIDTH; + exports2.Live2DFactory = Live2DFactory; + exports2.Live2DLoader = Live2DLoader; + exports2.Live2DModel = Live2DModel; + exports2.Live2DTransform = Live2DTransform; + exports2.LogLevel = LogLevel; + exports2.ModelSettings = ModelSettings; + exports2.MotionManager = MotionManager; + exports2.MotionPreloadStrategy = MotionPreloadStrategy; + exports2.MotionPriority = MotionPriority; + exports2.MotionState = MotionState; + exports2.Options = Options; + exports2.ParamAngleX = ParamAngleX; + exports2.ParamAngleY = ParamAngleY; + exports2.ParamAngleZ = ParamAngleZ; + exports2.ParamArmLA = ParamArmLA; + exports2.ParamArmLB = ParamArmLB; + exports2.ParamArmRA = ParamArmRA; + exports2.ParamArmRB = ParamArmRB; + exports2.ParamBaseX = ParamBaseX; + exports2.ParamBaseY = ParamBaseY; + exports2.ParamBodyAngleX = ParamBodyAngleX; + exports2.ParamBodyAngleY = ParamBodyAngleY; + exports2.ParamBodyAngleZ = ParamBodyAngleZ; + exports2.ParamBreath = ParamBreath; + exports2.ParamBrowLAngle = ParamBrowLAngle; + exports2.ParamBrowLForm = ParamBrowLForm; + exports2.ParamBrowLX = ParamBrowLX; + exports2.ParamBrowLY = ParamBrowLY; + exports2.ParamBrowRAngle = ParamBrowRAngle; + exports2.ParamBrowRForm = ParamBrowRForm; + exports2.ParamBrowRX = ParamBrowRX; + exports2.ParamBrowRY = ParamBrowRY; + exports2.ParamBustX = ParamBustX; + exports2.ParamBustY = ParamBustY; + exports2.ParamCheek = ParamCheek; + exports2.ParamEyeBallForm = ParamEyeBallForm; + exports2.ParamEyeBallX = ParamEyeBallX; + exports2.ParamEyeBallY = ParamEyeBallY; + exports2.ParamEyeLOpen = ParamEyeLOpen; + exports2.ParamEyeLSmile = ParamEyeLSmile; + exports2.ParamEyeROpen = ParamEyeROpen; + exports2.ParamEyeRSmile = ParamEyeRSmile; + exports2.ParamHairBack = ParamHairBack; + exports2.ParamHairFluffy = ParamHairFluffy; + exports2.ParamHairFront = ParamHairFront; + exports2.ParamHairSide = ParamHairSide; + exports2.ParamHandL = ParamHandL; + exports2.ParamHandR = ParamHandR; + exports2.ParamMouthForm = ParamMouthForm; + exports2.ParamMouthOpenY = ParamMouthOpenY; + exports2.ParamNONE = ParamNONE; + exports2.ParamShoulderY = ParamShoulderY; + exports2.PartData = PartData; + exports2.PartsArmLPrefix = PartsArmLPrefix; + exports2.PartsArmPrefix = PartsArmPrefix; + exports2.PartsArmRPrefix = PartsArmRPrefix; + exports2.PartsIdCore = PartsIdCore; + exports2.PhysicsJsonEffectiveForces = PhysicsJsonEffectiveForces; + exports2.ShaderNames = ShaderNames; + exports2.SoundManager = SoundManager; + exports2.VERSION = VERSION; + exports2.XHRLoader = XHRLoader; + exports2.ZipLoader = ZipLoader; + exports2.applyMixins = applyMixins; + exports2.clamp = clamp; + exports2.copyArray = copyArray; + exports2.copyProperty = copyProperty; + exports2.csmRect = csmRect; + exports2.cubism4Ready = cubism4Ready; + exports2.folderName = folderName; + exports2.fragmentShaderSrcMaskInvertedPremultipliedAlpha = fragmentShaderSrcMaskInvertedPremultipliedAlpha; + exports2.fragmentShaderSrcMaskPremultipliedAlpha = fragmentShaderSrcMaskPremultipliedAlpha; + exports2.fragmentShaderSrcPremultipliedAlpha = fragmentShaderSrcPremultipliedAlpha; + exports2.fragmentShaderSrcsetupMask = fragmentShaderSrcsetupMask; + exports2.logger = logger; + exports2.rand = rand; + exports2.remove = remove; + exports2.startUpCubism4 = startUpCubism4; + exports2.vertexShaderSrc = vertexShaderSrc; + exports2.vertexShaderSrcMasked = vertexShaderSrcMasked; + exports2.vertexShaderSrcSetupMask = vertexShaderSrcSetupMask; + Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); +}); diff --git a/live2d/node_modules/pixi-live2d-display/dist/cubism4.min.js b/live2d/node_modules/pixi-live2d-display/dist/cubism4.min.js new file mode 100644 index 0000000..f0e4a50 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/cubism4.min.js @@ -0,0 +1 @@ +var __pow=Math.pow,__async=(t,e,i)=>new Promise(((s,r)=>{var a=t=>{try{n(i.next(t))}catch(e){r(e)}},o=t=>{try{n(i.throw(t))}catch(e){r(e)}},n=t=>t.done?s(t.value):Promise.resolve(t.value).then(a,o);n((i=i.apply(t,e)).next())}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pixi/utils"),require("@pixi/math"),require("@pixi/core"),require("@pixi/display")):"function"==typeof define&&define.amd?define(["exports","@pixi/utils","@pixi/math","@pixi/core","@pixi/display"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).PIXI=t.PIXI||{},t.PIXI.live2d=t.PIXI.live2d||{}),t.PIXI.utils,t.PIXI,t.PIXI,t.PIXI)}(this,(function(t,e,i,s,r){"use strict";class a{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new a}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const i=2*this._currentTime*3.14159;for(let s=0;s=1&&(s=1,this._blinkingState=h.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),i=1-s;break;case h.EyeState_Closed:s=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,s>=1&&(this._blinkingState=h.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),i=0;break;case h.EyeState_Opening:s=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,s>=1&&(s=1,this._blinkingState=h.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),i=s;break;case h.EyeState_Interval:this._nextBlinkingTime(t[t.EyeState_First=0]="EyeState_First",t[t.EyeState_Interval=1]="EyeState_Interval",t[t.EyeState_Closing=2]="EyeState_Closing",t[t.EyeState_Closed=3]="EyeState_Closed",t[t.EyeState_Opening=4]="EyeState_Opening",t))(h||{});class u{static create(t){const e=new u;"number"==typeof t.FadeInTime&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=.5));const i=t.Groups,s=i.length;for(let r=0;r.001){if(r>=0)break;r=n,a=t.getPartOpacityByIndex(i),a+=e/this._fadeTimeSeconds,a>1&&(a=1)}}r<0&&(r=0,a=1);for(let n=i;n.15&&(i=1-.15/(1-a)),s>i&&(s=i),t.setPartOpacityByIndex(e,s)}}}constructor(){this._fadeTimeSeconds=.5,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class d{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],null!=t&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map((t=>t.clone())),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new d;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map((t=>t.clone())),t}}class c{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new c(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new c(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new c(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new c(t,t))}division(t){const e=new c(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new c(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const m=class{static range(t,e,i){return ti&&(t=i),t}static sin(t){return Math.sin(t)}static cos(t){return Math.cos(t)}static abs(t){return Math.abs(t)}static sqrt(t){return Math.sqrt(t)}static cbrt(t){if(0===t)return t;let e=t;const i=e<0;let s;return i&&(e=-e),e===1/0?s=1/0:(s=Math.exp(Math.log(e)/3),s=(e/(s*s)+2*s)/3),i?-s:s}static getEasingSine(t){return t<0?0:t>1?1:.5-.5*this.cos(t*Math.PI)}static max(t,e){return t>e?t:e}static min(t,e){return t>e?e:t}static degreesToRadian(t){return t/180*Math.PI}static radianToDegrees(t){return 180*t/Math.PI}static directionToRadian(t,e){let i=Math.atan2(e.y,e.x)-Math.atan2(t.y,t.x);for(;i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;return i}static directionToDegrees(t,e){const i=this.directionToRadian(t,e);let s=this.radianToDegrees(i);return e.x-t.x>0&&(s=-s),s}static radianToDirection(t){const e=new c;return e.x=this.sin(t),e.y=this.cos(t),e}static quadraticEquation(t,e,i){return this.abs(t)1&&(t=1),e<0?e=0:e>1&&(e=1),i<0?i=0:i>1&&(i=1),s<0?s=0:s>1&&(s=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=i,this._modelColor.A=s}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new y,this._mvpMatrix4x4=new p,this._mvpMatrix4x4.loadIdentity()}}var f=(t=>(t[t.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",t[t.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",t[t.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",t))(f||{});class y{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let x,v=!1,M=!1;const P={vertexOffset:0,vertexStep:2};class C{static startUp(t){if(v)return I("CubismFramework.startUp() is already done."),v;if(Live2DCubismCore._isStarted)return v=!0,!0;if(Live2DCubismCore._isStarted=!0,x=t,x&&Live2DCubismCore.Logging.csmSetLogFunction(x.logFunction),v=!0,v){const t=Live2DCubismCore.Version.csmGetVersion(),e=(16711680&t)>>16,i=65535&t,s=t;I("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+((4278190080&t)>>24)).slice(-2),("00"+e).slice(-2),("0000"+i).slice(-4),s)}return I("CubismFramework.startUp() is complete."),v}static cleanUp(){v=!1,M=!1,x=void 0}static initialize(){v?M?L("CubismFramework.initialize() skipped, already initialized."):(M=!0,I("CubismFramework.initialize() is complete.")):L("CubismFramework is not started.")}static dispose(){v?M?(_.staticRelease(),M=!1,I("CubismFramework.dispose() is complete.")):L("CubismFramework.dispose() skipped, not initialized."):L("CubismFramework is not started.")}static isStarted(){return v}static isInitialized(){return M}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return null!=x?x.loggingLevel:S.LogLevel_Off}constructor(){}}var S=(t=>(t[t.LogLevel_Verbose=0]="LogLevel_Verbose",t[t.LogLevel_Debug=1]="LogLevel_Debug",t[t.LogLevel_Info=2]="LogLevel_Info",t[t.LogLevel_Warning=3]="LogLevel_Warning",t[t.LogLevel_Error=4]="LogLevel_Error",t[t.LogLevel_Off=5]="LogLevel_Off",t))(S||{});const b=()=>{};function w(t,...e){E.print(S.LogLevel_Debug,"[CSM][D]"+t+"\n",e)}function I(t,...e){E.print(S.LogLevel_Info,"[CSM][I]"+t+"\n",e)}function L(t,...e){E.print(S.LogLevel_Warning,"[CSM][W]"+t+"\n",e)}function T(t,...e){E.print(S.LogLevel_Error,"[CSM][E]"+t+"\n",e)}class E{static print(t,e,i){if(ti[e])))}static dumpBytes(t,e,i){for(let s=0;s0?this.print(t,"\n"):s%8==0&&s>0&&this.print(t," "),this.print(t,"{0} ",[255&e[s]]);this.print(t,"\n")}constructor(){}}class D{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return null==this._model?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return null==this._model?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,e=this._savedParameters.length;for(let i=0;ie&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=1==i?e:this._parameterValues[t]=this._parameterValues[t]*(1-i)+e*i)}setParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.setParameterValueByIndex(s,e,i)}addParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*i)}addParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.addParameterValueByIndex(s,e,i)}multiplyParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.multiplyParameterValueByIndex(s,e,i)}multiplyParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*i))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let i=0;ie&&(t=e);for(let i=0;i0&&e.getEndTime()(t[t.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",t[t.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",t[t.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",t))(U||{});t.CubismConfig=void 0,(k=t.CubismConfig||(t.CubismConfig={})).supportMoreMaskDivisions=!0,k.setOpacityFromMotion=!1;var N=(t=>(t[t.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",t[t.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",t[t.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",t))(N||{}),V=(t=>(t[t.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",t[t.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",t[t.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",t[t.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",t))(V||{});class j{constructor(t=0,e=0){this.time=t,this.value=e}}class G{constructor(){this.basePointIndex=0,this.segmentType=0}}class X{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class z{constructor(){this.fireTime=0,this.value=""}}class W{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class H{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return Y.EvaluationOptionFlag_AreBeziersRistricted==t&&!!this._json.Meta.AreBeziersRestricted}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var Y=(t=>(t[t.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",t))(Y||{});function q(t,e,i){const s=new j;return s.time=t.time+(e.time-t.time)*i,s.value=t.value+(e.value-t.value)*i,s}function $(t,e){let i=(e-t[0].time)/(t[1].time-t[0].time);return i<0&&(i=0),t[0].value+(t[1].value-t[0].value)*i}function Z(t,e){let i=(e-t[0].time)/(t[3].time-t[0].time);i<0&&(i=0);const s=q(t[0],t[1],i),r=q(t[1],t[2],i),a=q(t[2],t[3],i),o=q(s,r,i),n=q(r,a,i);return q(o,n,i).value}function J(t,e){const i=e,s=t[0].time,r=t[3].time,a=t[1].time,o=t[2].time,n=r-3*o+3*a-s,l=3*o-6*a+3*s,h=3*a-3*s,u=s-i,d=g.cardanoAlgorithmForBezier(n,l,h,u),c=q(t[0],t[1],d),m=q(t[1],t[2],d),p=q(t[2],t[3],d),_=q(c,m,d),f=q(m,p,d);return q(_,f,d).value}function Q(t,e){return t[0].value}function K(t,e){return t[1].value}function tt(t,e,i){const s=t.curves[e];let r=-1;const a=s.baseSegmentIndex+s.segmentCount;let o=0;for(let l=s.baseSegmentIndex;li){r=l;break}if(-1==r)return t.points[o].value;const n=t.segments[r];return n.evaluate(t.points.slice(n.basePointIndex),i)}class et extends R{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const i=new et;return i.parse(t),i._sourceFrameRate=i._motionData.fps,i._loopDurationSeconds=i._motionData.duration,i._onFinishedMotion=e,i}doUpdateParameters(e,i,s,r){null==this._modelCurveIdEyeBlink&&(this._modelCurveIdEyeBlink="EyeBlink"),null==this._modelCurveIdLipSync&&(this._modelCurveIdLipSync="LipSync");let a=i-r.getStartTime();a<0&&(a=0);let o=Number.MAX_VALUE,n=Number.MAX_VALUE;const l=64;let h=0,u=0;this._eyeBlinkParameterIds.length>l&&w("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&w("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const d=this._fadeInSeconds<=0?1:g.getEasingSine((i-r.getFadeInStartTime())/this._fadeInSeconds),c=this._fadeOutSeconds<=0||r.getEndTime()<0?1:g.getEasingSine((r.getEndTime()-i)/this._fadeOutSeconds);let m,p,_,f=a;if(this._isLoop)for(;f>this._motionData.duration;)f-=this._motionData.duration;const y=this._motionData.curves;for(p=0;p>t&1)continue;const r=i+(n-i)*s;e.setParameterValueById(this._eyeBlinkParameterIds[t],r)}if(o!=Number.MAX_VALUE)for(let t=0;t>t&1)continue;const r=i+(o-i)*s;e.setParameterValueById(this._lipSyncParameterIds[t],r)}for(;p=this._motionData.duration&&(this._isLoop?(r.setStartTime(i),this._isLoopFadeIn&&r.setFadeInStartTime(i)):(this._onFinishedMotion&&this._onFinishedMotion(this),r.setIsFinished(!0))),this._lastWeight=s}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const i=this._motionData.curves;for(let s=0;snew X)),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map((()=>new G)),this._motionData.events=Array.from({length:this._motionData.eventCount}).map((()=>new z)),this._motionData.points=[];let a=0,o=0;for(let n=0;nt&&this._motionData.events[i].fireTime<=e&&this._firedEventValues.push(this._motionData.events[i].value);return this._firedEventValues}}class it{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const i=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||inull!=e&&e._motionQueueEntryHandle==t))}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let i=!1,s=0;for(;s(t[t.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",t))(at||{}),ot=(t=>(t[t.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",t[t.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",t[t.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",t))(ot||{});class nt{constructor(){this.initialPosition=new c(0,0),this.position=new c(0,0),this.lastPosition=new c(0,0),this.lastGravity=new c(0,0),this.force=new c(0,0),this.velocity=new c(0,0)}}class lt{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class ht{constructor(){this.source={}}}class ut{constructor(){this.destination={},this.translationScale=new c(0,0)}}class dt{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new c(0,0),this.wind=new c(0,0)}}class ct{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new c(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new c(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const i=new c(0,0);return i.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,i.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,i}}const mt="Angle";class gt{static create(t){const e=new gt;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let i,s,r,a;const o=new c;let n,l,h,u,d,m,p,_;d=t.getModel().parameters.values,m=t.getModel().parameters.maximumValues,p=t.getModel().parameters.minimumValues,_=t.getModel().parameters.defaultValues;for(let f=0;f=n.particleCount)break;-1==h[e].destinationParameterIndex&&(h[e].destinationParameterIndex=t.getParameterIndex(h[e].destination.id));const s=new c;s.x=u[i].position.x-u[i-1].position.x,s.y=u[i].position.y-u[i-1].position.y,a=h[e].getValue(s,u,i,h[e].reflect,this._options.gravity);const r=h[e].destinationParameterIndex,o=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(d.subarray(r))):d.slice(r);It(o,p[r],m[r],a,h[e]);for(let t=r,e=0;t=2?e[i-1].position.substract(e[i-2].position):r.multiplyByScaler(-1),a=g.directionToRadian(r,t),s&&(a*=-1),a}function Pt(t,e){return Math.min(t,e)+function(t,e){return Math.abs(Math.max(t,e)-Math.min(t,e))}(t,e)/2}function Ct(t,e){return t.x}function St(t,e){return t.y}function bt(t,e){return e}function wt(t,e,i,s,r,a,o,n){let l,h,u,d,m=new c(0,0),p=new c(0,0),_=new c(0,0),f=new c(0,0);t[0].position=new c(i.x,i.y),l=g.degreesToRadian(s),d=g.radianToDirection(l),d.normalize();for(let y=1;yi&&(o>r.valueExceededMaximum&&(r.valueExceededMaximum=o),o=i),n=r.weight/100,n>=1||(o=t[0]*(1-n)+o*n),t[0]=o}function Lt(t,e,i,s,r,a,o,n){let l=0;const h=g.max(i,e);ht&&(t=u);const d=g.min(r,a),c=g.max(r,a),m=o,p=Pt(u,h),_=t-p;switch(Math.sign(_)){case 1:{const t=c-m,e=h-p;0!=e&&(l=_*(t/e),l+=m);break}case-1:{const t=d-m,e=u-p;0!=e&&(l=_*(t/e),l+=m);break}case 0:l=m}return n?l:-1*l}class Tt{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e}}let Et,Dt,Ft;class At{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&0!=this._maskTexture.texture&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),0==t){const e=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,Ft),this._maskTexture=new Bt(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let i=Number.MAX_VALUE,s=Number.MAX_VALUE,r=Number.MIN_VALUE,a=Number.MIN_VALUE;const o=e._clippedDrawableIndexList.length;for(let n=0;nc&&(c=e),im&&(m=i)}if(u!=Number.MAX_VALUE)if(ur&&(r=c),m>a&&(a=m),i==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const t=r-i,o=a-s;e._allClippedDrawRect.x=i,e._allClippedDrawRect.y=s,e._allClippedDrawRect.width=t,e._allClippedDrawRect.height=o}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new Tt,this._tmpMatrix=new p,this._tmpMatrixForMask=new p,this._tmpMatrixForDraw=new p;let t=new y;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new y,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new y,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new y,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,i;const s=this;for(let r=0;r0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.preDraw(),this.setupLayoutBounds(i),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i(t[t.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",t[t.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",t[t.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",t[t.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",t[t.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",t[t.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",t))(kt||{});const Ut="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Nt="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",Vt="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",jt="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Gt="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",Xt="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",zt="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class Wt extends _{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new At,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new At,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new At,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,i;const s=this;this._clippingManager.release(),s._clippingManager=void 0,null==(t=this.gl)||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,null==(e=this.gl)||e.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,null==(i=this.gl)||i.deleteBuffer(this._bufferData.index),this._bufferData.index=null,s._bufferData=void 0,s._textures=void 0}doDrawModel(){this.preDraw(),null!=this._clippingManager&&this._clippingManager.setupClippingContext(this.getModel(),this);const t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let i=0;i{Wt.doStaticRelease()};class Ht{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find((t=>"EyeBlink"===t.Name)))?void 0:e.Ids}getLipSyncParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find((t=>"LipSync"===t.Name)))?void 0:e.Ids}}const Yt="ParamAngleX",qt="ParamAngleY",$t="ParamAngleZ",Zt="ParamEyeBallX",Jt="ParamEyeBallY",Qt="ParamBodyAngleX",Kt="ParamBreath";var te;t.config=void 0,(te=t.config||(t.config={})).LOG_LEVEL_VERBOSE=0,te.LOG_LEVEL_WARNING=1,te.LOG_LEVEL_ERROR=2,te.LOG_LEVEL_NONE=999,te.logLevel=te.LOG_LEVEL_WARNING,te.sound=!0,te.motionSync=!0,te.motionFadingDuration=500,te.idleMotionFadingDuration=2e3,te.expressionFadingDuration=500,te.preserveExpressionOnMotion=!0,te.cubism4=t.CubismConfig;const ee={log(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_VERBOSE&&console.log(`[${e}]`,...i)},warn(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_WARNING&&console.warn(`[${e}]`,...i)},error(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_ERROR&&console.error(`[${e}]`,...i)}};function ie(t,e,i){return ti?i:t}function se(t,e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((i=>{"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))}function re(t){let e=t.lastIndexOf("/");return-1!=e&&(t=t.slice(0,e)),e=t.lastIndexOf("/"),-1!==e&&(t=t.slice(e+1)),t}function ae(t,e){const i=t.indexOf(e);-1!==i&&t.splice(i,1)}class oe extends e.EventEmitter{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return __async(this,null,(function*(){if(!this.definitions[t])return void ee.warn(this.tag,`Undefined expression at [${t}]`);if(null===this.expressions[t])return void ee.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e}))}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return __async(this,null,(function*(){if(this.definitions.length){const t=[];for(let e=0;e-1&&tl&&(a*=l/n,o*=l/n),this.vx+=a,this.vy+=o;const h=Math.sqrt(__pow(this.vx,2)+__pow(this.vy,2)),u=.5*(Math.sqrt(__pow(l,2)+8*l*s)-l);h>u&&(this.vx*=u/h,this.vy*=u/h),this.x+=this.vx,this.y+=this.vy}}class le{constructor(t){this.json=t;let e=t.url;if("string"!=typeof e)throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=re(this.url)}resolveURL(t){return e.url.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),void 0!==this.pose&&(this.pose=t(this.pose,"pose")),void 0!==this.physics&&(this.physics=t(this.physics,"physics"));for(let e=0;e(t.push(e),e))),t}validateFiles(t){const e=(e,i)=>{const s=this.resolveURL(e);if(!t.includes(s)){if(i)throw new Error(`File "${e}" is defined in settings, but doesn't exist in given files`);return!1}return!0};[this.moc,...this.textures].forEach((t=>e(t,!0)));return this.getDefinedFiles().filter((t=>e(t,!1)))}}var he=(t=>(t[t.NONE=0]="NONE",t[t.IDLE=1]="IDLE",t[t.NORMAL=2]="NORMAL",t[t.FORCE=3]="FORCE",t))(he||{});class ue{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,i){if(i<=0)return ee.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return ee.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return ee.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(1===i){if(0!==this.currentPriority)return ee.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(void 0!==this.reservedIdleGroup)return ee.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(i<3){if(i<=this.currentPriority)return ee.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(i<=this.reservePriority)return ee.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,i)}return!0}start(t,e,i,s){if(1===s){if(this.setReservedIdle(void 0,void 0),0!==this.currentPriority)return ee.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,i)),!1}else{if(e!==this.reservedGroup||i!==this.reservedIndex)return ee.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,i)),!1;this.setReserved(void 0,void 0,0)}return!!t&&(this.setCurrent(e,i,s),!0)}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,i){this.currentPriority=i,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,i){this.reservePriority=i,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return void 0===this.currentGroup&&void 0===this.reservedIdleGroup}shouldOverrideExpression(){return!t.config.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){return`\n group = "${t}", index = ${e}\n`+["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"].map((t=>"["+t+"] "+this[t])).join("\n")}return""}}class de{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach((t=>t.volume=this._volume))}static add(t,e,i){const s=new Audio(t);return s.volume=this._volume,s.preload="auto",s.addEventListener("ended",(()=>{this.dispose(s),null==e||e()})),s.addEventListener("error",(e=>{this.dispose(s),ee.warn("SoundManager",`Error occurred on "${t}"`,e.error),null==i||i(e.error)})),this.audios.push(s),s}static play(t){return new Promise(((e,i)=>{var s;null==(s=t.play())||s.catch((e=>{t.dispatchEvent(new ErrorEvent("error",{error:e})),i(e)})),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)}))}static dispose(t){t.pause(),t.removeAttribute("src"),ae(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}de.audios=[],de._volume=.5;var ce=(t=>(t.ALL="ALL",t.IDLE="IDLE",t.NONE="NONE",t))(ce||{});class me extends e.EventEmitter{constructor(t,e){super(),this.motionGroups={},this.state=new ue,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){(null==t?void 0:t.idleMotionGroup)&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const i of Object.keys(this.definitions))this.motionGroups[i]=[];let e;switch(null==t?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;default:e=[this.groups.idle]}for(const i of e)if(this.definitions[i])for(let t=0;tthis.currentAudio=void 0),(()=>this.currentAudio=void 0)),this.currentAudio=o}catch(l){ee.warn(this.tag,"Failed to create audio",t,l)}}const n=yield this.loadMotion(e,i);if(o){const e=de.play(o).catch((t=>ee.warn(this.tag,"Failed to play audio",o.src,t)));t.config.motionSync&&(yield e)}return this.state.start(n,e,i,s)?(ee.log(this.tag,"Start motion:",this.getMotionName(a)),this.emit("motionStart",e,i,o),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(n),!0):(o&&(de.dispose(o),this.currentAudio=void 0),!1)}))}startRandomMotion(t,e){return __async(this,null,(function*(){const i=this.definitions[t];if(null==i?void 0:i.length){const s=[];for(let e=0;et.index>=0));for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter((i=>this.isHit(i,t,e)))}isHit(t,e,i){if(!this.hitAreas[t])return!1;const s=this.hitAreas[t].index,r=this.getDrawableBounds(s,ge);return r.x<=e&&e<=r.x+r.width&&r.y<=i&&i<=r.y+r.height}getDrawableBounds(t,e){const i=this.getDrawableVertices(t);let s=i[0],r=i[0],a=i[1],o=i[1];for(let n=0;n{200!==a.status&&0!==a.status||!a.response?a.onerror():s(a.response)},a.onerror=()=>{ee.warn("XHRLoader",`Failed to load resource as ${a.responseType} (Status ${a.status}): ${e}`),r(new _e("Network error.",e,a.status))},a.onabort=()=>r(new _e("Aborted.",e,a.status,!0)),a.onloadend=()=>{var e;fe.allXhrSet.delete(a),t&&(null==(e=fe.xhrMap.get(t))||e.delete(a))},a}static cancelXHRs(){var t;null==(t=fe.xhrMap.get(this))||t.forEach((t=>{t.abort(),fe.allXhrSet.delete(t)})),fe.xhrMap.delete(this)}static release(){fe.allXhrSet.forEach((t=>t.abort())),fe.allXhrSet.clear(),fe.xhrMap=new WeakMap}};let ye=fe;function xe(t,e){let i=-1;return function s(r,a){if(a)return Promise.reject(a);if(r<=i)return Promise.reject(new Error("next() called multiple times"));i=r;const o=t[r];if(!o)return Promise.resolve();try{return Promise.resolve(o(e,s.bind(null,r+1)))}catch(n){return Promise.reject(n)}}(0)}ye.xhrMap=new WeakMap,ye.allXhrSet=new Set,ye.loader=(t,e)=>new Promise(((e,i)=>{fe.createXHR(t.target,t.settings?t.settings.resolveURL(t.url):t.url,t.type,(i=>{t.result=i,e()}),i).send()}));class ve{static load(t){return xe(this.middlewares,t).then((()=>t.result))}}ve.middlewares=[ye.loader];const Me="Live2DFactory",Pe=(t,e)=>__async(this,null,(function*(){if("string"==typeof t.source){const e=yield ve.load({url:t.source,type:"json",target:t.live2dModel});e.url=t.source,t.source=e,t.live2dModel.emit("settingsJSONLoaded",e)}return e()})),Ce=(t,e)=>__async(this,null,(function*(){if(t.source instanceof le)return t.settings=t.source,e();if("object"==typeof t.source){const i=Te.findRuntime(t.source);if(i){const s=i.createModelSettings(t.source);return t.settings=s,t.live2dModel.emit("settingsLoaded",s),e()}}throw new TypeError("Unknown settings format.")})),Se=(t,e)=>{if(t.settings){const i=Te.findRuntime(t.settings);if(i)return i.ready().then(e)}return e()},be=(t,e)=>__async(this,null,(function*(){yield e();const i=t.internalModel;if(i){const e=t.settings,s=Te.findRuntime(e);if(s){const r=[];e.pose&&r.push(ve.load({settings:e,url:e.pose,type:"json",target:i}).then((e=>{i.pose=s.createPose(i.coreModel,e),t.live2dModel.emit("poseLoaded",i.pose)})).catch((e=>{t.live2dModel.emit("poseLoadError",e),ee.warn(Me,"Failed to load pose.",e)}))),e.physics&&r.push(ve.load({settings:e,url:e.physics,type:"json",target:i}).then((e=>{i.physics=s.createPhysics(i.coreModel,e),t.live2dModel.emit("physicsLoaded",i.physics)})).catch((e=>{t.live2dModel.emit("physicsLoadError",e),ee.warn(Me,"Failed to load physics.",e)}))),r.length&&(yield Promise.all(r))}}})),we=(t,e)=>__async(this,null,(function*(){if(!t.settings)throw new TypeError("Missing settings.");{const i=t.live2dModel,r=t.settings.textures.map((e=>function(t,e={}){const i={resourceOptions:{crossorigin:e.crossOrigin}};if(s.Texture.fromURL)return s.Texture.fromURL(t,i).catch((t=>{if(t instanceof Error)throw t;const e=new Error("Texture loading error");throw e.event=t,e}));i.resourceOptions.autoLoad=!1;const r=s.Texture.from(t,i);if(r.baseTexture.valid)return Promise.resolve(r);const a=r.baseTexture.resource;return null!=a._live2d_load||(a._live2d_load=new Promise(((t,e)=>{const i=t=>{a.source.removeEventListener("error",i);const s=new Error("Texture loading error");s.event=t,e(s)};a.source.addEventListener("error",i),a.load().then((()=>t(r))).catch(i)}))),a._live2d_load}(t.settings.resolveURL(e),{crossOrigin:t.options.crossOrigin})));if(yield e(),!t.internalModel)throw new TypeError("Missing internal model.");i.internalModel=t.internalModel,i.emit("modelLoaded",t.internalModel),i.textures=yield Promise.all(r),i.emit("textureLoaded",i.textures)}})),Ie=(t,e)=>__async(this,null,(function*(){const i=t.settings;if(i instanceof le){const s=Te.findRuntime(i);if(!s)throw new TypeError("Unknown model settings.");const r=yield ve.load({settings:i,url:i.moc,type:"arraybuffer",target:t.live2dModel});if(!s.isValidMoc(r))throw new Error("Invalid moc data");const a=s.createCoreModel(r);return t.internalModel=s.createInternalModel(a,i,t.options),e()}throw new TypeError("Missing settings.")})),Le=class{static registerRuntime(t){Le.runtimes.push(t),Le.runtimes.sort(((t,e)=>e.version-t.version))}static findRuntime(t){for(const e of Le.runtimes)if(e.test(t))return e}static setupLive2DModel(t,e,i){return __async(this,null,(function*(){const s=new Promise((e=>t.once("textureLoaded",e))),r=new Promise((e=>t.once("modelLoaded",e))),a=Promise.all([s,r]).then((()=>t.emit("ready")));yield xe(Le.live2DModelMiddlewares,{live2dModel:t,source:e,options:i||{}}),yield a,t.emit("load")}))}static loadMotion(t,e,i){var s;const r=s=>t.emit("motionLoadError",e,i,s);try{const a=null==(s=t.definitions[e])?void 0:s[i];if(!a)return Promise.resolve(void 0);t.listeners("destroy").includes(Le.releaseTasks)||t.once("destroy",Le.releaseTasks);let o=Le.motionTasksMap.get(t);o||(o={},Le.motionTasksMap.set(t,o));let n=o[e];n||(n=[],o[e]=n);const l=t.getMotionFile(a);return null!=n[i]||(n[i]=ve.load({url:l,settings:t.settings,type:t.motionDataType,target:t}).then((s=>{var r;const o=null==(r=Le.motionTasksMap.get(t))?void 0:r[e];o&&delete o[i];const n=t.createMotion(s,e,a);return t.emit("motionLoaded",e,i,n),n})).catch((e=>{ee.warn(t.tag,`Failed to load motion: ${l}\n`,e),r(e)}))),n[i]}catch(a){ee.warn(t.tag,`Failed to load motion at "${e}"[${i}]\n`,a),r(a)}return Promise.resolve(void 0)}static loadExpression(t,e){const i=i=>t.emit("expressionLoadError",e,i);try{const s=t.definitions[e];if(!s)return Promise.resolve(void 0);t.listeners("destroy").includes(Le.releaseTasks)||t.once("destroy",Le.releaseTasks);let r=Le.expressionTasksMap.get(t);r||(r=[],Le.expressionTasksMap.set(t,r));const a=t.getExpressionFile(s);return null!=r[e]||(r[e]=ve.load({url:a,settings:t.settings,type:"json",target:t}).then((i=>{const r=Le.expressionTasksMap.get(t);r&&delete r[e];const a=t.createExpression(i,s);return t.emit("expressionLoaded",e,a),a})).catch((e=>{ee.warn(t.tag,`Failed to load expression: ${a}\n`,e),i(e)}))),r[e]}catch(s){ee.warn(t.tag,`Failed to load expression at [${e}]\n`,s),i(s)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof me?Le.motionTasksMap.delete(this):Le.expressionTasksMap.delete(this)}};let Te=Le;Te.runtimes=[],Te.urlToJSON=Pe,Te.jsonToSettings=Ce,Te.waitUntilReady=Se,Te.setupOptionals=be,Te.setupEssentials=we,Te.createInternalModel=Ie,Te.live2DModelMiddlewares=[Pe,Ce,Se,be,we,Ie],Te.motionTasksMap=new WeakMap,Te.expressionTasksMap=new WeakMap,me.prototype._loadMotion=function(t,e){return Te.loadMotion(this,t,e)},oe.prototype._loadExpression=function(t){return Te.loadExpression(this,t)};class Ee{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",De,this):this.off("pointertap",De,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",Fe,this)))}unregisterInteraction(){var t;this.interactionManager&&(null==(t=this.interactionManager)||t.off("pointermove",Fe,this),this.interactionManager=void 0)}}function De(t){this.tap(t.data.global.x,t.data.global.y)}function Fe(t){this.focus(t.data.global.x,t.data.global.y)}class Ae extends i.Transform{}const Be=new i.Point,Re=new i.Matrix;let Oe;class ke extends r.Container{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new Ae,this.anchor=new i.ObservablePoint(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",(()=>this.init(t)))}static from(t,e){const i=new this(e);return Te.setupLive2DModel(i,t,e).then((()=>i))}static fromSync(t,e){const i=new this(e);return Te.setupLive2DModel(i,t,e).then(null==e?void 0:e.onLoad).catch(null==e?void 0:e.onError),i}static registerTicker(t){Oe=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;Oe||(Oe=null==(e=window.PIXI)?void 0:e.Ticker),t?this._destroyed||(Oe?(Oe.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):ee.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(null==Oe||Oe.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,i){return void 0===e?this.internalModel.motionManager.startRandomMotion(t,i):this.internalModel.motionManager.startMotion(t,e,i)}expression(t){return this.internalModel.motionManager.expressionManager?void 0===t?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,i=!1){Be.x=t,Be.y=e,this.toModelPosition(Be,Be,!0);let s=Be.x/this.internalModel.originalWidth*2-1,r=Be.y/this.internalModel.originalHeight*2-1,a=Math.atan2(r,s);this.internalModel.focusController.focus(Math.cos(a),-Math.sin(a),i)}tap(t,e){const i=this.hitTest(t,e);i.length&&(ee.log(this.tag,"Hit",i),this.emit("hit",i))}hitTest(t,e){return Be.x=t,Be.y=e,this.toModelPosition(Be,Be),this.internalModel.hitTest(Be.x,Be.y)}toModelPosition(t,e=t.clone(),i){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(Oe.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let r=0;re.destroy(t.baseTexture))),this.internalModel.destroy(),super.destroy(t)}}se(ke,[Ee]);const Ue=class{static resolveURL(t,e){var i;const s=null==(i=Ue.filesMap[t])?void 0:i[e];if(void 0===s)throw new Error("Cannot find this file from uploaded files: "+e);return s}static upload(t,i){return __async(this,null,(function*(){const s={};for(const r of i.getDefinedFiles()){const a=decodeURI(e.url.resolve(i.url,r)),o=t.find((t=>t.webkitRelativePath===a));o&&(s[r]=URL.createObjectURL(o))}Ue.filesMap[i._objectURL]=s}))}static createSettings(t){return __async(this,null,(function*(){const e=t.find((t=>t.name.endsWith("model.json")||t.name.endsWith("model3.json")));if(!e)throw new TypeError("Settings file not found");const i=yield Ue.readText(e),s=JSON.parse(i);s.url=e.webkitRelativePath;const r=Te.findRuntime(s);if(!r)throw new Error("Unknown settings JSON");const a=r.createModelSettings(s);return a._objectURL=URL.createObjectURL(e),a}))}static readText(t){return __async(this,null,(function*(){return new Promise(((e,i)=>{const s=new FileReader;s.onload=()=>e(s.result),s.onerror=i,s.readAsText(t,"utf8")}))}))}};let Ne=Ue;Ne.filesMap={},Ne.factory=(t,e)=>__async(this,null,(function*(){if(Array.isArray(t.source)&&t.source[0]instanceof File){const e=t.source;let i=e.settings;if(i){if(!i._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings')}else i=yield Ue.createSettings(e);i.validateFiles(e.map((t=>encodeURI(t.webkitRelativePath)))),yield Ue.upload(e,i),i.resolveURL=function(t){return Ue.resolveURL(this._objectURL,t)},t.source=i,t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){const t=this.settings._objectURL;if(URL.revokeObjectURL(t),Ue.filesMap[t])for(const e of Object.values(Ue.filesMap[t]))URL.revokeObjectURL(e);delete Ue.filesMap[t]}))}))}return e()})),Te.live2DModelMiddlewares.unshift(Ne.factory);const Ve=class{static unzip(t,i){return __async(this,null,(function*(){const s=yield Ve.getFilePaths(t),r=[];for(const t of i.getDefinedFiles()){const a=decodeURI(e.url.resolve(i.url,t));s.includes(a)&&r.push(a)}const a=yield Ve.getFiles(t,r);for(let t=0;tt.endsWith("model.json")||t.endsWith("model3.json")));if(!e)throw new Error("Settings file not found");const i=yield Ve.readText(t,e);if(!i)throw new Error("Empty settings file: "+e);const s=JSON.parse(i);s.url=e;const r=Te.findRuntime(s);if(!r)throw new Error("Unknown settings JSON");return r.createModelSettings(s)}))}static zipReader(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFilePaths(t){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFiles(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static readText(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static releaseReader(t){}};let je=Ve;if(je.ZIP_PROTOCOL="zip://",je.uid=0,je.factory=(t,e)=>__async(this,null,(function*(){const i=t.source;let s,r,a;if("string"==typeof i&&(i.endsWith(".zip")||i.startsWith(Ve.ZIP_PROTOCOL))?(s=i.startsWith(Ve.ZIP_PROTOCOL)?i.slice(Ve.ZIP_PROTOCOL.length):i,r=yield ve.load({url:s,type:"blob",target:t.live2dModel})):Array.isArray(i)&&1===i.length&&i[0]instanceof File&&i[0].name.endsWith(".zip")&&(r=i[0],s=URL.createObjectURL(r),a=i.settings),r){if(!r.size)throw new Error("Empty zip file");const e=yield Ve.zipReader(r,s);a||(a=yield Ve.createSettings(e)),a._objectURL=Ve.ZIP_PROTOCOL+Ve.uid+"/"+a.url;const i=yield Ve.unzip(e,a);i.settings=a,t.source=i,s.startsWith("blob:")&&t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){URL.revokeObjectURL(s)}))})),Ve.releaseReader(e)}return e()})),Te.live2DModelMiddlewares.unshift(je.factory),!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class Ge extends oe{constructor(t,e){var i;super(t,e),this.queueManager=new st,this.definitions=null!=(i=t.expressions)?i:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex((e=>e.Name===t))}getExpressionFile(t){return t.File}createExpression(t,e){return O.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class Xe extends le{constructor(t){if(super(t),!Xe.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new Ht(t))}static isValidJSON(t){var e;return!!(null==t?void 0:t.FileReferences)&&"string"==typeof t.FileReferences.Moc&&(null==(e=t.FileReferences.Textures)?void 0:e.length)>0&&t.FileReferences.Textures.every((t=>"string"==typeof t))}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,i]of Object.entries(this.motions))for(let s=0;s{this.emit("motion:"+e)}))}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(e,i,s){const r=et.create(e),a=new H(e),o=(i===this.groups.idle?t.config.idleMotionFadingDuration:t.config.motionFadingDuration)/1e3;return void 0===a.getMotionFadeInTime()&&r.setFadeInTime(s.FadeInTime>0?s.FadeInTime:o),void 0===a.getMotionFadeOutTime()&&r.setFadeOutTime(s.FadeOutTime>0?s.FadeOutTime:o),r.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),r}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const We=new p;class He extends pe{constructor(t,e,s){super(),this.lipSync=!0,this.breath=a.create(),this.renderer=new Wt,this.idParamAngleX=Yt,this.idParamAngleY=qt,this.idParamAngleZ=$t,this.idParamEyeBallX=Zt,this.idParamEyeBallY=Jt,this.idParamBodyAngleX=Qt,this.idParamBreath=Kt,this.pixelsPerUnit=1,this.centeringTransform=new i.Matrix,this.coreModel=t,this.settings=e,this.motionManager=new ze(e,s),this.init()}init(){var t;super.init(),(null==(t=this.settings.getEyeBlinkParameters())?void 0:t.length)>0&&(this.eyeBlink=l.create(this.settings)),this.breath.setParameters([new o(this.idParamAngleX,0,15,6.5345,.5),new o(this.idParamAngleY,0,8,3.5345,.5),new o(this.idParamAngleZ,0,10,5.5345,.5),new o(this.idParamBodyAngleX,0,4,15.5345,.5),new o(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){t[e.charAt(0).toLowerCase()+e.slice(1)]=this.settings.layout[e]}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,Ot.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return null!=(e=null==(t=this.settings.hitAreas)?void 0:t.map((t=>({id:t.Id,name:t.Name,index:this.coreModel.getDrawableIndex(t.Id)}))))?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if("string"==typeof t&&-1===(t=this.coreModel.getDrawableIndex(t)))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let i=0;i{!function i(){try{Ze(),t()}catch(s){if(qe--,qe<0){const t=new Error("Failed to start up Cubism 4 framework.");return t.cause=s,void e(t)}ee.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(i,10)}}()}))),Ye)}function Ze(t){t=Object.assign({logFunction:console.log,loggingLevel:S.LogLevel_Verbose},t),C.startUp(t),C.initialize()}function Je(){var t;null==(t=this.__moc)||t.release()}Te.registerRuntime({version:4,ready:$e,test:t=>t instanceof Xe||Xe.isValidJSON(t),isValidMoc(t){if(t.byteLength<4)return!1;const e=new Int8Array(t,0,4);return"MOC3"===String.fromCharCode(...e)},createModelSettings:t=>new Xe(t),createCoreModel(t){const e=F.create(t);try{const t=e.createModel();return t.__moc=e,t}catch(i){try{e.release()}catch(s){}throw i}},createInternalModel(t,e,i){const s=new He(t,e,i),r=t;return r.__moc&&(s.__moc=r.__moc,delete r.__moc,s.once("destroy",Je)),s},createPhysics:(t,e)=>gt.create(e),createPose:(t,e)=>u.create(e)}),t.ACubismMotion=R,t.BreathParameterData=o,t.CSM_ASSERT=b,t.Constant=P,t.Cubism4ExpressionManager=Ge,t.Cubism4InternalModel=He,t.Cubism4ModelSettings=Xe,t.Cubism4MotionManager=ze,t.CubismBlendMode=f,t.CubismBreath=a,t.CubismClippingContext=Rt,t.CubismClippingManager_WebGL=At,t.CubismDebug=E,t.CubismExpressionMotion=O,t.CubismEyeBlink=l,t.CubismFramework=C,t.CubismLogDebug=w,t.CubismLogError=T,t.CubismLogInfo=I,t.CubismLogVerbose=function(t,...e){E.print(S.LogLevel_Verbose,"[CSM][V]"+t+"\n",e)},t.CubismLogWarning=L,t.CubismMath=g,t.CubismMatrix44=p,t.CubismMoc=F,t.CubismModel=D,t.CubismModelSettingsJson=Ht,t.CubismModelUserData=B,t.CubismModelUserDataJson=A,t.CubismMotion=et,t.CubismMotionCurve=X,t.CubismMotionCurveTarget=N,t.CubismMotionData=W,t.CubismMotionEvent=z,t.CubismMotionJson=H,t.CubismMotionManager=class extends st{constructor(){super(),this._currentPriority=0,this._reservePriority=0}getCurrentPriority(){return this._currentPriority}getReservePriority(){return this._reservePriority}setReservePriority(t){this._reservePriority=t}startMotionPriority(t,e,i){return i==this._reservePriority&&(this._reservePriority=0),this._currentPriority=i,super.startMotion(t,e,this._userTimeSeconds)}updateMotion(t,e){this._userTimeSeconds+=e;const i=super.doUpdateMotion(t,this._userTimeSeconds);return this.isFinished()&&(this._currentPriority=0),i}reserveMotion(t){return!(t<=this._reservePriority||t<=this._currentPriority)&&(this._reservePriority=t,!0)}},t.CubismMotionPoint=j,t.CubismMotionQueueEntry=it,t.CubismMotionQueueManager=st,t.CubismMotionSegment=G,t.CubismMotionSegmentType=V,t.CubismPhysics=gt,t.CubismPhysicsInput=ht,t.CubismPhysicsJson=ct,t.CubismPhysicsOutput=ut,t.CubismPhysicsParticle=nt,t.CubismPhysicsRig=dt,t.CubismPhysicsSource=ot,t.CubismPhysicsSubRig=lt,t.CubismPhysicsTargetType=at,t.CubismPose=u,t.CubismRenderTextureResource=Bt,t.CubismRenderer=_,t.CubismRenderer_WebGL=Wt,t.CubismShader_WebGL=Ot,t.CubismTextureColor=y,t.CubismVector2=c,t.EvaluationOptionFlag=Y,t.ExpressionBlendType=U,t.ExpressionManager=oe,t.EyeState=h,t.FileLoader=Ne,t.FocusController=ne,t.HitAreaBody="Body",t.HitAreaHead="Head",t.HitAreaPrefix="HitArea",t.InteractionMixin=Ee,t.InternalModel=pe,t.InvalidMotionQueueEntryHandleValue=rt,t.LOGICAL_HEIGHT=2,t.LOGICAL_WIDTH=2,t.Live2DFactory=Te,t.Live2DLoader=ve,t.Live2DModel=ke,t.Live2DTransform=Ae,t.LogLevel=S,t.ModelSettings=le,t.MotionManager=me,t.MotionPreloadStrategy=ce,t.MotionPriority=he,t.MotionState=ue,t.Options=pt,t.ParamAngleX=Yt,t.ParamAngleY=qt,t.ParamAngleZ=$t,t.ParamArmLA="ParamArmLA",t.ParamArmLB="ParamArmLB",t.ParamArmRA="ParamArmRA",t.ParamArmRB="ParamArmRB",t.ParamBaseX="ParamBaseX",t.ParamBaseY="ParamBaseY",t.ParamBodyAngleX=Qt,t.ParamBodyAngleY="ParamBodyAngleY",t.ParamBodyAngleZ="ParamBodyAngleZ",t.ParamBreath=Kt,t.ParamBrowLAngle="ParamBrowLAngle",t.ParamBrowLForm="ParamBrowLForm",t.ParamBrowLX="ParamBrowLX",t.ParamBrowLY="ParamBrowLY",t.ParamBrowRAngle="ParamBrowRAngle",t.ParamBrowRForm="ParamBrowRForm",t.ParamBrowRX="ParamBrowRX",t.ParamBrowRY="ParamBrowRY",t.ParamBustX="ParamBustX",t.ParamBustY="ParamBustY",t.ParamCheek="ParamCheek",t.ParamEyeBallForm="ParamEyeBallForm",t.ParamEyeBallX=Zt,t.ParamEyeBallY=Jt,t.ParamEyeLOpen="ParamEyeLOpen",t.ParamEyeLSmile="ParamEyeLSmile",t.ParamEyeROpen="ParamEyeROpen",t.ParamEyeRSmile="ParamEyeRSmile",t.ParamHairBack="ParamHairBack",t.ParamHairFluffy="ParamHairFluffy",t.ParamHairFront="ParamHairFront",t.ParamHairSide="ParamHairSide",t.ParamHandL="ParamHandL",t.ParamHandR="ParamHandR",t.ParamMouthForm="ParamMouthForm",t.ParamMouthOpenY="ParamMouthOpenY",t.ParamNONE="NONE:",t.ParamShoulderY="ParamShoulderY",t.PartData=d,t.PartsArmLPrefix="Parts01ArmL_",t.PartsArmPrefix="Parts01Arm_",t.PartsArmRPrefix="Parts01ArmR_",t.PartsIdCore="Parts01Core",t.PhysicsJsonEffectiveForces=class{constructor(){this.gravity=new c(0,0),this.wind=new c(0,0)}},t.ShaderNames=kt,t.SoundManager=de,t.VERSION="0.4.0",t.XHRLoader=ye,t.ZipLoader=je,t.applyMixins=se,t.clamp=ie,t.copyArray=function(t,e,i,s,r){const a=e[s];Array.isArray(a)&&(i[r]=a.filter((e=>null!==e&&typeof e===t)))},t.copyProperty=function(t,e,i,s,r){const a=e[s];null!==a&&typeof a===t&&(i[r]=a)},t.csmRect=Tt,t.cubism4Ready=$e,t.folderName=re,t.fragmentShaderSrcMaskInvertedPremultipliedAlpha=zt,t.fragmentShaderSrcMaskPremultipliedAlpha=Xt,t.fragmentShaderSrcPremultipliedAlpha=Gt,t.fragmentShaderSrcsetupMask=Nt,t.logger=ee,t.rand=function(t,e){return Math.random()*(e-t)+t},t.remove=ae,t.startUpCubism4=Ze,t.vertexShaderSrc=Vt,t.vertexShaderSrcMasked=jt,t.vertexShaderSrcSetupMask=Ut,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); diff --git a/live2d/node_modules/pixi-live2d-display/dist/extra.es.js b/live2d/node_modules/pixi-live2d-display/dist/extra.es.js new file mode 100644 index 0000000..2718758 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/extra.es.js @@ -0,0 +1,61 @@ +var __pow = Math.pow; +import { Graphics } from "@pixi/graphics"; +import { TextStyle, Text } from "@pixi/text"; +import { Rectangle } from "@pixi/math"; +const tempBounds = new Rectangle(); +class HitAreaFrames extends Graphics { + constructor() { + super(); + this.initialized = false; + this.texts = []; + this.strokeWidth = 4; + this.normalColor = 14883354; + this.activeColor = 2017330; + this.interactive = true; + this.on("added", this.init).on("pointermove", this.onPointerMove); + } + init() { + const internalModel = this.parent.internalModel; + const textStyle = new TextStyle({ + fontSize: 24, + fill: "#ffffff", + stroke: "#000000", + strokeThickness: 4 + }); + this.texts = Object.keys(internalModel.hitAreas).map((hitAreaName) => { + const text = new Text(hitAreaName, textStyle); + text.visible = false; + this.addChild(text); + return text; + }); + } + onPointerMove(e) { + const hitAreaNames = this.parent.hitTest(e.data.global.x, e.data.global.y); + this.texts.forEach((text) => { + text.visible = hitAreaNames.includes(text.text); + }); + } + _render(renderer) { + const internalModel = this.parent.internalModel; + const scale = 1 / Math.sqrt(__pow(this.transform.worldTransform.a, 2) + __pow(this.transform.worldTransform.b, 2)); + this.texts.forEach((text) => { + this.lineStyle({ + width: this.strokeWidth * scale, + color: text.visible ? this.activeColor : this.normalColor + }); + const bounds = internalModel.getDrawableBounds(internalModel.hitAreas[text.text].index, tempBounds); + const transform = internalModel.localTransform; + bounds.x = bounds.x * transform.a + transform.tx; + bounds.y = bounds.y * transform.d + transform.ty; + bounds.width = bounds.width * transform.a; + bounds.height = bounds.height * transform.d; + this.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); + text.x = bounds.x + this.strokeWidth * scale; + text.y = bounds.y + this.strokeWidth * scale; + text.scale.set(scale); + }); + super._render(renderer); + this.clear(); + } +} +export { HitAreaFrames }; diff --git a/live2d/node_modules/pixi-live2d-display/dist/extra.js b/live2d/node_modules/pixi-live2d-display/dist/extra.js new file mode 100644 index 0000000..53d8e79 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/extra.js @@ -0,0 +1,64 @@ +var __pow = Math.pow; +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@pixi/graphics"), require("@pixi/text"), require("@pixi/math")) : typeof define === "function" && define.amd ? define(["exports", "@pixi/graphics", "@pixi/text", "@pixi/math"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory((global.PIXI = global.PIXI || {}, global.PIXI.live2d = global.PIXI.live2d || {}), global.PIXI, global.PIXI, global.PIXI)); +})(this, function(exports2, graphics, text, math) { + "use strict"; + const tempBounds = new math.Rectangle(); + class HitAreaFrames extends graphics.Graphics { + constructor() { + super(); + this.initialized = false; + this.texts = []; + this.strokeWidth = 4; + this.normalColor = 14883354; + this.activeColor = 2017330; + this.interactive = true; + this.on("added", this.init).on("pointermove", this.onPointerMove); + } + init() { + const internalModel = this.parent.internalModel; + const textStyle = new text.TextStyle({ + fontSize: 24, + fill: "#ffffff", + stroke: "#000000", + strokeThickness: 4 + }); + this.texts = Object.keys(internalModel.hitAreas).map((hitAreaName) => { + const text$1 = new text.Text(hitAreaName, textStyle); + text$1.visible = false; + this.addChild(text$1); + return text$1; + }); + } + onPointerMove(e) { + const hitAreaNames = this.parent.hitTest(e.data.global.x, e.data.global.y); + this.texts.forEach((text2) => { + text2.visible = hitAreaNames.includes(text2.text); + }); + } + _render(renderer) { + const internalModel = this.parent.internalModel; + const scale = 1 / Math.sqrt(__pow(this.transform.worldTransform.a, 2) + __pow(this.transform.worldTransform.b, 2)); + this.texts.forEach((text2) => { + this.lineStyle({ + width: this.strokeWidth * scale, + color: text2.visible ? this.activeColor : this.normalColor + }); + const bounds = internalModel.getDrawableBounds(internalModel.hitAreas[text2.text].index, tempBounds); + const transform = internalModel.localTransform; + bounds.x = bounds.x * transform.a + transform.tx; + bounds.y = bounds.y * transform.d + transform.ty; + bounds.width = bounds.width * transform.a; + bounds.height = bounds.height * transform.d; + this.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); + text2.x = bounds.x + this.strokeWidth * scale; + text2.y = bounds.y + this.strokeWidth * scale; + text2.scale.set(scale); + }); + super._render(renderer); + this.clear(); + } + } + exports2.HitAreaFrames = HitAreaFrames; + Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); +}); diff --git a/live2d/node_modules/pixi-live2d-display/dist/extra.min.js b/live2d/node_modules/pixi-live2d-display/dist/extra.min.js new file mode 100644 index 0000000..4541d9c --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/extra.min.js @@ -0,0 +1 @@ +var __pow=Math.pow;!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pixi/graphics"),require("@pixi/text"),require("@pixi/math")):"function"==typeof define&&define.amd?define(["exports","@pixi/graphics","@pixi/text","@pixi/math"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).PIXI=t.PIXI||{},t.PIXI.live2d=t.PIXI.live2d||{}),t.PIXI,t.PIXI,t.PIXI)}(this,(function(t,e,i,s){"use strict";const o=new s.Rectangle;class r extends e.Graphics{constructor(){super(),this.initialized=!1,this.texts=[],this.strokeWidth=4,this.normalColor=14883354,this.activeColor=2017330,this.interactive=!0,this.on("added",this.init).on("pointermove",this.onPointerMove)}init(){const t=this.parent.internalModel,e=new i.TextStyle({fontSize:24,fill:"#ffffff",stroke:"#000000",strokeThickness:4});this.texts=Object.keys(t.hitAreas).map((t=>{const s=new i.Text(t,e);return s.visible=!1,this.addChild(s),s}))}onPointerMove(t){const e=this.parent.hitTest(t.data.global.x,t.data.global.y);this.texts.forEach((t=>{t.visible=e.includes(t.text)}))}_render(t){const e=this.parent.internalModel,i=1/Math.sqrt(__pow(this.transform.worldTransform.a,2)+__pow(this.transform.worldTransform.b,2));this.texts.forEach((t=>{this.lineStyle({width:this.strokeWidth*i,color:t.visible?this.activeColor:this.normalColor});const s=e.getDrawableBounds(e.hitAreas[t.text].index,o),r=e.localTransform;s.x=s.x*r.a+r.tx,s.y=s.y*r.d+r.ty,s.width=s.width*r.a,s.height=s.height*r.d,this.drawRect(s.x,s.y,s.width,s.height),t.x=s.x+this.strokeWidth*i,t.y=s.y+this.strokeWidth*i,t.scale.set(i)})),super._render(t),this.clear()}}t.HitAreaFrames=r,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); diff --git a/live2d/node_modules/pixi-live2d-display/dist/index.es.js b/live2d/node_modules/pixi-live2d-display/dist/index.es.js new file mode 100644 index 0000000..f969d30 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/index.es.js @@ -0,0 +1,5984 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +import { EventEmitter, url } from "@pixi/utils"; +import { Matrix, Transform, Point, ObservablePoint } from "@pixi/math"; +import { Texture } from "@pixi/core"; +import { Container } from "@pixi/display"; +const LOGICAL_WIDTH = 2; +const LOGICAL_HEIGHT = 2; +var CubismConfig; +((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; +})(CubismConfig || (CubismConfig = {})); +var config; +((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = CubismConfig; +})(config || (config = {})); +const VERSION = "0.4.0"; +const logger = { + log(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (config.logLevel <= config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } +}; +function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; +} +function rand(min, max) { + return Math.random() * (max - min) + min; +} +function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } +} +function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } +} +function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); +} +function folderName(url2) { + let lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url2 = url2.slice(0, lastSlashIndex); + } + lastSlashIndex = url2.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url2 = url2.slice(lastSlashIndex + 1); + } + return url2; +} +function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } +} +class ExpressionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self = this; + self.definitions = void 0; + self.expressions = void 0; + } +} +const EPSILON = 0.01; +const MAX_SPEED = 40 / 7.5; +const ACCELERATION_TIME = 1 / (0.15 * 1e3); +class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } +} +class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } +} +var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; +})(MotionPriority || {}); +class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } +} +const TAG$2 = "SoundManager"; +const VOLUME = 0.5; +class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } +} +SoundManager.audios = []; +SoundManager._volume = VOLUME; +var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; +})(MotionPreloadStrategy || {}); +class MotionManager extends EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self = this; + self.definitions = void 0; + self.motionGroups = void 0; + } +} +const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; +class InternalModel extends EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new Matrix(); + this.drawingMatrix = new Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self = this; + const size = this.getSize(); + self.originalWidth = size[0]; + self.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self.width = this.originalWidth * this.localTransform.a; + self.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } +} +const TAG$1 = "XHRLoader"; +class NetworkError extends Error { + constructor(message, url2, status, aborted = false) { + super(message); + this.url = url2; + this.status = status; + this.aborted = aborted; + } +} +const _XHRLoader = class { + static createXHR(target, url2, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url2); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url2}`); + onerror(new NetworkError("Network error.", url2, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url2, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } +}; +let XHRLoader = _XHRLoader; +XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); +XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); +XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); +}; +function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } +} +class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } +} +Live2DLoader.middlewares = [XHRLoader.loader]; +function createTexture(url2, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (Texture.fromURL) { + return Texture.fromURL(url2, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = Texture.from(url2, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; +} +const TAG = "Live2DFactory"; +const urlToJSON = (context, next) => __async(void 0, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); +}); +const jsonToSettings = (context, next) => __async(void 0, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); +}); +const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); +}; +const setupOptionals = (context, next) => __async(void 0, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } +}); +const setupEssentials = (context, next) => __async(void 0, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url2 = context.settings.resolveURL(tex); + return createTexture(url2, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } +}); +const createInternalModel = (context, next) => __async(void 0, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); +}); +const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } +}; +let Live2DFactory = _Live2DFactory; +Live2DFactory.runtimes = []; +Live2DFactory.urlToJSON = urlToJSON; +Live2DFactory.jsonToSettings = jsonToSettings; +Live2DFactory.waitUntilReady = waitUntilReady; +Live2DFactory.setupOptionals = setupOptionals; +Live2DFactory.setupEssentials = setupEssentials; +Live2DFactory.createInternalModel = createInternalModel; +Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel +]; +Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); +Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); +MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); +}; +ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); +}; +class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } +} +function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); +} +function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); +} +class Live2DTransform extends Transform { +} +const tempPoint = new Point(); +const tempMatrix$1 = new Matrix(); +let tickerRef; +class Live2DModel extends Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix$1.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } +} +applyMixins(Live2DModel, [InteractionMixin]); +const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } +}; +let FileLoader = _FileLoader; +FileLoader.filesMap = {}; +FileLoader.factory = (context, next) => __async(void 0, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url2) { + return _FileLoader.resolveURL(this._objectURL, url2); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); +const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url2) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } +}; +let ZipLoader = _ZipLoader; +ZipLoader.ZIP_PROTOCOL = "zip://"; +ZipLoader.uid = 0; +ZipLoader.factory = (context, next) => __async(void 0, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); +}); +Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); +if (!window.Live2D) { + throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded."); +} +const originalUpdateParam = Live2DMotion.prototype.updateParam; +Live2DMotion.prototype.updateParam = function(model, entry) { + originalUpdateParam.call(this, model, entry); + if (entry.isFinished() && this.onFinishHandler) { + this.onFinishHandler(this); + delete this.onFinishHandler; + } +}; +class Live2DExpression extends AMotion { + constructor(json) { + super(); + this.params = []; + this.setFadeIn(json.fade_in > 0 ? json.fade_in : config.expressionFadingDuration); + this.setFadeOut(json.fade_out > 0 ? json.fade_out : config.expressionFadingDuration); + if (Array.isArray(json.params)) { + json.params.forEach((param) => { + const calc = param.calc || "add"; + if (calc === "add") { + const defaultValue = param.def || 0; + param.val -= defaultValue; + } else if (calc === "mult") { + const defaultValue = param.def || 1; + param.val /= defaultValue; + } + this.params.push({ + calc, + val: param.val, + id: param.id + }); + }); + } + } + updateParamExe(model, time, weight, motionQueueEnt) { + this.params.forEach((param) => { + model.setParamFloat(param.id, param.val * weight); + }); + } +} +class Cubism2ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new MotionQueueManager(); + this.definitions = (_a = this.settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.name === name); + } + getExpressionFile(definition) { + return definition.file; + } + createExpression(data, definition) { + return new Live2DExpression(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, dt) { + return this.queueManager.updateParam(model); + } +} +class Cubism2MotionManager extends MotionManager { + constructor(settings, options) { + super(settings, options); + this.groups = { idle: "idle" }; + this.motionDataType = "arraybuffer"; + this.queueManager = new MotionQueueManager(); + this.definitions = this.settings.motions; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism2ExpressionManager(this.settings, options); + } + } + isFinished() { + return this.queueManager.isFinished(); + } + createMotion(data, group, definition) { + const motion = Live2DMotion.loadMotion(data); + const defaultFadingDuration = group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration; + motion.setFadeIn(definition.fade_in > 0 ? definition.fade_in : defaultFadingDuration); + motion.setFadeOut(definition.fade_out > 0 ? definition.fade_out : defaultFadingDuration); + return motion; + } + getMotionFile(definition) { + return definition.file; + } + getMotionName(definition) { + return definition.file; + } + getSoundFile(definition) { + return definition.sound; + } + _startMotion(motion, onFinish) { + motion.onFinishHandler = onFinish; + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.updateParam(model); + } + destroy() { + super.destroy(); + this.queueManager = void 0; + } +} +class Live2DEyeBlink { + constructor(coreModel) { + this.coreModel = coreModel; + this.blinkInterval = 4e3; + this.closingDuration = 100; + this.closedDuration = 50; + this.openingDuration = 150; + this.eyeState = 0; + this.eyeParamValue = 1; + this.closedTimer = 0; + this.nextBlinkTimeLeft = this.blinkInterval; + this.leftParam = coreModel.getParamIndex("PARAM_EYE_L_OPEN"); + this.rightParam = coreModel.getParamIndex("PARAM_EYE_R_OPEN"); + } + setEyeParams(value) { + this.eyeParamValue = clamp(value, 0, 1); + this.coreModel.setParamFloat(this.leftParam, this.eyeParamValue); + this.coreModel.setParamFloat(this.rightParam, this.eyeParamValue); + } + update(dt) { + switch (this.eyeState) { + case 0: + this.nextBlinkTimeLeft -= dt; + if (this.nextBlinkTimeLeft < 0) { + this.eyeState = 1; + this.nextBlinkTimeLeft = this.blinkInterval + this.closingDuration + this.closedDuration + this.openingDuration + rand(0, 2e3); + } + break; + case 1: + this.setEyeParams(this.eyeParamValue + dt / this.closingDuration); + if (this.eyeParamValue <= 0) { + this.eyeState = 2; + this.closedTimer = 0; + } + break; + case 2: + this.closedTimer += dt; + if (this.closedTimer >= this.closedDuration) { + this.eyeState = 3; + } + break; + case 3: + this.setEyeParams(this.eyeParamValue + dt / this.openingDuration); + if (this.eyeParamValue >= 1) { + this.eyeState = 0; + } + } + } +} +const tempMatrixArray = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 +]); +class Cubism2InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.textureFlipY = true; + this.drawDataCount = 0; + this.disableCulling = false; + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism2MotionManager(settings, options); + this.eyeBlink = new Live2DEyeBlink(coreModel); + this.eyeballXParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_X"); + this.eyeballYParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_Y"); + this.angleXParamIndex = coreModel.getParamIndex("PARAM_ANGLE_X"); + this.angleYParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Y"); + this.angleZParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Z"); + this.bodyAngleXParamIndex = coreModel.getParamIndex("PARAM_BODY_ANGLE_X"); + this.breathParamIndex = coreModel.getParamIndex("PARAM_BREATH"); + this.init(); + } + init() { + super.init(); + if (this.settings.initParams) { + this.settings.initParams.forEach(({ id, value }) => this.coreModel.setParamFloat(id, value)); + } + if (this.settings.initOpacities) { + this.settings.initOpacities.forEach(({ id, value }) => this.coreModel.setPartsOpacity(id, value)); + } + this.coreModel.saveParam(); + const arr = this.coreModel.getModelContext()._$aS; + if (arr == null ? void 0 : arr.length) { + this.drawDataCount = arr.length; + } + let culling = this.coreModel.drawParamWebGL.culling; + Object.defineProperty(this.coreModel.drawParamWebGL, "culling", { + set: (v) => culling = v, + get: () => this.disableCulling ? false : culling + }); + const clipManager = this.coreModel.getModelContext().clipManager; + const originalSetupClip = clipManager.setupClip; + clipManager.setupClip = (modelContext, drawParam) => { + originalSetupClip.call(clipManager, modelContext, drawParam); + drawParam.gl.viewport(...this.viewport); + }; + } + getSize() { + return [this.coreModel.getCanvasWidth(), this.coreModel.getCanvasHeight()]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + let commonKey = key; + if (key === "center_x") { + commonKey = "centerX"; + } else if (key === "center_y") { + commonKey = "centerY"; + } + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + updateWebGLContext(gl, glContextID) { + const drawParamWebGL = this.coreModel.drawParamWebGL; + drawParamWebGL.firstDraw = true; + drawParamWebGL.setGL(gl); + drawParamWebGL.glno = glContextID; + for (const prop in drawParamWebGL) { + if (drawParamWebGL.hasOwnProperty(prop) && drawParamWebGL[prop] instanceof WebGLBuffer) { + drawParamWebGL[prop] = null; + } + } + const clipManager = this.coreModel.getModelContext().clipManager; + clipManager.curFrameNo = glContextID; + const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + clipManager.getMaskRenderTexture(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + bindTexture(index, texture) { + this.coreModel.setTexture(index, texture); + } + getHitAreaDefs() { + var _a; + return ((_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.id, + name: hitArea.name, + index: this.coreModel.getDrawDataIndex(hitArea.id) + }))) || []; + } + getDrawableIDs() { + const modelContext = this.coreModel.getModelContext(); + const ids = []; + for (let i = 0; i < this.drawDataCount; i++) { + const drawData = modelContext.getDrawData(i); + if (drawData) { + ids.push(drawData.getDrawDataID().id); + } + } + return ids; + } + getDrawableIndex(id) { + return this.coreModel.getDrawDataIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawDataIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + return this.coreModel.getTransformedPoints(drawIndex).slice(); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParam(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.update(dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt, now); + (_c = this.physics) == null ? void 0 : _c.update(now); + (_d = this.pose) == null ? void 0 : _d.update(dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParam(); + } + updateFocus() { + this.coreModel.addToParamFloat(this.eyeballXParamIndex, this.focusController.x); + this.coreModel.addToParamFloat(this.eyeballYParamIndex, this.focusController.y); + this.coreModel.addToParamFloat(this.angleXParamIndex, this.focusController.x * 30); + this.coreModel.addToParamFloat(this.angleYParamIndex, this.focusController.y * 30); + this.coreModel.addToParamFloat(this.angleZParamIndex, this.focusController.x * this.focusController.y * -30); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + const t = now / 1e3 * 2 * Math.PI; + this.coreModel.addToParamFloat(this.angleXParamIndex, 15 * Math.sin(t / 6.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleYParamIndex, 8 * Math.sin(t / 3.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleZParamIndex, 10 * Math.sin(t / 5.5345) * 0.5); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, 4 * Math.sin(t / 15.5345) * 0.5); + this.coreModel.setParamFloat(this.breathParamIndex, 0.5 + 0.5 * Math.sin(t / 3.2345)); + } + draw(gl) { + const disableCulling = this.disableCulling; + if (gl.getParameter(gl.FRAMEBUFFER_BINDING)) { + this.disableCulling = true; + } + const matrix = this.drawingMatrix; + tempMatrixArray[0] = matrix.a; + tempMatrixArray[1] = matrix.b; + tempMatrixArray[4] = matrix.c; + tempMatrixArray[5] = matrix.d; + tempMatrixArray[12] = matrix.tx; + tempMatrixArray[13] = matrix.ty; + this.coreModel.setMatrix(tempMatrixArray); + this.coreModel.draw(); + this.disableCulling = disableCulling; + } + destroy() { + super.destroy(); + this.coreModel = void 0; + } +} +class Cubism2ModelSettings extends ModelSettings { + constructor(json) { + super(json); + this.motions = {}; + if (!Cubism2ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + this.moc = json.model; + copyArray("string", json, this, "textures", "textures"); + this.copy(json); + } + static isValidJSON(json) { + var _a; + return !!json && typeof json.model === "string" && ((_a = json.textures) == null ? void 0 : _a.length) > 0 && json.textures.every((item) => typeof item === "string"); + } + copy(json) { + copyProperty("string", json, this, "name", "name"); + copyProperty("string", json, this, "pose", "pose"); + copyProperty("string", json, this, "physics", "physics"); + copyProperty("object", json, this, "layout", "layout"); + copyProperty("object", json, this, "motions", "motions"); + copyArray("object", json, this, "hit_areas", "hitAreas"); + copyArray("object", json, this, "expressions", "expressions"); + copyArray("object", json, this, "init_params", "initParams"); + copyArray("object", json, this, "init_opacities", "initOpacities"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].file = replace(motions[i].file, `motions.${group}[${i}].file`); + if (motions[i].sound !== void 0) { + motions[i].sound = replace(motions[i].sound, `motions.${group}[${i}].sound`); + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].file = replace(this.expressions[i].file, `expressions[${i}].file`); + } + } + } +} +const SRC_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE +}; +const TARGET_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE +}; +class Live2DPhysics { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.physicsHairs = []; + if (json.physics_hair) { + this.physicsHairs = json.physics_hair.map((definition) => { + const physicsHair = new PhysicsHair(); + physicsHair.setup(definition.setup.length, definition.setup.regist, definition.setup.mass); + definition.src.forEach(({ id, ptype, scale, weight }) => { + const type = SRC_TYPE_MAP[ptype]; + if (type) { + physicsHair.addSrcParam(type, id, scale, weight); + } + }); + definition.targets.forEach(({ id, ptype, scale, weight }) => { + const type = TARGET_TYPE_MAP[ptype]; + if (type) { + physicsHair.addTargetParam(type, id, scale, weight); + } + }); + return physicsHair; + }); + } + } + update(elapsed) { + this.physicsHairs.forEach((physicsHair) => physicsHair.update(this.coreModel, elapsed)); + } +} +class Live2DPartsParam { + constructor(id) { + this.id = id; + this.paramIndex = -1; + this.partsIndex = -1; + this.link = []; + } + initIndex(model) { + this.paramIndex = model.getParamIndex("VISIBLE:" + this.id); + this.partsIndex = model.getPartsDataIndex(PartsDataID.getID(this.id)); + model.setParamFloat(this.paramIndex, 1); + } +} +class Live2DPose { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.opacityAnimDuration = 500; + this.partsGroups = []; + if (json.parts_visible) { + this.partsGroups = json.parts_visible.map(({ group }) => group.map(({ id, link }) => { + const parts = new Live2DPartsParam(id); + if (link) { + parts.link = link.map((l) => new Live2DPartsParam(l)); + } + return parts; + })); + this.init(); + } + } + init() { + this.partsGroups.forEach((group) => { + group.forEach((parts) => { + parts.initIndex(this.coreModel); + if (parts.paramIndex >= 0) { + const visible = this.coreModel.getParamFloat(parts.paramIndex) !== 0; + this.coreModel.setPartsOpacity(parts.partsIndex, visible ? 1 : 0); + this.coreModel.setParamFloat(parts.paramIndex, visible ? 1 : 0); + if (parts.link.length > 0) { + parts.link.forEach((p) => p.initIndex(this.coreModel)); + } + } + }); + }); + } + normalizePartsOpacityGroup(partsGroup, dt) { + const model = this.coreModel; + const phi = 0.5; + const maxBackOpacity = 0.15; + let visibleOpacity = 1; + let visibleIndex = partsGroup.findIndex(({ paramIndex, partsIndex }) => partsIndex >= 0 && model.getParamFloat(paramIndex) !== 0); + if (visibleIndex >= 0) { + const originalOpacity = model.getPartsOpacity(partsGroup[visibleIndex].partsIndex); + visibleOpacity = clamp(originalOpacity + dt / this.opacityAnimDuration, 0, 1); + } else { + visibleIndex = 0; + visibleOpacity = 1; + } + partsGroup.forEach(({ partsIndex }, index) => { + if (partsIndex >= 0) { + if (visibleIndex == index) { + model.setPartsOpacity(partsIndex, visibleOpacity); + } else { + let opacity = model.getPartsOpacity(partsIndex); + let a1; + if (visibleOpacity < phi) { + a1 = visibleOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - visibleOpacity) * phi / (1 - phi); + } + let backOp = (1 - a1) * (1 - visibleOpacity); + if (backOp > maxBackOpacity) { + a1 = 1 - maxBackOpacity / (1 - visibleOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartsOpacity(partsIndex, opacity); + } + } + }); + } + copyOpacity(partsGroup) { + const model = this.coreModel; + partsGroup.forEach(({ partsIndex, link }) => { + if (partsIndex >= 0 && link) { + const opacity = model.getPartsOpacity(partsIndex); + link.forEach(({ partsIndex: partsIndex2 }) => { + if (partsIndex2 >= 0) { + model.setPartsOpacity(partsIndex2, opacity); + } + }); + } + }); + } + update(dt) { + this.partsGroups.forEach((partGroup) => { + this.normalizePartsOpacityGroup(partGroup, dt); + this.copyOpacity(partGroup); + }); + } +} +Live2DFactory.registerRuntime({ + version: 2, + test(source) { + return source instanceof Cubism2ModelSettings || Cubism2ModelSettings.isValidJSON(source); + }, + ready() { + return Promise.resolve(); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 3) { + return false; + } + const view = new Int8Array(modelData, 0, 3); + return String.fromCharCode(...view) === "moc"; + }, + createModelSettings(json) { + return new Cubism2ModelSettings(json); + }, + createCoreModel(data) { + const model = Live2DModelWebGL.loadModel(data); + const error = Live2D.getError(); + if (error) + throw error; + return model; + }, + createInternalModel(coreModel, settings, options) { + return new Cubism2InternalModel(coreModel, settings, options); + }, + createPose(coreModel, data) { + return new Live2DPose(coreModel, data); + }, + createPhysics(coreModel, data) { + return new Live2DPhysics(coreModel, data); + } +}); +if (!window.Live2DCubismCore) { + throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded."); +} +class CubismVector2 { + constructor(x, y) { + this.x = x || 0; + this.y = y || 0; + } + add(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x + vector2.x; + ret.y = this.y + vector2.y; + return ret; + } + substract(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x - vector2.x; + ret.y = this.y - vector2.y; + return ret; + } + multiply(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x * vector2.x; + ret.y = this.y * vector2.y; + return ret; + } + multiplyByScaler(scalar) { + return this.multiply(new CubismVector2(scalar, scalar)); + } + division(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x / vector2.x; + ret.y = this.y / vector2.y; + return ret; + } + divisionByScalar(scalar) { + return this.division(new CubismVector2(scalar, scalar)); + } + getLength() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } + getDistanceWith(a) { + return Math.sqrt((this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)); + } + dot(a) { + return this.x * a.x + this.y * a.y; + } + normalize() { + const length = Math.pow(this.x * this.x + this.y * this.y, 0.5); + this.x = this.x / length; + this.y = this.y / length; + } + isEqual(rhs) { + return this.x == rhs.x && this.y == rhs.y; + } + isNotEqual(rhs) { + return !this.isEqual(rhs); + } +} +const _CubismMath = class { + static range(value, min, max) { + if (value < min) { + value = min; + } else if (value > max) { + value = max; + } + return value; + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static abs(x) { + return Math.abs(x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static cbrt(x) { + if (x === 0) { + return x; + } + let cx = x; + const isNegativeNumber = cx < 0; + if (isNegativeNumber) { + cx = -cx; + } + let ret; + if (cx === Infinity) { + ret = Infinity; + } else { + ret = Math.exp(Math.log(cx) / 3); + ret = (cx / (ret * ret) + 2 * ret) / 3; + } + return isNegativeNumber ? -ret : ret; + } + static getEasingSine(value) { + if (value < 0) { + return 0; + } else if (value > 1) { + return 1; + } + return 0.5 - 0.5 * this.cos(value * Math.PI); + } + static max(left, right) { + return left > right ? left : right; + } + static min(left, right) { + return left > right ? right : left; + } + static degreesToRadian(degrees) { + return degrees / 180 * Math.PI; + } + static radianToDegrees(radian) { + return radian * 180 / Math.PI; + } + static directionToRadian(from, to) { + const q1 = Math.atan2(to.y, to.x); + const q2 = Math.atan2(from.y, from.x); + let ret = q1 - q2; + while (ret < -Math.PI) { + ret += Math.PI * 2; + } + while (ret > Math.PI) { + ret -= Math.PI * 2; + } + return ret; + } + static directionToDegrees(from, to) { + const radian = this.directionToRadian(from, to); + let degree = this.radianToDegrees(radian); + if (to.x - from.x > 0) { + degree = -degree; + } + return degree; + } + static radianToDirection(totalAngle) { + const ret = new CubismVector2(); + ret.x = this.sin(totalAngle); + ret.y = this.cos(totalAngle); + return ret; + } + static quadraticEquation(a, b, c) { + if (this.abs(a) < _CubismMath.Epsilon) { + if (this.abs(b) < _CubismMath.Epsilon) { + return -c; + } + return -c / b; + } + return -(b + this.sqrt(b * b - 4 * a * c)) / (2 * a); + } + static cardanoAlgorithmForBezier(a, b, c, d) { + if (this.sqrt(a) < _CubismMath.Epsilon) { + return this.range(this.quadraticEquation(b, c, d), 0, 1); + } + const ba = b / a; + const ca = c / a; + const da = d / a; + const p = (3 * ca - ba * ba) / 3; + const p3 = p / 3; + const q = (2 * ba * ba * ba - 9 * ba * ca + 27 * da) / 27; + const q2 = q / 2; + const discriminant = q2 * q2 + p3 * p3 * p3; + const center = 0.5; + const threshold = center + 0.01; + if (discriminant < 0) { + const mp3 = -p / 3; + const mp33 = mp3 * mp3 * mp3; + const r = this.sqrt(mp33); + const t = -q / (2 * r); + const cosphi = this.range(t, -1, 1); + const phi = Math.acos(cosphi); + const crtr = this.cbrt(r); + const t1 = 2 * crtr; + const root12 = t1 * this.cos(phi / 3) - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = t1 * this.cos((phi + 2 * Math.PI) / 3) - ba / 3; + if (this.abs(root2 - center) < threshold) { + return this.range(root2, 0, 1); + } + const root3 = t1 * this.cos((phi + 4 * Math.PI) / 3) - ba / 3; + return this.range(root3, 0, 1); + } + if (discriminant == 0) { + let u12; + if (q2 < 0) { + u12 = this.cbrt(-q2); + } else { + u12 = -this.cbrt(q2); + } + const root12 = 2 * u12 - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = -u12 - ba / 3; + return this.range(root2, 0, 1); + } + const sd = this.sqrt(discriminant); + const u1 = this.cbrt(sd - q2); + const v1 = this.cbrt(sd + q2); + const root1 = u1 - v1 - ba / 3; + return this.range(root1, 0, 1); + } + constructor() { + } +}; +let CubismMath = _CubismMath; +CubismMath.Epsilon = 1e-5; +class CubismMatrix44 { + constructor() { + this._tr = new Float32Array(16); + this.loadIdentity(); + } + static multiply(a, b, dst) { + const c = new Float32Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]); + const n = 4; + for (let i = 0; i < n; ++i) { + for (let j = 0; j < n; ++j) { + for (let k = 0; k < n; ++k) { + c[j + i * 4] += a[k + i * 4] * b[j + k * 4]; + } + } + } + for (let i = 0; i < 16; ++i) { + dst[i] = c[i]; + } + } + loadIdentity() { + const c = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + this.setMatrix(c); + } + setMatrix(tr) { + for (let i = 0; i < 16; ++i) { + this._tr[i] = tr[i]; + } + } + getArray() { + return this._tr; + } + getScaleX() { + return this._tr[0]; + } + getScaleY() { + return this._tr[5]; + } + getTranslateX() { + return this._tr[12]; + } + getTranslateY() { + return this._tr[13]; + } + transformX(src) { + return this._tr[0] * src + this._tr[12]; + } + transformY(src) { + return this._tr[5] * src + this._tr[13]; + } + invertTransformX(src) { + return (src - this._tr[12]) / this._tr[0]; + } + invertTransformY(src) { + return (src - this._tr[13]) / this._tr[5]; + } + translateRelative(x, y) { + const tr1 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + x, + y, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + translate(x, y) { + this._tr[12] = x; + this._tr[13] = y; + } + translateX(x) { + this._tr[12] = x; + } + translateY(y) { + this._tr[13] = y; + } + scaleRelative(x, y) { + const tr1 = new Float32Array([ + x, + 0, + 0, + 0, + 0, + y, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + scale(x, y) { + this._tr[0] = x; + this._tr[5] = y; + } + multiplyByMatrix(m) { + CubismMatrix44.multiply(m.getArray(), this._tr, this._tr); + } + clone() { + const cloneMatrix = new CubismMatrix44(); + for (let i = 0; i < this._tr.length; i++) { + cloneMatrix._tr[i] = this._tr[i]; + } + return cloneMatrix; + } +} +class CubismRenderer { + initialize(model) { + this._model = model; + } + drawModel() { + if (this.getModel() == null) + return; + this.doDrawModel(); + } + setMvpMatrix(matrix44) { + this._mvpMatrix4x4.setMatrix(matrix44.getArray()); + } + getMvpMatrix() { + return this._mvpMatrix4x4; + } + setModelColor(red, green, blue, alpha) { + if (red < 0) { + red = 0; + } else if (red > 1) { + red = 1; + } + if (green < 0) { + green = 0; + } else if (green > 1) { + green = 1; + } + if (blue < 0) { + blue = 0; + } else if (blue > 1) { + blue = 1; + } + if (alpha < 0) { + alpha = 0; + } else if (alpha > 1) { + alpha = 1; + } + this._modelColor.R = red; + this._modelColor.G = green; + this._modelColor.B = blue; + this._modelColor.A = alpha; + } + getModelColor() { + return Object.assign({}, this._modelColor); + } + setIsPremultipliedAlpha(enable) { + this._isPremultipliedAlpha = enable; + } + isPremultipliedAlpha() { + return this._isPremultipliedAlpha; + } + setIsCulling(culling) { + this._isCulling = culling; + } + isCulling() { + return this._isCulling; + } + setAnisotropy(n) { + this._anisortopy = n; + } + getAnisotropy() { + return this._anisortopy; + } + getModel() { + return this._model; + } + constructor() { + this._isCulling = false; + this._isPremultipliedAlpha = false; + this._anisortopy = 0; + this._modelColor = new CubismTextureColor(); + this._mvpMatrix4x4 = new CubismMatrix44(); + this._mvpMatrix4x4.loadIdentity(); + } +} +var CubismBlendMode = /* @__PURE__ */ ((CubismBlendMode2) => { + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Normal"] = 0] = "CubismBlendMode_Normal"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Additive"] = 1] = "CubismBlendMode_Additive"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Multiplicative"] = 2] = "CubismBlendMode_Multiplicative"; + return CubismBlendMode2; +})(CubismBlendMode || {}); +class CubismTextureColor { + constructor() { + this.R = 1; + this.G = 1; + this.B = 1; + this.A = 1; + } +} +let s_isStarted = false; +let s_isInitialized = false; +let s_option = void 0; +const Constant = { + vertexOffset: 0, + vertexStep: 2 +}; +class CubismFramework { + static startUp(option) { + if (s_isStarted) { + CubismLogInfo("CubismFramework.startUp() is already done."); + return s_isStarted; + } + if (Live2DCubismCore._isStarted) { + s_isStarted = true; + return true; + } + Live2DCubismCore._isStarted = true; + s_option = option; + if (s_option) { + Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction); + } + s_isStarted = true; + if (s_isStarted) { + const version = Live2DCubismCore.Version.csmGetVersion(); + const major = (version & 4278190080) >> 24; + const minor = (version & 16711680) >> 16; + const patch = version & 65535; + const versionNumber = version; + CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`, ("00" + major).slice(-2), ("00" + minor).slice(-2), ("0000" + patch).slice(-4), versionNumber); + } + CubismLogInfo("CubismFramework.startUp() is complete."); + return s_isStarted; + } + static cleanUp() { + s_isStarted = false; + s_isInitialized = false; + s_option = void 0; + } + static initialize() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (s_isInitialized) { + CubismLogWarning("CubismFramework.initialize() skipped, already initialized."); + return; + } + s_isInitialized = true; + CubismLogInfo("CubismFramework.initialize() is complete."); + } + static dispose() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (!s_isInitialized) { + CubismLogWarning("CubismFramework.dispose() skipped, not initialized."); + return; + } + CubismRenderer.staticRelease(); + s_isInitialized = false; + CubismLogInfo("CubismFramework.dispose() is complete."); + } + static isStarted() { + return s_isStarted; + } + static isInitialized() { + return s_isInitialized; + } + static coreLogFunction(message) { + if (!Live2DCubismCore.Logging.csmGetLogFunction()) { + return; + } + Live2DCubismCore.Logging.csmGetLogFunction()(message); + } + static getLoggingLevel() { + if (s_option != null) { + return s_option.loggingLevel; + } + return LogLevel.LogLevel_Off; + } + constructor() { + } +} +var LogLevel = /* @__PURE__ */ ((LogLevel2) => { + LogLevel2[LogLevel2["LogLevel_Verbose"] = 0] = "LogLevel_Verbose"; + LogLevel2[LogLevel2["LogLevel_Debug"] = 1] = "LogLevel_Debug"; + LogLevel2[LogLevel2["LogLevel_Info"] = 2] = "LogLevel_Info"; + LogLevel2[LogLevel2["LogLevel_Warning"] = 3] = "LogLevel_Warning"; + LogLevel2[LogLevel2["LogLevel_Error"] = 4] = "LogLevel_Error"; + LogLevel2[LogLevel2["LogLevel_Off"] = 5] = "LogLevel_Off"; + return LogLevel2; +})(LogLevel || {}); +const CSM_ASSERT = () => { +}; +function CubismLogDebug(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Debug, "[CSM][D]" + fmt + "\n", args); +} +function CubismLogInfo(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Info, "[CSM][I]" + fmt + "\n", args); +} +function CubismLogWarning(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Warning, "[CSM][W]" + fmt + "\n", args); +} +function CubismLogError(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Error, "[CSM][E]" + fmt + "\n", args); +} +class CubismDebug { + static print(logLevel, format, args) { + if (logLevel < CubismFramework.getLoggingLevel()) { + return; + } + const logPrint = CubismFramework.coreLogFunction; + if (!logPrint) + return; + const buffer = format.replace(/{(\d+)}/g, (m, k) => { + return args[k]; + }); + logPrint(buffer); + } + static dumpBytes(logLevel, data, length) { + for (let i = 0; i < length; i++) { + if (i % 16 == 0 && i > 0) + this.print(logLevel, "\n"); + else if (i % 8 == 0 && i > 0) + this.print(logLevel, " "); + this.print(logLevel, "{0} ", [data[i] & 255]); + } + this.print(logLevel, "\n"); + } + constructor() { + } +} +class ACubismMotion { + constructor() { + this._fadeInSeconds = -1; + this._fadeOutSeconds = -1; + this._weight = 1; + this._offsetSeconds = 0; + this._firedEventValues = []; + } + release() { + this._weight = 0; + } + updateParameters(model, motionQueueEntry, userTimeSeconds) { + if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) { + return; + } + if (!motionQueueEntry.isStarted()) { + motionQueueEntry.setIsStarted(true); + motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + const duration = this.getDuration(); + if (motionQueueEntry.getEndTime() < 0) { + motionQueueEntry.setEndTime(duration <= 0 ? -1 : motionQueueEntry.getStartTime() + duration); + } + } + let fadeWeight = this._weight; + const fadeIn = this._fadeInSeconds == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const fadeOut = this._fadeOutSeconds == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + fadeWeight = fadeWeight * fadeIn * fadeOut; + motionQueueEntry.setState(userTimeSeconds, fadeWeight); + this.doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry); + if (motionQueueEntry.getEndTime() > 0 && motionQueueEntry.getEndTime() < userTimeSeconds) { + motionQueueEntry.setIsFinished(true); + } + } + setFadeInTime(fadeInSeconds) { + this._fadeInSeconds = fadeInSeconds; + } + setFadeOutTime(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + } + getFadeOutTime() { + return this._fadeOutSeconds; + } + getFadeInTime() { + return this._fadeInSeconds; + } + setWeight(weight) { + this._weight = weight; + } + getWeight() { + return this._weight; + } + getDuration() { + return -1; + } + getLoopDuration() { + return -1; + } + setOffsetTime(offsetSeconds) { + this._offsetSeconds = offsetSeconds; + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + return this._firedEventValues; + } + setFinishedMotionHandler(onFinishedMotionHandler) { + this._onFinishedMotion = onFinishedMotionHandler; + } + getFinishedMotionHandler() { + return this._onFinishedMotion; + } +} +const DefaultFadeTime = 1; +class CubismExpressionMotion extends ACubismMotion { + constructor() { + super(); + this._parameters = []; + } + static create(json) { + const expression = new CubismExpressionMotion(); + const fadeInTime = json.FadeInTime; + const fadeOutTime = json.FadeOutTime; + expression.setFadeInTime(fadeInTime !== void 0 ? fadeInTime : DefaultFadeTime); + expression.setFadeOutTime(fadeOutTime !== void 0 ? fadeOutTime : DefaultFadeTime); + const parameters = json.Parameters || []; + for (let i = 0; i < parameters.length; ++i) { + const param = parameters[i]; + const parameterId = param.Id; + const value = param.Value; + let blendType; + switch (param.Blend) { + case "Multiply": + blendType = ExpressionBlendType.ExpressionBlendType_Multiply; + break; + case "Overwrite": + blendType = ExpressionBlendType.ExpressionBlendType_Overwrite; + break; + case "Add": + default: + blendType = ExpressionBlendType.ExpressionBlendType_Add; + break; + } + const item = { + parameterId, + blendType, + value + }; + expression._parameters.push(item); + } + return expression; + } + doUpdateParameters(model, userTimeSeconds, weight, motionQueueEntry) { + for (let i = 0; i < this._parameters.length; ++i) { + const parameter = this._parameters[i]; + switch (parameter.blendType) { + case ExpressionBlendType.ExpressionBlendType_Add: { + model.addParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Multiply: { + model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Overwrite: { + model.setParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + } + } + } +} +var ExpressionBlendType = /* @__PURE__ */ ((ExpressionBlendType2) => { + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Add"] = 0] = "ExpressionBlendType_Add"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Multiply"] = 1] = "ExpressionBlendType_Multiply"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Overwrite"] = 2] = "ExpressionBlendType_Overwrite"; + return ExpressionBlendType2; +})(ExpressionBlendType || {}); +class CubismMotionQueueEntry { + constructor() { + this._autoDelete = false; + this._available = true; + this._finished = false; + this._started = false; + this._startTimeSeconds = -1; + this._fadeInStartTimeSeconds = 0; + this._endTimeSeconds = -1; + this._stateTimeSeconds = 0; + this._stateWeight = 0; + this._lastEventCheckSeconds = 0; + this._motionQueueEntryHandle = this; + this._fadeOutSeconds = 0; + this._isTriggeredFadeOut = false; + } + release() { + if (this._autoDelete && this._motion) { + this._motion.release(); + } + } + setFadeOut(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + this._isTriggeredFadeOut = true; + } + startFadeOut(fadeOutSeconds, userTimeSeconds) { + const newEndTimeSeconds = userTimeSeconds + fadeOutSeconds; + this._isTriggeredFadeOut = true; + if (this._endTimeSeconds < 0 || newEndTimeSeconds < this._endTimeSeconds) { + this._endTimeSeconds = newEndTimeSeconds; + } + } + isFinished() { + return this._finished; + } + isStarted() { + return this._started; + } + getStartTime() { + return this._startTimeSeconds; + } + getFadeInStartTime() { + return this._fadeInStartTimeSeconds; + } + getEndTime() { + return this._endTimeSeconds; + } + setStartTime(startTime) { + this._startTimeSeconds = startTime; + } + setFadeInStartTime(startTime) { + this._fadeInStartTimeSeconds = startTime; + } + setEndTime(endTime) { + this._endTimeSeconds = endTime; + } + setIsFinished(f) { + this._finished = f; + } + setIsStarted(f) { + this._started = f; + } + isAvailable() { + return this._available; + } + setIsAvailable(v) { + this._available = v; + } + setState(timeSeconds, weight) { + this._stateTimeSeconds = timeSeconds; + this._stateWeight = weight; + } + getStateTime() { + return this._stateTimeSeconds; + } + getStateWeight() { + return this._stateWeight; + } + getLastCheckEventSeconds() { + return this._lastEventCheckSeconds; + } + setLastCheckEventSeconds(checkSeconds) { + this._lastEventCheckSeconds = checkSeconds; + } + isTriggeredFadeOut() { + return this._isTriggeredFadeOut; + } + getFadeOutSeconds() { + return this._fadeOutSeconds; + } +} +class CubismMotionQueueManager { + constructor() { + this._userTimeSeconds = 0; + this._eventCustomData = null; + this._motions = []; + } + release() { + for (let i = 0; i < this._motions.length; ++i) { + if (this._motions[i]) { + this._motions[i].release(); + } + } + this._motions = void 0; + } + startMotion(motion, autoDelete, userTimeSeconds) { + if (motion == null) { + return InvalidMotionQueueEntryHandleValue; + } + let motionQueueEntry; + for (let i = 0; i < this._motions.length; ++i) { + motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + motionQueueEntry.setFadeOut(motionQueueEntry._motion.getFadeOutTime()); + } + motionQueueEntry = new CubismMotionQueueEntry(); + motionQueueEntry._autoDelete = autoDelete; + motionQueueEntry._motion = motion; + this._motions.push(motionQueueEntry); + return motionQueueEntry._motionQueueEntryHandle; + } + isFinished() { + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + if (!motionQueueEntry.isFinished()) { + return false; + } + i++; + } + return true; + } + isFinishedByHandle(motionQueueEntryNumber) { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber && !motionQueueEntry.isFinished()) { + return false; + } + } + return true; + } + stopAllMotions() { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry != null) { + motionQueueEntry.release(); + } + } + this._motions = []; + } + getCubismMotionQueueEntry(motionQueueEntryNumber) { + return this._motions.find((entry) => entry != null && entry._motionQueueEntryHandle == motionQueueEntryNumber); + } + setEventCallback(callback, customData = null) { + this._eventCallBack = callback; + this._eventCustomData = customData; + } + doUpdateMotion(model, userTimeSeconds) { + let updated = false; + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + motion.updateParameters(model, motionQueueEntry, userTimeSeconds); + updated = true; + const firedList = motion.getFiredEvent(motionQueueEntry.getLastCheckEventSeconds() - motionQueueEntry.getStartTime(), userTimeSeconds - motionQueueEntry.getStartTime()); + for (let i2 = 0; i2 < firedList.length; ++i2) { + this._eventCallBack(this, firedList[i2], this._eventCustomData); + } + motionQueueEntry.setLastCheckEventSeconds(userTimeSeconds); + if (motionQueueEntry.isFinished()) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + } else { + if (motionQueueEntry.isTriggeredFadeOut()) { + motionQueueEntry.startFadeOut(motionQueueEntry.getFadeOutSeconds(), userTimeSeconds); + } + i++; + } + } + return updated; + } +} +const InvalidMotionQueueEntryHandleValue = -1; +class Cubism4ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.Name === name); + } + getExpressionFile(definition) { + return definition.File; + } + createExpression(data, definition) { + return CubismExpressionMotion.create(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion, false, performance.now()); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } +} +class CubismModelSettingsJson { + constructor(json) { + this.groups = json.Groups; + this.hitAreas = json.HitAreas; + this.layout = json.Layout; + this.moc = json.FileReferences.Moc; + this.expressions = json.FileReferences.Expressions; + this.motions = json.FileReferences.Motions; + this.textures = json.FileReferences.Textures; + this.physics = json.FileReferences.Physics; + this.pose = json.FileReferences.Pose; + } + getEyeBlinkParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "EyeBlink")) == null ? void 0 : _b.Ids; + } + getLipSyncParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "LipSync")) == null ? void 0 : _b.Ids; + } +} +class Cubism4ModelSettings extends ModelSettings { + constructor(json) { + super(json); + if (!Cubism4ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + Object.assign(this, new CubismModelSettingsJson(json)); + } + static isValidJSON(json) { + var _a; + return !!(json == null ? void 0 : json.FileReferences) && typeof json.FileReferences.Moc === "string" && ((_a = json.FileReferences.Textures) == null ? void 0 : _a.length) > 0 && json.FileReferences.Textures.every((item) => typeof item === "string"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + if (this.motions) { + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].File = replace(motions[i].File, `motions.${group}[${i}].File`); + if (motions[i].Sound !== void 0) { + motions[i].Sound = replace(motions[i].Sound, `motions.${group}[${i}].Sound`); + } + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].File = replace(this.expressions[i].File, `expressions[${i}].File`); + } + } + } +} +applyMixins(Cubism4ModelSettings, [CubismModelSettingsJson]); +var CubismMotionCurveTarget = /* @__PURE__ */ ((CubismMotionCurveTarget2) => { + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Model"] = 0] = "CubismMotionCurveTarget_Model"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Parameter"] = 1] = "CubismMotionCurveTarget_Parameter"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_PartOpacity"] = 2] = "CubismMotionCurveTarget_PartOpacity"; + return CubismMotionCurveTarget2; +})(CubismMotionCurveTarget || {}); +var CubismMotionSegmentType = /* @__PURE__ */ ((CubismMotionSegmentType2) => { + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Linear"] = 0] = "CubismMotionSegmentType_Linear"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Bezier"] = 1] = "CubismMotionSegmentType_Bezier"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Stepped"] = 2] = "CubismMotionSegmentType_Stepped"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_InverseStepped"] = 3] = "CubismMotionSegmentType_InverseStepped"; + return CubismMotionSegmentType2; +})(CubismMotionSegmentType || {}); +class CubismMotionPoint { + constructor(time = 0, value = 0) { + this.time = time; + this.value = value; + } +} +class CubismMotionSegment { + constructor() { + this.basePointIndex = 0; + this.segmentType = 0; + } +} +class CubismMotionCurve { + constructor() { + this.id = ""; + this.type = 0; + this.segmentCount = 0; + this.baseSegmentIndex = 0; + this.fadeInTime = 0; + this.fadeOutTime = 0; + } +} +class CubismMotionEvent { + constructor() { + this.fireTime = 0; + this.value = ""; + } +} +class CubismMotionData { + constructor() { + this.duration = 0; + this.loop = false; + this.curveCount = 0; + this.eventCount = 0; + this.fps = 0; + this.curves = []; + this.segments = []; + this.points = []; + this.events = []; + } +} +class CubismMotionJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getMotionDuration() { + return this._json.Meta.Duration; + } + isMotionLoop() { + return this._json.Meta.Loop || false; + } + getEvaluationOptionFlag(flagType) { + if (EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted == flagType) { + return !!this._json.Meta.AreBeziersRestricted; + } + return false; + } + getMotionCurveCount() { + return this._json.Meta.CurveCount; + } + getMotionFps() { + return this._json.Meta.Fps; + } + getMotionTotalSegmentCount() { + return this._json.Meta.TotalSegmentCount; + } + getMotionTotalPointCount() { + return this._json.Meta.TotalPointCount; + } + getMotionFadeInTime() { + return this._json.Meta.FadeInTime; + } + getMotionFadeOutTime() { + return this._json.Meta.FadeOutTime; + } + getMotionCurveTarget(curveIndex) { + return this._json.Curves[curveIndex].Target; + } + getMotionCurveId(curveIndex) { + return this._json.Curves[curveIndex].Id; + } + getMotionCurveFadeInTime(curveIndex) { + return this._json.Curves[curveIndex].FadeInTime; + } + getMotionCurveFadeOutTime(curveIndex) { + return this._json.Curves[curveIndex].FadeOutTime; + } + getMotionCurveSegmentCount(curveIndex) { + return this._json.Curves[curveIndex].Segments.length; + } + getMotionCurveSegment(curveIndex, segmentIndex) { + return this._json.Curves[curveIndex].Segments[segmentIndex]; + } + getEventCount() { + return this._json.Meta.UserDataCount || 0; + } + getTotalEventValueSize() { + return this._json.Meta.TotalUserDataSize; + } + getEventTime(userDataIndex) { + return this._json.UserData[userDataIndex].Time; + } + getEventValue(userDataIndex) { + return this._json.UserData[userDataIndex].Value; + } +} +var EvaluationOptionFlag = /* @__PURE__ */ ((EvaluationOptionFlag2) => { + EvaluationOptionFlag2[EvaluationOptionFlag2["EvaluationOptionFlag_AreBeziersRistricted"] = 0] = "EvaluationOptionFlag_AreBeziersRistricted"; + return EvaluationOptionFlag2; +})(EvaluationOptionFlag || {}); +const EffectNameEyeBlink = "EyeBlink"; +const EffectNameLipSync = "LipSync"; +const TargetNameModel = "Model"; +const TargetNameParameter = "Parameter"; +const TargetNamePartOpacity = "PartOpacity"; +const UseOldBeziersCurveMotion = false; +function lerpPoints(a, b, t) { + const result = new CubismMotionPoint(); + result.time = a.time + (b.time - a.time) * t; + result.value = a.value + (b.value - a.value) * t; + return result; +} +function linearEvaluate(points, time) { + let t = (time - points[0].time) / (points[1].time - points[0].time); + if (t < 0) { + t = 0; + } + return points[0].value + (points[1].value - points[0].value) * t; +} +function bezierEvaluate(points, time) { + let t = (time - points[0].time) / (points[3].time - points[0].time); + if (t < 0) { + t = 0; + } + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; +} +function bezierEvaluateCardanoInterpretation(points, time) { + const x = time; + const x1 = points[0].time; + const x2 = points[3].time; + const cx1 = points[1].time; + const cx2 = points[2].time; + const a = x2 - 3 * cx2 + 3 * cx1 - x1; + const b = 3 * cx2 - 6 * cx1 + 3 * x1; + const c = 3 * cx1 - 3 * x1; + const d = x1 - x; + const t = CubismMath.cardanoAlgorithmForBezier(a, b, c, d); + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; +} +function steppedEvaluate(points, time) { + return points[0].value; +} +function inverseSteppedEvaluate(points, time) { + return points[1].value; +} +function evaluateCurve(motionData, index, time) { + const curve = motionData.curves[index]; + let target = -1; + const totalSegmentCount = curve.baseSegmentIndex + curve.segmentCount; + let pointPosition = 0; + for (let i = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { + pointPosition = motionData.segments[i].basePointIndex + (motionData.segments[i].segmentType == CubismMotionSegmentType.CubismMotionSegmentType_Bezier ? 3 : 1); + if (motionData.points[pointPosition].time > time) { + target = i; + break; + } + } + if (target == -1) { + return motionData.points[pointPosition].value; + } + const segment = motionData.segments[target]; + return segment.evaluate(motionData.points.slice(segment.basePointIndex), time); +} +class CubismMotion extends ACubismMotion { + constructor() { + super(); + this._eyeBlinkParameterIds = []; + this._lipSyncParameterIds = []; + this._sourceFrameRate = 30; + this._loopDurationSeconds = -1; + this._isLoop = false; + this._isLoopFadeIn = true; + this._lastWeight = 0; + } + static create(json, onFinishedMotionHandler) { + const ret = new CubismMotion(); + ret.parse(json); + ret._sourceFrameRate = ret._motionData.fps; + ret._loopDurationSeconds = ret._motionData.duration; + ret._onFinishedMotion = onFinishedMotionHandler; + return ret; + } + doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry) { + if (this._modelCurveIdEyeBlink == null) { + this._modelCurveIdEyeBlink = EffectNameEyeBlink; + } + if (this._modelCurveIdLipSync == null) { + this._modelCurveIdLipSync = EffectNameLipSync; + } + let timeOffsetSeconds = userTimeSeconds - motionQueueEntry.getStartTime(); + if (timeOffsetSeconds < 0) { + timeOffsetSeconds = 0; + } + let lipSyncValue = Number.MAX_VALUE; + let eyeBlinkValue = Number.MAX_VALUE; + const MaxTargetSize = 64; + let lipSyncFlags = 0; + let eyeBlinkFlags = 0; + if (this._eyeBlinkParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many eye blink targets : {0}", this._eyeBlinkParameterIds.length); + } + if (this._lipSyncParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many lip sync targets : {0}", this._lipSyncParameterIds.length); + } + const tmpFadeIn = this._fadeInSeconds <= 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const tmpFadeOut = this._fadeOutSeconds <= 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + let value; + let c, parameterIndex; + let time = timeOffsetSeconds; + if (this._isLoop) { + while (time > this._motionData.duration) { + time -= this._motionData.duration; + } + } + const curves = this._motionData.curves; + for (c = 0; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (curves[c].id == this._modelCurveIdEyeBlink) { + eyeBlinkValue = value; + } else if (curves[c].id == this._modelCurveIdLipSync) { + lipSyncValue = value; + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; ++c) { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + const sourceValue = model.getParameterValueByIndex(parameterIndex); + value = evaluateCurve(this._motionData, c, time); + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + if (this._eyeBlinkParameterIds[i] == curves[c].id) { + value *= eyeBlinkValue; + eyeBlinkFlags |= 1 << i; + break; + } + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + if (this._lipSyncParameterIds[i] == curves[c].id) { + value += lipSyncValue; + lipSyncFlags |= 1 << i; + break; + } + } + } + let v; + if (curves[c].fadeInTime < 0 && curves[c].fadeOutTime < 0) { + v = sourceValue + (value - sourceValue) * fadeWeight; + } else { + let fin; + let fout; + if (curves[c].fadeInTime < 0) { + fin = tmpFadeIn; + } else { + fin = curves[c].fadeInTime == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / curves[c].fadeInTime); + } + if (curves[c].fadeOutTime < 0) { + fout = tmpFadeOut; + } else { + fout = curves[c].fadeOutTime == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / curves[c].fadeOutTime); + } + const paramWeight = this._weight * fin * fout; + v = sourceValue + (value - sourceValue) * paramWeight; + } + model.setParameterValueByIndex(parameterIndex, v, 1); + } + { + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._eyeBlinkParameterIds[i]); + if (eyeBlinkFlags >> i & 1) { + continue; + } + const v = sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._eyeBlinkParameterIds[i], v); + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._lipSyncParameterIds[i]); + if (lipSyncFlags >> i & 1) { + continue; + } + const v = sourceValue + (lipSyncValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._lipSyncParameterIds[i], v); + } + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (CubismConfig.setOpacityFromMotion) { + model.setPartOpacityById(curves[c].id, value); + } else { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + model.setParameterValueByIndex(parameterIndex, value); + } + } + if (timeOffsetSeconds >= this._motionData.duration) { + if (this._isLoop) { + motionQueueEntry.setStartTime(userTimeSeconds); + if (this._isLoopFadeIn) { + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + } + } else { + if (this._onFinishedMotion) { + this._onFinishedMotion(this); + } + motionQueueEntry.setIsFinished(true); + } + } + this._lastWeight = fadeWeight; + } + setIsLoop(loop) { + this._isLoop = loop; + } + isLoop() { + return this._isLoop; + } + setIsLoopFadeIn(loopFadeIn) { + this._isLoopFadeIn = loopFadeIn; + } + isLoopFadeIn() { + return this._isLoopFadeIn; + } + getDuration() { + return this._isLoop ? -1 : this._loopDurationSeconds; + } + getLoopDuration() { + return this._loopDurationSeconds; + } + setParameterFadeInTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeInTime = value; + return; + } + } + } + setParameterFadeOutTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeOutTime = value; + return; + } + } + } + getParameterFadeInTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeInTime; + } + } + return -1; + } + getParameterFadeOutTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeOutTime; + } + } + return -1; + } + setEffectIds(eyeBlinkParameterIds, lipSyncParameterIds) { + this._eyeBlinkParameterIds = eyeBlinkParameterIds; + this._lipSyncParameterIds = lipSyncParameterIds; + } + release() { + this._motionData = void 0; + } + parse(motionJson) { + this._motionData = new CubismMotionData(); + let json = new CubismMotionJson(motionJson); + this._motionData.duration = json.getMotionDuration(); + this._motionData.loop = json.isMotionLoop(); + this._motionData.curveCount = json.getMotionCurveCount(); + this._motionData.fps = json.getMotionFps(); + this._motionData.eventCount = json.getEventCount(); + const areBeziersRestructed = json.getEvaluationOptionFlag(EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted); + const fadeInSeconds = json.getMotionFadeInTime(); + const fadeOutSeconds = json.getMotionFadeOutTime(); + if (fadeInSeconds !== void 0) { + this._fadeInSeconds = fadeInSeconds < 0 ? 1 : fadeInSeconds; + } else { + this._fadeInSeconds = 1; + } + if (fadeOutSeconds !== void 0) { + this._fadeOutSeconds = fadeOutSeconds < 0 ? 1 : fadeOutSeconds; + } else { + this._fadeOutSeconds = 1; + } + this._motionData.curves = Array.from({ length: this._motionData.curveCount }).map(() => new CubismMotionCurve()); + this._motionData.segments = Array.from({ length: json.getMotionTotalSegmentCount() }).map(() => new CubismMotionSegment()); + this._motionData.events = Array.from({ length: this._motionData.eventCount }).map(() => new CubismMotionEvent()); + this._motionData.points = []; + let totalPointCount = 0; + let totalSegmentCount = 0; + for (let curveCount = 0; curveCount < this._motionData.curveCount; ++curveCount) { + const curve = this._motionData.curves[curveCount]; + switch (json.getMotionCurveTarget(curveCount)) { + case TargetNameModel: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + break; + case TargetNameParameter: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; + break; + case TargetNamePartOpacity: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; + break; + default: + CubismLogWarning('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!'); + } + curve.id = json.getMotionCurveId(curveCount); + curve.baseSegmentIndex = totalSegmentCount; + const fadeInTime = json.getMotionCurveFadeInTime(curveCount); + const fadeOutTime = json.getMotionCurveFadeOutTime(curveCount); + curve.fadeInTime = fadeInTime !== void 0 ? fadeInTime : -1; + curve.fadeOutTime = fadeOutTime !== void 0 ? fadeOutTime : -1; + for (let segmentPosition = 0; segmentPosition < json.getMotionCurveSegmentCount(curveCount); ) { + if (segmentPosition == 0) { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition), json.getMotionCurveSegment(curveCount, segmentPosition + 1)); + totalPointCount += 1; + segmentPosition += 2; + } else { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount - 1; + } + const segment = json.getMotionCurveSegment(curveCount, segmentPosition); + switch (segment) { + case CubismMotionSegmentType.CubismMotionSegmentType_Linear: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear; + this._motionData.segments[totalSegmentCount].evaluate = linearEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier; + if (areBeziersRestructed || UseOldBeziersCurveMotion) { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluate; + } else { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluateCardanoInterpretation; + } + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + this._motionData.points[totalPointCount + 1] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 3), json.getMotionCurveSegment(curveCount, segmentPosition + 4)); + this._motionData.points[totalPointCount + 2] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 5), json.getMotionCurveSegment(curveCount, segmentPosition + 6)); + totalPointCount += 3; + segmentPosition += 7; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped; + this._motionData.segments[totalSegmentCount].evaluate = steppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; + this._motionData.segments[totalSegmentCount].evaluate = inverseSteppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + } + ++curve.segmentCount; + ++totalSegmentCount; + } + this._motionData.curves.push(curve); + } + for (let userdatacount = 0; userdatacount < json.getEventCount(); ++userdatacount) { + this._motionData.events[userdatacount].fireTime = json.getEventTime(userdatacount); + this._motionData.events[userdatacount].value = json.getEventValue(userdatacount); + } + json.release(); + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + this._firedEventValues.length = 0; + for (let u = 0; u < this._motionData.eventCount; ++u) { + if (this._motionData.events[u].fireTime > beforeCheckTimeSeconds && this._motionData.events[u].fireTime <= motionTimeSeconds) { + this._firedEventValues.push(this._motionData.events[u].value); + } + } + return this._firedEventValues; + } +} +class Cubism4MotionManager extends MotionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.groups = { idle: "Idle" }; + this.motionDataType = "json"; + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.motions) != null ? _a : {}; + this.eyeBlinkIds = settings.getEyeBlinkParameters() || []; + this.lipSyncIds = settings.getLipSyncParameters() || []; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism4ExpressionManager(this.settings, options); + } + this.queueManager.setEventCallback((caller, eventValue, customData) => { + this.emit("motion:" + eventValue); + }); + } + isFinished() { + return this.queueManager.isFinished(); + } + _startMotion(motion, onFinish) { + motion.setFinishedMotionHandler(onFinish); + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion, false, performance.now()); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + createMotion(data, group, definition) { + const motion = CubismMotion.create(data); + const json = new CubismMotionJson(data); + const defaultFadingDuration = (group === this.groups.idle ? config.idleMotionFadingDuration : config.motionFadingDuration) / 1e3; + if (json.getMotionFadeInTime() === void 0) { + motion.setFadeInTime(definition.FadeInTime > 0 ? definition.FadeInTime : defaultFadingDuration); + } + if (json.getMotionFadeOutTime() === void 0) { + motion.setFadeOutTime(definition.FadeOutTime > 0 ? definition.FadeOutTime : defaultFadingDuration); + } + motion.setEffectIds(this.eyeBlinkIds, this.lipSyncIds); + return motion; + } + getMotionFile(definition) { + return definition.File; + } + getMotionName(definition) { + return definition.File; + } + getSoundFile(definition) { + return definition.Sound; + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + destroy() { + super.destroy(); + this.queueManager.release(); + this.queueManager = void 0; + } +} +const ParamAngleX = "ParamAngleX"; +const ParamAngleY = "ParamAngleY"; +const ParamAngleZ = "ParamAngleZ"; +const ParamEyeBallX = "ParamEyeBallX"; +const ParamEyeBallY = "ParamEyeBallY"; +const ParamBodyAngleX = "ParamBodyAngleX"; +const ParamBreath = "ParamBreath"; +class CubismBreath { + constructor() { + this._breathParameters = []; + this._currentTime = 0; + } + static create() { + return new CubismBreath(); + } + setParameters(breathParameters) { + this._breathParameters = breathParameters; + } + getParameters() { + return this._breathParameters; + } + updateParameters(model, deltaTimeSeconds) { + this._currentTime += deltaTimeSeconds; + const t = this._currentTime * 2 * 3.14159; + for (let i = 0; i < this._breathParameters.length; ++i) { + const data = this._breathParameters[i]; + model.addParameterValueById(data.parameterId, data.offset + data.peak * Math.sin(t / data.cycle), data.weight); + } + } +} +class BreathParameterData { + constructor(parameterId, offset, peak, cycle, weight) { + this.parameterId = parameterId == void 0 ? void 0 : parameterId; + this.offset = offset == void 0 ? 0 : offset; + this.peak = peak == void 0 ? 0 : peak; + this.cycle = cycle == void 0 ? 0 : cycle; + this.weight = weight == void 0 ? 0 : weight; + } +} +const _CubismEyeBlink = class { + static create(modelSetting) { + return new _CubismEyeBlink(modelSetting); + } + setBlinkingInterval(blinkingInterval) { + this._blinkingIntervalSeconds = blinkingInterval; + } + setBlinkingSetting(closing, closed, opening) { + this._closingSeconds = closing; + this._closedSeconds = closed; + this._openingSeconds = opening; + } + setParameterIds(parameterIds) { + this._parameterIds = parameterIds; + } + getParameterIds() { + return this._parameterIds; + } + updateParameters(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + let parameterValue; + let t = 0; + switch (this._blinkingState) { + case EyeState.EyeState_Closing: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Closed; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1 - t; + break; + case EyeState.EyeState_Closed: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closedSeconds; + if (t >= 1) { + this._blinkingState = EyeState.EyeState_Opening; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 0; + break; + case EyeState.EyeState_Opening: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._openingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + } + parameterValue = t; + break; + case EyeState.EyeState_Interval: + if (this._nextBlinkingTime < this._userTimeSeconds) { + this._blinkingState = EyeState.EyeState_Closing; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1; + break; + case EyeState.EyeState_First: + default: + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + parameterValue = 1; + break; + } + if (!_CubismEyeBlink.CloseIfZero) { + parameterValue = -parameterValue; + } + for (let i = 0; i < this._parameterIds.length; ++i) { + model.setParameterValueById(this._parameterIds[i], parameterValue); + } + } + constructor(modelSetting) { + var _a, _b; + this._blinkingState = EyeState.EyeState_First; + this._nextBlinkingTime = 0; + this._stateStartTimeSeconds = 0; + this._blinkingIntervalSeconds = 4; + this._closingSeconds = 0.1; + this._closedSeconds = 0.05; + this._openingSeconds = 0.15; + this._userTimeSeconds = 0; + this._parameterIds = []; + if (modelSetting == null) { + return; + } + this._parameterIds = (_b = (_a = modelSetting.getEyeBlinkParameters()) == null ? void 0 : _a.slice()) != null ? _b : this._parameterIds; + } + determinNextBlinkingTiming() { + const r = Math.random(); + return this._userTimeSeconds + r * (2 * this._blinkingIntervalSeconds - 1); + } +}; +let CubismEyeBlink = _CubismEyeBlink; +CubismEyeBlink.CloseIfZero = true; +var EyeState = /* @__PURE__ */ ((EyeState2) => { + EyeState2[EyeState2["EyeState_First"] = 0] = "EyeState_First"; + EyeState2[EyeState2["EyeState_Interval"] = 1] = "EyeState_Interval"; + EyeState2[EyeState2["EyeState_Closing"] = 2] = "EyeState_Closing"; + EyeState2[EyeState2["EyeState_Closed"] = 3] = "EyeState_Closed"; + EyeState2[EyeState2["EyeState_Opening"] = 4] = "EyeState_Opening"; + return EyeState2; +})(EyeState || {}); +class csmRect { + constructor(x = 0, y = 0, w = 0, h = 0) { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + } + getCenterX() { + return this.x + 0.5 * this.width; + } + getCenterY() { + return this.y + 0.5 * this.height; + } + getRight() { + return this.x + this.width; + } + getBottom() { + return this.y + this.height; + } + setRect(r) { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + } + expand(w, h) { + this.x -= w; + this.y -= h; + this.width += w * 2; + this.height += h * 2; + } +} +const ColorChannelCount = 4; +const shaderCount = 10; +let s_instance; +let s_viewport; +let s_fbo; +class CubismClippingManager_WebGL { + getChannelFlagAsColor(channelNo) { + return this._channelColors[channelNo]; + } + getMaskRenderTexture() { + let ret = 0; + if (this._maskTexture && this._maskTexture.texture != 0) { + this._maskTexture.frameNo = this._currentFrameNo; + ret = this._maskTexture.texture; + } + if (ret == 0) { + const size = this._clippingMaskBufferSize; + this._colorBuffer = this.gl.createTexture(); + this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); + this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, size, size, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + ret = this.gl.createFramebuffer(); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); + this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._colorBuffer, 0); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + this._maskTexture = new CubismRenderTextureResource(this._currentFrameNo, ret); + } + return ret; + } + setGL(gl) { + this.gl = gl; + } + calcClippedDrawTotalBounds(model, clippingContext) { + let clippedDrawTotalMinX = Number.MAX_VALUE; + let clippedDrawTotalMinY = Number.MAX_VALUE; + let clippedDrawTotalMaxX = Number.MIN_VALUE; + let clippedDrawTotalMaxY = Number.MIN_VALUE; + const clippedDrawCount = clippingContext._clippedDrawableIndexList.length; + for (let clippedDrawableIndex = 0; clippedDrawableIndex < clippedDrawCount; clippedDrawableIndex++) { + const drawableIndex = clippingContext._clippedDrawableIndexList[clippedDrawableIndex]; + const drawableVertexCount = model.getDrawableVertexCount(drawableIndex); + const drawableVertexes = model.getDrawableVertices(drawableIndex); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = Number.MIN_VALUE; + let maxY = Number.MIN_VALUE; + const loop = drawableVertexCount * Constant.vertexStep; + for (let pi = Constant.vertexOffset; pi < loop; pi += Constant.vertexStep) { + const x = drawableVertexes[pi]; + const y = drawableVertexes[pi + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + if (minX == Number.MAX_VALUE) { + continue; + } + if (minX < clippedDrawTotalMinX) { + clippedDrawTotalMinX = minX; + } + if (minY < clippedDrawTotalMinY) { + clippedDrawTotalMinY = minY; + } + if (maxX > clippedDrawTotalMaxX) { + clippedDrawTotalMaxX = maxX; + } + if (maxY > clippedDrawTotalMaxY) { + clippedDrawTotalMaxY = maxY; + } + if (clippedDrawTotalMinX == Number.MAX_VALUE) { + clippingContext._allClippedDrawRect.x = 0; + clippingContext._allClippedDrawRect.y = 0; + clippingContext._allClippedDrawRect.width = 0; + clippingContext._allClippedDrawRect.height = 0; + clippingContext._isUsing = false; + } else { + clippingContext._isUsing = true; + const w = clippedDrawTotalMaxX - clippedDrawTotalMinX; + const h = clippedDrawTotalMaxY - clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX; + clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.width = w; + clippingContext._allClippedDrawRect.height = h; + } + } + } + constructor() { + this._maskRenderTexture = null; + this._colorBuffer = null; + this._currentFrameNo = 0; + this._clippingMaskBufferSize = 256; + this._clippingContextListForMask = []; + this._clippingContextListForDraw = []; + this._channelColors = []; + this._tmpBoundsOnModel = new csmRect(); + this._tmpMatrix = new CubismMatrix44(); + this._tmpMatrixForMask = new CubismMatrix44(); + this._tmpMatrixForDraw = new CubismMatrix44(); + let tmp = new CubismTextureColor(); + tmp.R = 1; + tmp.G = 0; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 1; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 1; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 0; + tmp.A = 1; + this._channelColors.push(tmp); + } + release() { + var _a, _b, _c; + const self = this; + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + if (this._clippingContextListForMask[i]) { + (_a = this._clippingContextListForMask[i]) == null ? void 0 : _a.release(); + } + } + self._clippingContextListForMask = void 0; + self._clippingContextListForDraw = void 0; + if (this._maskTexture) { + (_b = this.gl) == null ? void 0 : _b.deleteFramebuffer(this._maskTexture.texture); + self._maskTexture = void 0; + } + self._channelColors = void 0; + (_c = this.gl) == null ? void 0 : _c.deleteTexture(this._colorBuffer); + this._colorBuffer = null; + } + initialize(model, drawableCount, drawableMasks, drawableMaskCounts) { + for (let i = 0; i < drawableCount; i++) { + if (drawableMaskCounts[i] <= 0) { + this._clippingContextListForDraw.push(null); + continue; + } + let clippingContext = this.findSameClip(drawableMasks[i], drawableMaskCounts[i]); + if (clippingContext == null) { + clippingContext = new CubismClippingContext(this, drawableMasks[i], drawableMaskCounts[i]); + this._clippingContextListForMask.push(clippingContext); + } + clippingContext.addClippedDrawable(i); + this._clippingContextListForDraw.push(clippingContext); + } + } + setupClippingContext(model, renderer) { + this._currentFrameNo++; + let usingClipCount = 0; + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const cc = this._clippingContextListForMask[clipIndex]; + this.calcClippedDrawTotalBounds(model, cc); + if (cc._isUsing) { + usingClipCount++; + } + } + if (usingClipCount > 0) { + this.gl.viewport(0, 0, this._clippingMaskBufferSize, this._clippingMaskBufferSize); + this._maskRenderTexture = this.getMaskRenderTexture(); + renderer.getMvpMatrix(); + renderer.preDraw(); + this.setupLayoutBounds(usingClipCount); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + this.gl.clearColor(1, 1, 1, 1); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const clipContext = this._clippingContextListForMask[clipIndex]; + const allClipedDrawRect = clipContext._allClippedDrawRect; + const layoutBoundsOnTex01 = clipContext._layoutBounds; + const MARGIN = 0.05; + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand(allClipedDrawRect.width * MARGIN, allClipedDrawRect.height * MARGIN); + const scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + const scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(-1, -1); + this._tmpMatrix.scaleRelative(2, 2); + } + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()); + } + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); + } + clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); + clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); + const clipDrawCount = clipContext._clippingIdCount; + for (let i = 0; i < clipDrawCount; i++) { + const clipDrawIndex = clipContext._clippingIdList[i]; + if (!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)) { + continue; + } + renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false); + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh(model.getDrawableTextureIndices(clipDrawIndex), model.getDrawableVertexIndexCount(clipDrawIndex), model.getDrawableVertexCount(clipDrawIndex), model.getDrawableVertexIndices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex), CubismBlendMode.CubismBlendMode_Normal, false); + } + } + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + renderer.setClippingContextBufferForMask(null); + this.gl.viewport(s_viewport[0], s_viewport[1], s_viewport[2], s_viewport[3]); + } + } + findSameClip(drawableMasks, drawableMaskCounts) { + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + const clippingContext = this._clippingContextListForMask[i]; + const count = clippingContext._clippingIdCount; + if (count != drawableMaskCounts) { + continue; + } + let sameCount = 0; + for (let j = 0; j < count; j++) { + const clipId = clippingContext._clippingIdList[j]; + for (let k = 0; k < count; k++) { + if (drawableMasks[k] == clipId) { + sameCount++; + break; + } + } + } + if (sameCount == count) { + return clippingContext; + } + } + return null; + } + setupLayoutBounds(usingClipCount) { + let div = usingClipCount / ColorChannelCount; + let mod = usingClipCount % ColorChannelCount; + div = ~~div; + mod = ~~mod; + let curClipIndex = 0; + for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + const layoutCount = div + (channelNo < mod ? 1 : 0); + if (layoutCount == 0) + ; + else if (layoutCount == 1) { + const clipContext = this._clippingContextListForMask[curClipIndex++]; + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0; + clipContext._layoutBounds.y = 0; + clipContext._layoutBounds.width = 1; + clipContext._layoutBounds.height = 1; + } else if (layoutCount == 2) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + xpos = ~~xpos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1; + } + } else if (layoutCount <= 4) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + let ypos = i / 2; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + } + } else if (layoutCount <= 9) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 3; + let ypos = i / 3; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 3; + cc._layoutBounds.y = ypos / 3; + cc._layoutBounds.width = 1 / 3; + cc._layoutBounds.height = 1 / 3; + } + } else if (CubismConfig.supportMoreMaskDivisions && layoutCount <= 16) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 4; + let ypos = i / 4; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 4; + cc._layoutBounds.y = ypos / 4; + cc._layoutBounds.width = 1 / 4; + cc._layoutBounds.height = 1 / 4; + } + } else { + CubismLogError("not supported mask count : {0}", layoutCount); + } + } + } + getColorBuffer() { + return this._colorBuffer; + } + getClippingContextListForDraw() { + return this._clippingContextListForDraw; + } + setClippingMaskBufferSize(size) { + this._clippingMaskBufferSize = size; + } + getClippingMaskBufferSize() { + return this._clippingMaskBufferSize; + } +} +class CubismRenderTextureResource { + constructor(frameNo, texture) { + this.frameNo = frameNo; + this.texture = texture; + } +} +class CubismClippingContext { + constructor(manager, clippingDrawableIndices, clipCount) { + this._isUsing = false; + this._owner = manager; + this._clippingIdList = clippingDrawableIndices; + this._clippingIdCount = clipCount; + this._allClippedDrawRect = new csmRect(); + this._layoutBounds = new csmRect(); + this._clippedDrawableIndexList = []; + this._matrixForMask = new CubismMatrix44(); + this._matrixForDraw = new CubismMatrix44(); + } + release() { + const self = this; + self._layoutBounds = void 0; + self._allClippedDrawRect = void 0; + self._clippedDrawableIndexList = void 0; + } + addClippedDrawable(drawableIndex) { + this._clippedDrawableIndexList.push(drawableIndex); + } + getClippingManager() { + return this._owner; + } + setGl(gl) { + this._owner.setGL(gl); + } +} +class CubismShader_WebGL { + static getInstance() { + if (s_instance == null) { + s_instance = new CubismShader_WebGL(); + return s_instance; + } + return s_instance; + } + static deleteInstance() { + if (s_instance) { + s_instance.release(); + s_instance = void 0; + } + } + constructor() { + this._shaderSets = []; + } + release() { + this.releaseShaderProgram(); + } + setupShaderProgram(renderer, textureId, vertexCount, vertexArray, indexArray, uvArray, bufferData, opacity, colorBlendMode, baseColor, isPremultipliedAlpha, matrix4x4, invertedMask) { + if (!isPremultipliedAlpha) { + CubismLogError("NoPremultipliedAlpha is not allowed"); + } + if (this._shaderSets.length == 0) { + this.generateShaders(); + } + let SRC_COLOR; + let DST_COLOR; + let SRC_ALPHA; + let DST_ALPHA; + const clippingContextBufferForMask = renderer.getClippingContextBufferForMask(); + if (clippingContextBufferForMask != null) { + const shaderSet = this._shaderSets[ShaderNames.ShaderNames_SetupMask]; + this.gl.useProgram(shaderSet.shaderProgram); + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + const channelNo = clippingContextBufferForMask._layoutChannelNo; + const colorChannel = clippingContextBufferForMask.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForMask._matrixForMask.getArray()); + const rect = clippingContextBufferForMask._layoutBounds; + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, rect.x * 2 - 1, rect.y * 2 - 1, rect.getRight() * 2 - 1, rect.getBottom() * 2 - 1); + SRC_COLOR = this.gl.ZERO; + DST_COLOR = this.gl.ONE_MINUS_SRC_COLOR; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + } else { + const clippingContextBufferForDraw = renderer.getClippingContextBufferForDraw(); + const masked = clippingContextBufferForDraw != null; + const offset = masked ? invertedMask ? 2 : 1 : 0; + let shaderSet; + switch (colorBlendMode) { + case CubismBlendMode.CubismBlendMode_Normal: + default: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ONE; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + break; + case CubismBlendMode.CubismBlendMode_Additive: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_AddPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + case CubismBlendMode.CubismBlendMode_Multiplicative: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_MultPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.DST_COLOR; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + } + this.gl.useProgram(shaderSet.shaderProgram); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + if (clippingContextBufferForDraw != null) { + this.gl.activeTexture(this.gl.TEXTURE1); + const tex = clippingContextBufferForDraw.getClippingManager().getColorBuffer(); + this.gl.bindTexture(this.gl.TEXTURE_2D, tex); + this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForDraw._matrixForDraw.getArray()); + const channelNo = clippingContextBufferForDraw._layoutChannelNo; + const colorChannel = clippingContextBufferForDraw.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); + } + if (bufferData.index == null) { + bufferData.index = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, bufferData.index); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, indexArray, this.gl.DYNAMIC_DRAW); + this.gl.blendFuncSeparate(SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA); + } + releaseShaderProgram() { + for (let i = 0; i < this._shaderSets.length; i++) { + this.gl.deleteProgram(this._shaderSets[i].shaderProgram); + this._shaderSets[i].shaderProgram = 0; + } + this._shaderSets = []; + } + generateShaders() { + for (let i = 0; i < shaderCount; i++) { + this._shaderSets.push({}); + } + this._shaderSets[0].shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask); + this._shaderSets[1].shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha); + this._shaderSets[2].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha); + this._shaderSets[3].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskInvertedPremultipliedAlpha); + this._shaderSets[4].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[5].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[6].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[7].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[8].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[9].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[0].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_position"); + this._shaderSets[0].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_texCoord"); + this._shaderSets[0].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "s_texture0"); + this._shaderSets[0].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_clipMatrix"); + this._shaderSets[0].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_channelFlag"); + this._shaderSets[0].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_baseColor"); + this._shaderSets[1].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_position"); + this._shaderSets[1].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_texCoord"); + this._shaderSets[1].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "s_texture0"); + this._shaderSets[1].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_matrix"); + this._shaderSets[1].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_baseColor"); + this._shaderSets[2].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_position"); + this._shaderSets[2].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_texCoord"); + this._shaderSets[2].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture0"); + this._shaderSets[2].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture1"); + this._shaderSets[2].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_matrix"); + this._shaderSets[2].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_clipMatrix"); + this._shaderSets[2].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_channelFlag"); + this._shaderSets[2].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_baseColor"); + this._shaderSets[3].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_position"); + this._shaderSets[3].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_texCoord"); + this._shaderSets[3].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture0"); + this._shaderSets[3].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture1"); + this._shaderSets[3].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_matrix"); + this._shaderSets[3].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_clipMatrix"); + this._shaderSets[3].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_channelFlag"); + this._shaderSets[3].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_baseColor"); + this._shaderSets[4].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_position"); + this._shaderSets[4].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_texCoord"); + this._shaderSets[4].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "s_texture0"); + this._shaderSets[4].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_matrix"); + this._shaderSets[4].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_baseColor"); + this._shaderSets[5].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_position"); + this._shaderSets[5].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_texCoord"); + this._shaderSets[5].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture0"); + this._shaderSets[5].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture1"); + this._shaderSets[5].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_matrix"); + this._shaderSets[5].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_clipMatrix"); + this._shaderSets[5].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_channelFlag"); + this._shaderSets[5].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_baseColor"); + this._shaderSets[6].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_position"); + this._shaderSets[6].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_texCoord"); + this._shaderSets[6].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture0"); + this._shaderSets[6].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture1"); + this._shaderSets[6].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_matrix"); + this._shaderSets[6].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_clipMatrix"); + this._shaderSets[6].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_channelFlag"); + this._shaderSets[6].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_baseColor"); + this._shaderSets[7].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_position"); + this._shaderSets[7].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_texCoord"); + this._shaderSets[7].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "s_texture0"); + this._shaderSets[7].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_matrix"); + this._shaderSets[7].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_baseColor"); + this._shaderSets[8].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_position"); + this._shaderSets[8].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_texCoord"); + this._shaderSets[8].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture0"); + this._shaderSets[8].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture1"); + this._shaderSets[8].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_matrix"); + this._shaderSets[8].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_clipMatrix"); + this._shaderSets[8].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_channelFlag"); + this._shaderSets[8].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_baseColor"); + this._shaderSets[9].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_position"); + this._shaderSets[9].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_texCoord"); + this._shaderSets[9].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture0"); + this._shaderSets[9].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture1"); + this._shaderSets[9].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_matrix"); + this._shaderSets[9].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_clipMatrix"); + this._shaderSets[9].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_channelFlag"); + this._shaderSets[9].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_baseColor"); + } + loadShaderProgram(vertexShaderSource, fragmentShaderSource) { + let shaderProgram = this.gl.createProgram(); + let vertShader = this.compileShaderSource(this.gl.VERTEX_SHADER, vertexShaderSource); + if (!vertShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + let fragShader = this.compileShaderSource(this.gl.FRAGMENT_SHADER, fragmentShaderSource); + if (!fragShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + this.gl.attachShader(shaderProgram, vertShader); + this.gl.attachShader(shaderProgram, fragShader); + this.gl.linkProgram(shaderProgram); + const linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); + if (!linkStatus) { + CubismLogError("Failed to link program: {0}", shaderProgram); + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + if (shaderProgram) { + this.gl.deleteProgram(shaderProgram); + } + return 0; + } + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + return shaderProgram; + } + compileShaderSource(shaderType, shaderSource) { + const source = shaderSource; + const shader = this.gl.createShader(shaderType); + this.gl.shaderSource(shader, source); + this.gl.compileShader(shader); + if (!shader) { + const log = this.gl.getShaderInfoLog(shader); + CubismLogError("Shader compile log: {0} ", log); + } + const status = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); + if (!status) { + this.gl.deleteShader(shader); + return null; + } + return shader; + } + setGl(gl) { + this.gl = gl; + } +} +var ShaderNames = /* @__PURE__ */ ((ShaderNames2) => { + ShaderNames2[ShaderNames2["ShaderNames_SetupMask"] = 0] = "ShaderNames_SetupMask"; + ShaderNames2[ShaderNames2["ShaderNames_NormalPremultipliedAlpha"] = 1] = "ShaderNames_NormalPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NormalMaskedPremultipliedAlpha"] = 2] = "ShaderNames_NormalMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NomralMaskedInvertedPremultipliedAlpha"] = 3] = "ShaderNames_NomralMaskedInvertedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddPremultipliedAlpha"] = 4] = "ShaderNames_AddPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlpha"] = 5] = "ShaderNames_AddMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlphaInverted"] = 6] = "ShaderNames_AddMaskedPremultipliedAlphaInverted"; + ShaderNames2[ShaderNames2["ShaderNames_MultPremultipliedAlpha"] = 7] = "ShaderNames_MultPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlpha"] = 8] = "ShaderNames_MultMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlphaInverted"] = 9] = "ShaderNames_MultMaskedPremultipliedAlphaInverted"; + return ShaderNames2; +})(ShaderNames || {}); +const vertexShaderSrcSetupMask = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const fragmentShaderSrcsetupMask = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}"; +const vertexShaderSrc = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const vertexShaderSrcMasked = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; +const fragmentShaderSrcPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}"; +const fragmentShaderSrcMaskPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}"; +const fragmentShaderSrcMaskInvertedPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}"; +class CubismRenderer_WebGL extends CubismRenderer { + constructor() { + super(); + this._clippingContextBufferForMask = null; + this._clippingContextBufferForDraw = null; + this._clippingManager = new CubismClippingManager_WebGL(); + this.firstDraw = true; + this._textures = {}; + this._sortedDrawableIndexList = []; + this._bufferData = { + vertex: null, + uv: null, + index: null + }; + } + initialize(model) { + if (model.isUsingMasking()) { + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.initialize(model, model.getDrawableCount(), model.getDrawableMasks(), model.getDrawableMaskCounts()); + } + for (let i = model.getDrawableCount() - 1; i >= 0; i--) { + this._sortedDrawableIndexList[i] = 0; + } + super.initialize(model); + } + bindTexture(modelTextureNo, glTexture) { + this._textures[modelTextureNo] = glTexture; + } + getBindedTextures() { + return this._textures; + } + setClippingMaskBufferSize(size) { + this._clippingManager.release(); + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.setClippingMaskBufferSize(size); + this._clippingManager.initialize(this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), this.getModel().getDrawableMaskCounts()); + } + getClippingMaskBufferSize() { + return this._clippingManager.getClippingMaskBufferSize(); + } + release() { + var _a, _b, _c; + const self = this; + this._clippingManager.release(); + self._clippingManager = void 0; + (_a = this.gl) == null ? void 0 : _a.deleteBuffer(this._bufferData.vertex); + this._bufferData.vertex = null; + (_b = this.gl) == null ? void 0 : _b.deleteBuffer(this._bufferData.uv); + this._bufferData.uv = null; + (_c = this.gl) == null ? void 0 : _c.deleteBuffer(this._bufferData.index); + this._bufferData.index = null; + self._bufferData = void 0; + self._textures = void 0; + } + doDrawModel() { + this.preDraw(); + if (this._clippingManager != null) { + this._clippingManager.setupClippingContext(this.getModel(), this); + } + const drawableCount = this.getModel().getDrawableCount(); + const renderOrder = this.getModel().getDrawableRenderOrders(); + for (let i = 0; i < drawableCount; ++i) { + const order = renderOrder[i]; + this._sortedDrawableIndexList[order] = i; + } + for (let i = 0; i < drawableCount; ++i) { + const drawableIndex = this._sortedDrawableIndexList[i]; + if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) { + continue; + } + this.setClippingContextBufferForDraw(this._clippingManager != null ? this._clippingManager.getClippingContextListForDraw()[drawableIndex] : null); + this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); + this.drawMesh(this.getModel().getDrawableTextureIndices(drawableIndex), this.getModel().getDrawableVertexIndexCount(drawableIndex), this.getModel().getDrawableVertexCount(drawableIndex), this.getModel().getDrawableVertexIndices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableBlendMode(drawableIndex), this.getModel().getDrawableInvertedMaskBit(drawableIndex)); + } + } + drawMesh(textureNo, indexCount, vertexCount, indexArray, vertexArray, uvArray, opacity, colorBlendMode, invertedMask) { + if (this.isCulling()) { + this.gl.enable(this.gl.CULL_FACE); + } else { + this.gl.disable(this.gl.CULL_FACE); + } + this.gl.frontFace(this.gl.CCW); + const modelColorRGBA = this.getModelColor(); + if (this.getClippingContextBufferForMask() == null) { + modelColorRGBA.A *= opacity; + if (this.isPremultipliedAlpha()) { + modelColorRGBA.R *= modelColorRGBA.A; + modelColorRGBA.G *= modelColorRGBA.A; + modelColorRGBA.B *= modelColorRGBA.A; + } + } + let drawtexture = null; + if (this._textures[textureNo] != null) { + drawtexture = this._textures[textureNo]; + } + CubismShader_WebGL.getInstance().setupShaderProgram(this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this._bufferData, opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), this.getMvpMatrix(), invertedMask); + this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); + this.gl.useProgram(null); + this.setClippingContextBufferForDraw(null); + this.setClippingContextBufferForMask(null); + } + static doStaticRelease() { + CubismShader_WebGL.deleteInstance(); + } + setRenderState(fbo, viewport) { + s_fbo = fbo; + s_viewport = viewport; + } + preDraw() { + if (this.firstDraw) { + this.firstDraw = false; + this._anisortopy = this.gl.getExtension("EXT_texture_filter_anisotropic") || this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic"); + } + this.gl.disable(this.gl.SCISSOR_TEST); + this.gl.disable(this.gl.STENCIL_TEST); + this.gl.disable(this.gl.DEPTH_TEST); + this.gl.frontFace(this.gl.CW); + this.gl.enable(this.gl.BLEND); + this.gl.colorMask(true, true, true, true); + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null); + } + setClippingContextBufferForMask(clip) { + this._clippingContextBufferForMask = clip; + } + getClippingContextBufferForMask() { + return this._clippingContextBufferForMask; + } + setClippingContextBufferForDraw(clip) { + this._clippingContextBufferForDraw = clip; + } + getClippingContextBufferForDraw() { + return this._clippingContextBufferForDraw; + } + startUp(gl) { + this.gl = gl; + this._clippingManager.setGL(gl); + CubismShader_WebGL.getInstance().setGl(gl); + } +} +CubismRenderer.staticRelease = () => { + CubismRenderer_WebGL.doStaticRelease(); +}; +const tempMatrix = new CubismMatrix44(); +class Cubism4InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.lipSync = true; + this.breath = CubismBreath.create(); + this.renderer = new CubismRenderer_WebGL(); + this.idParamAngleX = ParamAngleX; + this.idParamAngleY = ParamAngleY; + this.idParamAngleZ = ParamAngleZ; + this.idParamEyeBallX = ParamEyeBallX; + this.idParamEyeBallY = ParamEyeBallY; + this.idParamBodyAngleX = ParamBodyAngleX; + this.idParamBreath = ParamBreath; + this.pixelsPerUnit = 1; + this.centeringTransform = new Matrix(); + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism4MotionManager(settings, options); + this.init(); + } + init() { + var _a; + super.init(); + if (((_a = this.settings.getEyeBlinkParameters()) == null ? void 0 : _a.length) > 0) { + this.eyeBlink = CubismEyeBlink.create(this.settings); + } + this.breath.setParameters([ + new BreathParameterData(this.idParamAngleX, 0, 15, 6.5345, 0.5), + new BreathParameterData(this.idParamAngleY, 0, 8, 3.5345, 0.5), + new BreathParameterData(this.idParamAngleZ, 0, 10, 5.5345, 0.5), + new BreathParameterData(this.idParamBodyAngleX, 0, 4, 15.5345, 0.5), + new BreathParameterData(this.idParamBreath, 0, 0.5, 3.2345, 0.5) + ]); + this.renderer.initialize(this.coreModel); + this.renderer.setIsPremultipliedAlpha(true); + } + getSize() { + return [this.coreModel.getModel().canvasinfo.CanvasWidth, this.coreModel.getModel().canvasinfo.CanvasHeight]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + const commonKey = key.charAt(0).toLowerCase() + key.slice(1); + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + setupLayout() { + super.setupLayout(); + this.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit; + this.centeringTransform.scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2); + } + updateWebGLContext(gl, glContextID) { + this.renderer.firstDraw = true; + this.renderer._bufferData = { + vertex: null, + uv: null, + index: null + }; + this.renderer.startUp(gl); + this.renderer._clippingManager._currentFrameNo = glContextID; + this.renderer._clippingManager._maskTexture = void 0; + CubismShader_WebGL.getInstance()._shaderSets = []; + } + bindTexture(index, texture) { + this.renderer.bindTexture(index, texture); + } + getHitAreaDefs() { + var _a, _b; + return (_b = (_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.Id, + name: hitArea.Name, + index: this.coreModel.getDrawableIndex(hitArea.Id) + }))) != null ? _b : []; + } + getDrawableIDs() { + return this.coreModel.getDrawableIds(); + } + getDrawableIndex(id) { + return this.coreModel.getDrawableIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawableIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + const arr = this.coreModel.getDrawableVertices(drawIndex).slice(); + for (let i = 0; i < arr.length; i += 2) { + arr[i] = arr[i] * this.pixelsPerUnit + this.originalWidth / 2; + arr[i + 1] = -arr[i + 1] * this.pixelsPerUnit + this.originalHeight / 2; + } + return arr; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(transform); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + dt /= 1e3; + now /= 1e3; + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParameters(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.updateParameters(model, dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt * 1e3, now * 1e3); + (_c = this.physics) == null ? void 0 : _c.evaluate(model, dt); + (_d = this.pose) == null ? void 0 : _d.updateParameters(model, dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParameters(); + } + updateFocus() { + this.coreModel.addParameterValueById(this.idParamEyeBallX, this.focusController.x); + this.coreModel.addParameterValueById(this.idParamEyeBallY, this.focusController.y); + this.coreModel.addParameterValueById(this.idParamAngleX, this.focusController.x * 30); + this.coreModel.addParameterValueById(this.idParamAngleY, this.focusController.y * 30); + this.coreModel.addParameterValueById(this.idParamAngleZ, this.focusController.x * this.focusController.y * -30); + this.coreModel.addParameterValueById(this.idParamBodyAngleX, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + var _a; + (_a = this.breath) == null ? void 0 : _a.updateParameters(this.coreModel, dt / 1e3); + } + draw(gl) { + const matrix = this.drawingMatrix; + const array = tempMatrix.getArray(); + array[0] = matrix.a; + array[1] = matrix.b; + array[4] = -matrix.c; + array[5] = -matrix.d; + array[12] = matrix.tx; + array[13] = matrix.ty; + this.renderer.setMvpMatrix(tempMatrix); + this.renderer.setRenderState(gl.getParameter(gl.FRAMEBUFFER_BINDING), this.viewport); + this.renderer.drawModel(); + } + destroy() { + super.destroy(); + this.renderer.release(); + this.coreModel.release(); + this.renderer = void 0; + this.coreModel = void 0; + } +} +let startupPromise; +let startupRetries = 20; +function cubism4Ready() { + if (CubismFramework.isStarted()) { + return Promise.resolve(); + } + startupPromise != null ? startupPromise : startupPromise = new Promise((resolve, reject) => { + function startUpWithRetry() { + try { + startUpCubism4(); + resolve(); + } catch (e) { + startupRetries--; + if (startupRetries < 0) { + const err = new Error("Failed to start up Cubism 4 framework."); + err.cause = e; + reject(err); + return; + } + logger.log("Cubism4", "Startup failed, retrying 10ms later..."); + setTimeout(startUpWithRetry, 10); + } + } + startUpWithRetry(); + }); + return startupPromise; +} +function startUpCubism4(options) { + options = Object.assign({ + logFunction: console.log, + loggingLevel: LogLevel.LogLevel_Verbose + }, options); + CubismFramework.startUp(options); + CubismFramework.initialize(); +} +const Epsilon = 1e-3; +const DefaultFadeInSeconds = 0.5; +class CubismPose { + static create(pose3json) { + const ret = new CubismPose(); + if (typeof pose3json.FadeInTime === "number") { + ret._fadeTimeSeconds = pose3json.FadeInTime; + if (ret._fadeTimeSeconds <= 0) { + ret._fadeTimeSeconds = DefaultFadeInSeconds; + } + } + const poseListInfo = pose3json.Groups; + const poseCount = poseListInfo.length; + for (let poseIndex = 0; poseIndex < poseCount; ++poseIndex) { + const idListInfo = poseListInfo[poseIndex]; + const idCount = idListInfo.length; + let groupCount = 0; + for (let groupIndex = 0; groupIndex < idCount; ++groupIndex) { + const partInfo = idListInfo[groupIndex]; + const partData = new PartData(); + partData.partId = partInfo.Id; + const linkListInfo = partInfo.Link; + if (linkListInfo) { + const linkCount = linkListInfo.length; + for (let linkIndex = 0; linkIndex < linkCount; ++linkIndex) { + const linkPart = new PartData(); + linkPart.partId = linkListInfo[linkIndex]; + partData.link.push(linkPart); + } + } + ret._partGroups.push(partData); + ++groupCount; + } + ret._partGroupCounts.push(groupCount); + } + return ret; + } + updateParameters(model, deltaTimeSeconds) { + if (model != this._lastModel) { + this.reset(model); + } + this._lastModel = model; + if (deltaTimeSeconds < 0) { + deltaTimeSeconds = 0; + } + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; i++) { + const partGroupCount = this._partGroupCounts[i]; + this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount); + beginIndex += partGroupCount; + } + this.copyPartOpacities(model); + } + reset(model) { + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; ++i) { + const groupCount = this._partGroupCounts[i]; + for (let j = beginIndex; j < beginIndex + groupCount; ++j) { + this._partGroups[j].initialize(model); + const partsIndex = this._partGroups[j].partIndex; + const paramIndex = this._partGroups[j].parameterIndex; + if (partsIndex < 0) { + continue; + } + model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1 : 0); + model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1 : 0); + for (let k = 0; k < this._partGroups[j].link.length; ++k) { + this._partGroups[j].link[k].initialize(model); + } + } + beginIndex += groupCount; + } + } + copyPartOpacities(model) { + for (let groupIndex = 0; groupIndex < this._partGroups.length; ++groupIndex) { + const partData = this._partGroups[groupIndex]; + if (partData.link.length == 0) { + continue; + } + const partIndex = this._partGroups[groupIndex].partIndex; + const opacity = model.getPartOpacityByIndex(partIndex); + for (let linkIndex = 0; linkIndex < partData.link.length; ++linkIndex) { + const linkPart = partData.link[linkIndex]; + const linkPartIndex = linkPart.partIndex; + if (linkPartIndex < 0) { + continue; + } + model.setPartOpacityByIndex(linkPartIndex, opacity); + } + } + } + doFade(model, deltaTimeSeconds, beginIndex, partGroupCount) { + let visiblePartIndex = -1; + let newOpacity = 1; + const phi = 0.5; + const backOpacityThreshold = 0.15; + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partIndex = this._partGroups[i].partIndex; + const paramIndex = this._partGroups[i].parameterIndex; + if (model.getParameterValueByIndex(paramIndex) > Epsilon) { + if (visiblePartIndex >= 0) { + break; + } + visiblePartIndex = i; + newOpacity = model.getPartOpacityByIndex(partIndex); + newOpacity += deltaTimeSeconds / this._fadeTimeSeconds; + if (newOpacity > 1) { + newOpacity = 1; + } + } + } + if (visiblePartIndex < 0) { + visiblePartIndex = 0; + newOpacity = 1; + } + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partsIndex = this._partGroups[i].partIndex; + if (visiblePartIndex == i) { + model.setPartOpacityByIndex(partsIndex, newOpacity); + } else { + let opacity = model.getPartOpacityByIndex(partsIndex); + let a1; + if (newOpacity < phi) { + a1 = newOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - newOpacity) * phi / (1 - phi); + } + const backOpacity = (1 - a1) * (1 - newOpacity); + if (backOpacity > backOpacityThreshold) { + a1 = 1 - backOpacityThreshold / (1 - newOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartOpacityByIndex(partsIndex, opacity); + } + } + } + constructor() { + this._fadeTimeSeconds = DefaultFadeInSeconds; + this._lastModel = void 0; + this._partGroups = []; + this._partGroupCounts = []; + } +} +class PartData { + constructor(v) { + this.parameterIndex = 0; + this.partIndex = 0; + this.partId = ""; + this.link = []; + if (v != void 0) { + this.assignment(v); + } + } + assignment(v) { + this.partId = v.partId; + this.link = v.link.map((link) => link.clone()); + return this; + } + initialize(model) { + this.parameterIndex = model.getParameterIndex(this.partId); + this.partIndex = model.getPartIndex(this.partId); + model.setParameterValueByIndex(this.parameterIndex, 1); + } + clone() { + const clonePartData = new PartData(); + clonePartData.partId = this.partId; + clonePartData.parameterIndex = this.parameterIndex; + clonePartData.partIndex = this.partIndex; + clonePartData.link = this.link.map((link) => link.clone()); + return clonePartData; + } +} +class CubismModel { + update() { + this._model.update(); + this._model.drawables.resetDynamicFlags(); + } + getCanvasWidth() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit; + } + getCanvasHeight() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit; + } + saveParameters() { + const parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + for (let i = 0; i < parameterCount; ++i) { + if (i < savedParameterCount) { + this._savedParameters[i] = this._parameterValues[i]; + } else { + this._savedParameters.push(this._parameterValues[i]); + } + } + } + getModel() { + return this._model; + } + getPartIndex(partId) { + let partIndex; + const partCount = this._model.parts.count; + for (partIndex = 0; partIndex < partCount; ++partIndex) { + if (partId == this._partIds[partIndex]) { + return partIndex; + } + } + if (partId in this._notExistPartId) { + return this._notExistPartId[partId]; + } + partIndex = partCount + this._notExistPartId.length; + this._notExistPartId[partId] = partIndex; + this._notExistPartOpacities[partIndex] = 0; + return partIndex; + } + getPartCount() { + return this._model.parts.count; + } + setPartOpacityByIndex(partIndex, opacity) { + if (partIndex in this._notExistPartOpacities) { + this._notExistPartOpacities[partIndex] = opacity; + return; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + this._partOpacities[partIndex] = opacity; + } + setPartOpacityById(partId, opacity) { + const index = this.getPartIndex(partId); + if (index < 0) { + return; + } + this.setPartOpacityByIndex(index, opacity); + } + getPartOpacityByIndex(partIndex) { + if (partIndex in this._notExistPartOpacities) { + return this._notExistPartOpacities[partIndex]; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + return this._partOpacities[partIndex]; + } + getPartOpacityById(partId) { + const index = this.getPartIndex(partId); + if (index < 0) { + return 0; + } + return this.getPartOpacityByIndex(index); + } + getParameterIndex(parameterId) { + let parameterIndex; + const idCount = this._model.parameters.count; + for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) { + if (parameterId != this._parameterIds[parameterIndex]) { + continue; + } + return parameterIndex; + } + if (parameterId in this._notExistParameterId) { + return this._notExistParameterId[parameterId]; + } + parameterIndex = this._model.parameters.count + Object.keys(this._notExistParameterId).length; + this._notExistParameterId[parameterId] = parameterIndex; + this._notExistParameterValues[parameterIndex] = 0; + return parameterIndex; + } + getParameterCount() { + return this._model.parameters.count; + } + getParameterMaximumValue(parameterIndex) { + return this._model.parameters.maximumValues[parameterIndex]; + } + getParameterMinimumValue(parameterIndex) { + return this._model.parameters.minimumValues[parameterIndex]; + } + getParameterDefaultValue(parameterIndex) { + return this._model.parameters.defaultValues[parameterIndex]; + } + getParameterValueByIndex(parameterIndex) { + if (parameterIndex in this._notExistParameterValues) { + return this._notExistParameterValues[parameterIndex]; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + return this._parameterValues[parameterIndex]; + } + getParameterValueById(parameterId) { + const parameterIndex = this.getParameterIndex(parameterId); + return this.getParameterValueByIndex(parameterIndex); + } + setParameterValueByIndex(parameterIndex, value, weight = 1) { + if (parameterIndex in this._notExistParameterValues) { + this._notExistParameterValues[parameterIndex] = weight == 1 ? value : this._notExistParameterValues[parameterIndex] * (1 - weight) + value * weight; + return; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + if (this._model.parameters.maximumValues[parameterIndex] < value) { + value = this._model.parameters.maximumValues[parameterIndex]; + } + if (this._model.parameters.minimumValues[parameterIndex] > value) { + value = this._model.parameters.minimumValues[parameterIndex]; + } + this._parameterValues[parameterIndex] = weight == 1 ? value : this._parameterValues[parameterIndex] = this._parameterValues[parameterIndex] * (1 - weight) + value * weight; + } + setParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.setParameterValueByIndex(index, value, weight); + } + addParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) + value * weight); + } + addParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.addParameterValueByIndex(index, value, weight); + } + multiplyParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.multiplyParameterValueByIndex(index, value, weight); + } + multiplyParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) * (1 + (value - 1) * weight)); + } + getDrawableIds() { + return this._drawableIds.slice(); + } + getDrawableIndex(drawableId) { + const drawableCount = this._model.drawables.count; + for (let drawableIndex = 0; drawableIndex < drawableCount; ++drawableIndex) { + if (this._drawableIds[drawableIndex] == drawableId) { + return drawableIndex; + } + } + return -1; + } + getDrawableCount() { + return this._model.drawables.count; + } + getDrawableId(drawableIndex) { + return this._model.drawables.ids[drawableIndex]; + } + getDrawableRenderOrders() { + return this._model.drawables.renderOrders; + } + getDrawableTextureIndices(drawableIndex) { + return this._model.drawables.textureIndices[drawableIndex]; + } + getDrawableDynamicFlagVertexPositionsDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableVertexIndexCount(drawableIndex) { + return this._model.drawables.indexCounts[drawableIndex]; + } + getDrawableVertexCount(drawableIndex) { + return this._model.drawables.vertexCounts[drawableIndex]; + } + getDrawableVertices(drawableIndex) { + return this.getDrawableVertexPositions(drawableIndex); + } + getDrawableVertexIndices(drawableIndex) { + return this._model.drawables.indices[drawableIndex]; + } + getDrawableVertexPositions(drawableIndex) { + return this._model.drawables.vertexPositions[drawableIndex]; + } + getDrawableVertexUvs(drawableIndex) { + return this._model.drawables.vertexUvs[drawableIndex]; + } + getDrawableOpacity(drawableIndex) { + return this._model.drawables.opacities[drawableIndex]; + } + getDrawableCulling(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); + } + getDrawableBlendMode(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Additive : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Multiplicative : CubismBlendMode.CubismBlendMode_Normal; + } + getDrawableInvertedMaskBit(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]); + } + getDrawableMasks() { + return this._model.drawables.masks; + } + getDrawableMaskCounts() { + return this._model.drawables.maskCounts; + } + isUsingMasking() { + for (let d = 0; d < this._model.drawables.count; ++d) { + if (this._model.drawables.maskCounts[d] <= 0) { + continue; + } + return true; + } + return false; + } + getDrawableDynamicFlagIsVisible(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagVisibilityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagOpacityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasOpacityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagRenderOrderDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(dynamicFlags[drawableIndex]); + } + loadParameters() { + let parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + if (parameterCount > savedParameterCount) { + parameterCount = savedParameterCount; + } + for (let i = 0; i < parameterCount; ++i) { + this._parameterValues[i] = this._savedParameters[i]; + } + } + initialize() { + this._parameterValues = this._model.parameters.values; + this._partOpacities = this._model.parts.opacities; + this._parameterMaximumValues = this._model.parameters.maximumValues; + this._parameterMinimumValues = this._model.parameters.minimumValues; + { + const parameterIds = this._model.parameters.ids; + const parameterCount = this._model.parameters.count; + for (let i = 0; i < parameterCount; ++i) { + this._parameterIds.push(parameterIds[i]); + } + } + { + const partIds = this._model.parts.ids; + const partCount = this._model.parts.count; + for (let i = 0; i < partCount; ++i) { + this._partIds.push(partIds[i]); + } + } + { + const drawableIds = this._model.drawables.ids; + const drawableCount = this._model.drawables.count; + for (let i = 0; i < drawableCount; ++i) { + this._drawableIds.push(drawableIds[i]); + } + } + } + constructor(model) { + this._model = model; + this._savedParameters = []; + this._parameterIds = []; + this._drawableIds = []; + this._partIds = []; + this._notExistPartId = {}; + this._notExistParameterId = {}; + this._notExistParameterValues = {}; + this._notExistPartOpacities = {}; + this.initialize(); + } + release() { + this._model.release(); + this._model = void 0; + } +} +class CubismMoc { + static create(mocBytes) { + const moc = Live2DCubismCore.Moc.fromArrayBuffer(mocBytes); + if (moc) { + return new CubismMoc(moc); + } + throw new Error("Unknown error"); + } + createModel() { + let cubismModel; + const model = Live2DCubismCore.Model.fromMoc(this._moc); + if (model) { + cubismModel = new CubismModel(model); + ++this._modelCount; + return cubismModel; + } + throw new Error("Unknown error"); + } + deleteModel(model) { + if (model != null) { + --this._modelCount; + } + } + constructor(moc) { + this._moc = moc; + this._modelCount = 0; + } + release() { + this._moc._release(); + this._moc = void 0; + } +} +var CubismPhysicsTargetType = /* @__PURE__ */ ((CubismPhysicsTargetType2) => { + CubismPhysicsTargetType2[CubismPhysicsTargetType2["CubismPhysicsTargetType_Parameter"] = 0] = "CubismPhysicsTargetType_Parameter"; + return CubismPhysicsTargetType2; +})(CubismPhysicsTargetType || {}); +var CubismPhysicsSource = /* @__PURE__ */ ((CubismPhysicsSource2) => { + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_X"] = 0] = "CubismPhysicsSource_X"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Y"] = 1] = "CubismPhysicsSource_Y"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Angle"] = 2] = "CubismPhysicsSource_Angle"; + return CubismPhysicsSource2; +})(CubismPhysicsSource || {}); +class CubismPhysicsParticle { + constructor() { + this.initialPosition = new CubismVector2(0, 0); + this.position = new CubismVector2(0, 0); + this.lastPosition = new CubismVector2(0, 0); + this.lastGravity = new CubismVector2(0, 0); + this.force = new CubismVector2(0, 0); + this.velocity = new CubismVector2(0, 0); + } +} +class CubismPhysicsSubRig { + constructor() { + this.normalizationPosition = {}; + this.normalizationAngle = {}; + } +} +class CubismPhysicsInput { + constructor() { + this.source = {}; + } +} +class CubismPhysicsOutput { + constructor() { + this.destination = {}; + this.translationScale = new CubismVector2(0, 0); + } +} +class CubismPhysicsRig { + constructor() { + this.settings = []; + this.inputs = []; + this.outputs = []; + this.particles = []; + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } +} +class CubismPhysicsJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getGravity() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Gravity.X; + ret.y = this._json.Meta.EffectiveForces.Gravity.Y; + return ret; + } + getWind() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Wind.X; + ret.y = this._json.Meta.EffectiveForces.Wind.Y; + return ret; + } + getSubRigCount() { + return this._json.Meta.PhysicsSettingCount; + } + getTotalInputCount() { + return this._json.Meta.TotalInputCount; + } + getTotalOutputCount() { + return this._json.Meta.TotalOutputCount; + } + getVertexCount() { + return this._json.Meta.VertexCount; + } + getNormalizationPositionMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Minimum; + } + getNormalizationPositionMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Maximum; + } + getNormalizationPositionDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Default; + } + getNormalizationAngleMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Minimum; + } + getNormalizationAngleMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Maximum; + } + getNormalizationAngleDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Default; + } + getInputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input.length; + } + getInputWeight(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Weight; + } + getInputReflect(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Reflect; + } + getInputType(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Type; + } + getInputSourceId(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Source.Id; + } + getOutputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output.length; + } + getOutputVertexIndex(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].VertexIndex; + } + getOutputAngleScale(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Scale; + } + getOutputWeight(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Weight; + } + getOutputDestinationId(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Destination.Id; + } + getOutputType(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Type; + } + getOutputReflect(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Reflect; + } + getParticleCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices.length; + } + getParticleMobility(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Mobility; + } + getParticleDelay(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Delay; + } + getParticleAcceleration(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Acceleration; + } + getParticleRadius(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Radius; + } + getParticlePosition(physicsSettingIndex, vertexIndex) { + const ret = new CubismVector2(0, 0); + ret.x = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.X; + ret.y = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.Y; + return ret; + } +} +const PhysicsTypeTagX = "X"; +const PhysicsTypeTagY = "Y"; +const PhysicsTypeTagAngle = "Angle"; +const AirResistance = 5; +const MaximumWeight = 100; +const MovementThreshold = 1e-3; +class CubismPhysics { + static create(json) { + const ret = new CubismPhysics(); + ret.parse(json); + ret._physicsRig.gravity.y = 0; + return ret; + } + evaluate(model, deltaTimeSeconds) { + let totalAngle; + let weight; + let radAngle; + let outputValue; + const totalTranslation = new CubismVector2(); + let currentSetting; + let currentInput; + let currentOutput; + let currentParticles; + let parameterValue; + let parameterMaximumValue; + let parameterMinimumValue; + let parameterDefaultValue; + parameterValue = model.getModel().parameters.values; + parameterMaximumValue = model.getModel().parameters.maximumValues; + parameterMinimumValue = model.getModel().parameters.minimumValues; + parameterDefaultValue = model.getModel().parameters.defaultValues; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + totalAngle = { angle: 0 }; + totalTranslation.x = 0; + totalTranslation.y = 0; + currentSetting = this._physicsRig.settings[settingIndex]; + currentInput = this._physicsRig.inputs.slice(currentSetting.baseInputIndex); + currentOutput = this._physicsRig.outputs.slice(currentSetting.baseOutputIndex); + currentParticles = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + for (let i = 0; i < currentSetting.inputCount; ++i) { + weight = currentInput[i].weight / MaximumWeight; + if (currentInput[i].sourceParameterIndex == -1) { + currentInput[i].sourceParameterIndex = model.getParameterIndex(currentInput[i].source.id); + } + currentInput[i].getNormalizedParameterValue(totalTranslation, totalAngle, parameterValue[currentInput[i].sourceParameterIndex], parameterMinimumValue[currentInput[i].sourceParameterIndex], parameterMaximumValue[currentInput[i].sourceParameterIndex], parameterDefaultValue[currentInput[i].sourceParameterIndex], currentSetting.normalizationPosition, currentSetting.normalizationAngle, currentInput[i].reflect, weight); + } + radAngle = CubismMath.degreesToRadian(-totalAngle.angle); + totalTranslation.x = totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle); + totalTranslation.y = totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle); + updateParticles(currentParticles, currentSetting.particleCount, totalTranslation, totalAngle.angle, this._options.wind, MovementThreshold * currentSetting.normalizationPosition.maximum, deltaTimeSeconds, AirResistance); + for (let i = 0; i < currentSetting.outputCount; ++i) { + const particleIndex = currentOutput[i].vertexIndex; + if (particleIndex < 1 || particleIndex >= currentSetting.particleCount) { + break; + } + if (currentOutput[i].destinationParameterIndex == -1) { + currentOutput[i].destinationParameterIndex = model.getParameterIndex(currentOutput[i].destination.id); + } + const translation = new CubismVector2(); + translation.x = currentParticles[particleIndex].position.x - currentParticles[particleIndex - 1].position.x; + translation.y = currentParticles[particleIndex].position.y - currentParticles[particleIndex - 1].position.y; + outputValue = currentOutput[i].getValue(translation, currentParticles, particleIndex, currentOutput[i].reflect, this._options.gravity); + const destinationParameterIndex = currentOutput[i].destinationParameterIndex; + const outParameterValue = !Float32Array.prototype.slice && "subarray" in Float32Array.prototype ? JSON.parse(JSON.stringify(parameterValue.subarray(destinationParameterIndex))) : parameterValue.slice(destinationParameterIndex); + updateOutputParameterValue(outParameterValue, parameterMinimumValue[destinationParameterIndex], parameterMaximumValue[destinationParameterIndex], outputValue, currentOutput[i]); + for (let offset = destinationParameterIndex, outParamIndex = 0; offset < parameterValue.length; offset++, outParamIndex++) { + parameterValue[offset] = outParameterValue[outParamIndex]; + } + } + } + } + setOptions(options) { + this._options = options; + } + getOption() { + return this._options; + } + constructor() { + this._options = new Options(); + this._options.gravity.y = -1; + this._options.gravity.x = 0; + this._options.wind.x = 0; + this._options.wind.y = 0; + } + release() { + this._physicsRig = void 0; + } + parse(physicsJson) { + this._physicsRig = new CubismPhysicsRig(); + let json = new CubismPhysicsJson(physicsJson); + this._physicsRig.gravity = json.getGravity(); + this._physicsRig.wind = json.getWind(); + this._physicsRig.subRigCount = json.getSubRigCount(); + let inputIndex = 0, outputIndex = 0, particleIndex = 0; + for (let i = 0; i < this._physicsRig.subRigCount; ++i) { + const setting = new CubismPhysicsSubRig(); + setting.normalizationPosition.minimum = json.getNormalizationPositionMinimumValue(i); + setting.normalizationPosition.maximum = json.getNormalizationPositionMaximumValue(i); + setting.normalizationPosition.defalut = json.getNormalizationPositionDefaultValue(i); + setting.normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i); + setting.normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i); + setting.normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i); + setting.inputCount = json.getInputCount(i); + setting.baseInputIndex = inputIndex; + inputIndex += setting.inputCount; + for (let j = 0; j < setting.inputCount; ++j) { + const input = new CubismPhysicsInput(); + input.sourceParameterIndex = -1; + input.weight = json.getInputWeight(i, j); + input.reflect = json.getInputReflect(i, j); + switch (json.getInputType(i, j)) { + case PhysicsTypeTagX: + input.type = CubismPhysicsSource.CubismPhysicsSource_X; + input.getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + break; + case PhysicsTypeTagY: + input.type = CubismPhysicsSource.CubismPhysicsSource_Y; + input.getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + break; + case PhysicsTypeTagAngle: + input.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + input.getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + break; + } + input.source.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + input.source.id = json.getInputSourceId(i, j); + this._physicsRig.inputs.push(input); + } + setting.outputCount = json.getOutputCount(i); + setting.baseOutputIndex = outputIndex; + outputIndex += setting.outputCount; + for (let j = 0; j < setting.outputCount; ++j) { + const output = new CubismPhysicsOutput(); + output.destinationParameterIndex = -1; + output.vertexIndex = json.getOutputVertexIndex(i, j); + output.angleScale = json.getOutputAngleScale(i, j); + output.weight = json.getOutputWeight(i, j); + output.destination.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + output.destination.id = json.getOutputDestinationId(i, j); + switch (json.getOutputType(i, j)) { + case PhysicsTypeTagX: + output.type = CubismPhysicsSource.CubismPhysicsSource_X; + output.getValue = getOutputTranslationX; + output.getScale = getOutputScaleTranslationX; + break; + case PhysicsTypeTagY: + output.type = CubismPhysicsSource.CubismPhysicsSource_Y; + output.getValue = getOutputTranslationY; + output.getScale = getOutputScaleTranslationY; + break; + case PhysicsTypeTagAngle: + output.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + output.getValue = getOutputAngle; + output.getScale = getOutputScaleAngle; + break; + } + output.reflect = json.getOutputReflect(i, j); + this._physicsRig.outputs.push(output); + } + setting.particleCount = json.getParticleCount(i); + setting.baseParticleIndex = particleIndex; + particleIndex += setting.particleCount; + for (let j = 0; j < setting.particleCount; ++j) { + const particle = new CubismPhysicsParticle(); + particle.mobility = json.getParticleMobility(i, j); + particle.delay = json.getParticleDelay(i, j); + particle.acceleration = json.getParticleAcceleration(i, j); + particle.radius = json.getParticleRadius(i, j); + particle.position = json.getParticlePosition(i, j); + this._physicsRig.particles.push(particle); + } + this._physicsRig.settings.push(setting); + } + this.initialize(); + json.release(); + } + initialize() { + let strand; + let currentSetting; + let radius; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + currentSetting = this._physicsRig.settings[settingIndex]; + strand = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + strand[0].initialPosition = new CubismVector2(0, 0); + strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); + strand[0].lastGravity = new CubismVector2(0, -1); + strand[0].lastGravity.y *= -1; + strand[0].velocity = new CubismVector2(0, 0); + strand[0].force = new CubismVector2(0, 0); + for (let i = 1; i < currentSetting.particleCount; ++i) { + radius = new CubismVector2(0, 0); + radius.y = strand[i].radius; + strand[i].initialPosition = new CubismVector2(strand[i - 1].initialPosition.x + radius.x, strand[i - 1].initialPosition.y + radius.y); + strand[i].position = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastPosition = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastGravity = new CubismVector2(0, -1); + strand[i].lastGravity.y *= -1; + strand[i].velocity = new CubismVector2(0, 0); + strand[i].force = new CubismVector2(0, 0); + } + } + } +} +class Options { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } +} +function getInputTranslationXFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.x += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; +} +function getInputTranslationYFromNormalizedParamterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.y += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; +} +function getInputAngleFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizaitionPosition, normalizationAngle, isInverted, weight) { + targetAngle.angle += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationAngle.minimum, normalizationAngle.maximum, normalizationAngle.defalut, isInverted) * weight; +} +function getOutputTranslationX(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.x; + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getOutputTranslationY(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.y; + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getOutputAngle(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue; + if (particleIndex >= 2) { + parentGravity = particles[particleIndex - 1].position.substract(particles[particleIndex - 2].position); + } else { + parentGravity = parentGravity.multiplyByScaler(-1); + } + outputValue = CubismMath.directionToRadian(parentGravity, translation); + if (isInverted) { + outputValue *= -1; + } + return outputValue; +} +function getRangeValue(min, max) { + return Math.abs(Math.max(min, max) - Math.min(min, max)); +} +function getDefaultValue(min, max) { + const minValue = Math.min(min, max); + return minValue + getRangeValue(min, max) / 2; +} +function getOutputScaleTranslationX(translationScale, angleScale) { + return translationScale.x; +} +function getOutputScaleTranslationY(translationScale, angleScale) { + return translationScale.y; +} +function getOutputScaleAngle(translationScale, angleScale) { + return angleScale; +} +function updateParticles(strand, strandCount, totalTranslation, totalAngle, windDirection, thresholdValue, deltaTimeSeconds, airResistance) { + let totalRadian; + let delay; + let radian; + let currentGravity; + let direction = new CubismVector2(0, 0); + let velocity = new CubismVector2(0, 0); + let force = new CubismVector2(0, 0); + let newDirection = new CubismVector2(0, 0); + strand[0].position = new CubismVector2(totalTranslation.x, totalTranslation.y); + totalRadian = CubismMath.degreesToRadian(totalAngle); + currentGravity = CubismMath.radianToDirection(totalRadian); + currentGravity.normalize(); + for (let i = 1; i < strandCount; ++i) { + strand[i].force = currentGravity.multiplyByScaler(strand[i].acceleration).add(windDirection); + strand[i].lastPosition = new CubismVector2(strand[i].position.x, strand[i].position.y); + delay = strand[i].delay * deltaTimeSeconds * 30; + direction = strand[i].position.substract(strand[i - 1].position); + radian = CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) / airResistance; + direction.x = CubismMath.cos(radian) * direction.x - direction.y * CubismMath.sin(radian); + direction.y = CubismMath.sin(radian) * direction.x + direction.y * CubismMath.cos(radian); + strand[i].position = strand[i - 1].position.add(direction); + velocity = strand[i].velocity.multiplyByScaler(delay); + force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay); + strand[i].position = strand[i].position.add(velocity).add(force); + newDirection = strand[i].position.substract(strand[i - 1].position); + newDirection.normalize(); + strand[i].position = strand[i - 1].position.add(newDirection.multiplyByScaler(strand[i].radius)); + if (CubismMath.abs(strand[i].position.x) < thresholdValue) { + strand[i].position.x = 0; + } + if (delay != 0) { + strand[i].velocity = strand[i].position.substract(strand[i].lastPosition); + strand[i].velocity = strand[i].velocity.divisionByScalar(delay); + strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); + } + strand[i].force = new CubismVector2(0, 0); + strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); + } +} +function updateOutputParameterValue(parameterValue, parameterValueMinimum, parameterValueMaximum, translation, output) { + let outputScale; + let value; + let weight; + outputScale = output.getScale(output.translationScale, output.angleScale); + value = translation * outputScale; + if (value < parameterValueMinimum) { + if (value < output.valueBelowMinimum) { + output.valueBelowMinimum = value; + } + value = parameterValueMinimum; + } else if (value > parameterValueMaximum) { + if (value > output.valueExceededMaximum) { + output.valueExceededMaximum = value; + } + value = parameterValueMaximum; + } + weight = output.weight / MaximumWeight; + if (weight >= 1) { + parameterValue[0] = value; + } else { + value = parameterValue[0] * (1 - weight) + value * weight; + parameterValue[0] = value; + } +} +function normalizeParameterValue(value, parameterMinimum, parameterMaximum, parameterDefault, normalizedMinimum, normalizedMaximum, normalizedDefault, isInverted) { + let result = 0; + const maxValue = CubismMath.max(parameterMaximum, parameterMinimum); + if (maxValue < value) { + value = maxValue; + } + const minValue = CubismMath.min(parameterMaximum, parameterMinimum); + if (minValue > value) { + value = minValue; + } + const minNormValue = CubismMath.min(normalizedMinimum, normalizedMaximum); + const maxNormValue = CubismMath.max(normalizedMinimum, normalizedMaximum); + const middleNormValue = normalizedDefault; + const middleValue = getDefaultValue(minValue, maxValue); + const paramValue = value - middleValue; + switch (Math.sign(paramValue)) { + case 1: { + const nLength = maxNormValue - middleNormValue; + const pLength = maxValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case -1: { + const nLength = minNormValue - middleNormValue; + const pLength = minValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case 0: { + result = middleNormValue; + break; + } + } + return isInverted ? result : result * -1; +} +Live2DFactory.registerRuntime({ + version: 4, + ready: cubism4Ready, + test(source) { + return source instanceof Cubism4ModelSettings || Cubism4ModelSettings.isValidJSON(source); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 4) { + return false; + } + const view = new Int8Array(modelData, 0, 4); + return String.fromCharCode(...view) === "MOC3"; + }, + createModelSettings(json) { + return new Cubism4ModelSettings(json); + }, + createCoreModel(data) { + const moc = CubismMoc.create(data); + try { + const model = moc.createModel(); + model.__moc = moc; + return model; + } catch (e) { + try { + moc.release(); + } catch (ignored) { + } + throw e; + } + }, + createInternalModel(coreModel, settings, options) { + const model = new Cubism4InternalModel(coreModel, settings, options); + const coreModelWithMoc = coreModel; + if (coreModelWithMoc.__moc) { + model.__moc = coreModelWithMoc.__moc; + delete coreModelWithMoc.__moc; + model.once("destroy", releaseMoc); + } + return model; + }, + createPhysics(coreModel, data) { + return CubismPhysics.create(data); + }, + createPose(coreModel, data) { + return CubismPose.create(data); + } +}); +function releaseMoc() { + var _a; + (_a = this.__moc) == null ? void 0 : _a.release(); +} +export { Cubism2ExpressionManager, Cubism2InternalModel, Cubism2ModelSettings, Cubism2MotionManager, Cubism4ExpressionManager, Cubism4InternalModel, Cubism4ModelSettings, Cubism4MotionManager, ExpressionManager, FileLoader, FocusController, InteractionMixin, InternalModel, LOGICAL_HEIGHT, LOGICAL_WIDTH, Live2DExpression, Live2DEyeBlink, Live2DFactory, Live2DLoader, Live2DModel, Live2DPhysics, Live2DPose, Live2DTransform, ModelSettings, MotionManager, MotionPreloadStrategy, MotionPriority, MotionState, SoundManager, VERSION, XHRLoader, ZipLoader, applyMixins, clamp, config, copyArray, copyProperty, cubism4Ready, folderName, logger, rand, remove, startUpCubism4 }; diff --git a/live2d/node_modules/pixi-live2d-display/dist/index.js b/live2d/node_modules/pixi-live2d-display/dist/index.js new file mode 100644 index 0000000..bc3d800 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/index.js @@ -0,0 +1,6027 @@ +var __pow = Math.pow; +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@pixi/utils"), require("@pixi/math"), require("@pixi/core"), require("@pixi/display")) : typeof define === "function" && define.amd ? define(["exports", "@pixi/utils", "@pixi/math", "@pixi/core", "@pixi/display"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory((global.PIXI = global.PIXI || {}, global.PIXI.live2d = global.PIXI.live2d || {}), global.PIXI.utils, global.PIXI, global.PIXI, global.PIXI)); +})(this, function(exports2, utils, math, core, display) { + "use strict"; + const LOGICAL_WIDTH = 2; + const LOGICAL_HEIGHT = 2; + var CubismConfig; + ((CubismConfig2) => { + CubismConfig2.supportMoreMaskDivisions = true; + CubismConfig2.setOpacityFromMotion = false; + })(CubismConfig || (CubismConfig = {})); + exports2.config = void 0; + ((config2) => { + config2.LOG_LEVEL_VERBOSE = 0; + config2.LOG_LEVEL_WARNING = 1; + config2.LOG_LEVEL_ERROR = 2; + config2.LOG_LEVEL_NONE = 999; + config2.logLevel = config2.LOG_LEVEL_WARNING; + config2.sound = true; + config2.motionSync = true; + config2.motionFadingDuration = 500; + config2.idleMotionFadingDuration = 2e3; + config2.expressionFadingDuration = 500; + config2.preserveExpressionOnMotion = true; + config2.cubism4 = CubismConfig; + })(exports2.config || (exports2.config = {})); + const VERSION = "0.4.0"; + const logger = { + log(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_VERBOSE) { + console.log(`[${tag}]`, ...messages); + } + }, + warn(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_WARNING) { + console.warn(`[${tag}]`, ...messages); + } + }, + error(tag, ...messages) { + if (exports2.config.logLevel <= exports2.config.LOG_LEVEL_ERROR) { + console.error(`[${tag}]`, ...messages); + } + } + }; + function clamp(num, lower, upper) { + return num < lower ? lower : num > upper ? upper : num; + } + function rand(min, max) { + return Math.random() * (max - min) + min; + } + function copyProperty(type, from, to, fromKey, toKey) { + const value = from[fromKey]; + if (value !== null && typeof value === type) { + to[toKey] = value; + } + } + function copyArray(type, from, to, fromKey, toKey) { + const array = from[fromKey]; + if (Array.isArray(array)) { + to[toKey] = array.filter((item) => item !== null && typeof item === type); + } + } + function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => { + if (name !== "constructor") { + Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); + } + }); + }); + } + function folderName(url) { + let lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex != -1) { + url = url.slice(0, lastSlashIndex); + } + lastSlashIndex = url.lastIndexOf("/"); + if (lastSlashIndex !== -1) { + url = url.slice(lastSlashIndex + 1); + } + return url; + } + function remove(array, item) { + const index = array.indexOf(item); + if (index !== -1) { + array.splice(index, 1); + } + } + class ExpressionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.expressions = []; + this.reserveExpressionIndex = -1; + this.destroyed = false; + this.settings = settings; + this.tag = `ExpressionManager(${settings.name})`; + } + init() { + this.defaultExpression = this.createExpression({}, void 0); + this.currentExpression = this.defaultExpression; + this.stopAllExpressions(); + } + loadExpression(index) { + return __async(this, null, function* () { + if (!this.definitions[index]) { + logger.warn(this.tag, `Undefined expression at [${index}]`); + return void 0; + } + if (this.expressions[index] === null) { + logger.warn(this.tag, `Cannot set expression at [${index}] because it's already failed in loading.`); + return void 0; + } + if (this.expressions[index]) { + return this.expressions[index]; + } + const expression = yield this._loadExpression(index); + this.expressions[index] = expression; + return expression; + }); + } + _loadExpression(index) { + throw new Error("Not implemented."); + } + setRandomExpression() { + return __async(this, null, function* () { + if (this.definitions.length) { + const availableIndices = []; + for (let i = 0; i < this.definitions.length; i++) { + if (this.expressions[i] !== null && this.expressions[i] !== this.currentExpression && i !== this.reserveExpressionIndex) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.setExpression(index); + } + } + return false; + }); + } + resetExpression() { + this._setExpression(this.defaultExpression); + } + restoreExpression() { + this._setExpression(this.currentExpression); + } + setExpression(index) { + return __async(this, null, function* () { + if (typeof index !== "number") { + index = this.getExpressionIndex(index); + } + if (!(index > -1 && index < this.definitions.length)) { + return false; + } + if (index === this.expressions.indexOf(this.currentExpression)) { + return false; + } + this.reserveExpressionIndex = index; + const expression = yield this.loadExpression(index); + if (!expression || this.reserveExpressionIndex !== index) { + return false; + } + this.reserveExpressionIndex = -1; + this.currentExpression = expression; + this._setExpression(expression); + return true; + }); + } + update(model, now) { + if (!this.isFinished()) { + return this.updateParameters(model, now); + } + return false; + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + const self2 = this; + self2.definitions = void 0; + self2.expressions = void 0; + } + } + const EPSILON = 0.01; + const MAX_SPEED = 40 / 7.5; + const ACCELERATION_TIME = 1 / (0.15 * 1e3); + class FocusController { + constructor() { + this.targetX = 0; + this.targetY = 0; + this.x = 0; + this.y = 0; + this.vx = 0; + this.vy = 0; + } + focus(x, y, instant = false) { + this.targetX = clamp(x, -1, 1); + this.targetY = clamp(y, -1, 1); + if (instant) { + this.x = this.targetX; + this.y = this.targetY; + } + } + update(dt) { + const dx = this.targetX - this.x; + const dy = this.targetY - this.y; + if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) + return; + const d = Math.sqrt(__pow(dx, 2) + __pow(dy, 2)); + const maxSpeed = MAX_SPEED / (1e3 / dt); + let ax = maxSpeed * (dx / d) - this.vx; + let ay = maxSpeed * (dy / d) - this.vy; + const a = Math.sqrt(__pow(ax, 2) + __pow(ay, 2)); + const maxA = maxSpeed * ACCELERATION_TIME * dt; + if (a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this.vx += ax; + this.vy += ay; + const v = Math.sqrt(__pow(this.vx, 2) + __pow(this.vy, 2)); + const maxV = 0.5 * (Math.sqrt(__pow(maxA, 2) + 8 * maxA * d) - maxA); + if (v > maxV) { + this.vx *= maxV / v; + this.vy *= maxV / v; + } + this.x += this.vx; + this.y += this.vy; + } + } + class ModelSettings { + constructor(json) { + this.json = json; + let url2 = json.url; + if (typeof url2 !== "string") { + throw new TypeError("The `url` field in settings JSON must be defined as a string."); + } + this.url = url2; + this.name = folderName(this.url); + } + resolveURL(path) { + return utils.url.resolve(this.url, path); + } + replaceFiles(replacer) { + this.moc = replacer(this.moc, "moc"); + if (this.pose !== void 0) { + this.pose = replacer(this.pose, "pose"); + } + if (this.physics !== void 0) { + this.physics = replacer(this.physics, "physics"); + } + for (let i = 0; i < this.textures.length; i++) { + this.textures[i] = replacer(this.textures[i], `textures[${i}]`); + } + } + getDefinedFiles() { + const files = []; + this.replaceFiles((file) => { + files.push(file); + return file; + }); + return files; + } + validateFiles(files) { + const assertFileExists = (expectedFile, shouldThrow) => { + const actualPath = this.resolveURL(expectedFile); + if (!files.includes(actualPath)) { + if (shouldThrow) { + throw new Error(`File "${expectedFile}" is defined in settings, but doesn't exist in given files`); + } + return false; + } + return true; + }; + const essentialFiles = [this.moc, ...this.textures]; + essentialFiles.forEach((texture) => assertFileExists(texture, true)); + const definedFiles = this.getDefinedFiles(); + return definedFiles.filter((file) => assertFileExists(file, false)); + } + } + var MotionPriority = /* @__PURE__ */ ((MotionPriority2) => { + MotionPriority2[MotionPriority2["NONE"] = 0] = "NONE"; + MotionPriority2[MotionPriority2["IDLE"] = 1] = "IDLE"; + MotionPriority2[MotionPriority2["NORMAL"] = 2] = "NORMAL"; + MotionPriority2[MotionPriority2["FORCE"] = 3] = "FORCE"; + return MotionPriority2; + })(MotionPriority || {}); + class MotionState { + constructor() { + this.debug = false; + this.currentPriority = 0; + this.reservePriority = 0; + } + reserve(group, index, priority) { + if (priority <= 0) { + logger.log(this.tag, `Cannot start a motion with MotionPriority.NONE.`); + return false; + } + if (group === this.currentGroup && index === this.currentIndex) { + logger.log(this.tag, `Motion is already playing.`, this.dump(group, index)); + return false; + } + if (group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex) { + logger.log(this.tag, `Motion is already reserved.`, this.dump(group, index)); + return false; + } + if (priority === 1) { + if (this.currentPriority !== 0) { + logger.log(this.tag, `Cannot start idle motion because another motion is playing.`, this.dump(group, index)); + return false; + } + if (this.reservedIdleGroup !== void 0) { + logger.log(this.tag, `Cannot start idle motion because another idle motion has reserved.`, this.dump(group, index)); + return false; + } + this.setReservedIdle(group, index); + } else { + if (priority < 3) { + if (priority <= this.currentPriority) { + logger.log(this.tag, "Cannot start motion because another motion is playing as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + if (priority <= this.reservePriority) { + logger.log(this.tag, "Cannot start motion because another motion has reserved as an equivalent or higher priority.", this.dump(group, index)); + return false; + } + } + this.setReserved(group, index, priority); + } + return true; + } + start(motion, group, index, priority) { + if (priority === 1) { + this.setReservedIdle(void 0, void 0); + if (this.currentPriority !== 0) { + logger.log(this.tag, "Cannot start idle motion because another motion is playing.", this.dump(group, index)); + return false; + } + } else { + if (group !== this.reservedGroup || index !== this.reservedIndex) { + logger.log(this.tag, "Cannot start motion because another motion has taken the place.", this.dump(group, index)); + return false; + } + this.setReserved(void 0, void 0, 0); + } + if (!motion) { + return false; + } + this.setCurrent(group, index, priority); + return true; + } + complete() { + this.setCurrent(void 0, void 0, 0); + } + setCurrent(group, index, priority) { + this.currentPriority = priority; + this.currentGroup = group; + this.currentIndex = index; + } + setReserved(group, index, priority) { + this.reservePriority = priority; + this.reservedGroup = group; + this.reservedIndex = index; + } + setReservedIdle(group, index) { + this.reservedIdleGroup = group; + this.reservedIdleIndex = index; + } + isActive(group, index) { + return group === this.currentGroup && index === this.currentIndex || group === this.reservedGroup && index === this.reservedIndex || group === this.reservedIdleGroup && index === this.reservedIdleIndex; + } + reset() { + this.setCurrent(void 0, void 0, 0); + this.setReserved(void 0, void 0, 0); + this.setReservedIdle(void 0, void 0); + } + shouldRequestIdleMotion() { + return this.currentGroup === void 0 && this.reservedIdleGroup === void 0; + } + shouldOverrideExpression() { + return !exports2.config.preserveExpressionOnMotion && this.currentPriority > 1; + } + dump(requestedGroup, requestedIndex) { + if (this.debug) { + const keys = [ + "currentPriority", + "reservePriority", + "currentGroup", + "currentIndex", + "reservedGroup", + "reservedIndex", + "reservedIdleGroup", + "reservedIdleIndex" + ]; + return ` + group = "${requestedGroup}", index = ${requestedIndex} +` + keys.map((key) => "[" + key + "] " + this[key]).join("\n"); + } + return ""; + } + } + const TAG$2 = "SoundManager"; + const VOLUME = 0.5; + class SoundManager { + static get volume() { + return this._volume; + } + static set volume(value) { + this._volume = (value > 1 ? 1 : value < 0 ? 0 : value) || 0; + this.audios.forEach((audio) => audio.volume = this._volume); + } + static add(file, onFinish, onError) { + const audio = new Audio(file); + audio.volume = this._volume; + audio.preload = "auto"; + audio.addEventListener("ended", () => { + this.dispose(audio); + onFinish == null ? void 0 : onFinish(); + }); + audio.addEventListener("error", (e) => { + this.dispose(audio); + logger.warn(TAG$2, `Error occurred on "${file}"`, e.error); + onError == null ? void 0 : onError(e.error); + }); + this.audios.push(audio); + return audio; + } + static play(audio) { + return new Promise((resolve, reject) => { + var _a; + (_a = audio.play()) == null ? void 0 : _a.catch((e) => { + audio.dispatchEvent(new ErrorEvent("error", { error: e })); + reject(e); + }); + if (audio.readyState === audio.HAVE_ENOUGH_DATA) { + resolve(); + } else { + audio.addEventListener("canplaythrough", resolve); + } + }); + } + static dispose(audio) { + audio.pause(); + audio.removeAttribute("src"); + remove(this.audios, audio); + } + static destroy() { + for (let i = this.audios.length - 1; i >= 0; i--) { + this.dispose(this.audios[i]); + } + } + } + SoundManager.audios = []; + SoundManager._volume = VOLUME; + var MotionPreloadStrategy = /* @__PURE__ */ ((MotionPreloadStrategy2) => { + MotionPreloadStrategy2["ALL"] = "ALL"; + MotionPreloadStrategy2["IDLE"] = "IDLE"; + MotionPreloadStrategy2["NONE"] = "NONE"; + return MotionPreloadStrategy2; + })(MotionPreloadStrategy || {}); + class MotionManager extends utils.EventEmitter { + constructor(settings, options) { + super(); + this.motionGroups = {}; + this.state = new MotionState(); + this.playing = false; + this.destroyed = false; + this.settings = settings; + this.tag = `MotionManager(${settings.name})`; + this.state.tag = this.tag; + } + init(options) { + if (options == null ? void 0 : options.idleMotionGroup) { + this.groups.idle = options.idleMotionGroup; + } + this.setupMotions(options); + this.stopAllMotions(); + } + setupMotions(options) { + for (const group of Object.keys(this.definitions)) { + this.motionGroups[group] = []; + } + let groups; + switch (options == null ? void 0 : options.motionPreload) { + case "NONE": + return; + case "ALL": + groups = Object.keys(this.definitions); + break; + case "IDLE": + default: + groups = [this.groups.idle]; + break; + } + for (const group of groups) { + if (this.definitions[group]) { + for (let i = 0; i < this.definitions[group].length; i++) { + this.loadMotion(group, i).then(); + } + } + } + } + loadMotion(group, index) { + return __async(this, null, function* () { + var _a; + if (!((_a = this.definitions[group]) == null ? void 0 : _a[index])) { + logger.warn(this.tag, `Undefined motion at "${group}"[${index}]`); + return void 0; + } + if (this.motionGroups[group][index] === null) { + logger.warn(this.tag, `Cannot start motion at "${group}"[${index}] because it's already failed in loading.`); + return void 0; + } + if (this.motionGroups[group][index]) { + return this.motionGroups[group][index]; + } + const motion = yield this._loadMotion(group, index); + if (this.destroyed) { + return; + } + this.motionGroups[group][index] = motion != null ? motion : null; + return motion; + }); + } + _loadMotion(group, index) { + throw new Error("Not implemented."); + } + startMotion(_0, _1) { + return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL) { + var _a; + if (!this.state.reserve(group, index, priority)) { + return false; + } + const definition = (_a = this.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return false; + } + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + } + let audio; + if (exports2.config.sound) { + const soundURL = this.getSoundFile(definition); + if (soundURL) { + try { + audio = SoundManager.add(this.settings.resolveURL(soundURL), () => this.currentAudio = void 0, () => this.currentAudio = void 0); + this.currentAudio = audio; + } catch (e) { + logger.warn(this.tag, "Failed to create audio", soundURL, e); + } + } + } + const motion = yield this.loadMotion(group, index); + if (audio) { + const readyToPlay = SoundManager.play(audio).catch((e) => logger.warn(this.tag, "Failed to play audio", audio.src, e)); + if (exports2.config.motionSync) { + yield readyToPlay; + } + } + if (!this.state.start(motion, group, index, priority)) { + if (audio) { + SoundManager.dispose(audio); + this.currentAudio = void 0; + } + return false; + } + logger.log(this.tag, "Start motion:", this.getMotionName(definition)); + this.emit("motionStart", group, index, audio); + if (this.state.shouldOverrideExpression()) { + this.expressionManager && this.expressionManager.resetExpression(); + } + this.playing = true; + this._startMotion(motion); + return true; + }); + } + startRandomMotion(group, priority) { + return __async(this, null, function* () { + const groupDefs = this.definitions[group]; + if (groupDefs == null ? void 0 : groupDefs.length) { + const availableIndices = []; + for (let i = 0; i < groupDefs.length; i++) { + if (this.motionGroups[group][i] !== null && !this.state.isActive(group, i)) { + availableIndices.push(i); + } + } + if (availableIndices.length) { + const index = Math.floor(Math.random() * availableIndices.length); + return this.startMotion(group, availableIndices[index], priority); + } + } + return false; + }); + } + stopAllMotions() { + this._stopAllMotions(); + this.state.reset(); + if (this.currentAudio) { + SoundManager.dispose(this.currentAudio); + this.currentAudio = void 0; + } + } + update(model, now) { + var _a; + if (this.isFinished()) { + if (this.playing) { + this.playing = false; + this.emit("motionFinish"); + } + if (this.state.shouldOverrideExpression()) { + (_a = this.expressionManager) == null ? void 0 : _a.restoreExpression(); + } + this.state.complete(); + if (this.state.shouldRequestIdleMotion()) { + this.startRandomMotion(this.groups.idle, MotionPriority.IDLE); + } + } + return this.updateParameters(model, now); + } + destroy() { + var _a; + this.destroyed = true; + this.emit("destroy"); + this.stopAllMotions(); + (_a = this.expressionManager) == null ? void 0 : _a.destroy(); + const self2 = this; + self2.definitions = void 0; + self2.motionGroups = void 0; + } + } + const tempBounds = { x: 0, y: 0, width: 0, height: 0 }; + class InternalModel extends utils.EventEmitter { + constructor() { + super(...arguments); + this.focusController = new FocusController(); + this.originalWidth = 0; + this.originalHeight = 0; + this.width = 0; + this.height = 0; + this.localTransform = new math.Matrix(); + this.drawingMatrix = new math.Matrix(); + this.hitAreas = {}; + this.textureFlipY = false; + this.viewport = [0, 0, 0, 0]; + this.destroyed = false; + } + init() { + this.setupLayout(); + this.setupHitAreas(); + } + setupLayout() { + const self2 = this; + const size = this.getSize(); + self2.originalWidth = size[0]; + self2.originalHeight = size[1]; + const layout = Object.assign({ + width: LOGICAL_WIDTH, + height: LOGICAL_HEIGHT + }, this.getLayout()); + this.localTransform.scale(layout.width / LOGICAL_WIDTH, layout.height / LOGICAL_HEIGHT); + self2.width = this.originalWidth * this.localTransform.a; + self2.height = this.originalHeight * this.localTransform.d; + const offsetX = layout.x !== void 0 && layout.x - layout.width / 2 || layout.centerX !== void 0 && layout.centerX || layout.left !== void 0 && layout.left - layout.width / 2 || layout.right !== void 0 && layout.right + layout.width / 2 || 0; + const offsetY = layout.y !== void 0 && layout.y - layout.height / 2 || layout.centerY !== void 0 && layout.centerY || layout.top !== void 0 && layout.top - layout.height / 2 || layout.bottom !== void 0 && layout.bottom + layout.height / 2 || 0; + this.localTransform.translate(this.width * offsetX, -this.height * offsetY); + } + setupHitAreas() { + const definitions = this.getHitAreaDefs().filter((hitArea) => hitArea.index >= 0); + for (const def of definitions) { + this.hitAreas[def.name] = def; + } + } + hitTest(x, y) { + return Object.keys(this.hitAreas).filter((hitAreaName) => this.isHit(hitAreaName, x, y)); + } + isHit(hitAreaName, x, y) { + if (!this.hitAreas[hitAreaName]) { + return false; + } + const drawIndex = this.hitAreas[hitAreaName].index; + const bounds = this.getDrawableBounds(drawIndex, tempBounds); + return bounds.x <= x && x <= bounds.x + bounds.width && bounds.y <= y && y <= bounds.y + bounds.height; + } + getDrawableBounds(index, bounds) { + const vertices = this.getDrawableVertices(index); + let left = vertices[0]; + let right = vertices[0]; + let top = vertices[1]; + let bottom = vertices[1]; + for (let i = 0; i < vertices.length; i += 2) { + const vx = vertices[i]; + const vy = vertices[i + 1]; + left = Math.min(vx, left); + right = Math.max(vx, right); + top = Math.min(vy, top); + bottom = Math.max(vy, bottom); + } + bounds != null ? bounds : bounds = {}; + bounds.x = left; + bounds.y = top; + bounds.width = right - left; + bounds.height = bottom - top; + return bounds; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(transform).append(this.localTransform); + } + update(dt, now) { + this.focusController.update(dt); + } + destroy() { + this.destroyed = true; + this.emit("destroy"); + this.motionManager.destroy(); + this.motionManager = void 0; + } + } + const TAG$1 = "XHRLoader"; + class NetworkError extends Error { + constructor(message, url, status, aborted = false) { + super(message); + this.url = url; + this.status = status; + this.aborted = aborted; + } + } + const _XHRLoader = class { + static createXHR(target, url, type, onload, onerror) { + const xhr = new XMLHttpRequest(); + _XHRLoader.allXhrSet.add(xhr); + if (target) { + let xhrSet = _XHRLoader.xhrMap.get(target); + if (!xhrSet) { + xhrSet = /* @__PURE__ */ new Set([xhr]); + _XHRLoader.xhrMap.set(target, xhrSet); + } else { + xhrSet.add(xhr); + } + if (!target.listeners("destroy").includes(_XHRLoader.cancelXHRs)) { + target.once("destroy", _XHRLoader.cancelXHRs); + } + } + xhr.open("GET", url); + xhr.responseType = type; + xhr.onload = () => { + if ((xhr.status === 200 || xhr.status === 0) && xhr.response) { + onload(xhr.response); + } else { + xhr.onerror(); + } + }; + xhr.onerror = () => { + logger.warn(TAG$1, `Failed to load resource as ${xhr.responseType} (Status ${xhr.status}): ${url}`); + onerror(new NetworkError("Network error.", url, xhr.status)); + }; + xhr.onabort = () => onerror(new NetworkError("Aborted.", url, xhr.status, true)); + xhr.onloadend = () => { + var _a; + _XHRLoader.allXhrSet.delete(xhr); + if (target) { + (_a = _XHRLoader.xhrMap.get(target)) == null ? void 0 : _a.delete(xhr); + } + }; + return xhr; + } + static cancelXHRs() { + var _a; + (_a = _XHRLoader.xhrMap.get(this)) == null ? void 0 : _a.forEach((xhr) => { + xhr.abort(); + _XHRLoader.allXhrSet.delete(xhr); + }); + _XHRLoader.xhrMap.delete(this); + } + static release() { + _XHRLoader.allXhrSet.forEach((xhr) => xhr.abort()); + _XHRLoader.allXhrSet.clear(); + _XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + } + }; + let XHRLoader = _XHRLoader; + XHRLoader.xhrMap = /* @__PURE__ */ new WeakMap(); + XHRLoader.allXhrSet = /* @__PURE__ */ new Set(); + XHRLoader.loader = (context, next) => { + return new Promise((resolve, reject) => { + const xhr = _XHRLoader.createXHR(context.target, context.settings ? context.settings.resolveURL(context.url) : context.url, context.type, (data) => { + context.result = data; + resolve(); + }, reject); + xhr.send(); + }); + }; + function runMiddlewares(middleware, context) { + let index = -1; + return dispatch(0); + function dispatch(i, err) { + if (err) + return Promise.reject(err); + if (i <= index) + return Promise.reject(new Error("next() called multiple times")); + index = i; + const fn = middleware[i]; + if (!fn) + return Promise.resolve(); + try { + return Promise.resolve(fn(context, dispatch.bind(null, i + 1))); + } catch (err2) { + return Promise.reject(err2); + } + } + } + class Live2DLoader { + static load(context) { + return runMiddlewares(this.middlewares, context).then(() => context.result); + } + } + Live2DLoader.middlewares = [XHRLoader.loader]; + function createTexture(url, options = {}) { + var _a; + const textureOptions = { resourceOptions: { crossorigin: options.crossOrigin } }; + if (core.Texture.fromURL) { + return core.Texture.fromURL(url, textureOptions).catch((e) => { + if (e instanceof Error) { + throw e; + } + const err = new Error("Texture loading error"); + err.event = e; + throw err; + }); + } + textureOptions.resourceOptions.autoLoad = false; + const texture = core.Texture.from(url, textureOptions); + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + const resource = texture.baseTexture.resource; + (_a = resource._live2d_load) != null ? _a : resource._live2d_load = new Promise((resolve, reject) => { + const errorHandler = (event) => { + resource.source.removeEventListener("error", errorHandler); + const err = new Error("Texture loading error"); + err.event = event; + reject(err); + }; + resource.source.addEventListener("error", errorHandler); + resource.load().then(() => resolve(texture)).catch(errorHandler); + }); + return resource._live2d_load; + } + const TAG = "Live2DFactory"; + const urlToJSON = (context, next) => __async(this, null, function* () { + if (typeof context.source === "string") { + const data = yield Live2DLoader.load({ + url: context.source, + type: "json", + target: context.live2dModel + }); + data.url = context.source; + context.source = data; + context.live2dModel.emit("settingsJSONLoaded", data); + } + return next(); + }); + const jsonToSettings = (context, next) => __async(this, null, function* () { + if (context.source instanceof ModelSettings) { + context.settings = context.source; + return next(); + } else if (typeof context.source === "object") { + const runtime = Live2DFactory.findRuntime(context.source); + if (runtime) { + const settings = runtime.createModelSettings(context.source); + context.settings = settings; + context.live2dModel.emit("settingsLoaded", settings); + return next(); + } + } + throw new TypeError("Unknown settings format."); + }); + const waitUntilReady = (context, next) => { + if (context.settings) { + const runtime = Live2DFactory.findRuntime(context.settings); + if (runtime) { + return runtime.ready().then(next); + } + } + return next(); + }; + const setupOptionals = (context, next) => __async(this, null, function* () { + yield next(); + const internalModel = context.internalModel; + if (internalModel) { + const settings = context.settings; + const runtime = Live2DFactory.findRuntime(settings); + if (runtime) { + const tasks = []; + if (settings.pose) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.pose, + type: "json", + target: internalModel + }).then((data) => { + internalModel.pose = runtime.createPose(internalModel.coreModel, data); + context.live2dModel.emit("poseLoaded", internalModel.pose); + }).catch((e) => { + context.live2dModel.emit("poseLoadError", e); + logger.warn(TAG, "Failed to load pose.", e); + })); + } + if (settings.physics) { + tasks.push(Live2DLoader.load({ + settings, + url: settings.physics, + type: "json", + target: internalModel + }).then((data) => { + internalModel.physics = runtime.createPhysics(internalModel.coreModel, data); + context.live2dModel.emit("physicsLoaded", internalModel.physics); + }).catch((e) => { + context.live2dModel.emit("physicsLoadError", e); + logger.warn(TAG, "Failed to load physics.", e); + })); + } + if (tasks.length) { + yield Promise.all(tasks); + } + } + } + }); + const setupEssentials = (context, next) => __async(this, null, function* () { + if (context.settings) { + const live2DModel = context.live2dModel; + const textureLoadings = context.settings.textures.map((tex) => { + const url = context.settings.resolveURL(tex); + return createTexture(url, { crossOrigin: context.options.crossOrigin }); + }); + yield next(); + if (context.internalModel) { + live2DModel.internalModel = context.internalModel; + live2DModel.emit("modelLoaded", context.internalModel); + } else { + throw new TypeError("Missing internal model."); + } + live2DModel.textures = yield Promise.all(textureLoadings); + live2DModel.emit("textureLoaded", live2DModel.textures); + } else { + throw new TypeError("Missing settings."); + } + }); + const createInternalModel = (context, next) => __async(this, null, function* () { + const settings = context.settings; + if (settings instanceof ModelSettings) { + const runtime = Live2DFactory.findRuntime(settings); + if (!runtime) { + throw new TypeError("Unknown model settings."); + } + const modelData = yield Live2DLoader.load({ + settings, + url: settings.moc, + type: "arraybuffer", + target: context.live2dModel + }); + if (!runtime.isValidMoc(modelData)) { + throw new Error("Invalid moc data"); + } + const coreModel = runtime.createCoreModel(modelData); + context.internalModel = runtime.createInternalModel(coreModel, settings, context.options); + return next(); + } + throw new TypeError("Missing settings."); + }); + const _Live2DFactory = class { + static registerRuntime(runtime) { + _Live2DFactory.runtimes.push(runtime); + _Live2DFactory.runtimes.sort((a, b) => b.version - a.version); + } + static findRuntime(source) { + for (const runtime of _Live2DFactory.runtimes) { + if (runtime.test(source)) { + return runtime; + } + } + } + static setupLive2DModel(live2dModel, source, options) { + return __async(this, null, function* () { + const textureLoaded = new Promise((resolve) => live2dModel.once("textureLoaded", resolve)); + const modelLoaded = new Promise((resolve) => live2dModel.once("modelLoaded", resolve)); + const readyEventEmitted = Promise.all([textureLoaded, modelLoaded]).then(() => live2dModel.emit("ready")); + yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares, { + live2dModel, + source, + options: options || {} + }); + yield readyEventEmitted; + live2dModel.emit("load"); + }); + } + static loadMotion(motionManager, group, index) { + var _a, _b; + const handleError = (e) => motionManager.emit("motionLoadError", group, index, e); + try { + const definition = (_a = motionManager.definitions[group]) == null ? void 0 : _a[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!motionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + motionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.motionTasksMap.get(motionManager); + if (!tasks) { + tasks = {}; + _Live2DFactory.motionTasksMap.set(motionManager, tasks); + } + let taskGroup = tasks[group]; + if (!taskGroup) { + taskGroup = []; + tasks[group] = taskGroup; + } + const path = motionManager.getMotionFile(definition); + (_b = taskGroup[index]) != null ? _b : taskGroup[index] = Live2DLoader.load({ + url: path, + settings: motionManager.settings, + type: motionManager.motionDataType, + target: motionManager + }).then((data) => { + var _a2; + const taskGroup2 = (_a2 = _Live2DFactory.motionTasksMap.get(motionManager)) == null ? void 0 : _a2[group]; + if (taskGroup2) { + delete taskGroup2[index]; + } + const motion = motionManager.createMotion(data, group, definition); + motionManager.emit("motionLoaded", group, index, motion); + return motion; + }).catch((e) => { + logger.warn(motionManager.tag, `Failed to load motion: ${path} +`, e); + handleError(e); + }); + return taskGroup[index]; + } catch (e) { + logger.warn(motionManager.tag, `Failed to load motion at "${group}"[${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static loadExpression(expressionManager, index) { + var _a; + const handleError = (e) => expressionManager.emit("expressionLoadError", index, e); + try { + const definition = expressionManager.definitions[index]; + if (!definition) { + return Promise.resolve(void 0); + } + if (!expressionManager.listeners("destroy").includes(_Live2DFactory.releaseTasks)) { + expressionManager.once("destroy", _Live2DFactory.releaseTasks); + } + let tasks = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (!tasks) { + tasks = []; + _Live2DFactory.expressionTasksMap.set(expressionManager, tasks); + } + const path = expressionManager.getExpressionFile(definition); + (_a = tasks[index]) != null ? _a : tasks[index] = Live2DLoader.load({ + url: path, + settings: expressionManager.settings, + type: "json", + target: expressionManager + }).then((data) => { + const tasks2 = _Live2DFactory.expressionTasksMap.get(expressionManager); + if (tasks2) { + delete tasks2[index]; + } + const expression = expressionManager.createExpression(data, definition); + expressionManager.emit("expressionLoaded", index, expression); + return expression; + }).catch((e) => { + logger.warn(expressionManager.tag, `Failed to load expression: ${path} +`, e); + handleError(e); + }); + return tasks[index]; + } catch (e) { + logger.warn(expressionManager.tag, `Failed to load expression at [${index}] +`, e); + handleError(e); + } + return Promise.resolve(void 0); + } + static releaseTasks() { + if (this instanceof MotionManager) { + _Live2DFactory.motionTasksMap.delete(this); + } else { + _Live2DFactory.expressionTasksMap.delete(this); + } + } + }; + let Live2DFactory = _Live2DFactory; + Live2DFactory.runtimes = []; + Live2DFactory.urlToJSON = urlToJSON; + Live2DFactory.jsonToSettings = jsonToSettings; + Live2DFactory.waitUntilReady = waitUntilReady; + Live2DFactory.setupOptionals = setupOptionals; + Live2DFactory.setupEssentials = setupEssentials; + Live2DFactory.createInternalModel = createInternalModel; + Live2DFactory.live2DModelMiddlewares = [ + urlToJSON, + jsonToSettings, + waitUntilReady, + setupOptionals, + setupEssentials, + createInternalModel + ]; + Live2DFactory.motionTasksMap = /* @__PURE__ */ new WeakMap(); + Live2DFactory.expressionTasksMap = /* @__PURE__ */ new WeakMap(); + MotionManager.prototype["_loadMotion"] = function(group, index) { + return Live2DFactory.loadMotion(this, group, index); + }; + ExpressionManager.prototype["_loadExpression"] = function(index) { + return Live2DFactory.loadExpression(this, index); + }; + class InteractionMixin { + constructor() { + this._autoInteract = false; + } + get autoInteract() { + return this._autoInteract; + } + set autoInteract(autoInteract) { + if (autoInteract !== this._autoInteract) { + if (autoInteract) { + this.on("pointertap", onTap, this); + } else { + this.off("pointertap", onTap, this); + } + this._autoInteract = autoInteract; + } + } + registerInteraction(manager) { + if (manager !== this.interactionManager) { + this.unregisterInteraction(); + if (this._autoInteract && manager) { + this.interactionManager = manager; + manager.on("pointermove", onPointerMove, this); + } + } + } + unregisterInteraction() { + var _a; + if (this.interactionManager) { + (_a = this.interactionManager) == null ? void 0 : _a.off("pointermove", onPointerMove, this); + this.interactionManager = void 0; + } + } + } + function onTap(event) { + this.tap(event.data.global.x, event.data.global.y); + } + function onPointerMove(event) { + this.focus(event.data.global.x, event.data.global.y); + } + class Live2DTransform extends math.Transform { + } + const tempPoint = new math.Point(); + const tempMatrix$1 = new math.Matrix(); + let tickerRef; + class Live2DModel extends display.Container { + constructor(options) { + super(); + this.tag = "Live2DModel(uninitialized)"; + this.textures = []; + this.transform = new Live2DTransform(); + this.anchor = new math.ObservablePoint(this.onAnchorChange, this, 0, 0); + this.glContextID = -1; + this.elapsedTime = performance.now(); + this.deltaTime = 0; + this._autoUpdate = false; + this.once("modelLoaded", () => this.init(options)); + } + static from(source, options) { + const model = new this(options); + return Live2DFactory.setupLive2DModel(model, source, options).then(() => model); + } + static fromSync(source, options) { + const model = new this(options); + Live2DFactory.setupLive2DModel(model, source, options).then(options == null ? void 0 : options.onLoad).catch(options == null ? void 0 : options.onError); + return model; + } + static registerTicker(tickerClass) { + tickerRef = tickerClass; + } + get autoUpdate() { + return this._autoUpdate; + } + set autoUpdate(autoUpdate) { + var _a; + tickerRef || (tickerRef = (_a = window.PIXI) == null ? void 0 : _a.Ticker); + if (autoUpdate) { + if (!this._destroyed) { + if (tickerRef) { + tickerRef.shared.add(this.onTickerUpdate, this); + this._autoUpdate = true; + } else { + logger.warn(this.tag, "No Ticker registered, please call Live2DModel.registerTicker(Ticker)."); + } + } + } else { + tickerRef == null ? void 0 : tickerRef.shared.remove(this.onTickerUpdate, this); + this._autoUpdate = false; + } + } + init(options) { + this.tag = `Live2DModel(${this.internalModel.settings.name})`; + const _options = Object.assign({ + autoUpdate: true, + autoInteract: true + }, options); + if (_options.autoInteract) { + this.interactive = true; + } + this.autoInteract = _options.autoInteract; + this.autoUpdate = _options.autoUpdate; + } + onAnchorChange() { + this.pivot.set(this.anchor.x * this.internalModel.width, this.anchor.y * this.internalModel.height); + } + motion(group, index, priority) { + return index === void 0 ? this.internalModel.motionManager.startRandomMotion(group, priority) : this.internalModel.motionManager.startMotion(group, index, priority); + } + expression(id) { + if (this.internalModel.motionManager.expressionManager) { + return id === void 0 ? this.internalModel.motionManager.expressionManager.setRandomExpression() : this.internalModel.motionManager.expressionManager.setExpression(id); + } + return Promise.resolve(false); + } + focus(x, y, instant = false) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint, true); + let tx = tempPoint.x / this.internalModel.originalWidth * 2 - 1; + let ty = tempPoint.y / this.internalModel.originalHeight * 2 - 1; + let radian = Math.atan2(ty, tx); + this.internalModel.focusController.focus(Math.cos(radian), -Math.sin(radian), instant); + } + tap(x, y) { + const hitAreaNames = this.hitTest(x, y); + if (hitAreaNames.length) { + logger.log(this.tag, `Hit`, hitAreaNames); + this.emit("hit", hitAreaNames); + } + } + hitTest(x, y) { + tempPoint.x = x; + tempPoint.y = y; + this.toModelPosition(tempPoint, tempPoint); + return this.internalModel.hitTest(tempPoint.x, tempPoint.y); + } + toModelPosition(position, result = position.clone(), skipUpdate) { + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } else { + this.displayObjectUpdateTransform(); + } + } + this.transform.worldTransform.applyInverse(position, result); + this.internalModel.localTransform.applyInverse(result, result); + return result; + } + containsPoint(point) { + return this.getBounds(true).contains(point.x, point.y); + } + _calculateBounds() { + this._bounds.addFrame(this.transform, 0, 0, this.internalModel.width, this.internalModel.height); + } + onTickerUpdate() { + this.update(tickerRef.shared.deltaMS); + } + update(dt) { + this.deltaTime += dt; + this.elapsedTime += dt; + } + _render(renderer) { + this.registerInteraction(renderer.plugins.interaction); + renderer.batch.reset(); + renderer.geometry.reset(); + renderer.shader.reset(); + renderer.state.reset(); + let shouldUpdateTexture = false; + if (this.glContextID !== renderer.CONTEXT_UID) { + this.glContextID = renderer.CONTEXT_UID; + this.internalModel.updateWebGLContext(renderer.gl, this.glContextID); + shouldUpdateTexture = true; + } + for (let i = 0; i < this.textures.length; i++) { + const texture = this.textures[i]; + if (!texture.valid) { + continue; + } + if (shouldUpdateTexture || !texture.baseTexture._glTextures[this.glContextID]) { + renderer.gl.pixelStorei(WebGLRenderingContext.UNPACK_FLIP_Y_WEBGL, this.internalModel.textureFlipY); + renderer.texture.bind(texture.baseTexture, 0); + } + this.internalModel.bindTexture(i, texture.baseTexture._glTextures[this.glContextID].texture); + texture.baseTexture.touched = renderer.textureGC.count; + } + const viewport = renderer.framebuffer.viewport; + this.internalModel.viewport = [viewport.x, viewport.y, viewport.width, viewport.height]; + if (this.deltaTime) { + this.internalModel.update(this.deltaTime, this.elapsedTime); + this.deltaTime = 0; + } + const internalTransform = tempMatrix$1.copyFrom(renderer.globalUniforms.uniforms.projectionMatrix).append(this.worldTransform); + this.internalModel.updateTransform(internalTransform); + this.internalModel.draw(renderer.gl); + renderer.state.reset(); + renderer.texture.reset(); + } + destroy(options) { + this.emit("destroy"); + this.autoUpdate = false; + this.unregisterInteraction(); + if (options == null ? void 0 : options.texture) { + this.textures.forEach((texture) => texture.destroy(options.baseTexture)); + } + this.internalModel.destroy(); + super.destroy(options); + } + } + applyMixins(Live2DModel, [InteractionMixin]); + const _FileLoader = class { + static resolveURL(settingsURL, filePath) { + var _a; + const resolved = (_a = _FileLoader.filesMap[settingsURL]) == null ? void 0 : _a[filePath]; + if (resolved === void 0) { + throw new Error("Cannot find this file from uploaded files: " + filePath); + } + return resolved; + } + static upload(files, settings) { + return __async(this, null, function* () { + const fileMap = {}; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + const actualFile = files.find((file) => file.webkitRelativePath === actualPath); + if (actualFile) { + fileMap[definedFile] = URL.createObjectURL(actualFile); + } + } + _FileLoader.filesMap[settings._objectURL] = fileMap; + }); + } + static createSettings(files) { + return __async(this, null, function* () { + const settingsFile = files.find((file) => file.name.endsWith("model.json") || file.name.endsWith("model3.json")); + if (!settingsFile) { + throw new TypeError("Settings file not found"); + } + const settingsText = yield _FileLoader.readText(settingsFile); + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFile.webkitRelativePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + const settings = runtime.createModelSettings(settingsJSON); + settings._objectURL = URL.createObjectURL(settingsFile); + return settings; + }); + } + static readText(file) { + return __async(this, null, function* () { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(file, "utf8"); + }); + }); + } + }; + let FileLoader = _FileLoader; + FileLoader.filesMap = {}; + FileLoader.factory = (context, next) => __async(this, null, function* () { + if (Array.isArray(context.source) && context.source[0] instanceof File) { + const files = context.source; + let settings = files.settings; + if (!settings) { + settings = yield _FileLoader.createSettings(files); + } else if (!settings._objectURL) { + throw new Error('"_objectURL" must be specified in ModelSettings'); + } + settings.validateFiles(files.map((file) => encodeURI(file.webkitRelativePath))); + yield _FileLoader.upload(files, settings); + settings.resolveURL = function(url) { + return _FileLoader.resolveURL(this._objectURL, url); + }; + context.source = settings; + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + const objectURL = this.settings._objectURL; + URL.revokeObjectURL(objectURL); + if (_FileLoader.filesMap[objectURL]) { + for (const resourceObjectURL of Object.values(_FileLoader.filesMap[objectURL])) { + URL.revokeObjectURL(resourceObjectURL); + } + } + delete _FileLoader.filesMap[objectURL]; + }); + }); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory); + const _ZipLoader = class { + static unzip(reader, settings) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const requiredFilePaths = []; + for (const definedFile of settings.getDefinedFiles()) { + const actualPath = decodeURI(utils.url.resolve(settings.url, definedFile)); + if (filePaths.includes(actualPath)) { + requiredFilePaths.push(actualPath); + } + } + const files = yield _ZipLoader.getFiles(reader, requiredFilePaths); + for (let i = 0; i < files.length; i++) { + const path = requiredFilePaths[i]; + const file = files[i]; + Object.defineProperty(file, "webkitRelativePath", { + value: path + }); + } + return files; + }); + } + static createSettings(reader) { + return __async(this, null, function* () { + const filePaths = yield _ZipLoader.getFilePaths(reader); + const settingsFilePath = filePaths.find((path) => path.endsWith("model.json") || path.endsWith("model3.json")); + if (!settingsFilePath) { + throw new Error("Settings file not found"); + } + const settingsText = yield _ZipLoader.readText(reader, settingsFilePath); + if (!settingsText) { + throw new Error("Empty settings file: " + settingsFilePath); + } + const settingsJSON = JSON.parse(settingsText); + settingsJSON.url = settingsFilePath; + const runtime = Live2DFactory.findRuntime(settingsJSON); + if (!runtime) { + throw new Error("Unknown settings JSON"); + } + return runtime.createModelSettings(settingsJSON); + }); + } + static zipReader(data, url) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFilePaths(reader) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static getFiles(reader, paths) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static readText(reader, path) { + return __async(this, null, function* () { + throw new Error("Not implemented"); + }); + } + static releaseReader(reader) { + } + }; + let ZipLoader = _ZipLoader; + ZipLoader.ZIP_PROTOCOL = "zip://"; + ZipLoader.uid = 0; + ZipLoader.factory = (context, next) => __async(this, null, function* () { + const source = context.source; + let sourceURL; + let zipBlob; + let settings; + if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) { + if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) { + sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length); + } else { + sourceURL = source; + } + zipBlob = yield Live2DLoader.load({ + url: sourceURL, + type: "blob", + target: context.live2dModel + }); + } else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) { + zipBlob = source[0]; + sourceURL = URL.createObjectURL(zipBlob); + settings = source.settings; + } + if (zipBlob) { + if (!zipBlob.size) { + throw new Error("Empty zip file"); + } + const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL); + if (!settings) { + settings = yield _ZipLoader.createSettings(reader); + } + settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url; + const files = yield _ZipLoader.unzip(reader, settings); + files.settings = settings; + context.source = files; + if (sourceURL.startsWith("blob:")) { + context.live2dModel.once("modelLoaded", (internalModel) => { + internalModel.once("destroy", function() { + URL.revokeObjectURL(sourceURL); + }); + }); + } + _ZipLoader.releaseReader(reader); + } + return next(); + }); + Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory); + if (!window.Live2D) { + throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded."); + } + const originalUpdateParam = Live2DMotion.prototype.updateParam; + Live2DMotion.prototype.updateParam = function(model, entry) { + originalUpdateParam.call(this, model, entry); + if (entry.isFinished() && this.onFinishHandler) { + this.onFinishHandler(this); + delete this.onFinishHandler; + } + }; + class Live2DExpression extends AMotion { + constructor(json) { + super(); + this.params = []; + this.setFadeIn(json.fade_in > 0 ? json.fade_in : exports2.config.expressionFadingDuration); + this.setFadeOut(json.fade_out > 0 ? json.fade_out : exports2.config.expressionFadingDuration); + if (Array.isArray(json.params)) { + json.params.forEach((param) => { + const calc = param.calc || "add"; + if (calc === "add") { + const defaultValue = param.def || 0; + param.val -= defaultValue; + } else if (calc === "mult") { + const defaultValue = param.def || 1; + param.val /= defaultValue; + } + this.params.push({ + calc, + val: param.val, + id: param.id + }); + }); + } + } + updateParamExe(model, time, weight, motionQueueEnt) { + this.params.forEach((param) => { + model.setParamFloat(param.id, param.val * weight); + }); + } + } + class Cubism2ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new MotionQueueManager(); + this.definitions = (_a = this.settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.name === name); + } + getExpressionFile(definition) { + return definition.file; + } + createExpression(data, definition) { + return new Live2DExpression(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, dt) { + return this.queueManager.updateParam(model); + } + } + class Cubism2MotionManager extends MotionManager { + constructor(settings, options) { + super(settings, options); + this.groups = { idle: "idle" }; + this.motionDataType = "arraybuffer"; + this.queueManager = new MotionQueueManager(); + this.definitions = this.settings.motions; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism2ExpressionManager(this.settings, options); + } + } + isFinished() { + return this.queueManager.isFinished(); + } + createMotion(data, group, definition) { + const motion = Live2DMotion.loadMotion(data); + const defaultFadingDuration = group === this.groups.idle ? exports2.config.idleMotionFadingDuration : exports2.config.motionFadingDuration; + motion.setFadeIn(definition.fade_in > 0 ? definition.fade_in : defaultFadingDuration); + motion.setFadeOut(definition.fade_out > 0 ? definition.fade_out : defaultFadingDuration); + return motion; + } + getMotionFile(definition) { + return definition.file; + } + getMotionName(definition) { + return definition.file; + } + getSoundFile(definition) { + return definition.sound; + } + _startMotion(motion, onFinish) { + motion.onFinishHandler = onFinish; + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.updateParam(model); + } + destroy() { + super.destroy(); + this.queueManager = void 0; + } + } + class Live2DEyeBlink { + constructor(coreModel) { + this.coreModel = coreModel; + this.blinkInterval = 4e3; + this.closingDuration = 100; + this.closedDuration = 50; + this.openingDuration = 150; + this.eyeState = 0; + this.eyeParamValue = 1; + this.closedTimer = 0; + this.nextBlinkTimeLeft = this.blinkInterval; + this.leftParam = coreModel.getParamIndex("PARAM_EYE_L_OPEN"); + this.rightParam = coreModel.getParamIndex("PARAM_EYE_R_OPEN"); + } + setEyeParams(value) { + this.eyeParamValue = clamp(value, 0, 1); + this.coreModel.setParamFloat(this.leftParam, this.eyeParamValue); + this.coreModel.setParamFloat(this.rightParam, this.eyeParamValue); + } + update(dt) { + switch (this.eyeState) { + case 0: + this.nextBlinkTimeLeft -= dt; + if (this.nextBlinkTimeLeft < 0) { + this.eyeState = 1; + this.nextBlinkTimeLeft = this.blinkInterval + this.closingDuration + this.closedDuration + this.openingDuration + rand(0, 2e3); + } + break; + case 1: + this.setEyeParams(this.eyeParamValue + dt / this.closingDuration); + if (this.eyeParamValue <= 0) { + this.eyeState = 2; + this.closedTimer = 0; + } + break; + case 2: + this.closedTimer += dt; + if (this.closedTimer >= this.closedDuration) { + this.eyeState = 3; + } + break; + case 3: + this.setEyeParams(this.eyeParamValue + dt / this.openingDuration); + if (this.eyeParamValue >= 1) { + this.eyeState = 0; + } + } + } + } + const tempMatrixArray = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + class Cubism2InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.textureFlipY = true; + this.drawDataCount = 0; + this.disableCulling = false; + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism2MotionManager(settings, options); + this.eyeBlink = new Live2DEyeBlink(coreModel); + this.eyeballXParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_X"); + this.eyeballYParamIndex = coreModel.getParamIndex("PARAM_EYE_BALL_Y"); + this.angleXParamIndex = coreModel.getParamIndex("PARAM_ANGLE_X"); + this.angleYParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Y"); + this.angleZParamIndex = coreModel.getParamIndex("PARAM_ANGLE_Z"); + this.bodyAngleXParamIndex = coreModel.getParamIndex("PARAM_BODY_ANGLE_X"); + this.breathParamIndex = coreModel.getParamIndex("PARAM_BREATH"); + this.init(); + } + init() { + super.init(); + if (this.settings.initParams) { + this.settings.initParams.forEach(({ id, value }) => this.coreModel.setParamFloat(id, value)); + } + if (this.settings.initOpacities) { + this.settings.initOpacities.forEach(({ id, value }) => this.coreModel.setPartsOpacity(id, value)); + } + this.coreModel.saveParam(); + const arr = this.coreModel.getModelContext()._$aS; + if (arr == null ? void 0 : arr.length) { + this.drawDataCount = arr.length; + } + let culling = this.coreModel.drawParamWebGL.culling; + Object.defineProperty(this.coreModel.drawParamWebGL, "culling", { + set: (v) => culling = v, + get: () => this.disableCulling ? false : culling + }); + const clipManager = this.coreModel.getModelContext().clipManager; + const originalSetupClip = clipManager.setupClip; + clipManager.setupClip = (modelContext, drawParam) => { + originalSetupClip.call(clipManager, modelContext, drawParam); + drawParam.gl.viewport(...this.viewport); + }; + } + getSize() { + return [this.coreModel.getCanvasWidth(), this.coreModel.getCanvasHeight()]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + let commonKey = key; + if (key === "center_x") { + commonKey = "centerX"; + } else if (key === "center_y") { + commonKey = "centerY"; + } + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + updateWebGLContext(gl, glContextID) { + const drawParamWebGL = this.coreModel.drawParamWebGL; + drawParamWebGL.firstDraw = true; + drawParamWebGL.setGL(gl); + drawParamWebGL.glno = glContextID; + for (const prop in drawParamWebGL) { + if (drawParamWebGL.hasOwnProperty(prop) && drawParamWebGL[prop] instanceof WebGLBuffer) { + drawParamWebGL[prop] = null; + } + } + const clipManager = this.coreModel.getModelContext().clipManager; + clipManager.curFrameNo = glContextID; + const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + clipManager.getMaskRenderTexture(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + } + bindTexture(index, texture) { + this.coreModel.setTexture(index, texture); + } + getHitAreaDefs() { + var _a; + return ((_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.id, + name: hitArea.name, + index: this.coreModel.getDrawDataIndex(hitArea.id) + }))) || []; + } + getDrawableIDs() { + const modelContext = this.coreModel.getModelContext(); + const ids = []; + for (let i = 0; i < this.drawDataCount; i++) { + const drawData = modelContext.getDrawData(i); + if (drawData) { + ids.push(drawData.getDrawDataID().id); + } + } + return ids; + } + getDrawableIndex(id) { + return this.coreModel.getDrawDataIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawDataIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + return this.coreModel.getTransformedPoints(drawIndex).slice(); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParam(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.update(dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt, now); + (_c = this.physics) == null ? void 0 : _c.update(now); + (_d = this.pose) == null ? void 0 : _d.update(dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParam(); + } + updateFocus() { + this.coreModel.addToParamFloat(this.eyeballXParamIndex, this.focusController.x); + this.coreModel.addToParamFloat(this.eyeballYParamIndex, this.focusController.y); + this.coreModel.addToParamFloat(this.angleXParamIndex, this.focusController.x * 30); + this.coreModel.addToParamFloat(this.angleYParamIndex, this.focusController.y * 30); + this.coreModel.addToParamFloat(this.angleZParamIndex, this.focusController.x * this.focusController.y * -30); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + const t = now / 1e3 * 2 * Math.PI; + this.coreModel.addToParamFloat(this.angleXParamIndex, 15 * Math.sin(t / 6.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleYParamIndex, 8 * Math.sin(t / 3.5345) * 0.5); + this.coreModel.addToParamFloat(this.angleZParamIndex, 10 * Math.sin(t / 5.5345) * 0.5); + this.coreModel.addToParamFloat(this.bodyAngleXParamIndex, 4 * Math.sin(t / 15.5345) * 0.5); + this.coreModel.setParamFloat(this.breathParamIndex, 0.5 + 0.5 * Math.sin(t / 3.2345)); + } + draw(gl) { + const disableCulling = this.disableCulling; + if (gl.getParameter(gl.FRAMEBUFFER_BINDING)) { + this.disableCulling = true; + } + const matrix = this.drawingMatrix; + tempMatrixArray[0] = matrix.a; + tempMatrixArray[1] = matrix.b; + tempMatrixArray[4] = matrix.c; + tempMatrixArray[5] = matrix.d; + tempMatrixArray[12] = matrix.tx; + tempMatrixArray[13] = matrix.ty; + this.coreModel.setMatrix(tempMatrixArray); + this.coreModel.draw(); + this.disableCulling = disableCulling; + } + destroy() { + super.destroy(); + this.coreModel = void 0; + } + } + class Cubism2ModelSettings extends ModelSettings { + constructor(json) { + super(json); + this.motions = {}; + if (!Cubism2ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + this.moc = json.model; + copyArray("string", json, this, "textures", "textures"); + this.copy(json); + } + static isValidJSON(json) { + var _a; + return !!json && typeof json.model === "string" && ((_a = json.textures) == null ? void 0 : _a.length) > 0 && json.textures.every((item) => typeof item === "string"); + } + copy(json) { + copyProperty("string", json, this, "name", "name"); + copyProperty("string", json, this, "pose", "pose"); + copyProperty("string", json, this, "physics", "physics"); + copyProperty("object", json, this, "layout", "layout"); + copyProperty("object", json, this, "motions", "motions"); + copyArray("object", json, this, "hit_areas", "hitAreas"); + copyArray("object", json, this, "expressions", "expressions"); + copyArray("object", json, this, "init_params", "initParams"); + copyArray("object", json, this, "init_opacities", "initOpacities"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].file = replace(motions[i].file, `motions.${group}[${i}].file`); + if (motions[i].sound !== void 0) { + motions[i].sound = replace(motions[i].sound, `motions.${group}[${i}].sound`); + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].file = replace(this.expressions[i].file, `expressions[${i}].file`); + } + } + } + } + const SRC_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE + }; + const TARGET_TYPE_MAP = { + x: PhysicsHair.Src.SRC_TO_X, + y: PhysicsHair.Src.SRC_TO_Y, + angle: PhysicsHair.Src.SRC_TO_G_ANGLE + }; + class Live2DPhysics { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.physicsHairs = []; + if (json.physics_hair) { + this.physicsHairs = json.physics_hair.map((definition) => { + const physicsHair = new PhysicsHair(); + physicsHair.setup(definition.setup.length, definition.setup.regist, definition.setup.mass); + definition.src.forEach(({ id, ptype, scale, weight }) => { + const type = SRC_TYPE_MAP[ptype]; + if (type) { + physicsHair.addSrcParam(type, id, scale, weight); + } + }); + definition.targets.forEach(({ id, ptype, scale, weight }) => { + const type = TARGET_TYPE_MAP[ptype]; + if (type) { + physicsHair.addTargetParam(type, id, scale, weight); + } + }); + return physicsHair; + }); + } + } + update(elapsed) { + this.physicsHairs.forEach((physicsHair) => physicsHair.update(this.coreModel, elapsed)); + } + } + class Live2DPartsParam { + constructor(id) { + this.id = id; + this.paramIndex = -1; + this.partsIndex = -1; + this.link = []; + } + initIndex(model) { + this.paramIndex = model.getParamIndex("VISIBLE:" + this.id); + this.partsIndex = model.getPartsDataIndex(PartsDataID.getID(this.id)); + model.setParamFloat(this.paramIndex, 1); + } + } + class Live2DPose { + constructor(coreModel, json) { + this.coreModel = coreModel; + this.opacityAnimDuration = 500; + this.partsGroups = []; + if (json.parts_visible) { + this.partsGroups = json.parts_visible.map(({ group }) => group.map(({ id, link }) => { + const parts = new Live2DPartsParam(id); + if (link) { + parts.link = link.map((l) => new Live2DPartsParam(l)); + } + return parts; + })); + this.init(); + } + } + init() { + this.partsGroups.forEach((group) => { + group.forEach((parts) => { + parts.initIndex(this.coreModel); + if (parts.paramIndex >= 0) { + const visible = this.coreModel.getParamFloat(parts.paramIndex) !== 0; + this.coreModel.setPartsOpacity(parts.partsIndex, visible ? 1 : 0); + this.coreModel.setParamFloat(parts.paramIndex, visible ? 1 : 0); + if (parts.link.length > 0) { + parts.link.forEach((p) => p.initIndex(this.coreModel)); + } + } + }); + }); + } + normalizePartsOpacityGroup(partsGroup, dt) { + const model = this.coreModel; + const phi = 0.5; + const maxBackOpacity = 0.15; + let visibleOpacity = 1; + let visibleIndex = partsGroup.findIndex(({ paramIndex, partsIndex }) => partsIndex >= 0 && model.getParamFloat(paramIndex) !== 0); + if (visibleIndex >= 0) { + const originalOpacity = model.getPartsOpacity(partsGroup[visibleIndex].partsIndex); + visibleOpacity = clamp(originalOpacity + dt / this.opacityAnimDuration, 0, 1); + } else { + visibleIndex = 0; + visibleOpacity = 1; + } + partsGroup.forEach(({ partsIndex }, index) => { + if (partsIndex >= 0) { + if (visibleIndex == index) { + model.setPartsOpacity(partsIndex, visibleOpacity); + } else { + let opacity = model.getPartsOpacity(partsIndex); + let a1; + if (visibleOpacity < phi) { + a1 = visibleOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - visibleOpacity) * phi / (1 - phi); + } + let backOp = (1 - a1) * (1 - visibleOpacity); + if (backOp > maxBackOpacity) { + a1 = 1 - maxBackOpacity / (1 - visibleOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartsOpacity(partsIndex, opacity); + } + } + }); + } + copyOpacity(partsGroup) { + const model = this.coreModel; + partsGroup.forEach(({ partsIndex, link }) => { + if (partsIndex >= 0 && link) { + const opacity = model.getPartsOpacity(partsIndex); + link.forEach(({ partsIndex: partsIndex2 }) => { + if (partsIndex2 >= 0) { + model.setPartsOpacity(partsIndex2, opacity); + } + }); + } + }); + } + update(dt) { + this.partsGroups.forEach((partGroup) => { + this.normalizePartsOpacityGroup(partGroup, dt); + this.copyOpacity(partGroup); + }); + } + } + Live2DFactory.registerRuntime({ + version: 2, + test(source) { + return source instanceof Cubism2ModelSettings || Cubism2ModelSettings.isValidJSON(source); + }, + ready() { + return Promise.resolve(); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 3) { + return false; + } + const view = new Int8Array(modelData, 0, 3); + return String.fromCharCode(...view) === "moc"; + }, + createModelSettings(json) { + return new Cubism2ModelSettings(json); + }, + createCoreModel(data) { + const model = Live2DModelWebGL.loadModel(data); + const error = Live2D.getError(); + if (error) + throw error; + return model; + }, + createInternalModel(coreModel, settings, options) { + return new Cubism2InternalModel(coreModel, settings, options); + }, + createPose(coreModel, data) { + return new Live2DPose(coreModel, data); + }, + createPhysics(coreModel, data) { + return new Live2DPhysics(coreModel, data); + } + }); + if (!window.Live2DCubismCore) { + throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded."); + } + class CubismVector2 { + constructor(x, y) { + this.x = x || 0; + this.y = y || 0; + } + add(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x + vector2.x; + ret.y = this.y + vector2.y; + return ret; + } + substract(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x - vector2.x; + ret.y = this.y - vector2.y; + return ret; + } + multiply(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x * vector2.x; + ret.y = this.y * vector2.y; + return ret; + } + multiplyByScaler(scalar) { + return this.multiply(new CubismVector2(scalar, scalar)); + } + division(vector2) { + const ret = new CubismVector2(0, 0); + ret.x = this.x / vector2.x; + ret.y = this.y / vector2.y; + return ret; + } + divisionByScalar(scalar) { + return this.division(new CubismVector2(scalar, scalar)); + } + getLength() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } + getDistanceWith(a) { + return Math.sqrt((this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)); + } + dot(a) { + return this.x * a.x + this.y * a.y; + } + normalize() { + const length = Math.pow(this.x * this.x + this.y * this.y, 0.5); + this.x = this.x / length; + this.y = this.y / length; + } + isEqual(rhs) { + return this.x == rhs.x && this.y == rhs.y; + } + isNotEqual(rhs) { + return !this.isEqual(rhs); + } + } + const _CubismMath = class { + static range(value, min, max) { + if (value < min) { + value = min; + } else if (value > max) { + value = max; + } + return value; + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static abs(x) { + return Math.abs(x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static cbrt(x) { + if (x === 0) { + return x; + } + let cx = x; + const isNegativeNumber = cx < 0; + if (isNegativeNumber) { + cx = -cx; + } + let ret; + if (cx === Infinity) { + ret = Infinity; + } else { + ret = Math.exp(Math.log(cx) / 3); + ret = (cx / (ret * ret) + 2 * ret) / 3; + } + return isNegativeNumber ? -ret : ret; + } + static getEasingSine(value) { + if (value < 0) { + return 0; + } else if (value > 1) { + return 1; + } + return 0.5 - 0.5 * this.cos(value * Math.PI); + } + static max(left, right) { + return left > right ? left : right; + } + static min(left, right) { + return left > right ? right : left; + } + static degreesToRadian(degrees) { + return degrees / 180 * Math.PI; + } + static radianToDegrees(radian) { + return radian * 180 / Math.PI; + } + static directionToRadian(from, to) { + const q1 = Math.atan2(to.y, to.x); + const q2 = Math.atan2(from.y, from.x); + let ret = q1 - q2; + while (ret < -Math.PI) { + ret += Math.PI * 2; + } + while (ret > Math.PI) { + ret -= Math.PI * 2; + } + return ret; + } + static directionToDegrees(from, to) { + const radian = this.directionToRadian(from, to); + let degree = this.radianToDegrees(radian); + if (to.x - from.x > 0) { + degree = -degree; + } + return degree; + } + static radianToDirection(totalAngle) { + const ret = new CubismVector2(); + ret.x = this.sin(totalAngle); + ret.y = this.cos(totalAngle); + return ret; + } + static quadraticEquation(a, b, c) { + if (this.abs(a) < _CubismMath.Epsilon) { + if (this.abs(b) < _CubismMath.Epsilon) { + return -c; + } + return -c / b; + } + return -(b + this.sqrt(b * b - 4 * a * c)) / (2 * a); + } + static cardanoAlgorithmForBezier(a, b, c, d) { + if (this.sqrt(a) < _CubismMath.Epsilon) { + return this.range(this.quadraticEquation(b, c, d), 0, 1); + } + const ba = b / a; + const ca = c / a; + const da = d / a; + const p = (3 * ca - ba * ba) / 3; + const p3 = p / 3; + const q = (2 * ba * ba * ba - 9 * ba * ca + 27 * da) / 27; + const q2 = q / 2; + const discriminant = q2 * q2 + p3 * p3 * p3; + const center = 0.5; + const threshold = center + 0.01; + if (discriminant < 0) { + const mp3 = -p / 3; + const mp33 = mp3 * mp3 * mp3; + const r = this.sqrt(mp33); + const t = -q / (2 * r); + const cosphi = this.range(t, -1, 1); + const phi = Math.acos(cosphi); + const crtr = this.cbrt(r); + const t1 = 2 * crtr; + const root12 = t1 * this.cos(phi / 3) - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = t1 * this.cos((phi + 2 * Math.PI) / 3) - ba / 3; + if (this.abs(root2 - center) < threshold) { + return this.range(root2, 0, 1); + } + const root3 = t1 * this.cos((phi + 4 * Math.PI) / 3) - ba / 3; + return this.range(root3, 0, 1); + } + if (discriminant == 0) { + let u12; + if (q2 < 0) { + u12 = this.cbrt(-q2); + } else { + u12 = -this.cbrt(q2); + } + const root12 = 2 * u12 - ba / 3; + if (this.abs(root12 - center) < threshold) { + return this.range(root12, 0, 1); + } + const root2 = -u12 - ba / 3; + return this.range(root2, 0, 1); + } + const sd = this.sqrt(discriminant); + const u1 = this.cbrt(sd - q2); + const v1 = this.cbrt(sd + q2); + const root1 = u1 - v1 - ba / 3; + return this.range(root1, 0, 1); + } + constructor() { + } + }; + let CubismMath = _CubismMath; + CubismMath.Epsilon = 1e-5; + class CubismMatrix44 { + constructor() { + this._tr = new Float32Array(16); + this.loadIdentity(); + } + static multiply(a, b, dst) { + const c = new Float32Array([ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]); + const n = 4; + for (let i = 0; i < n; ++i) { + for (let j = 0; j < n; ++j) { + for (let k = 0; k < n; ++k) { + c[j + i * 4] += a[k + i * 4] * b[j + k * 4]; + } + } + } + for (let i = 0; i < 16; ++i) { + dst[i] = c[i]; + } + } + loadIdentity() { + const c = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + this.setMatrix(c); + } + setMatrix(tr) { + for (let i = 0; i < 16; ++i) { + this._tr[i] = tr[i]; + } + } + getArray() { + return this._tr; + } + getScaleX() { + return this._tr[0]; + } + getScaleY() { + return this._tr[5]; + } + getTranslateX() { + return this._tr[12]; + } + getTranslateY() { + return this._tr[13]; + } + transformX(src) { + return this._tr[0] * src + this._tr[12]; + } + transformY(src) { + return this._tr[5] * src + this._tr[13]; + } + invertTransformX(src) { + return (src - this._tr[12]) / this._tr[0]; + } + invertTransformY(src) { + return (src - this._tr[13]) / this._tr[5]; + } + translateRelative(x, y) { + const tr1 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + x, + y, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + translate(x, y) { + this._tr[12] = x; + this._tr[13] = y; + } + translateX(x) { + this._tr[12] = x; + } + translateY(y) { + this._tr[13] = y; + } + scaleRelative(x, y) { + const tr1 = new Float32Array([ + x, + 0, + 0, + 0, + 0, + y, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + } + scale(x, y) { + this._tr[0] = x; + this._tr[5] = y; + } + multiplyByMatrix(m) { + CubismMatrix44.multiply(m.getArray(), this._tr, this._tr); + } + clone() { + const cloneMatrix = new CubismMatrix44(); + for (let i = 0; i < this._tr.length; i++) { + cloneMatrix._tr[i] = this._tr[i]; + } + return cloneMatrix; + } + } + class CubismRenderer { + initialize(model) { + this._model = model; + } + drawModel() { + if (this.getModel() == null) + return; + this.doDrawModel(); + } + setMvpMatrix(matrix44) { + this._mvpMatrix4x4.setMatrix(matrix44.getArray()); + } + getMvpMatrix() { + return this._mvpMatrix4x4; + } + setModelColor(red, green, blue, alpha) { + if (red < 0) { + red = 0; + } else if (red > 1) { + red = 1; + } + if (green < 0) { + green = 0; + } else if (green > 1) { + green = 1; + } + if (blue < 0) { + blue = 0; + } else if (blue > 1) { + blue = 1; + } + if (alpha < 0) { + alpha = 0; + } else if (alpha > 1) { + alpha = 1; + } + this._modelColor.R = red; + this._modelColor.G = green; + this._modelColor.B = blue; + this._modelColor.A = alpha; + } + getModelColor() { + return Object.assign({}, this._modelColor); + } + setIsPremultipliedAlpha(enable) { + this._isPremultipliedAlpha = enable; + } + isPremultipliedAlpha() { + return this._isPremultipliedAlpha; + } + setIsCulling(culling) { + this._isCulling = culling; + } + isCulling() { + return this._isCulling; + } + setAnisotropy(n) { + this._anisortopy = n; + } + getAnisotropy() { + return this._anisortopy; + } + getModel() { + return this._model; + } + constructor() { + this._isCulling = false; + this._isPremultipliedAlpha = false; + this._anisortopy = 0; + this._modelColor = new CubismTextureColor(); + this._mvpMatrix4x4 = new CubismMatrix44(); + this._mvpMatrix4x4.loadIdentity(); + } + } + var CubismBlendMode = /* @__PURE__ */ ((CubismBlendMode2) => { + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Normal"] = 0] = "CubismBlendMode_Normal"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Additive"] = 1] = "CubismBlendMode_Additive"; + CubismBlendMode2[CubismBlendMode2["CubismBlendMode_Multiplicative"] = 2] = "CubismBlendMode_Multiplicative"; + return CubismBlendMode2; + })(CubismBlendMode || {}); + class CubismTextureColor { + constructor() { + this.R = 1; + this.G = 1; + this.B = 1; + this.A = 1; + } + } + let s_isStarted = false; + let s_isInitialized = false; + let s_option = void 0; + const Constant = { + vertexOffset: 0, + vertexStep: 2 + }; + class CubismFramework { + static startUp(option) { + if (s_isStarted) { + CubismLogInfo("CubismFramework.startUp() is already done."); + return s_isStarted; + } + if (Live2DCubismCore._isStarted) { + s_isStarted = true; + return true; + } + Live2DCubismCore._isStarted = true; + s_option = option; + if (s_option) { + Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction); + } + s_isStarted = true; + if (s_isStarted) { + const version = Live2DCubismCore.Version.csmGetVersion(); + const major = (version & 4278190080) >> 24; + const minor = (version & 16711680) >> 16; + const patch = version & 65535; + const versionNumber = version; + CubismLogInfo(`Live2D Cubism Core version: {0}.{1}.{2} ({3})`, ("00" + major).slice(-2), ("00" + minor).slice(-2), ("0000" + patch).slice(-4), versionNumber); + } + CubismLogInfo("CubismFramework.startUp() is complete."); + return s_isStarted; + } + static cleanUp() { + s_isStarted = false; + s_isInitialized = false; + s_option = void 0; + } + static initialize() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (s_isInitialized) { + CubismLogWarning("CubismFramework.initialize() skipped, already initialized."); + return; + } + s_isInitialized = true; + CubismLogInfo("CubismFramework.initialize() is complete."); + } + static dispose() { + if (!s_isStarted) { + CubismLogWarning("CubismFramework is not started."); + return; + } + if (!s_isInitialized) { + CubismLogWarning("CubismFramework.dispose() skipped, not initialized."); + return; + } + CubismRenderer.staticRelease(); + s_isInitialized = false; + CubismLogInfo("CubismFramework.dispose() is complete."); + } + static isStarted() { + return s_isStarted; + } + static isInitialized() { + return s_isInitialized; + } + static coreLogFunction(message) { + if (!Live2DCubismCore.Logging.csmGetLogFunction()) { + return; + } + Live2DCubismCore.Logging.csmGetLogFunction()(message); + } + static getLoggingLevel() { + if (s_option != null) { + return s_option.loggingLevel; + } + return LogLevel.LogLevel_Off; + } + constructor() { + } + } + var LogLevel = /* @__PURE__ */ ((LogLevel2) => { + LogLevel2[LogLevel2["LogLevel_Verbose"] = 0] = "LogLevel_Verbose"; + LogLevel2[LogLevel2["LogLevel_Debug"] = 1] = "LogLevel_Debug"; + LogLevel2[LogLevel2["LogLevel_Info"] = 2] = "LogLevel_Info"; + LogLevel2[LogLevel2["LogLevel_Warning"] = 3] = "LogLevel_Warning"; + LogLevel2[LogLevel2["LogLevel_Error"] = 4] = "LogLevel_Error"; + LogLevel2[LogLevel2["LogLevel_Off"] = 5] = "LogLevel_Off"; + return LogLevel2; + })(LogLevel || {}); + const CSM_ASSERT = () => { + }; + function CubismLogDebug(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Debug, "[CSM][D]" + fmt + "\n", args); + } + function CubismLogInfo(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Info, "[CSM][I]" + fmt + "\n", args); + } + function CubismLogWarning(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Warning, "[CSM][W]" + fmt + "\n", args); + } + function CubismLogError(fmt, ...args) { + CubismDebug.print(LogLevel.LogLevel_Error, "[CSM][E]" + fmt + "\n", args); + } + class CubismDebug { + static print(logLevel, format, args) { + if (logLevel < CubismFramework.getLoggingLevel()) { + return; + } + const logPrint = CubismFramework.coreLogFunction; + if (!logPrint) + return; + const buffer = format.replace(/{(\d+)}/g, (m, k) => { + return args[k]; + }); + logPrint(buffer); + } + static dumpBytes(logLevel, data, length) { + for (let i = 0; i < length; i++) { + if (i % 16 == 0 && i > 0) + this.print(logLevel, "\n"); + else if (i % 8 == 0 && i > 0) + this.print(logLevel, " "); + this.print(logLevel, "{0} ", [data[i] & 255]); + } + this.print(logLevel, "\n"); + } + constructor() { + } + } + class ACubismMotion { + constructor() { + this._fadeInSeconds = -1; + this._fadeOutSeconds = -1; + this._weight = 1; + this._offsetSeconds = 0; + this._firedEventValues = []; + } + release() { + this._weight = 0; + } + updateParameters(model, motionQueueEntry, userTimeSeconds) { + if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) { + return; + } + if (!motionQueueEntry.isStarted()) { + motionQueueEntry.setIsStarted(true); + motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + const duration = this.getDuration(); + if (motionQueueEntry.getEndTime() < 0) { + motionQueueEntry.setEndTime(duration <= 0 ? -1 : motionQueueEntry.getStartTime() + duration); + } + } + let fadeWeight = this._weight; + const fadeIn = this._fadeInSeconds == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const fadeOut = this._fadeOutSeconds == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + fadeWeight = fadeWeight * fadeIn * fadeOut; + motionQueueEntry.setState(userTimeSeconds, fadeWeight); + this.doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry); + if (motionQueueEntry.getEndTime() > 0 && motionQueueEntry.getEndTime() < userTimeSeconds) { + motionQueueEntry.setIsFinished(true); + } + } + setFadeInTime(fadeInSeconds) { + this._fadeInSeconds = fadeInSeconds; + } + setFadeOutTime(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + } + getFadeOutTime() { + return this._fadeOutSeconds; + } + getFadeInTime() { + return this._fadeInSeconds; + } + setWeight(weight) { + this._weight = weight; + } + getWeight() { + return this._weight; + } + getDuration() { + return -1; + } + getLoopDuration() { + return -1; + } + setOffsetTime(offsetSeconds) { + this._offsetSeconds = offsetSeconds; + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + return this._firedEventValues; + } + setFinishedMotionHandler(onFinishedMotionHandler) { + this._onFinishedMotion = onFinishedMotionHandler; + } + getFinishedMotionHandler() { + return this._onFinishedMotion; + } + } + const DefaultFadeTime = 1; + class CubismExpressionMotion extends ACubismMotion { + constructor() { + super(); + this._parameters = []; + } + static create(json) { + const expression = new CubismExpressionMotion(); + const fadeInTime = json.FadeInTime; + const fadeOutTime = json.FadeOutTime; + expression.setFadeInTime(fadeInTime !== void 0 ? fadeInTime : DefaultFadeTime); + expression.setFadeOutTime(fadeOutTime !== void 0 ? fadeOutTime : DefaultFadeTime); + const parameters = json.Parameters || []; + for (let i = 0; i < parameters.length; ++i) { + const param = parameters[i]; + const parameterId = param.Id; + const value = param.Value; + let blendType; + switch (param.Blend) { + case "Multiply": + blendType = ExpressionBlendType.ExpressionBlendType_Multiply; + break; + case "Overwrite": + blendType = ExpressionBlendType.ExpressionBlendType_Overwrite; + break; + case "Add": + default: + blendType = ExpressionBlendType.ExpressionBlendType_Add; + break; + } + const item = { + parameterId, + blendType, + value + }; + expression._parameters.push(item); + } + return expression; + } + doUpdateParameters(model, userTimeSeconds, weight, motionQueueEntry) { + for (let i = 0; i < this._parameters.length; ++i) { + const parameter = this._parameters[i]; + switch (parameter.blendType) { + case ExpressionBlendType.ExpressionBlendType_Add: { + model.addParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Multiply: { + model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Overwrite: { + model.setParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + } + } + } + } + var ExpressionBlendType = /* @__PURE__ */ ((ExpressionBlendType2) => { + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Add"] = 0] = "ExpressionBlendType_Add"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Multiply"] = 1] = "ExpressionBlendType_Multiply"; + ExpressionBlendType2[ExpressionBlendType2["ExpressionBlendType_Overwrite"] = 2] = "ExpressionBlendType_Overwrite"; + return ExpressionBlendType2; + })(ExpressionBlendType || {}); + class CubismMotionQueueEntry { + constructor() { + this._autoDelete = false; + this._available = true; + this._finished = false; + this._started = false; + this._startTimeSeconds = -1; + this._fadeInStartTimeSeconds = 0; + this._endTimeSeconds = -1; + this._stateTimeSeconds = 0; + this._stateWeight = 0; + this._lastEventCheckSeconds = 0; + this._motionQueueEntryHandle = this; + this._fadeOutSeconds = 0; + this._isTriggeredFadeOut = false; + } + release() { + if (this._autoDelete && this._motion) { + this._motion.release(); + } + } + setFadeOut(fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + this._isTriggeredFadeOut = true; + } + startFadeOut(fadeOutSeconds, userTimeSeconds) { + const newEndTimeSeconds = userTimeSeconds + fadeOutSeconds; + this._isTriggeredFadeOut = true; + if (this._endTimeSeconds < 0 || newEndTimeSeconds < this._endTimeSeconds) { + this._endTimeSeconds = newEndTimeSeconds; + } + } + isFinished() { + return this._finished; + } + isStarted() { + return this._started; + } + getStartTime() { + return this._startTimeSeconds; + } + getFadeInStartTime() { + return this._fadeInStartTimeSeconds; + } + getEndTime() { + return this._endTimeSeconds; + } + setStartTime(startTime) { + this._startTimeSeconds = startTime; + } + setFadeInStartTime(startTime) { + this._fadeInStartTimeSeconds = startTime; + } + setEndTime(endTime) { + this._endTimeSeconds = endTime; + } + setIsFinished(f) { + this._finished = f; + } + setIsStarted(f) { + this._started = f; + } + isAvailable() { + return this._available; + } + setIsAvailable(v) { + this._available = v; + } + setState(timeSeconds, weight) { + this._stateTimeSeconds = timeSeconds; + this._stateWeight = weight; + } + getStateTime() { + return this._stateTimeSeconds; + } + getStateWeight() { + return this._stateWeight; + } + getLastCheckEventSeconds() { + return this._lastEventCheckSeconds; + } + setLastCheckEventSeconds(checkSeconds) { + this._lastEventCheckSeconds = checkSeconds; + } + isTriggeredFadeOut() { + return this._isTriggeredFadeOut; + } + getFadeOutSeconds() { + return this._fadeOutSeconds; + } + } + class CubismMotionQueueManager { + constructor() { + this._userTimeSeconds = 0; + this._eventCustomData = null; + this._motions = []; + } + release() { + for (let i = 0; i < this._motions.length; ++i) { + if (this._motions[i]) { + this._motions[i].release(); + } + } + this._motions = void 0; + } + startMotion(motion, autoDelete, userTimeSeconds) { + if (motion == null) { + return InvalidMotionQueueEntryHandleValue; + } + let motionQueueEntry; + for (let i = 0; i < this._motions.length; ++i) { + motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + motionQueueEntry.setFadeOut(motionQueueEntry._motion.getFadeOutTime()); + } + motionQueueEntry = new CubismMotionQueueEntry(); + motionQueueEntry._autoDelete = autoDelete; + motionQueueEntry._motion = motion; + this._motions.push(motionQueueEntry); + return motionQueueEntry._motionQueueEntryHandle; + } + isFinished() { + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + if (!motionQueueEntry.isFinished()) { + return false; + } + i++; + } + return true; + } + isFinishedByHandle(motionQueueEntryNumber) { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber && !motionQueueEntry.isFinished()) { + return false; + } + } + return true; + } + stopAllMotions() { + for (let i = 0; i < this._motions.length; i++) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry != null) { + motionQueueEntry.release(); + } + } + this._motions = []; + } + getCubismMotionQueueEntry(motionQueueEntryNumber) { + return this._motions.find((entry) => entry != null && entry._motionQueueEntryHandle == motionQueueEntryNumber); + } + setEventCallback(callback, customData = null) { + this._eventCallBack = callback; + this._eventCustomData = customData; + } + doUpdateMotion(model, userTimeSeconds) { + let updated = false; + let i = 0; + while (i < this._motions.length) { + const motionQueueEntry = this._motions[i]; + if (motionQueueEntry == null) { + this._motions.splice(i, 1); + continue; + } + const motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + continue; + } + motion.updateParameters(model, motionQueueEntry, userTimeSeconds); + updated = true; + const firedList = motion.getFiredEvent(motionQueueEntry.getLastCheckEventSeconds() - motionQueueEntry.getStartTime(), userTimeSeconds - motionQueueEntry.getStartTime()); + for (let i2 = 0; i2 < firedList.length; ++i2) { + this._eventCallBack(this, firedList[i2], this._eventCustomData); + } + motionQueueEntry.setLastCheckEventSeconds(userTimeSeconds); + if (motionQueueEntry.isFinished()) { + motionQueueEntry.release(); + this._motions.splice(i, 1); + } else { + if (motionQueueEntry.isTriggeredFadeOut()) { + motionQueueEntry.startFadeOut(motionQueueEntry.getFadeOutSeconds(), userTimeSeconds); + } + i++; + } + } + return updated; + } + } + const InvalidMotionQueueEntryHandleValue = -1; + class Cubism4ExpressionManager extends ExpressionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.expressions) != null ? _a : []; + this.init(); + } + isFinished() { + return this.queueManager.isFinished(); + } + getExpressionIndex(name) { + return this.definitions.findIndex((def) => def.Name === name); + } + getExpressionFile(definition) { + return definition.File; + } + createExpression(data, definition) { + return CubismExpressionMotion.create(data); + } + _setExpression(motion) { + return this.queueManager.startMotion(motion, false, performance.now()); + } + stopAllExpressions() { + this.queueManager.stopAllMotions(); + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + } + class CubismModelSettingsJson { + constructor(json) { + this.groups = json.Groups; + this.hitAreas = json.HitAreas; + this.layout = json.Layout; + this.moc = json.FileReferences.Moc; + this.expressions = json.FileReferences.Expressions; + this.motions = json.FileReferences.Motions; + this.textures = json.FileReferences.Textures; + this.physics = json.FileReferences.Physics; + this.pose = json.FileReferences.Pose; + } + getEyeBlinkParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "EyeBlink")) == null ? void 0 : _b.Ids; + } + getLipSyncParameters() { + var _a, _b; + return (_b = (_a = this.groups) == null ? void 0 : _a.find((group) => group.Name === "LipSync")) == null ? void 0 : _b.Ids; + } + } + class Cubism4ModelSettings extends ModelSettings { + constructor(json) { + super(json); + if (!Cubism4ModelSettings.isValidJSON(json)) { + throw new TypeError("Invalid JSON."); + } + Object.assign(this, new CubismModelSettingsJson(json)); + } + static isValidJSON(json) { + var _a; + return !!(json == null ? void 0 : json.FileReferences) && typeof json.FileReferences.Moc === "string" && ((_a = json.FileReferences.Textures) == null ? void 0 : _a.length) > 0 && json.FileReferences.Textures.every((item) => typeof item === "string"); + } + replaceFiles(replace) { + super.replaceFiles(replace); + if (this.motions) { + for (const [group, motions] of Object.entries(this.motions)) { + for (let i = 0; i < motions.length; i++) { + motions[i].File = replace(motions[i].File, `motions.${group}[${i}].File`); + if (motions[i].Sound !== void 0) { + motions[i].Sound = replace(motions[i].Sound, `motions.${group}[${i}].Sound`); + } + } + } + } + if (this.expressions) { + for (let i = 0; i < this.expressions.length; i++) { + this.expressions[i].File = replace(this.expressions[i].File, `expressions[${i}].File`); + } + } + } + } + applyMixins(Cubism4ModelSettings, [CubismModelSettingsJson]); + var CubismMotionCurveTarget = /* @__PURE__ */ ((CubismMotionCurveTarget2) => { + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Model"] = 0] = "CubismMotionCurveTarget_Model"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_Parameter"] = 1] = "CubismMotionCurveTarget_Parameter"; + CubismMotionCurveTarget2[CubismMotionCurveTarget2["CubismMotionCurveTarget_PartOpacity"] = 2] = "CubismMotionCurveTarget_PartOpacity"; + return CubismMotionCurveTarget2; + })(CubismMotionCurveTarget || {}); + var CubismMotionSegmentType = /* @__PURE__ */ ((CubismMotionSegmentType2) => { + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Linear"] = 0] = "CubismMotionSegmentType_Linear"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Bezier"] = 1] = "CubismMotionSegmentType_Bezier"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_Stepped"] = 2] = "CubismMotionSegmentType_Stepped"; + CubismMotionSegmentType2[CubismMotionSegmentType2["CubismMotionSegmentType_InverseStepped"] = 3] = "CubismMotionSegmentType_InverseStepped"; + return CubismMotionSegmentType2; + })(CubismMotionSegmentType || {}); + class CubismMotionPoint { + constructor(time = 0, value = 0) { + this.time = time; + this.value = value; + } + } + class CubismMotionSegment { + constructor() { + this.basePointIndex = 0; + this.segmentType = 0; + } + } + class CubismMotionCurve { + constructor() { + this.id = ""; + this.type = 0; + this.segmentCount = 0; + this.baseSegmentIndex = 0; + this.fadeInTime = 0; + this.fadeOutTime = 0; + } + } + class CubismMotionEvent { + constructor() { + this.fireTime = 0; + this.value = ""; + } + } + class CubismMotionData { + constructor() { + this.duration = 0; + this.loop = false; + this.curveCount = 0; + this.eventCount = 0; + this.fps = 0; + this.curves = []; + this.segments = []; + this.points = []; + this.events = []; + } + } + class CubismMotionJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getMotionDuration() { + return this._json.Meta.Duration; + } + isMotionLoop() { + return this._json.Meta.Loop || false; + } + getEvaluationOptionFlag(flagType) { + if (EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted == flagType) { + return !!this._json.Meta.AreBeziersRestricted; + } + return false; + } + getMotionCurveCount() { + return this._json.Meta.CurveCount; + } + getMotionFps() { + return this._json.Meta.Fps; + } + getMotionTotalSegmentCount() { + return this._json.Meta.TotalSegmentCount; + } + getMotionTotalPointCount() { + return this._json.Meta.TotalPointCount; + } + getMotionFadeInTime() { + return this._json.Meta.FadeInTime; + } + getMotionFadeOutTime() { + return this._json.Meta.FadeOutTime; + } + getMotionCurveTarget(curveIndex) { + return this._json.Curves[curveIndex].Target; + } + getMotionCurveId(curveIndex) { + return this._json.Curves[curveIndex].Id; + } + getMotionCurveFadeInTime(curveIndex) { + return this._json.Curves[curveIndex].FadeInTime; + } + getMotionCurveFadeOutTime(curveIndex) { + return this._json.Curves[curveIndex].FadeOutTime; + } + getMotionCurveSegmentCount(curveIndex) { + return this._json.Curves[curveIndex].Segments.length; + } + getMotionCurveSegment(curveIndex, segmentIndex) { + return this._json.Curves[curveIndex].Segments[segmentIndex]; + } + getEventCount() { + return this._json.Meta.UserDataCount || 0; + } + getTotalEventValueSize() { + return this._json.Meta.TotalUserDataSize; + } + getEventTime(userDataIndex) { + return this._json.UserData[userDataIndex].Time; + } + getEventValue(userDataIndex) { + return this._json.UserData[userDataIndex].Value; + } + } + var EvaluationOptionFlag = /* @__PURE__ */ ((EvaluationOptionFlag2) => { + EvaluationOptionFlag2[EvaluationOptionFlag2["EvaluationOptionFlag_AreBeziersRistricted"] = 0] = "EvaluationOptionFlag_AreBeziersRistricted"; + return EvaluationOptionFlag2; + })(EvaluationOptionFlag || {}); + const EffectNameEyeBlink = "EyeBlink"; + const EffectNameLipSync = "LipSync"; + const TargetNameModel = "Model"; + const TargetNameParameter = "Parameter"; + const TargetNamePartOpacity = "PartOpacity"; + const UseOldBeziersCurveMotion = false; + function lerpPoints(a, b, t) { + const result = new CubismMotionPoint(); + result.time = a.time + (b.time - a.time) * t; + result.value = a.value + (b.value - a.value) * t; + return result; + } + function linearEvaluate(points, time) { + let t = (time - points[0].time) / (points[1].time - points[0].time); + if (t < 0) { + t = 0; + } + return points[0].value + (points[1].value - points[0].value) * t; + } + function bezierEvaluate(points, time) { + let t = (time - points[0].time) / (points[3].time - points[0].time); + if (t < 0) { + t = 0; + } + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; + } + function bezierEvaluateCardanoInterpretation(points, time) { + const x = time; + const x1 = points[0].time; + const x2 = points[3].time; + const cx1 = points[1].time; + const cx2 = points[2].time; + const a = x2 - 3 * cx2 + 3 * cx1 - x1; + const b = 3 * cx2 - 6 * cx1 + 3 * x1; + const c = 3 * cx1 - 3 * x1; + const d = x1 - x; + const t = CubismMath.cardanoAlgorithmForBezier(a, b, c, d); + const p01 = lerpPoints(points[0], points[1], t); + const p12 = lerpPoints(points[1], points[2], t); + const p23 = lerpPoints(points[2], points[3], t); + const p012 = lerpPoints(p01, p12, t); + const p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; + } + function steppedEvaluate(points, time) { + return points[0].value; + } + function inverseSteppedEvaluate(points, time) { + return points[1].value; + } + function evaluateCurve(motionData, index, time) { + const curve = motionData.curves[index]; + let target = -1; + const totalSegmentCount = curve.baseSegmentIndex + curve.segmentCount; + let pointPosition = 0; + for (let i = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { + pointPosition = motionData.segments[i].basePointIndex + (motionData.segments[i].segmentType == CubismMotionSegmentType.CubismMotionSegmentType_Bezier ? 3 : 1); + if (motionData.points[pointPosition].time > time) { + target = i; + break; + } + } + if (target == -1) { + return motionData.points[pointPosition].value; + } + const segment = motionData.segments[target]; + return segment.evaluate(motionData.points.slice(segment.basePointIndex), time); + } + class CubismMotion extends ACubismMotion { + constructor() { + super(); + this._eyeBlinkParameterIds = []; + this._lipSyncParameterIds = []; + this._sourceFrameRate = 30; + this._loopDurationSeconds = -1; + this._isLoop = false; + this._isLoopFadeIn = true; + this._lastWeight = 0; + } + static create(json, onFinishedMotionHandler) { + const ret = new CubismMotion(); + ret.parse(json); + ret._sourceFrameRate = ret._motionData.fps; + ret._loopDurationSeconds = ret._motionData.duration; + ret._onFinishedMotion = onFinishedMotionHandler; + return ret; + } + doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry) { + if (this._modelCurveIdEyeBlink == null) { + this._modelCurveIdEyeBlink = EffectNameEyeBlink; + } + if (this._modelCurveIdLipSync == null) { + this._modelCurveIdLipSync = EffectNameLipSync; + } + let timeOffsetSeconds = userTimeSeconds - motionQueueEntry.getStartTime(); + if (timeOffsetSeconds < 0) { + timeOffsetSeconds = 0; + } + let lipSyncValue = Number.MAX_VALUE; + let eyeBlinkValue = Number.MAX_VALUE; + const MaxTargetSize = 64; + let lipSyncFlags = 0; + let eyeBlinkFlags = 0; + if (this._eyeBlinkParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many eye blink targets : {0}", this._eyeBlinkParameterIds.length); + } + if (this._lipSyncParameterIds.length > MaxTargetSize) { + CubismLogDebug("too many lip sync targets : {0}", this._lipSyncParameterIds.length); + } + const tmpFadeIn = this._fadeInSeconds <= 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / this._fadeInSeconds); + const tmpFadeOut = this._fadeOutSeconds <= 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / this._fadeOutSeconds); + let value; + let c, parameterIndex; + let time = timeOffsetSeconds; + if (this._isLoop) { + while (time > this._motionData.duration) { + time -= this._motionData.duration; + } + } + const curves = this._motionData.curves; + for (c = 0; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Model; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (curves[c].id == this._modelCurveIdEyeBlink) { + eyeBlinkValue = value; + } else if (curves[c].id == this._modelCurveIdLipSync) { + lipSyncValue = value; + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; ++c) { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + const sourceValue = model.getParameterValueByIndex(parameterIndex); + value = evaluateCurve(this._motionData, c, time); + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + if (this._eyeBlinkParameterIds[i] == curves[c].id) { + value *= eyeBlinkValue; + eyeBlinkFlags |= 1 << i; + break; + } + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + if (this._lipSyncParameterIds[i] == curves[c].id) { + value += lipSyncValue; + lipSyncFlags |= 1 << i; + break; + } + } + } + let v; + if (curves[c].fadeInTime < 0 && curves[c].fadeOutTime < 0) { + v = sourceValue + (value - sourceValue) * fadeWeight; + } else { + let fin; + let fout; + if (curves[c].fadeInTime < 0) { + fin = tmpFadeIn; + } else { + fin = curves[c].fadeInTime == 0 ? 1 : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / curves[c].fadeInTime); + } + if (curves[c].fadeOutTime < 0) { + fout = tmpFadeOut; + } else { + fout = curves[c].fadeOutTime == 0 || motionQueueEntry.getEndTime() < 0 ? 1 : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / curves[c].fadeOutTime); + } + const paramWeight = this._weight * fin * fout; + v = sourceValue + (value - sourceValue) * paramWeight; + } + model.setParameterValueByIndex(parameterIndex, v, 1); + } + { + if (eyeBlinkValue != Number.MAX_VALUE) { + for (let i = 0; i < this._eyeBlinkParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._eyeBlinkParameterIds[i]); + if (eyeBlinkFlags >> i & 1) { + continue; + } + const v = sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._eyeBlinkParameterIds[i], v); + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (let i = 0; i < this._lipSyncParameterIds.length && i < MaxTargetSize; ++i) { + const sourceValue = model.getParameterValueById(this._lipSyncParameterIds[i]); + if (lipSyncFlags >> i & 1) { + continue; + } + const v = sourceValue + (lipSyncValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._lipSyncParameterIds[i], v); + } + } + } + for (; c < this._motionData.curveCount && curves[c].type == CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (CubismConfig.setOpacityFromMotion) { + model.setPartOpacityById(curves[c].id, value); + } else { + parameterIndex = model.getParameterIndex(curves[c].id); + if (parameterIndex == -1) { + continue; + } + model.setParameterValueByIndex(parameterIndex, value); + } + } + if (timeOffsetSeconds >= this._motionData.duration) { + if (this._isLoop) { + motionQueueEntry.setStartTime(userTimeSeconds); + if (this._isLoopFadeIn) { + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + } + } else { + if (this._onFinishedMotion) { + this._onFinishedMotion(this); + } + motionQueueEntry.setIsFinished(true); + } + } + this._lastWeight = fadeWeight; + } + setIsLoop(loop) { + this._isLoop = loop; + } + isLoop() { + return this._isLoop; + } + setIsLoopFadeIn(loopFadeIn) { + this._isLoopFadeIn = loopFadeIn; + } + isLoopFadeIn() { + return this._isLoopFadeIn; + } + getDuration() { + return this._isLoop ? -1 : this._loopDurationSeconds; + } + getLoopDuration() { + return this._loopDurationSeconds; + } + setParameterFadeInTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeInTime = value; + return; + } + } + } + setParameterFadeOutTime(parameterId, value) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + curves[i].fadeOutTime = value; + return; + } + } + } + getParameterFadeInTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeInTime; + } + } + return -1; + } + getParameterFadeOutTime(parameterId) { + const curves = this._motionData.curves; + for (let i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves[i].id) { + return curves[i].fadeOutTime; + } + } + return -1; + } + setEffectIds(eyeBlinkParameterIds, lipSyncParameterIds) { + this._eyeBlinkParameterIds = eyeBlinkParameterIds; + this._lipSyncParameterIds = lipSyncParameterIds; + } + release() { + this._motionData = void 0; + } + parse(motionJson) { + this._motionData = new CubismMotionData(); + let json = new CubismMotionJson(motionJson); + this._motionData.duration = json.getMotionDuration(); + this._motionData.loop = json.isMotionLoop(); + this._motionData.curveCount = json.getMotionCurveCount(); + this._motionData.fps = json.getMotionFps(); + this._motionData.eventCount = json.getEventCount(); + const areBeziersRestructed = json.getEvaluationOptionFlag(EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted); + const fadeInSeconds = json.getMotionFadeInTime(); + const fadeOutSeconds = json.getMotionFadeOutTime(); + if (fadeInSeconds !== void 0) { + this._fadeInSeconds = fadeInSeconds < 0 ? 1 : fadeInSeconds; + } else { + this._fadeInSeconds = 1; + } + if (fadeOutSeconds !== void 0) { + this._fadeOutSeconds = fadeOutSeconds < 0 ? 1 : fadeOutSeconds; + } else { + this._fadeOutSeconds = 1; + } + this._motionData.curves = Array.from({ length: this._motionData.curveCount }).map(() => new CubismMotionCurve()); + this._motionData.segments = Array.from({ length: json.getMotionTotalSegmentCount() }).map(() => new CubismMotionSegment()); + this._motionData.events = Array.from({ length: this._motionData.eventCount }).map(() => new CubismMotionEvent()); + this._motionData.points = []; + let totalPointCount = 0; + let totalSegmentCount = 0; + for (let curveCount = 0; curveCount < this._motionData.curveCount; ++curveCount) { + const curve = this._motionData.curves[curveCount]; + switch (json.getMotionCurveTarget(curveCount)) { + case TargetNameModel: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + break; + case TargetNameParameter: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; + break; + case TargetNamePartOpacity: + curve.type = CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; + break; + default: + CubismLogWarning('Warning : Unable to get segment type from Curve! The number of "CurveCount" may be incorrect!'); + } + curve.id = json.getMotionCurveId(curveCount); + curve.baseSegmentIndex = totalSegmentCount; + const fadeInTime = json.getMotionCurveFadeInTime(curveCount); + const fadeOutTime = json.getMotionCurveFadeOutTime(curveCount); + curve.fadeInTime = fadeInTime !== void 0 ? fadeInTime : -1; + curve.fadeOutTime = fadeOutTime !== void 0 ? fadeOutTime : -1; + for (let segmentPosition = 0; segmentPosition < json.getMotionCurveSegmentCount(curveCount); ) { + if (segmentPosition == 0) { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition), json.getMotionCurveSegment(curveCount, segmentPosition + 1)); + totalPointCount += 1; + segmentPosition += 2; + } else { + this._motionData.segments[totalSegmentCount].basePointIndex = totalPointCount - 1; + } + const segment = json.getMotionCurveSegment(curveCount, segmentPosition); + switch (segment) { + case CubismMotionSegmentType.CubismMotionSegmentType_Linear: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Linear; + this._motionData.segments[totalSegmentCount].evaluate = linearEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Bezier; + if (areBeziersRestructed || UseOldBeziersCurveMotion) { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluate; + } else { + this._motionData.segments[totalSegmentCount].evaluate = bezierEvaluateCardanoInterpretation; + } + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + this._motionData.points[totalPointCount + 1] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 3), json.getMotionCurveSegment(curveCount, segmentPosition + 4)); + this._motionData.points[totalPointCount + 2] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 5), json.getMotionCurveSegment(curveCount, segmentPosition + 6)); + totalPointCount += 3; + segmentPosition += 7; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_Stepped; + this._motionData.segments[totalSegmentCount].evaluate = steppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: { + this._motionData.segments[totalSegmentCount].segmentType = CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; + this._motionData.segments[totalSegmentCount].evaluate = inverseSteppedEvaluate; + this._motionData.points[totalPointCount] = new CubismMotionPoint(json.getMotionCurveSegment(curveCount, segmentPosition + 1), json.getMotionCurveSegment(curveCount, segmentPosition + 2)); + totalPointCount += 1; + segmentPosition += 3; + break; + } + } + ++curve.segmentCount; + ++totalSegmentCount; + } + this._motionData.curves.push(curve); + } + for (let userdatacount = 0; userdatacount < json.getEventCount(); ++userdatacount) { + this._motionData.events[userdatacount].fireTime = json.getEventTime(userdatacount); + this._motionData.events[userdatacount].value = json.getEventValue(userdatacount); + } + json.release(); + } + getFiredEvent(beforeCheckTimeSeconds, motionTimeSeconds) { + this._firedEventValues.length = 0; + for (let u = 0; u < this._motionData.eventCount; ++u) { + if (this._motionData.events[u].fireTime > beforeCheckTimeSeconds && this._motionData.events[u].fireTime <= motionTimeSeconds) { + this._firedEventValues.push(this._motionData.events[u].value); + } + } + return this._firedEventValues; + } + } + class Cubism4MotionManager extends MotionManager { + constructor(settings, options) { + var _a; + super(settings, options); + this.groups = { idle: "Idle" }; + this.motionDataType = "json"; + this.queueManager = new CubismMotionQueueManager(); + this.definitions = (_a = settings.motions) != null ? _a : {}; + this.eyeBlinkIds = settings.getEyeBlinkParameters() || []; + this.lipSyncIds = settings.getLipSyncParameters() || []; + this.init(options); + } + init(options) { + super.init(options); + if (this.settings.expressions) { + this.expressionManager = new Cubism4ExpressionManager(this.settings, options); + } + this.queueManager.setEventCallback((caller, eventValue, customData) => { + this.emit("motion:" + eventValue); + }); + } + isFinished() { + return this.queueManager.isFinished(); + } + _startMotion(motion, onFinish) { + motion.setFinishedMotionHandler(onFinish); + this.queueManager.stopAllMotions(); + return this.queueManager.startMotion(motion, false, performance.now()); + } + _stopAllMotions() { + this.queueManager.stopAllMotions(); + } + createMotion(data, group, definition) { + const motion = CubismMotion.create(data); + const json = new CubismMotionJson(data); + const defaultFadingDuration = (group === this.groups.idle ? exports2.config.idleMotionFadingDuration : exports2.config.motionFadingDuration) / 1e3; + if (json.getMotionFadeInTime() === void 0) { + motion.setFadeInTime(definition.FadeInTime > 0 ? definition.FadeInTime : defaultFadingDuration); + } + if (json.getMotionFadeOutTime() === void 0) { + motion.setFadeOutTime(definition.FadeOutTime > 0 ? definition.FadeOutTime : defaultFadingDuration); + } + motion.setEffectIds(this.eyeBlinkIds, this.lipSyncIds); + return motion; + } + getMotionFile(definition) { + return definition.File; + } + getMotionName(definition) { + return definition.File; + } + getSoundFile(definition) { + return definition.Sound; + } + updateParameters(model, now) { + return this.queueManager.doUpdateMotion(model, now); + } + destroy() { + super.destroy(); + this.queueManager.release(); + this.queueManager = void 0; + } + } + const ParamAngleX = "ParamAngleX"; + const ParamAngleY = "ParamAngleY"; + const ParamAngleZ = "ParamAngleZ"; + const ParamEyeBallX = "ParamEyeBallX"; + const ParamEyeBallY = "ParamEyeBallY"; + const ParamBodyAngleX = "ParamBodyAngleX"; + const ParamBreath = "ParamBreath"; + class CubismBreath { + constructor() { + this._breathParameters = []; + this._currentTime = 0; + } + static create() { + return new CubismBreath(); + } + setParameters(breathParameters) { + this._breathParameters = breathParameters; + } + getParameters() { + return this._breathParameters; + } + updateParameters(model, deltaTimeSeconds) { + this._currentTime += deltaTimeSeconds; + const t = this._currentTime * 2 * 3.14159; + for (let i = 0; i < this._breathParameters.length; ++i) { + const data = this._breathParameters[i]; + model.addParameterValueById(data.parameterId, data.offset + data.peak * Math.sin(t / data.cycle), data.weight); + } + } + } + class BreathParameterData { + constructor(parameterId, offset, peak, cycle, weight) { + this.parameterId = parameterId == void 0 ? void 0 : parameterId; + this.offset = offset == void 0 ? 0 : offset; + this.peak = peak == void 0 ? 0 : peak; + this.cycle = cycle == void 0 ? 0 : cycle; + this.weight = weight == void 0 ? 0 : weight; + } + } + const _CubismEyeBlink = class { + static create(modelSetting) { + return new _CubismEyeBlink(modelSetting); + } + setBlinkingInterval(blinkingInterval) { + this._blinkingIntervalSeconds = blinkingInterval; + } + setBlinkingSetting(closing, closed, opening) { + this._closingSeconds = closing; + this._closedSeconds = closed; + this._openingSeconds = opening; + } + setParameterIds(parameterIds) { + this._parameterIds = parameterIds; + } + getParameterIds() { + return this._parameterIds; + } + updateParameters(model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + let parameterValue; + let t = 0; + switch (this._blinkingState) { + case EyeState.EyeState_Closing: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Closed; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1 - t; + break; + case EyeState.EyeState_Closed: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._closedSeconds; + if (t >= 1) { + this._blinkingState = EyeState.EyeState_Opening; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 0; + break; + case EyeState.EyeState_Opening: + t = (this._userTimeSeconds - this._stateStartTimeSeconds) / this._openingSeconds; + if (t >= 1) { + t = 1; + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + } + parameterValue = t; + break; + case EyeState.EyeState_Interval: + if (this._nextBlinkingTime < this._userTimeSeconds) { + this._blinkingState = EyeState.EyeState_Closing; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1; + break; + case EyeState.EyeState_First: + default: + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + parameterValue = 1; + break; + } + if (!_CubismEyeBlink.CloseIfZero) { + parameterValue = -parameterValue; + } + for (let i = 0; i < this._parameterIds.length; ++i) { + model.setParameterValueById(this._parameterIds[i], parameterValue); + } + } + constructor(modelSetting) { + var _a, _b; + this._blinkingState = EyeState.EyeState_First; + this._nextBlinkingTime = 0; + this._stateStartTimeSeconds = 0; + this._blinkingIntervalSeconds = 4; + this._closingSeconds = 0.1; + this._closedSeconds = 0.05; + this._openingSeconds = 0.15; + this._userTimeSeconds = 0; + this._parameterIds = []; + if (modelSetting == null) { + return; + } + this._parameterIds = (_b = (_a = modelSetting.getEyeBlinkParameters()) == null ? void 0 : _a.slice()) != null ? _b : this._parameterIds; + } + determinNextBlinkingTiming() { + const r = Math.random(); + return this._userTimeSeconds + r * (2 * this._blinkingIntervalSeconds - 1); + } + }; + let CubismEyeBlink = _CubismEyeBlink; + CubismEyeBlink.CloseIfZero = true; + var EyeState = /* @__PURE__ */ ((EyeState2) => { + EyeState2[EyeState2["EyeState_First"] = 0] = "EyeState_First"; + EyeState2[EyeState2["EyeState_Interval"] = 1] = "EyeState_Interval"; + EyeState2[EyeState2["EyeState_Closing"] = 2] = "EyeState_Closing"; + EyeState2[EyeState2["EyeState_Closed"] = 3] = "EyeState_Closed"; + EyeState2[EyeState2["EyeState_Opening"] = 4] = "EyeState_Opening"; + return EyeState2; + })(EyeState || {}); + class csmRect { + constructor(x = 0, y = 0, w = 0, h = 0) { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + } + getCenterX() { + return this.x + 0.5 * this.width; + } + getCenterY() { + return this.y + 0.5 * this.height; + } + getRight() { + return this.x + this.width; + } + getBottom() { + return this.y + this.height; + } + setRect(r) { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + } + expand(w, h) { + this.x -= w; + this.y -= h; + this.width += w * 2; + this.height += h * 2; + } + } + const ColorChannelCount = 4; + const shaderCount = 10; + let s_instance; + let s_viewport; + let s_fbo; + class CubismClippingManager_WebGL { + getChannelFlagAsColor(channelNo) { + return this._channelColors[channelNo]; + } + getMaskRenderTexture() { + let ret = 0; + if (this._maskTexture && this._maskTexture.texture != 0) { + this._maskTexture.frameNo = this._currentFrameNo; + ret = this._maskTexture.texture; + } + if (ret == 0) { + const size = this._clippingMaskBufferSize; + this._colorBuffer = this.gl.createTexture(); + this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); + this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, size, size, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); + this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + ret = this.gl.createFramebuffer(); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); + this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._colorBuffer, 0); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + this._maskTexture = new CubismRenderTextureResource(this._currentFrameNo, ret); + } + return ret; + } + setGL(gl) { + this.gl = gl; + } + calcClippedDrawTotalBounds(model, clippingContext) { + let clippedDrawTotalMinX = Number.MAX_VALUE; + let clippedDrawTotalMinY = Number.MAX_VALUE; + let clippedDrawTotalMaxX = Number.MIN_VALUE; + let clippedDrawTotalMaxY = Number.MIN_VALUE; + const clippedDrawCount = clippingContext._clippedDrawableIndexList.length; + for (let clippedDrawableIndex = 0; clippedDrawableIndex < clippedDrawCount; clippedDrawableIndex++) { + const drawableIndex = clippingContext._clippedDrawableIndexList[clippedDrawableIndex]; + const drawableVertexCount = model.getDrawableVertexCount(drawableIndex); + const drawableVertexes = model.getDrawableVertices(drawableIndex); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = Number.MIN_VALUE; + let maxY = Number.MIN_VALUE; + const loop = drawableVertexCount * Constant.vertexStep; + for (let pi = Constant.vertexOffset; pi < loop; pi += Constant.vertexStep) { + const x = drawableVertexes[pi]; + const y = drawableVertexes[pi + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + if (minX == Number.MAX_VALUE) { + continue; + } + if (minX < clippedDrawTotalMinX) { + clippedDrawTotalMinX = minX; + } + if (minY < clippedDrawTotalMinY) { + clippedDrawTotalMinY = minY; + } + if (maxX > clippedDrawTotalMaxX) { + clippedDrawTotalMaxX = maxX; + } + if (maxY > clippedDrawTotalMaxY) { + clippedDrawTotalMaxY = maxY; + } + if (clippedDrawTotalMinX == Number.MAX_VALUE) { + clippingContext._allClippedDrawRect.x = 0; + clippingContext._allClippedDrawRect.y = 0; + clippingContext._allClippedDrawRect.width = 0; + clippingContext._allClippedDrawRect.height = 0; + clippingContext._isUsing = false; + } else { + clippingContext._isUsing = true; + const w = clippedDrawTotalMaxX - clippedDrawTotalMinX; + const h = clippedDrawTotalMaxY - clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX; + clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.width = w; + clippingContext._allClippedDrawRect.height = h; + } + } + } + constructor() { + this._maskRenderTexture = null; + this._colorBuffer = null; + this._currentFrameNo = 0; + this._clippingMaskBufferSize = 256; + this._clippingContextListForMask = []; + this._clippingContextListForDraw = []; + this._channelColors = []; + this._tmpBoundsOnModel = new csmRect(); + this._tmpMatrix = new CubismMatrix44(); + this._tmpMatrixForMask = new CubismMatrix44(); + this._tmpMatrixForDraw = new CubismMatrix44(); + let tmp = new CubismTextureColor(); + tmp.R = 1; + tmp.G = 0; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 1; + tmp.B = 0; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 1; + tmp.A = 0; + this._channelColors.push(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0; + tmp.G = 0; + tmp.B = 0; + tmp.A = 1; + this._channelColors.push(tmp); + } + release() { + var _a, _b, _c; + const self2 = this; + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + if (this._clippingContextListForMask[i]) { + (_a = this._clippingContextListForMask[i]) == null ? void 0 : _a.release(); + } + } + self2._clippingContextListForMask = void 0; + self2._clippingContextListForDraw = void 0; + if (this._maskTexture) { + (_b = this.gl) == null ? void 0 : _b.deleteFramebuffer(this._maskTexture.texture); + self2._maskTexture = void 0; + } + self2._channelColors = void 0; + (_c = this.gl) == null ? void 0 : _c.deleteTexture(this._colorBuffer); + this._colorBuffer = null; + } + initialize(model, drawableCount, drawableMasks, drawableMaskCounts) { + for (let i = 0; i < drawableCount; i++) { + if (drawableMaskCounts[i] <= 0) { + this._clippingContextListForDraw.push(null); + continue; + } + let clippingContext = this.findSameClip(drawableMasks[i], drawableMaskCounts[i]); + if (clippingContext == null) { + clippingContext = new CubismClippingContext(this, drawableMasks[i], drawableMaskCounts[i]); + this._clippingContextListForMask.push(clippingContext); + } + clippingContext.addClippedDrawable(i); + this._clippingContextListForDraw.push(clippingContext); + } + } + setupClippingContext(model, renderer) { + this._currentFrameNo++; + let usingClipCount = 0; + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const cc = this._clippingContextListForMask[clipIndex]; + this.calcClippedDrawTotalBounds(model, cc); + if (cc._isUsing) { + usingClipCount++; + } + } + if (usingClipCount > 0) { + this.gl.viewport(0, 0, this._clippingMaskBufferSize, this._clippingMaskBufferSize); + this._maskRenderTexture = this.getMaskRenderTexture(); + renderer.getMvpMatrix(); + renderer.preDraw(); + this.setupLayoutBounds(usingClipCount); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + this.gl.clearColor(1, 1, 1, 1); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + for (let clipIndex = 0; clipIndex < this._clippingContextListForMask.length; clipIndex++) { + const clipContext = this._clippingContextListForMask[clipIndex]; + const allClipedDrawRect = clipContext._allClippedDrawRect; + const layoutBoundsOnTex01 = clipContext._layoutBounds; + const MARGIN = 0.05; + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand(allClipedDrawRect.width * MARGIN, allClipedDrawRect.height * MARGIN); + const scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + const scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(-1, -1); + this._tmpMatrix.scaleRelative(2, 2); + } + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()); + } + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); + } + clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); + clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); + const clipDrawCount = clipContext._clippingIdCount; + for (let i = 0; i < clipDrawCount; i++) { + const clipDrawIndex = clipContext._clippingIdList[i]; + if (!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)) { + continue; + } + renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false); + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh(model.getDrawableTextureIndices(clipDrawIndex), model.getDrawableVertexIndexCount(clipDrawIndex), model.getDrawableVertexCount(clipDrawIndex), model.getDrawableVertexIndices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex), CubismBlendMode.CubismBlendMode_Normal, false); + } + } + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + renderer.setClippingContextBufferForMask(null); + this.gl.viewport(s_viewport[0], s_viewport[1], s_viewport[2], s_viewport[3]); + } + } + findSameClip(drawableMasks, drawableMaskCounts) { + for (let i = 0; i < this._clippingContextListForMask.length; i++) { + const clippingContext = this._clippingContextListForMask[i]; + const count = clippingContext._clippingIdCount; + if (count != drawableMaskCounts) { + continue; + } + let sameCount = 0; + for (let j = 0; j < count; j++) { + const clipId = clippingContext._clippingIdList[j]; + for (let k = 0; k < count; k++) { + if (drawableMasks[k] == clipId) { + sameCount++; + break; + } + } + } + if (sameCount == count) { + return clippingContext; + } + } + return null; + } + setupLayoutBounds(usingClipCount) { + let div = usingClipCount / ColorChannelCount; + let mod = usingClipCount % ColorChannelCount; + div = ~~div; + mod = ~~mod; + let curClipIndex = 0; + for (let channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + const layoutCount = div + (channelNo < mod ? 1 : 0); + if (layoutCount == 0) + ; + else if (layoutCount == 1) { + const clipContext = this._clippingContextListForMask[curClipIndex++]; + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0; + clipContext._layoutBounds.y = 0; + clipContext._layoutBounds.width = 1; + clipContext._layoutBounds.height = 1; + } else if (layoutCount == 2) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + xpos = ~~xpos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1; + } + } else if (layoutCount <= 4) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 2; + let ypos = i / 2; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + } + } else if (layoutCount <= 9) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 3; + let ypos = i / 3; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 3; + cc._layoutBounds.y = ypos / 3; + cc._layoutBounds.width = 1 / 3; + cc._layoutBounds.height = 1 / 3; + } + } else if (CubismConfig.supportMoreMaskDivisions && layoutCount <= 16) { + for (let i = 0; i < layoutCount; i++) { + let xpos = i % 4; + let ypos = i / 4; + xpos = ~~xpos; + ypos = ~~ypos; + const cc = this._clippingContextListForMask[curClipIndex++]; + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 4; + cc._layoutBounds.y = ypos / 4; + cc._layoutBounds.width = 1 / 4; + cc._layoutBounds.height = 1 / 4; + } + } else { + CubismLogError("not supported mask count : {0}", layoutCount); + } + } + } + getColorBuffer() { + return this._colorBuffer; + } + getClippingContextListForDraw() { + return this._clippingContextListForDraw; + } + setClippingMaskBufferSize(size) { + this._clippingMaskBufferSize = size; + } + getClippingMaskBufferSize() { + return this._clippingMaskBufferSize; + } + } + class CubismRenderTextureResource { + constructor(frameNo, texture) { + this.frameNo = frameNo; + this.texture = texture; + } + } + class CubismClippingContext { + constructor(manager, clippingDrawableIndices, clipCount) { + this._isUsing = false; + this._owner = manager; + this._clippingIdList = clippingDrawableIndices; + this._clippingIdCount = clipCount; + this._allClippedDrawRect = new csmRect(); + this._layoutBounds = new csmRect(); + this._clippedDrawableIndexList = []; + this._matrixForMask = new CubismMatrix44(); + this._matrixForDraw = new CubismMatrix44(); + } + release() { + const self2 = this; + self2._layoutBounds = void 0; + self2._allClippedDrawRect = void 0; + self2._clippedDrawableIndexList = void 0; + } + addClippedDrawable(drawableIndex) { + this._clippedDrawableIndexList.push(drawableIndex); + } + getClippingManager() { + return this._owner; + } + setGl(gl) { + this._owner.setGL(gl); + } + } + class CubismShader_WebGL { + static getInstance() { + if (s_instance == null) { + s_instance = new CubismShader_WebGL(); + return s_instance; + } + return s_instance; + } + static deleteInstance() { + if (s_instance) { + s_instance.release(); + s_instance = void 0; + } + } + constructor() { + this._shaderSets = []; + } + release() { + this.releaseShaderProgram(); + } + setupShaderProgram(renderer, textureId, vertexCount, vertexArray, indexArray, uvArray, bufferData, opacity, colorBlendMode, baseColor, isPremultipliedAlpha, matrix4x4, invertedMask) { + if (!isPremultipliedAlpha) { + CubismLogError("NoPremultipliedAlpha is not allowed"); + } + if (this._shaderSets.length == 0) { + this.generateShaders(); + } + let SRC_COLOR; + let DST_COLOR; + let SRC_ALPHA; + let DST_ALPHA; + const clippingContextBufferForMask = renderer.getClippingContextBufferForMask(); + if (clippingContextBufferForMask != null) { + const shaderSet = this._shaderSets[ShaderNames.ShaderNames_SetupMask]; + this.gl.useProgram(shaderSet.shaderProgram); + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + const channelNo = clippingContextBufferForMask._layoutChannelNo; + const colorChannel = clippingContextBufferForMask.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForMask._matrixForMask.getArray()); + const rect = clippingContextBufferForMask._layoutBounds; + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, rect.x * 2 - 1, rect.y * 2 - 1, rect.getRight() * 2 - 1, rect.getBottom() * 2 - 1); + SRC_COLOR = this.gl.ZERO; + DST_COLOR = this.gl.ONE_MINUS_SRC_COLOR; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + } else { + const clippingContextBufferForDraw = renderer.getClippingContextBufferForDraw(); + const masked = clippingContextBufferForDraw != null; + const offset = masked ? invertedMask ? 2 : 1 : 0; + let shaderSet; + switch (colorBlendMode) { + case CubismBlendMode.CubismBlendMode_Normal: + default: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ONE; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + break; + case CubismBlendMode.CubismBlendMode_Additive: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_AddPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + case CubismBlendMode.CubismBlendMode_Multiplicative: + shaderSet = this._shaderSets[ShaderNames.ShaderNames_MultPremultipliedAlpha + offset]; + SRC_COLOR = this.gl.DST_COLOR; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + } + this.gl.useProgram(shaderSet.shaderProgram); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + if (clippingContextBufferForDraw != null) { + this.gl.activeTexture(this.gl.TEXTURE1); + const tex = clippingContextBufferForDraw.getClippingManager().getColorBuffer(); + this.gl.bindTexture(this.gl.TEXTURE_2D, tex); + this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, clippingContextBufferForDraw._matrixForDraw.getArray()); + const channelNo = clippingContextBufferForDraw._layoutChannelNo; + const colorChannel = clippingContextBufferForDraw.getClippingManager().getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); + } + if (bufferData.index == null) { + bufferData.index = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, bufferData.index); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, indexArray, this.gl.DYNAMIC_DRAW); + this.gl.blendFuncSeparate(SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA); + } + releaseShaderProgram() { + for (let i = 0; i < this._shaderSets.length; i++) { + this.gl.deleteProgram(this._shaderSets[i].shaderProgram); + this._shaderSets[i].shaderProgram = 0; + } + this._shaderSets = []; + } + generateShaders() { + for (let i = 0; i < shaderCount; i++) { + this._shaderSets.push({}); + } + this._shaderSets[0].shaderProgram = this.loadShaderProgram(vertexShaderSrcSetupMask, fragmentShaderSrcsetupMask); + this._shaderSets[1].shaderProgram = this.loadShaderProgram(vertexShaderSrc, fragmentShaderSrcPremultipliedAlpha); + this._shaderSets[2].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskPremultipliedAlpha); + this._shaderSets[3].shaderProgram = this.loadShaderProgram(vertexShaderSrcMasked, fragmentShaderSrcMaskInvertedPremultipliedAlpha); + this._shaderSets[4].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[5].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[6].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[7].shaderProgram = this._shaderSets[1].shaderProgram; + this._shaderSets[8].shaderProgram = this._shaderSets[2].shaderProgram; + this._shaderSets[9].shaderProgram = this._shaderSets[3].shaderProgram; + this._shaderSets[0].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_position"); + this._shaderSets[0].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[0].shaderProgram, "a_texCoord"); + this._shaderSets[0].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "s_texture0"); + this._shaderSets[0].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_clipMatrix"); + this._shaderSets[0].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_channelFlag"); + this._shaderSets[0].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[0].shaderProgram, "u_baseColor"); + this._shaderSets[1].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_position"); + this._shaderSets[1].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[1].shaderProgram, "a_texCoord"); + this._shaderSets[1].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "s_texture0"); + this._shaderSets[1].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_matrix"); + this._shaderSets[1].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[1].shaderProgram, "u_baseColor"); + this._shaderSets[2].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_position"); + this._shaderSets[2].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[2].shaderProgram, "a_texCoord"); + this._shaderSets[2].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture0"); + this._shaderSets[2].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "s_texture1"); + this._shaderSets[2].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_matrix"); + this._shaderSets[2].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_clipMatrix"); + this._shaderSets[2].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_channelFlag"); + this._shaderSets[2].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[2].shaderProgram, "u_baseColor"); + this._shaderSets[3].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_position"); + this._shaderSets[3].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[3].shaderProgram, "a_texCoord"); + this._shaderSets[3].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture0"); + this._shaderSets[3].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "s_texture1"); + this._shaderSets[3].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_matrix"); + this._shaderSets[3].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_clipMatrix"); + this._shaderSets[3].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_channelFlag"); + this._shaderSets[3].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[3].shaderProgram, "u_baseColor"); + this._shaderSets[4].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_position"); + this._shaderSets[4].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[4].shaderProgram, "a_texCoord"); + this._shaderSets[4].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "s_texture0"); + this._shaderSets[4].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_matrix"); + this._shaderSets[4].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[4].shaderProgram, "u_baseColor"); + this._shaderSets[5].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_position"); + this._shaderSets[5].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[5].shaderProgram, "a_texCoord"); + this._shaderSets[5].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture0"); + this._shaderSets[5].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "s_texture1"); + this._shaderSets[5].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_matrix"); + this._shaderSets[5].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_clipMatrix"); + this._shaderSets[5].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_channelFlag"); + this._shaderSets[5].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[5].shaderProgram, "u_baseColor"); + this._shaderSets[6].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_position"); + this._shaderSets[6].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[6].shaderProgram, "a_texCoord"); + this._shaderSets[6].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture0"); + this._shaderSets[6].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "s_texture1"); + this._shaderSets[6].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_matrix"); + this._shaderSets[6].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_clipMatrix"); + this._shaderSets[6].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_channelFlag"); + this._shaderSets[6].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[6].shaderProgram, "u_baseColor"); + this._shaderSets[7].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_position"); + this._shaderSets[7].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[7].shaderProgram, "a_texCoord"); + this._shaderSets[7].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "s_texture0"); + this._shaderSets[7].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_matrix"); + this._shaderSets[7].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[7].shaderProgram, "u_baseColor"); + this._shaderSets[8].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_position"); + this._shaderSets[8].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[8].shaderProgram, "a_texCoord"); + this._shaderSets[8].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture0"); + this._shaderSets[8].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "s_texture1"); + this._shaderSets[8].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_matrix"); + this._shaderSets[8].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_clipMatrix"); + this._shaderSets[8].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_channelFlag"); + this._shaderSets[8].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[8].shaderProgram, "u_baseColor"); + this._shaderSets[9].attributePositionLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_position"); + this._shaderSets[9].attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets[9].shaderProgram, "a_texCoord"); + this._shaderSets[9].samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture0"); + this._shaderSets[9].samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "s_texture1"); + this._shaderSets[9].uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_matrix"); + this._shaderSets[9].uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_clipMatrix"); + this._shaderSets[9].uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_channelFlag"); + this._shaderSets[9].uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets[9].shaderProgram, "u_baseColor"); + } + loadShaderProgram(vertexShaderSource, fragmentShaderSource) { + let shaderProgram = this.gl.createProgram(); + let vertShader = this.compileShaderSource(this.gl.VERTEX_SHADER, vertexShaderSource); + if (!vertShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + let fragShader = this.compileShaderSource(this.gl.FRAGMENT_SHADER, fragmentShaderSource); + if (!fragShader) { + CubismLogError("Vertex shader compile error!"); + return 0; + } + this.gl.attachShader(shaderProgram, vertShader); + this.gl.attachShader(shaderProgram, fragShader); + this.gl.linkProgram(shaderProgram); + const linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); + if (!linkStatus) { + CubismLogError("Failed to link program: {0}", shaderProgram); + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + if (shaderProgram) { + this.gl.deleteProgram(shaderProgram); + } + return 0; + } + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + return shaderProgram; + } + compileShaderSource(shaderType, shaderSource) { + const source = shaderSource; + const shader = this.gl.createShader(shaderType); + this.gl.shaderSource(shader, source); + this.gl.compileShader(shader); + if (!shader) { + const log = this.gl.getShaderInfoLog(shader); + CubismLogError("Shader compile log: {0} ", log); + } + const status = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); + if (!status) { + this.gl.deleteShader(shader); + return null; + } + return shader; + } + setGl(gl) { + this.gl = gl; + } + } + var ShaderNames = /* @__PURE__ */ ((ShaderNames2) => { + ShaderNames2[ShaderNames2["ShaderNames_SetupMask"] = 0] = "ShaderNames_SetupMask"; + ShaderNames2[ShaderNames2["ShaderNames_NormalPremultipliedAlpha"] = 1] = "ShaderNames_NormalPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NormalMaskedPremultipliedAlpha"] = 2] = "ShaderNames_NormalMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_NomralMaskedInvertedPremultipliedAlpha"] = 3] = "ShaderNames_NomralMaskedInvertedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddPremultipliedAlpha"] = 4] = "ShaderNames_AddPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlpha"] = 5] = "ShaderNames_AddMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_AddMaskedPremultipliedAlphaInverted"] = 6] = "ShaderNames_AddMaskedPremultipliedAlphaInverted"; + ShaderNames2[ShaderNames2["ShaderNames_MultPremultipliedAlpha"] = 7] = "ShaderNames_MultPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlpha"] = 8] = "ShaderNames_MultMaskedPremultipliedAlpha"; + ShaderNames2[ShaderNames2["ShaderNames_MultMaskedPremultipliedAlphaInverted"] = 9] = "ShaderNames_MultMaskedPremultipliedAlphaInverted"; + return ShaderNames2; + })(ShaderNames || {}); + const vertexShaderSrcSetupMask = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const fragmentShaderSrcsetupMask = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}"; + const vertexShaderSrc = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const vertexShaderSrcMasked = "attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}"; + const fragmentShaderSrcPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}"; + const fragmentShaderSrcMaskPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}"; + const fragmentShaderSrcMaskInvertedPremultipliedAlpha = "precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}"; + class CubismRenderer_WebGL extends CubismRenderer { + constructor() { + super(); + this._clippingContextBufferForMask = null; + this._clippingContextBufferForDraw = null; + this._clippingManager = new CubismClippingManager_WebGL(); + this.firstDraw = true; + this._textures = {}; + this._sortedDrawableIndexList = []; + this._bufferData = { + vertex: null, + uv: null, + index: null + }; + } + initialize(model) { + if (model.isUsingMasking()) { + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.initialize(model, model.getDrawableCount(), model.getDrawableMasks(), model.getDrawableMaskCounts()); + } + for (let i = model.getDrawableCount() - 1; i >= 0; i--) { + this._sortedDrawableIndexList[i] = 0; + } + super.initialize(model); + } + bindTexture(modelTextureNo, glTexture) { + this._textures[modelTextureNo] = glTexture; + } + getBindedTextures() { + return this._textures; + } + setClippingMaskBufferSize(size) { + this._clippingManager.release(); + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.setClippingMaskBufferSize(size); + this._clippingManager.initialize(this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), this.getModel().getDrawableMaskCounts()); + } + getClippingMaskBufferSize() { + return this._clippingManager.getClippingMaskBufferSize(); + } + release() { + var _a, _b, _c; + const self2 = this; + this._clippingManager.release(); + self2._clippingManager = void 0; + (_a = this.gl) == null ? void 0 : _a.deleteBuffer(this._bufferData.vertex); + this._bufferData.vertex = null; + (_b = this.gl) == null ? void 0 : _b.deleteBuffer(this._bufferData.uv); + this._bufferData.uv = null; + (_c = this.gl) == null ? void 0 : _c.deleteBuffer(this._bufferData.index); + this._bufferData.index = null; + self2._bufferData = void 0; + self2._textures = void 0; + } + doDrawModel() { + this.preDraw(); + if (this._clippingManager != null) { + this._clippingManager.setupClippingContext(this.getModel(), this); + } + const drawableCount = this.getModel().getDrawableCount(); + const renderOrder = this.getModel().getDrawableRenderOrders(); + for (let i = 0; i < drawableCount; ++i) { + const order = renderOrder[i]; + this._sortedDrawableIndexList[order] = i; + } + for (let i = 0; i < drawableCount; ++i) { + const drawableIndex = this._sortedDrawableIndexList[i]; + if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) { + continue; + } + this.setClippingContextBufferForDraw(this._clippingManager != null ? this._clippingManager.getClippingContextListForDraw()[drawableIndex] : null); + this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); + this.drawMesh(this.getModel().getDrawableTextureIndices(drawableIndex), this.getModel().getDrawableVertexIndexCount(drawableIndex), this.getModel().getDrawableVertexCount(drawableIndex), this.getModel().getDrawableVertexIndices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableBlendMode(drawableIndex), this.getModel().getDrawableInvertedMaskBit(drawableIndex)); + } + } + drawMesh(textureNo, indexCount, vertexCount, indexArray, vertexArray, uvArray, opacity, colorBlendMode, invertedMask) { + if (this.isCulling()) { + this.gl.enable(this.gl.CULL_FACE); + } else { + this.gl.disable(this.gl.CULL_FACE); + } + this.gl.frontFace(this.gl.CCW); + const modelColorRGBA = this.getModelColor(); + if (this.getClippingContextBufferForMask() == null) { + modelColorRGBA.A *= opacity; + if (this.isPremultipliedAlpha()) { + modelColorRGBA.R *= modelColorRGBA.A; + modelColorRGBA.G *= modelColorRGBA.A; + modelColorRGBA.B *= modelColorRGBA.A; + } + } + let drawtexture = null; + if (this._textures[textureNo] != null) { + drawtexture = this._textures[textureNo]; + } + CubismShader_WebGL.getInstance().setupShaderProgram(this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this._bufferData, opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), this.getMvpMatrix(), invertedMask); + this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); + this.gl.useProgram(null); + this.setClippingContextBufferForDraw(null); + this.setClippingContextBufferForMask(null); + } + static doStaticRelease() { + CubismShader_WebGL.deleteInstance(); + } + setRenderState(fbo, viewport) { + s_fbo = fbo; + s_viewport = viewport; + } + preDraw() { + if (this.firstDraw) { + this.firstDraw = false; + this._anisortopy = this.gl.getExtension("EXT_texture_filter_anisotropic") || this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic"); + } + this.gl.disable(this.gl.SCISSOR_TEST); + this.gl.disable(this.gl.STENCIL_TEST); + this.gl.disable(this.gl.DEPTH_TEST); + this.gl.frontFace(this.gl.CW); + this.gl.enable(this.gl.BLEND); + this.gl.colorMask(true, true, true, true); + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null); + } + setClippingContextBufferForMask(clip) { + this._clippingContextBufferForMask = clip; + } + getClippingContextBufferForMask() { + return this._clippingContextBufferForMask; + } + setClippingContextBufferForDraw(clip) { + this._clippingContextBufferForDraw = clip; + } + getClippingContextBufferForDraw() { + return this._clippingContextBufferForDraw; + } + startUp(gl) { + this.gl = gl; + this._clippingManager.setGL(gl); + CubismShader_WebGL.getInstance().setGl(gl); + } + } + CubismRenderer.staticRelease = () => { + CubismRenderer_WebGL.doStaticRelease(); + }; + const tempMatrix = new CubismMatrix44(); + class Cubism4InternalModel extends InternalModel { + constructor(coreModel, settings, options) { + super(); + this.lipSync = true; + this.breath = CubismBreath.create(); + this.renderer = new CubismRenderer_WebGL(); + this.idParamAngleX = ParamAngleX; + this.idParamAngleY = ParamAngleY; + this.idParamAngleZ = ParamAngleZ; + this.idParamEyeBallX = ParamEyeBallX; + this.idParamEyeBallY = ParamEyeBallY; + this.idParamBodyAngleX = ParamBodyAngleX; + this.idParamBreath = ParamBreath; + this.pixelsPerUnit = 1; + this.centeringTransform = new math.Matrix(); + this.coreModel = coreModel; + this.settings = settings; + this.motionManager = new Cubism4MotionManager(settings, options); + this.init(); + } + init() { + var _a; + super.init(); + if (((_a = this.settings.getEyeBlinkParameters()) == null ? void 0 : _a.length) > 0) { + this.eyeBlink = CubismEyeBlink.create(this.settings); + } + this.breath.setParameters([ + new BreathParameterData(this.idParamAngleX, 0, 15, 6.5345, 0.5), + new BreathParameterData(this.idParamAngleY, 0, 8, 3.5345, 0.5), + new BreathParameterData(this.idParamAngleZ, 0, 10, 5.5345, 0.5), + new BreathParameterData(this.idParamBodyAngleX, 0, 4, 15.5345, 0.5), + new BreathParameterData(this.idParamBreath, 0, 0.5, 3.2345, 0.5) + ]); + this.renderer.initialize(this.coreModel); + this.renderer.setIsPremultipliedAlpha(true); + } + getSize() { + return [this.coreModel.getModel().canvasinfo.CanvasWidth, this.coreModel.getModel().canvasinfo.CanvasHeight]; + } + getLayout() { + const layout = {}; + if (this.settings.layout) { + for (const key of Object.keys(this.settings.layout)) { + const commonKey = key.charAt(0).toLowerCase() + key.slice(1); + layout[commonKey] = this.settings.layout[key]; + } + } + return layout; + } + setupLayout() { + super.setupLayout(); + this.pixelsPerUnit = this.coreModel.getModel().canvasinfo.PixelsPerUnit; + this.centeringTransform.scale(this.pixelsPerUnit, this.pixelsPerUnit).translate(this.originalWidth / 2, this.originalHeight / 2); + } + updateWebGLContext(gl, glContextID) { + this.renderer.firstDraw = true; + this.renderer._bufferData = { + vertex: null, + uv: null, + index: null + }; + this.renderer.startUp(gl); + this.renderer._clippingManager._currentFrameNo = glContextID; + this.renderer._clippingManager._maskTexture = void 0; + CubismShader_WebGL.getInstance()._shaderSets = []; + } + bindTexture(index, texture) { + this.renderer.bindTexture(index, texture); + } + getHitAreaDefs() { + var _a, _b; + return (_b = (_a = this.settings.hitAreas) == null ? void 0 : _a.map((hitArea) => ({ + id: hitArea.Id, + name: hitArea.Name, + index: this.coreModel.getDrawableIndex(hitArea.Id) + }))) != null ? _b : []; + } + getDrawableIDs() { + return this.coreModel.getDrawableIds(); + } + getDrawableIndex(id) { + return this.coreModel.getDrawableIndex(id); + } + getDrawableVertices(drawIndex) { + if (typeof drawIndex === "string") { + drawIndex = this.coreModel.getDrawableIndex(drawIndex); + if (drawIndex === -1) + throw new TypeError("Unable to find drawable ID: " + drawIndex); + } + const arr = this.coreModel.getDrawableVertices(drawIndex).slice(); + for (let i = 0; i < arr.length; i += 2) { + arr[i] = arr[i] * this.pixelsPerUnit + this.originalWidth / 2; + arr[i + 1] = -arr[i + 1] * this.pixelsPerUnit + this.originalHeight / 2; + } + return arr; + } + updateTransform(transform) { + this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(transform); + } + update(dt, now) { + var _a, _b, _c, _d; + super.update(dt, now); + dt /= 1e3; + now /= 1e3; + const model = this.coreModel; + this.emit("beforeMotionUpdate"); + const motionUpdated = this.motionManager.update(this.coreModel, now); + this.emit("afterMotionUpdate"); + model.saveParameters(); + (_a = this.motionManager.expressionManager) == null ? void 0 : _a.update(model, now); + if (!motionUpdated) { + (_b = this.eyeBlink) == null ? void 0 : _b.updateParameters(model, dt); + } + this.updateFocus(); + this.updateNaturalMovements(dt * 1e3, now * 1e3); + (_c = this.physics) == null ? void 0 : _c.evaluate(model, dt); + (_d = this.pose) == null ? void 0 : _d.updateParameters(model, dt); + this.emit("beforeModelUpdate"); + model.update(); + model.loadParameters(); + } + updateFocus() { + this.coreModel.addParameterValueById(this.idParamEyeBallX, this.focusController.x); + this.coreModel.addParameterValueById(this.idParamEyeBallY, this.focusController.y); + this.coreModel.addParameterValueById(this.idParamAngleX, this.focusController.x * 30); + this.coreModel.addParameterValueById(this.idParamAngleY, this.focusController.y * 30); + this.coreModel.addParameterValueById(this.idParamAngleZ, this.focusController.x * this.focusController.y * -30); + this.coreModel.addParameterValueById(this.idParamBodyAngleX, this.focusController.x * 10); + } + updateNaturalMovements(dt, now) { + var _a; + (_a = this.breath) == null ? void 0 : _a.updateParameters(this.coreModel, dt / 1e3); + } + draw(gl) { + const matrix = this.drawingMatrix; + const array = tempMatrix.getArray(); + array[0] = matrix.a; + array[1] = matrix.b; + array[4] = -matrix.c; + array[5] = -matrix.d; + array[12] = matrix.tx; + array[13] = matrix.ty; + this.renderer.setMvpMatrix(tempMatrix); + this.renderer.setRenderState(gl.getParameter(gl.FRAMEBUFFER_BINDING), this.viewport); + this.renderer.drawModel(); + } + destroy() { + super.destroy(); + this.renderer.release(); + this.coreModel.release(); + this.renderer = void 0; + this.coreModel = void 0; + } + } + let startupPromise; + let startupRetries = 20; + function cubism4Ready() { + if (CubismFramework.isStarted()) { + return Promise.resolve(); + } + startupPromise != null ? startupPromise : startupPromise = new Promise((resolve, reject) => { + function startUpWithRetry() { + try { + startUpCubism4(); + resolve(); + } catch (e) { + startupRetries--; + if (startupRetries < 0) { + const err = new Error("Failed to start up Cubism 4 framework."); + err.cause = e; + reject(err); + return; + } + logger.log("Cubism4", "Startup failed, retrying 10ms later..."); + setTimeout(startUpWithRetry, 10); + } + } + startUpWithRetry(); + }); + return startupPromise; + } + function startUpCubism4(options) { + options = Object.assign({ + logFunction: console.log, + loggingLevel: LogLevel.LogLevel_Verbose + }, options); + CubismFramework.startUp(options); + CubismFramework.initialize(); + } + const Epsilon = 1e-3; + const DefaultFadeInSeconds = 0.5; + class CubismPose { + static create(pose3json) { + const ret = new CubismPose(); + if (typeof pose3json.FadeInTime === "number") { + ret._fadeTimeSeconds = pose3json.FadeInTime; + if (ret._fadeTimeSeconds <= 0) { + ret._fadeTimeSeconds = DefaultFadeInSeconds; + } + } + const poseListInfo = pose3json.Groups; + const poseCount = poseListInfo.length; + for (let poseIndex = 0; poseIndex < poseCount; ++poseIndex) { + const idListInfo = poseListInfo[poseIndex]; + const idCount = idListInfo.length; + let groupCount = 0; + for (let groupIndex = 0; groupIndex < idCount; ++groupIndex) { + const partInfo = idListInfo[groupIndex]; + const partData = new PartData(); + partData.partId = partInfo.Id; + const linkListInfo = partInfo.Link; + if (linkListInfo) { + const linkCount = linkListInfo.length; + for (let linkIndex = 0; linkIndex < linkCount; ++linkIndex) { + const linkPart = new PartData(); + linkPart.partId = linkListInfo[linkIndex]; + partData.link.push(linkPart); + } + } + ret._partGroups.push(partData); + ++groupCount; + } + ret._partGroupCounts.push(groupCount); + } + return ret; + } + updateParameters(model, deltaTimeSeconds) { + if (model != this._lastModel) { + this.reset(model); + } + this._lastModel = model; + if (deltaTimeSeconds < 0) { + deltaTimeSeconds = 0; + } + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; i++) { + const partGroupCount = this._partGroupCounts[i]; + this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount); + beginIndex += partGroupCount; + } + this.copyPartOpacities(model); + } + reset(model) { + let beginIndex = 0; + for (let i = 0; i < this._partGroupCounts.length; ++i) { + const groupCount = this._partGroupCounts[i]; + for (let j = beginIndex; j < beginIndex + groupCount; ++j) { + this._partGroups[j].initialize(model); + const partsIndex = this._partGroups[j].partIndex; + const paramIndex = this._partGroups[j].parameterIndex; + if (partsIndex < 0) { + continue; + } + model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1 : 0); + model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1 : 0); + for (let k = 0; k < this._partGroups[j].link.length; ++k) { + this._partGroups[j].link[k].initialize(model); + } + } + beginIndex += groupCount; + } + } + copyPartOpacities(model) { + for (let groupIndex = 0; groupIndex < this._partGroups.length; ++groupIndex) { + const partData = this._partGroups[groupIndex]; + if (partData.link.length == 0) { + continue; + } + const partIndex = this._partGroups[groupIndex].partIndex; + const opacity = model.getPartOpacityByIndex(partIndex); + for (let linkIndex = 0; linkIndex < partData.link.length; ++linkIndex) { + const linkPart = partData.link[linkIndex]; + const linkPartIndex = linkPart.partIndex; + if (linkPartIndex < 0) { + continue; + } + model.setPartOpacityByIndex(linkPartIndex, opacity); + } + } + } + doFade(model, deltaTimeSeconds, beginIndex, partGroupCount) { + let visiblePartIndex = -1; + let newOpacity = 1; + const phi = 0.5; + const backOpacityThreshold = 0.15; + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partIndex = this._partGroups[i].partIndex; + const paramIndex = this._partGroups[i].parameterIndex; + if (model.getParameterValueByIndex(paramIndex) > Epsilon) { + if (visiblePartIndex >= 0) { + break; + } + visiblePartIndex = i; + newOpacity = model.getPartOpacityByIndex(partIndex); + newOpacity += deltaTimeSeconds / this._fadeTimeSeconds; + if (newOpacity > 1) { + newOpacity = 1; + } + } + } + if (visiblePartIndex < 0) { + visiblePartIndex = 0; + newOpacity = 1; + } + for (let i = beginIndex; i < beginIndex + partGroupCount; ++i) { + const partsIndex = this._partGroups[i].partIndex; + if (visiblePartIndex == i) { + model.setPartOpacityByIndex(partsIndex, newOpacity); + } else { + let opacity = model.getPartOpacityByIndex(partsIndex); + let a1; + if (newOpacity < phi) { + a1 = newOpacity * (phi - 1) / phi + 1; + } else { + a1 = (1 - newOpacity) * phi / (1 - phi); + } + const backOpacity = (1 - a1) * (1 - newOpacity); + if (backOpacity > backOpacityThreshold) { + a1 = 1 - backOpacityThreshold / (1 - newOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartOpacityByIndex(partsIndex, opacity); + } + } + } + constructor() { + this._fadeTimeSeconds = DefaultFadeInSeconds; + this._lastModel = void 0; + this._partGroups = []; + this._partGroupCounts = []; + } + } + class PartData { + constructor(v) { + this.parameterIndex = 0; + this.partIndex = 0; + this.partId = ""; + this.link = []; + if (v != void 0) { + this.assignment(v); + } + } + assignment(v) { + this.partId = v.partId; + this.link = v.link.map((link) => link.clone()); + return this; + } + initialize(model) { + this.parameterIndex = model.getParameterIndex(this.partId); + this.partIndex = model.getPartIndex(this.partId); + model.setParameterValueByIndex(this.parameterIndex, 1); + } + clone() { + const clonePartData = new PartData(); + clonePartData.partId = this.partId; + clonePartData.parameterIndex = this.parameterIndex; + clonePartData.partIndex = this.partIndex; + clonePartData.link = this.link.map((link) => link.clone()); + return clonePartData; + } + } + class CubismModel { + update() { + this._model.update(); + this._model.drawables.resetDynamicFlags(); + } + getCanvasWidth() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasWidth / this._model.canvasinfo.PixelsPerUnit; + } + getCanvasHeight() { + if (this._model == null) { + return 0; + } + return this._model.canvasinfo.CanvasHeight / this._model.canvasinfo.PixelsPerUnit; + } + saveParameters() { + const parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + for (let i = 0; i < parameterCount; ++i) { + if (i < savedParameterCount) { + this._savedParameters[i] = this._parameterValues[i]; + } else { + this._savedParameters.push(this._parameterValues[i]); + } + } + } + getModel() { + return this._model; + } + getPartIndex(partId) { + let partIndex; + const partCount = this._model.parts.count; + for (partIndex = 0; partIndex < partCount; ++partIndex) { + if (partId == this._partIds[partIndex]) { + return partIndex; + } + } + if (partId in this._notExistPartId) { + return this._notExistPartId[partId]; + } + partIndex = partCount + this._notExistPartId.length; + this._notExistPartId[partId] = partIndex; + this._notExistPartOpacities[partIndex] = 0; + return partIndex; + } + getPartCount() { + return this._model.parts.count; + } + setPartOpacityByIndex(partIndex, opacity) { + if (partIndex in this._notExistPartOpacities) { + this._notExistPartOpacities[partIndex] = opacity; + return; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + this._partOpacities[partIndex] = opacity; + } + setPartOpacityById(partId, opacity) { + const index = this.getPartIndex(partId); + if (index < 0) { + return; + } + this.setPartOpacityByIndex(index, opacity); + } + getPartOpacityByIndex(partIndex) { + if (partIndex in this._notExistPartOpacities) { + return this._notExistPartOpacities[partIndex]; + } + CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + return this._partOpacities[partIndex]; + } + getPartOpacityById(partId) { + const index = this.getPartIndex(partId); + if (index < 0) { + return 0; + } + return this.getPartOpacityByIndex(index); + } + getParameterIndex(parameterId) { + let parameterIndex; + const idCount = this._model.parameters.count; + for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) { + if (parameterId != this._parameterIds[parameterIndex]) { + continue; + } + return parameterIndex; + } + if (parameterId in this._notExistParameterId) { + return this._notExistParameterId[parameterId]; + } + parameterIndex = this._model.parameters.count + Object.keys(this._notExistParameterId).length; + this._notExistParameterId[parameterId] = parameterIndex; + this._notExistParameterValues[parameterIndex] = 0; + return parameterIndex; + } + getParameterCount() { + return this._model.parameters.count; + } + getParameterMaximumValue(parameterIndex) { + return this._model.parameters.maximumValues[parameterIndex]; + } + getParameterMinimumValue(parameterIndex) { + return this._model.parameters.minimumValues[parameterIndex]; + } + getParameterDefaultValue(parameterIndex) { + return this._model.parameters.defaultValues[parameterIndex]; + } + getParameterValueByIndex(parameterIndex) { + if (parameterIndex in this._notExistParameterValues) { + return this._notExistParameterValues[parameterIndex]; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + return this._parameterValues[parameterIndex]; + } + getParameterValueById(parameterId) { + const parameterIndex = this.getParameterIndex(parameterId); + return this.getParameterValueByIndex(parameterIndex); + } + setParameterValueByIndex(parameterIndex, value, weight = 1) { + if (parameterIndex in this._notExistParameterValues) { + this._notExistParameterValues[parameterIndex] = weight == 1 ? value : this._notExistParameterValues[parameterIndex] * (1 - weight) + value * weight; + return; + } + CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + if (this._model.parameters.maximumValues[parameterIndex] < value) { + value = this._model.parameters.maximumValues[parameterIndex]; + } + if (this._model.parameters.minimumValues[parameterIndex] > value) { + value = this._model.parameters.minimumValues[parameterIndex]; + } + this._parameterValues[parameterIndex] = weight == 1 ? value : this._parameterValues[parameterIndex] = this._parameterValues[parameterIndex] * (1 - weight) + value * weight; + } + setParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.setParameterValueByIndex(index, value, weight); + } + addParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) + value * weight); + } + addParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.addParameterValueByIndex(index, value, weight); + } + multiplyParameterValueById(parameterId, value, weight = 1) { + const index = this.getParameterIndex(parameterId); + this.multiplyParameterValueByIndex(index, value, weight); + } + multiplyParameterValueByIndex(parameterIndex, value, weight = 1) { + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) * (1 + (value - 1) * weight)); + } + getDrawableIds() { + return this._drawableIds.slice(); + } + getDrawableIndex(drawableId) { + const drawableCount = this._model.drawables.count; + for (let drawableIndex = 0; drawableIndex < drawableCount; ++drawableIndex) { + if (this._drawableIds[drawableIndex] == drawableId) { + return drawableIndex; + } + } + return -1; + } + getDrawableCount() { + return this._model.drawables.count; + } + getDrawableId(drawableIndex) { + return this._model.drawables.ids[drawableIndex]; + } + getDrawableRenderOrders() { + return this._model.drawables.renderOrders; + } + getDrawableTextureIndices(drawableIndex) { + return this._model.drawables.textureIndices[drawableIndex]; + } + getDrawableDynamicFlagVertexPositionsDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableVertexIndexCount(drawableIndex) { + return this._model.drawables.indexCounts[drawableIndex]; + } + getDrawableVertexCount(drawableIndex) { + return this._model.drawables.vertexCounts[drawableIndex]; + } + getDrawableVertices(drawableIndex) { + return this.getDrawableVertexPositions(drawableIndex); + } + getDrawableVertexIndices(drawableIndex) { + return this._model.drawables.indices[drawableIndex]; + } + getDrawableVertexPositions(drawableIndex) { + return this._model.drawables.vertexPositions[drawableIndex]; + } + getDrawableVertexUvs(drawableIndex) { + return this._model.drawables.vertexUvs[drawableIndex]; + } + getDrawableOpacity(drawableIndex) { + return this._model.drawables.opacities[drawableIndex]; + } + getDrawableCulling(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); + } + getDrawableBlendMode(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Additive : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]) ? CubismBlendMode.CubismBlendMode_Multiplicative : CubismBlendMode.CubismBlendMode_Normal; + } + getDrawableInvertedMaskBit(drawableIndex) { + const constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]); + } + getDrawableMasks() { + return this._model.drawables.masks; + } + getDrawableMaskCounts() { + return this._model.drawables.maskCounts; + } + isUsingMasking() { + for (let d = 0; d < this._model.drawables.count; ++d) { + if (this._model.drawables.maskCounts[d] <= 0) { + continue; + } + return true; + } + return false; + } + getDrawableDynamicFlagIsVisible(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagVisibilityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagOpacityDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasOpacityDidChangeBit(dynamicFlags[drawableIndex]); + } + getDrawableDynamicFlagRenderOrderDidChange(drawableIndex) { + const dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(dynamicFlags[drawableIndex]); + } + loadParameters() { + let parameterCount = this._model.parameters.count; + const savedParameterCount = this._savedParameters.length; + if (parameterCount > savedParameterCount) { + parameterCount = savedParameterCount; + } + for (let i = 0; i < parameterCount; ++i) { + this._parameterValues[i] = this._savedParameters[i]; + } + } + initialize() { + this._parameterValues = this._model.parameters.values; + this._partOpacities = this._model.parts.opacities; + this._parameterMaximumValues = this._model.parameters.maximumValues; + this._parameterMinimumValues = this._model.parameters.minimumValues; + { + const parameterIds = this._model.parameters.ids; + const parameterCount = this._model.parameters.count; + for (let i = 0; i < parameterCount; ++i) { + this._parameterIds.push(parameterIds[i]); + } + } + { + const partIds = this._model.parts.ids; + const partCount = this._model.parts.count; + for (let i = 0; i < partCount; ++i) { + this._partIds.push(partIds[i]); + } + } + { + const drawableIds = this._model.drawables.ids; + const drawableCount = this._model.drawables.count; + for (let i = 0; i < drawableCount; ++i) { + this._drawableIds.push(drawableIds[i]); + } + } + } + constructor(model) { + this._model = model; + this._savedParameters = []; + this._parameterIds = []; + this._drawableIds = []; + this._partIds = []; + this._notExistPartId = {}; + this._notExistParameterId = {}; + this._notExistParameterValues = {}; + this._notExistPartOpacities = {}; + this.initialize(); + } + release() { + this._model.release(); + this._model = void 0; + } + } + class CubismMoc { + static create(mocBytes) { + const moc = Live2DCubismCore.Moc.fromArrayBuffer(mocBytes); + if (moc) { + return new CubismMoc(moc); + } + throw new Error("Unknown error"); + } + createModel() { + let cubismModel; + const model = Live2DCubismCore.Model.fromMoc(this._moc); + if (model) { + cubismModel = new CubismModel(model); + ++this._modelCount; + return cubismModel; + } + throw new Error("Unknown error"); + } + deleteModel(model) { + if (model != null) { + --this._modelCount; + } + } + constructor(moc) { + this._moc = moc; + this._modelCount = 0; + } + release() { + this._moc._release(); + this._moc = void 0; + } + } + var CubismPhysicsTargetType = /* @__PURE__ */ ((CubismPhysicsTargetType2) => { + CubismPhysicsTargetType2[CubismPhysicsTargetType2["CubismPhysicsTargetType_Parameter"] = 0] = "CubismPhysicsTargetType_Parameter"; + return CubismPhysicsTargetType2; + })(CubismPhysicsTargetType || {}); + var CubismPhysicsSource = /* @__PURE__ */ ((CubismPhysicsSource2) => { + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_X"] = 0] = "CubismPhysicsSource_X"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Y"] = 1] = "CubismPhysicsSource_Y"; + CubismPhysicsSource2[CubismPhysicsSource2["CubismPhysicsSource_Angle"] = 2] = "CubismPhysicsSource_Angle"; + return CubismPhysicsSource2; + })(CubismPhysicsSource || {}); + class CubismPhysicsParticle { + constructor() { + this.initialPosition = new CubismVector2(0, 0); + this.position = new CubismVector2(0, 0); + this.lastPosition = new CubismVector2(0, 0); + this.lastGravity = new CubismVector2(0, 0); + this.force = new CubismVector2(0, 0); + this.velocity = new CubismVector2(0, 0); + } + } + class CubismPhysicsSubRig { + constructor() { + this.normalizationPosition = {}; + this.normalizationAngle = {}; + } + } + class CubismPhysicsInput { + constructor() { + this.source = {}; + } + } + class CubismPhysicsOutput { + constructor() { + this.destination = {}; + this.translationScale = new CubismVector2(0, 0); + } + } + class CubismPhysicsRig { + constructor() { + this.settings = []; + this.inputs = []; + this.outputs = []; + this.particles = []; + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + } + class CubismPhysicsJson { + constructor(json) { + this._json = json; + } + release() { + this._json = void 0; + } + getGravity() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Gravity.X; + ret.y = this._json.Meta.EffectiveForces.Gravity.Y; + return ret; + } + getWind() { + const ret = new CubismVector2(0, 0); + ret.x = this._json.Meta.EffectiveForces.Wind.X; + ret.y = this._json.Meta.EffectiveForces.Wind.Y; + return ret; + } + getSubRigCount() { + return this._json.Meta.PhysicsSettingCount; + } + getTotalInputCount() { + return this._json.Meta.TotalInputCount; + } + getTotalOutputCount() { + return this._json.Meta.TotalOutputCount; + } + getVertexCount() { + return this._json.Meta.VertexCount; + } + getNormalizationPositionMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Minimum; + } + getNormalizationPositionMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Maximum; + } + getNormalizationPositionDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Position.Default; + } + getNormalizationAngleMinimumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Minimum; + } + getNormalizationAngleMaximumValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Maximum; + } + getNormalizationAngleDefaultValue(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Normalization.Angle.Default; + } + getInputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input.length; + } + getInputWeight(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Weight; + } + getInputReflect(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Reflect; + } + getInputType(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Type; + } + getInputSourceId(physicsSettingIndex, inputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Input[inputIndex].Source.Id; + } + getOutputCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output.length; + } + getOutputVertexIndex(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].VertexIndex; + } + getOutputAngleScale(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Scale; + } + getOutputWeight(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Weight; + } + getOutputDestinationId(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Destination.Id; + } + getOutputType(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Type; + } + getOutputReflect(physicsSettingIndex, outputIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Output[outputIndex].Reflect; + } + getParticleCount(physicsSettingIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices.length; + } + getParticleMobility(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Mobility; + } + getParticleDelay(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Delay; + } + getParticleAcceleration(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Acceleration; + } + getParticleRadius(physicsSettingIndex, vertexIndex) { + return this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Radius; + } + getParticlePosition(physicsSettingIndex, vertexIndex) { + const ret = new CubismVector2(0, 0); + ret.x = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.X; + ret.y = this._json.PhysicsSettings[physicsSettingIndex].Vertices[vertexIndex].Position.Y; + return ret; + } + } + const PhysicsTypeTagX = "X"; + const PhysicsTypeTagY = "Y"; + const PhysicsTypeTagAngle = "Angle"; + const AirResistance = 5; + const MaximumWeight = 100; + const MovementThreshold = 1e-3; + class CubismPhysics { + static create(json) { + const ret = new CubismPhysics(); + ret.parse(json); + ret._physicsRig.gravity.y = 0; + return ret; + } + evaluate(model, deltaTimeSeconds) { + let totalAngle; + let weight; + let radAngle; + let outputValue; + const totalTranslation = new CubismVector2(); + let currentSetting; + let currentInput; + let currentOutput; + let currentParticles; + let parameterValue; + let parameterMaximumValue; + let parameterMinimumValue; + let parameterDefaultValue; + parameterValue = model.getModel().parameters.values; + parameterMaximumValue = model.getModel().parameters.maximumValues; + parameterMinimumValue = model.getModel().parameters.minimumValues; + parameterDefaultValue = model.getModel().parameters.defaultValues; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + totalAngle = { angle: 0 }; + totalTranslation.x = 0; + totalTranslation.y = 0; + currentSetting = this._physicsRig.settings[settingIndex]; + currentInput = this._physicsRig.inputs.slice(currentSetting.baseInputIndex); + currentOutput = this._physicsRig.outputs.slice(currentSetting.baseOutputIndex); + currentParticles = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + for (let i = 0; i < currentSetting.inputCount; ++i) { + weight = currentInput[i].weight / MaximumWeight; + if (currentInput[i].sourceParameterIndex == -1) { + currentInput[i].sourceParameterIndex = model.getParameterIndex(currentInput[i].source.id); + } + currentInput[i].getNormalizedParameterValue(totalTranslation, totalAngle, parameterValue[currentInput[i].sourceParameterIndex], parameterMinimumValue[currentInput[i].sourceParameterIndex], parameterMaximumValue[currentInput[i].sourceParameterIndex], parameterDefaultValue[currentInput[i].sourceParameterIndex], currentSetting.normalizationPosition, currentSetting.normalizationAngle, currentInput[i].reflect, weight); + } + radAngle = CubismMath.degreesToRadian(-totalAngle.angle); + totalTranslation.x = totalTranslation.x * CubismMath.cos(radAngle) - totalTranslation.y * CubismMath.sin(radAngle); + totalTranslation.y = totalTranslation.x * CubismMath.sin(radAngle) + totalTranslation.y * CubismMath.cos(radAngle); + updateParticles(currentParticles, currentSetting.particleCount, totalTranslation, totalAngle.angle, this._options.wind, MovementThreshold * currentSetting.normalizationPosition.maximum, deltaTimeSeconds, AirResistance); + for (let i = 0; i < currentSetting.outputCount; ++i) { + const particleIndex = currentOutput[i].vertexIndex; + if (particleIndex < 1 || particleIndex >= currentSetting.particleCount) { + break; + } + if (currentOutput[i].destinationParameterIndex == -1) { + currentOutput[i].destinationParameterIndex = model.getParameterIndex(currentOutput[i].destination.id); + } + const translation = new CubismVector2(); + translation.x = currentParticles[particleIndex].position.x - currentParticles[particleIndex - 1].position.x; + translation.y = currentParticles[particleIndex].position.y - currentParticles[particleIndex - 1].position.y; + outputValue = currentOutput[i].getValue(translation, currentParticles, particleIndex, currentOutput[i].reflect, this._options.gravity); + const destinationParameterIndex = currentOutput[i].destinationParameterIndex; + const outParameterValue = !Float32Array.prototype.slice && "subarray" in Float32Array.prototype ? JSON.parse(JSON.stringify(parameterValue.subarray(destinationParameterIndex))) : parameterValue.slice(destinationParameterIndex); + updateOutputParameterValue(outParameterValue, parameterMinimumValue[destinationParameterIndex], parameterMaximumValue[destinationParameterIndex], outputValue, currentOutput[i]); + for (let offset = destinationParameterIndex, outParamIndex = 0; offset < parameterValue.length; offset++, outParamIndex++) { + parameterValue[offset] = outParameterValue[outParamIndex]; + } + } + } + } + setOptions(options) { + this._options = options; + } + getOption() { + return this._options; + } + constructor() { + this._options = new Options(); + this._options.gravity.y = -1; + this._options.gravity.x = 0; + this._options.wind.x = 0; + this._options.wind.y = 0; + } + release() { + this._physicsRig = void 0; + } + parse(physicsJson) { + this._physicsRig = new CubismPhysicsRig(); + let json = new CubismPhysicsJson(physicsJson); + this._physicsRig.gravity = json.getGravity(); + this._physicsRig.wind = json.getWind(); + this._physicsRig.subRigCount = json.getSubRigCount(); + let inputIndex = 0, outputIndex = 0, particleIndex = 0; + for (let i = 0; i < this._physicsRig.subRigCount; ++i) { + const setting = new CubismPhysicsSubRig(); + setting.normalizationPosition.minimum = json.getNormalizationPositionMinimumValue(i); + setting.normalizationPosition.maximum = json.getNormalizationPositionMaximumValue(i); + setting.normalizationPosition.defalut = json.getNormalizationPositionDefaultValue(i); + setting.normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i); + setting.normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i); + setting.normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i); + setting.inputCount = json.getInputCount(i); + setting.baseInputIndex = inputIndex; + inputIndex += setting.inputCount; + for (let j = 0; j < setting.inputCount; ++j) { + const input = new CubismPhysicsInput(); + input.sourceParameterIndex = -1; + input.weight = json.getInputWeight(i, j); + input.reflect = json.getInputReflect(i, j); + switch (json.getInputType(i, j)) { + case PhysicsTypeTagX: + input.type = CubismPhysicsSource.CubismPhysicsSource_X; + input.getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + break; + case PhysicsTypeTagY: + input.type = CubismPhysicsSource.CubismPhysicsSource_Y; + input.getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + break; + case PhysicsTypeTagAngle: + input.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + input.getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + break; + } + input.source.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + input.source.id = json.getInputSourceId(i, j); + this._physicsRig.inputs.push(input); + } + setting.outputCount = json.getOutputCount(i); + setting.baseOutputIndex = outputIndex; + outputIndex += setting.outputCount; + for (let j = 0; j < setting.outputCount; ++j) { + const output = new CubismPhysicsOutput(); + output.destinationParameterIndex = -1; + output.vertexIndex = json.getOutputVertexIndex(i, j); + output.angleScale = json.getOutputAngleScale(i, j); + output.weight = json.getOutputWeight(i, j); + output.destination.targetType = CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + output.destination.id = json.getOutputDestinationId(i, j); + switch (json.getOutputType(i, j)) { + case PhysicsTypeTagX: + output.type = CubismPhysicsSource.CubismPhysicsSource_X; + output.getValue = getOutputTranslationX; + output.getScale = getOutputScaleTranslationX; + break; + case PhysicsTypeTagY: + output.type = CubismPhysicsSource.CubismPhysicsSource_Y; + output.getValue = getOutputTranslationY; + output.getScale = getOutputScaleTranslationY; + break; + case PhysicsTypeTagAngle: + output.type = CubismPhysicsSource.CubismPhysicsSource_Angle; + output.getValue = getOutputAngle; + output.getScale = getOutputScaleAngle; + break; + } + output.reflect = json.getOutputReflect(i, j); + this._physicsRig.outputs.push(output); + } + setting.particleCount = json.getParticleCount(i); + setting.baseParticleIndex = particleIndex; + particleIndex += setting.particleCount; + for (let j = 0; j < setting.particleCount; ++j) { + const particle = new CubismPhysicsParticle(); + particle.mobility = json.getParticleMobility(i, j); + particle.delay = json.getParticleDelay(i, j); + particle.acceleration = json.getParticleAcceleration(i, j); + particle.radius = json.getParticleRadius(i, j); + particle.position = json.getParticlePosition(i, j); + this._physicsRig.particles.push(particle); + } + this._physicsRig.settings.push(setting); + } + this.initialize(); + json.release(); + } + initialize() { + let strand; + let currentSetting; + let radius; + for (let settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + currentSetting = this._physicsRig.settings[settingIndex]; + strand = this._physicsRig.particles.slice(currentSetting.baseParticleIndex); + strand[0].initialPosition = new CubismVector2(0, 0); + strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); + strand[0].lastGravity = new CubismVector2(0, -1); + strand[0].lastGravity.y *= -1; + strand[0].velocity = new CubismVector2(0, 0); + strand[0].force = new CubismVector2(0, 0); + for (let i = 1; i < currentSetting.particleCount; ++i) { + radius = new CubismVector2(0, 0); + radius.y = strand[i].radius; + strand[i].initialPosition = new CubismVector2(strand[i - 1].initialPosition.x + radius.x, strand[i - 1].initialPosition.y + radius.y); + strand[i].position = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastPosition = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastGravity = new CubismVector2(0, -1); + strand[i].lastGravity.y *= -1; + strand[i].velocity = new CubismVector2(0, 0); + strand[i].force = new CubismVector2(0, 0); + } + } + } + } + class Options { + constructor() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + } + function getInputTranslationXFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.x += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputTranslationYFromNormalizedParamterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.y += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputAngleFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizaitionPosition, normalizationAngle, isInverted, weight) { + targetAngle.angle += normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationAngle.minimum, normalizationAngle.maximum, normalizationAngle.defalut, isInverted) * weight; + } + function getOutputTranslationX(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.x; + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getOutputTranslationY(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue = translation.y; + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getOutputAngle(translation, particles, particleIndex, isInverted, parentGravity) { + let outputValue; + if (particleIndex >= 2) { + parentGravity = particles[particleIndex - 1].position.substract(particles[particleIndex - 2].position); + } else { + parentGravity = parentGravity.multiplyByScaler(-1); + } + outputValue = CubismMath.directionToRadian(parentGravity, translation); + if (isInverted) { + outputValue *= -1; + } + return outputValue; + } + function getRangeValue(min, max) { + return Math.abs(Math.max(min, max) - Math.min(min, max)); + } + function getDefaultValue(min, max) { + const minValue = Math.min(min, max); + return minValue + getRangeValue(min, max) / 2; + } + function getOutputScaleTranslationX(translationScale, angleScale) { + return translationScale.x; + } + function getOutputScaleTranslationY(translationScale, angleScale) { + return translationScale.y; + } + function getOutputScaleAngle(translationScale, angleScale) { + return angleScale; + } + function updateParticles(strand, strandCount, totalTranslation, totalAngle, windDirection, thresholdValue, deltaTimeSeconds, airResistance) { + let totalRadian; + let delay; + let radian; + let currentGravity; + let direction = new CubismVector2(0, 0); + let velocity = new CubismVector2(0, 0); + let force = new CubismVector2(0, 0); + let newDirection = new CubismVector2(0, 0); + strand[0].position = new CubismVector2(totalTranslation.x, totalTranslation.y); + totalRadian = CubismMath.degreesToRadian(totalAngle); + currentGravity = CubismMath.radianToDirection(totalRadian); + currentGravity.normalize(); + for (let i = 1; i < strandCount; ++i) { + strand[i].force = currentGravity.multiplyByScaler(strand[i].acceleration).add(windDirection); + strand[i].lastPosition = new CubismVector2(strand[i].position.x, strand[i].position.y); + delay = strand[i].delay * deltaTimeSeconds * 30; + direction = strand[i].position.substract(strand[i - 1].position); + radian = CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) / airResistance; + direction.x = CubismMath.cos(radian) * direction.x - direction.y * CubismMath.sin(radian); + direction.y = CubismMath.sin(radian) * direction.x + direction.y * CubismMath.cos(radian); + strand[i].position = strand[i - 1].position.add(direction); + velocity = strand[i].velocity.multiplyByScaler(delay); + force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay); + strand[i].position = strand[i].position.add(velocity).add(force); + newDirection = strand[i].position.substract(strand[i - 1].position); + newDirection.normalize(); + strand[i].position = strand[i - 1].position.add(newDirection.multiplyByScaler(strand[i].radius)); + if (CubismMath.abs(strand[i].position.x) < thresholdValue) { + strand[i].position.x = 0; + } + if (delay != 0) { + strand[i].velocity = strand[i].position.substract(strand[i].lastPosition); + strand[i].velocity = strand[i].velocity.divisionByScalar(delay); + strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); + } + strand[i].force = new CubismVector2(0, 0); + strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); + } + } + function updateOutputParameterValue(parameterValue, parameterValueMinimum, parameterValueMaximum, translation, output) { + let outputScale; + let value; + let weight; + outputScale = output.getScale(output.translationScale, output.angleScale); + value = translation * outputScale; + if (value < parameterValueMinimum) { + if (value < output.valueBelowMinimum) { + output.valueBelowMinimum = value; + } + value = parameterValueMinimum; + } else if (value > parameterValueMaximum) { + if (value > output.valueExceededMaximum) { + output.valueExceededMaximum = value; + } + value = parameterValueMaximum; + } + weight = output.weight / MaximumWeight; + if (weight >= 1) { + parameterValue[0] = value; + } else { + value = parameterValue[0] * (1 - weight) + value * weight; + parameterValue[0] = value; + } + } + function normalizeParameterValue(value, parameterMinimum, parameterMaximum, parameterDefault, normalizedMinimum, normalizedMaximum, normalizedDefault, isInverted) { + let result = 0; + const maxValue = CubismMath.max(parameterMaximum, parameterMinimum); + if (maxValue < value) { + value = maxValue; + } + const minValue = CubismMath.min(parameterMaximum, parameterMinimum); + if (minValue > value) { + value = minValue; + } + const minNormValue = CubismMath.min(normalizedMinimum, normalizedMaximum); + const maxNormValue = CubismMath.max(normalizedMinimum, normalizedMaximum); + const middleNormValue = normalizedDefault; + const middleValue = getDefaultValue(minValue, maxValue); + const paramValue = value - middleValue; + switch (Math.sign(paramValue)) { + case 1: { + const nLength = maxNormValue - middleNormValue; + const pLength = maxValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case -1: { + const nLength = minNormValue - middleNormValue; + const pLength = minValue - middleValue; + if (pLength != 0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case 0: { + result = middleNormValue; + break; + } + } + return isInverted ? result : result * -1; + } + Live2DFactory.registerRuntime({ + version: 4, + ready: cubism4Ready, + test(source) { + return source instanceof Cubism4ModelSettings || Cubism4ModelSettings.isValidJSON(source); + }, + isValidMoc(modelData) { + if (modelData.byteLength < 4) { + return false; + } + const view = new Int8Array(modelData, 0, 4); + return String.fromCharCode(...view) === "MOC3"; + }, + createModelSettings(json) { + return new Cubism4ModelSettings(json); + }, + createCoreModel(data) { + const moc = CubismMoc.create(data); + try { + const model = moc.createModel(); + model.__moc = moc; + return model; + } catch (e) { + try { + moc.release(); + } catch (ignored) { + } + throw e; + } + }, + createInternalModel(coreModel, settings, options) { + const model = new Cubism4InternalModel(coreModel, settings, options); + const coreModelWithMoc = coreModel; + if (coreModelWithMoc.__moc) { + model.__moc = coreModelWithMoc.__moc; + delete coreModelWithMoc.__moc; + model.once("destroy", releaseMoc); + } + return model; + }, + createPhysics(coreModel, data) { + return CubismPhysics.create(data); + }, + createPose(coreModel, data) { + return CubismPose.create(data); + } + }); + function releaseMoc() { + var _a; + (_a = this.__moc) == null ? void 0 : _a.release(); + } + exports2.Cubism2ExpressionManager = Cubism2ExpressionManager; + exports2.Cubism2InternalModel = Cubism2InternalModel; + exports2.Cubism2ModelSettings = Cubism2ModelSettings; + exports2.Cubism2MotionManager = Cubism2MotionManager; + exports2.Cubism4ExpressionManager = Cubism4ExpressionManager; + exports2.Cubism4InternalModel = Cubism4InternalModel; + exports2.Cubism4ModelSettings = Cubism4ModelSettings; + exports2.Cubism4MotionManager = Cubism4MotionManager; + exports2.ExpressionManager = ExpressionManager; + exports2.FileLoader = FileLoader; + exports2.FocusController = FocusController; + exports2.InteractionMixin = InteractionMixin; + exports2.InternalModel = InternalModel; + exports2.LOGICAL_HEIGHT = LOGICAL_HEIGHT; + exports2.LOGICAL_WIDTH = LOGICAL_WIDTH; + exports2.Live2DExpression = Live2DExpression; + exports2.Live2DEyeBlink = Live2DEyeBlink; + exports2.Live2DFactory = Live2DFactory; + exports2.Live2DLoader = Live2DLoader; + exports2.Live2DModel = Live2DModel; + exports2.Live2DPhysics = Live2DPhysics; + exports2.Live2DPose = Live2DPose; + exports2.Live2DTransform = Live2DTransform; + exports2.ModelSettings = ModelSettings; + exports2.MotionManager = MotionManager; + exports2.MotionPreloadStrategy = MotionPreloadStrategy; + exports2.MotionPriority = MotionPriority; + exports2.MotionState = MotionState; + exports2.SoundManager = SoundManager; + exports2.VERSION = VERSION; + exports2.XHRLoader = XHRLoader; + exports2.ZipLoader = ZipLoader; + exports2.applyMixins = applyMixins; + exports2.clamp = clamp; + exports2.copyArray = copyArray; + exports2.copyProperty = copyProperty; + exports2.cubism4Ready = cubism4Ready; + exports2.folderName = folderName; + exports2.logger = logger; + exports2.rand = rand; + exports2.remove = remove; + exports2.startUpCubism4 = startUpCubism4; + Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); +}); diff --git a/live2d/node_modules/pixi-live2d-display/dist/index.min.js b/live2d/node_modules/pixi-live2d-display/dist/index.min.js new file mode 100644 index 0000000..99a26e3 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/dist/index.min.js @@ -0,0 +1 @@ +var __pow=Math.pow,__async=(t,e,i)=>new Promise(((s,r)=>{var a=t=>{try{n(i.next(t))}catch(e){r(e)}},o=t=>{try{n(i.throw(t))}catch(e){r(e)}},n=t=>t.done?s(t.value):Promise.resolve(t.value).then(a,o);n((i=i.apply(t,e)).next())}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@pixi/utils"),require("@pixi/math"),require("@pixi/core"),require("@pixi/display")):"function"==typeof define&&define.amd?define(["exports","@pixi/utils","@pixi/math","@pixi/core","@pixi/display"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).PIXI=t.PIXI||{},t.PIXI.live2d=t.PIXI.live2d||{}),t.PIXI.utils,t.PIXI,t.PIXI,t.PIXI)}(this,(function(t,e,i,s,r){"use strict";var a,o,n;(o=a||(a={})).supportMoreMaskDivisions=!0,o.setOpacityFromMotion=!1,t.config=void 0,(n=t.config||(t.config={})).LOG_LEVEL_VERBOSE=0,n.LOG_LEVEL_WARNING=1,n.LOG_LEVEL_ERROR=2,n.LOG_LEVEL_NONE=999,n.logLevel=n.LOG_LEVEL_WARNING,n.sound=!0,n.motionSync=!0,n.motionFadingDuration=500,n.idleMotionFadingDuration=2e3,n.expressionFadingDuration=500,n.preserveExpressionOnMotion=!0,n.cubism4=a;const l={log(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_VERBOSE&&console.log(`[${e}]`,...i)},warn(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_WARNING&&console.warn(`[${e}]`,...i)},error(e,...i){t.config.logLevel<=t.config.LOG_LEVEL_ERROR&&console.error(`[${e}]`,...i)}};function h(t,e,i){return ti?i:t}function d(t,e){return Math.random()*(e-t)+t}function u(t,e,i,s,r){const a=e[s];null!==a&&typeof a===t&&(i[r]=a)}function c(t,e,i,s,r){const a=e[s];Array.isArray(a)&&(i[r]=a.filter((e=>null!==e&&typeof e===t)))}function g(t,e){e.forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((i=>{"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))}function m(t){let e=t.lastIndexOf("/");return-1!=e&&(t=t.slice(0,e)),e=t.lastIndexOf("/"),-1!==e&&(t=t.slice(e+1)),t}function p(t,e){const i=t.indexOf(e);-1!==i&&t.splice(i,1)}class _ extends e.EventEmitter{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return __async(this,null,(function*(){if(!this.definitions[t])return void l.warn(this.tag,`Undefined expression at [${t}]`);if(null===this.expressions[t])return void l.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e}))}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return __async(this,null,(function*(){if(this.definitions.length){const t=[];for(let e=0;e-1&&tl&&(a*=l/n,o*=l/n),this.vx+=a,this.vy+=o;const h=Math.sqrt(__pow(this.vx,2)+__pow(this.vy,2)),d=.5*(Math.sqrt(__pow(l,2)+8*l*s)-l);h>d&&(this.vx*=d/h,this.vy*=d/h),this.x+=this.vx,this.y+=this.vy}}class x{constructor(t){this.json=t;let e=t.url;if("string"!=typeof e)throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=m(this.url)}resolveURL(t){return e.url.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),void 0!==this.pose&&(this.pose=t(this.pose,"pose")),void 0!==this.physics&&(this.physics=t(this.physics,"physics"));for(let e=0;e(t.push(e),e))),t}validateFiles(t){const e=(e,i)=>{const s=this.resolveURL(e);if(!t.includes(s)){if(i)throw new Error(`File "${e}" is defined in settings, but doesn't exist in given files`);return!1}return!0};[this.moc,...this.textures].forEach((t=>e(t,!0)));return this.getDefinedFiles().filter((t=>e(t,!1)))}}var y=(t=>(t[t.NONE=0]="NONE",t[t.IDLE=1]="IDLE",t[t.NORMAL=2]="NORMAL",t[t.FORCE=3]="FORCE",t))(y||{});class M{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,i){if(i<=0)return l.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return l.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return l.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(1===i){if(0!==this.currentPriority)return l.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(void 0!==this.reservedIdleGroup)return l.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(i<3){if(i<=this.currentPriority)return l.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(i<=this.reservePriority)return l.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,i)}return!0}start(t,e,i,s){if(1===s){if(this.setReservedIdle(void 0,void 0),0!==this.currentPriority)return l.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,i)),!1}else{if(e!==this.reservedGroup||i!==this.reservedIndex)return l.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,i)),!1;this.setReserved(void 0,void 0,0)}return!!t&&(this.setCurrent(e,i,s),!0)}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,i){this.currentPriority=i,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,i){this.reservePriority=i,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return void 0===this.currentGroup&&void 0===this.reservedIdleGroup}shouldOverrideExpression(){return!t.config.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){return`\n group = "${t}", index = ${e}\n`+["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"].map((t=>"["+t+"] "+this[t])).join("\n")}return""}}class v{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach((t=>t.volume=this._volume))}static add(t,e,i){const s=new Audio(t);return s.volume=this._volume,s.preload="auto",s.addEventListener("ended",(()=>{this.dispose(s),null==e||e()})),s.addEventListener("error",(e=>{this.dispose(s),l.warn("SoundManager",`Error occurred on "${t}"`,e.error),null==i||i(e.error)})),this.audios.push(s),s}static play(t){return new Promise(((e,i)=>{var s;null==(s=t.play())||s.catch((e=>{t.dispatchEvent(new ErrorEvent("error",{error:e})),i(e)})),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)}))}static dispose(t){t.pause(),t.removeAttribute("src"),p(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}v.audios=[],v._volume=.5;var P=(t=>(t.ALL="ALL",t.IDLE="IDLE",t.NONE="NONE",t))(P||{});class C extends e.EventEmitter{constructor(t,e){super(),this.motionGroups={},this.state=new M,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){(null==t?void 0:t.idleMotionGroup)&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const i of Object.keys(this.definitions))this.motionGroups[i]=[];let e;switch(null==t?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;default:e=[this.groups.idle]}for(const i of e)if(this.definitions[i])for(let t=0;tthis.currentAudio=void 0),(()=>this.currentAudio=void 0)),this.currentAudio=o}catch(h){l.warn(this.tag,"Failed to create audio",t,h)}}const n=yield this.loadMotion(e,i);if(o){const e=v.play(o).catch((t=>l.warn(this.tag,"Failed to play audio",o.src,t)));t.config.motionSync&&(yield e)}return this.state.start(n,e,i,s)?(l.log(this.tag,"Start motion:",this.getMotionName(a)),this.emit("motionStart",e,i,o),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(n),!0):(o&&(v.dispose(o),this.currentAudio=void 0),!1)}))}startRandomMotion(t,e){return __async(this,null,(function*(){const i=this.definitions[t];if(null==i?void 0:i.length){const s=[];for(let e=0;et.index>=0));for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter((i=>this.isHit(i,t,e)))}isHit(t,e,i){if(!this.hitAreas[t])return!1;const s=this.hitAreas[t].index,r=this.getDrawableBounds(s,S);return r.x<=e&&e<=r.x+r.width&&r.y<=i&&i<=r.y+r.height}getDrawableBounds(t,e){const i=this.getDrawableVertices(t);let s=i[0],r=i[0],a=i[1],o=i[1];for(let n=0;n{200!==a.status&&0!==a.status||!a.response?a.onerror():s(a.response)},a.onerror=()=>{l.warn("XHRLoader",`Failed to load resource as ${a.responseType} (Status ${a.status}): ${e}`),r(new I("Network error.",e,a.status))},a.onabort=()=>r(new I("Aborted.",e,a.status,!0)),a.onloadend=()=>{var e;w.allXhrSet.delete(a),t&&(null==(e=w.xhrMap.get(t))||e.delete(a))},a}static cancelXHRs(){var t;null==(t=w.xhrMap.get(this))||t.forEach((t=>{t.abort(),w.allXhrSet.delete(t)})),w.xhrMap.delete(this)}static release(){w.allXhrSet.forEach((t=>t.abort())),w.allXhrSet.clear(),w.xhrMap=new WeakMap}};let T=w;function L(t,e){let i=-1;return function s(r,a){if(a)return Promise.reject(a);if(r<=i)return Promise.reject(new Error("next() called multiple times"));i=r;const o=t[r];if(!o)return Promise.resolve();try{return Promise.resolve(o(e,s.bind(null,r+1)))}catch(n){return Promise.reject(n)}}(0)}T.xhrMap=new WeakMap,T.allXhrSet=new Set,T.loader=(t,e)=>new Promise(((e,i)=>{w.createXHR(t.target,t.settings?t.settings.resolveURL(t.url):t.url,t.type,(i=>{t.result=i,e()}),i).send()}));class E{static load(t){return L(this.middlewares,t).then((()=>t.result))}}E.middlewares=[T.loader];const F="Live2DFactory",D=(t,e)=>__async(this,null,(function*(){if("string"==typeof t.source){const e=yield E.load({url:t.source,type:"json",target:t.live2dModel});e.url=t.source,t.source=e,t.live2dModel.emit("settingsJSONLoaded",e)}return e()})),A=(t,e)=>__async(this,null,(function*(){if(t.source instanceof x)return t.settings=t.source,e();if("object"==typeof t.source){const i=N.findRuntime(t.source);if(i){const s=i.createModelSettings(t.source);return t.settings=s,t.live2dModel.emit("settingsLoaded",s),e()}}throw new TypeError("Unknown settings format.")})),B=(t,e)=>{if(t.settings){const i=N.findRuntime(t.settings);if(i)return i.ready().then(e)}return e()},R=(t,e)=>__async(this,null,(function*(){yield e();const i=t.internalModel;if(i){const e=t.settings,s=N.findRuntime(e);if(s){const r=[];e.pose&&r.push(E.load({settings:e,url:e.pose,type:"json",target:i}).then((e=>{i.pose=s.createPose(i.coreModel,e),t.live2dModel.emit("poseLoaded",i.pose)})).catch((e=>{t.live2dModel.emit("poseLoadError",e),l.warn(F,"Failed to load pose.",e)}))),e.physics&&r.push(E.load({settings:e,url:e.physics,type:"json",target:i}).then((e=>{i.physics=s.createPhysics(i.coreModel,e),t.live2dModel.emit("physicsLoaded",i.physics)})).catch((e=>{t.live2dModel.emit("physicsLoadError",e),l.warn(F,"Failed to load physics.",e)}))),r.length&&(yield Promise.all(r))}}})),O=(t,e)=>__async(this,null,(function*(){if(!t.settings)throw new TypeError("Missing settings.");{const i=t.live2dModel,r=t.settings.textures.map((e=>function(t,e={}){const i={resourceOptions:{crossorigin:e.crossOrigin}};if(s.Texture.fromURL)return s.Texture.fromURL(t,i).catch((t=>{if(t instanceof Error)throw t;const e=new Error("Texture loading error");throw e.event=t,e}));i.resourceOptions.autoLoad=!1;const r=s.Texture.from(t,i);if(r.baseTexture.valid)return Promise.resolve(r);const a=r.baseTexture.resource;return null!=a._live2d_load||(a._live2d_load=new Promise(((t,e)=>{const i=t=>{a.source.removeEventListener("error",i);const s=new Error("Texture loading error");s.event=t,e(s)};a.source.addEventListener("error",i),a.load().then((()=>t(r))).catch(i)}))),a._live2d_load}(t.settings.resolveURL(e),{crossOrigin:t.options.crossOrigin})));if(yield e(),!t.internalModel)throw new TypeError("Missing internal model.");i.internalModel=t.internalModel,i.emit("modelLoaded",t.internalModel),i.textures=yield Promise.all(r),i.emit("textureLoaded",i.textures)}})),k=(t,e)=>__async(this,null,(function*(){const i=t.settings;if(i instanceof x){const s=N.findRuntime(i);if(!s)throw new TypeError("Unknown model settings.");const r=yield E.load({settings:i,url:i.moc,type:"arraybuffer",target:t.live2dModel});if(!s.isValidMoc(r))throw new Error("Invalid moc data");const a=s.createCoreModel(r);return t.internalModel=s.createInternalModel(a,i,t.options),e()}throw new TypeError("Missing settings.")})),U=class{static registerRuntime(t){U.runtimes.push(t),U.runtimes.sort(((t,e)=>e.version-t.version))}static findRuntime(t){for(const e of U.runtimes)if(e.test(t))return e}static setupLive2DModel(t,e,i){return __async(this,null,(function*(){const s=new Promise((e=>t.once("textureLoaded",e))),r=new Promise((e=>t.once("modelLoaded",e))),a=Promise.all([s,r]).then((()=>t.emit("ready")));yield L(U.live2DModelMiddlewares,{live2dModel:t,source:e,options:i||{}}),yield a,t.emit("load")}))}static loadMotion(t,e,i){var s;const r=s=>t.emit("motionLoadError",e,i,s);try{const a=null==(s=t.definitions[e])?void 0:s[i];if(!a)return Promise.resolve(void 0);t.listeners("destroy").includes(U.releaseTasks)||t.once("destroy",U.releaseTasks);let o=U.motionTasksMap.get(t);o||(o={},U.motionTasksMap.set(t,o));let n=o[e];n||(n=[],o[e]=n);const h=t.getMotionFile(a);return null!=n[i]||(n[i]=E.load({url:h,settings:t.settings,type:t.motionDataType,target:t}).then((s=>{var r;const o=null==(r=U.motionTasksMap.get(t))?void 0:r[e];o&&delete o[i];const n=t.createMotion(s,e,a);return t.emit("motionLoaded",e,i,n),n})).catch((e=>{l.warn(t.tag,`Failed to load motion: ${h}\n`,e),r(e)}))),n[i]}catch(a){l.warn(t.tag,`Failed to load motion at "${e}"[${i}]\n`,a),r(a)}return Promise.resolve(void 0)}static loadExpression(t,e){const i=i=>t.emit("expressionLoadError",e,i);try{const s=t.definitions[e];if(!s)return Promise.resolve(void 0);t.listeners("destroy").includes(U.releaseTasks)||t.once("destroy",U.releaseTasks);let r=U.expressionTasksMap.get(t);r||(r=[],U.expressionTasksMap.set(t,r));const a=t.getExpressionFile(s);return null!=r[e]||(r[e]=E.load({url:a,settings:t.settings,type:"json",target:t}).then((i=>{const r=U.expressionTasksMap.get(t);r&&delete r[e];const a=t.createExpression(i,s);return t.emit("expressionLoaded",e,a),a})).catch((e=>{l.warn(t.tag,`Failed to load expression: ${a}\n`,e),i(e)}))),r[e]}catch(s){l.warn(t.tag,`Failed to load expression at [${e}]\n`,s),i(s)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof C?U.motionTasksMap.delete(this):U.expressionTasksMap.delete(this)}};let N=U;N.runtimes=[],N.urlToJSON=D,N.jsonToSettings=A,N.waitUntilReady=B,N.setupOptionals=R,N.setupEssentials=O,N.createInternalModel=k,N.live2DModelMiddlewares=[D,A,B,R,O,k],N.motionTasksMap=new WeakMap,N.expressionTasksMap=new WeakMap,C.prototype._loadMotion=function(t,e){return N.loadMotion(this,t,e)},_.prototype._loadExpression=function(t){return N.loadExpression(this,t)};class V{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",G,this):this.off("pointertap",G,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",j,this)))}unregisterInteraction(){var t;this.interactionManager&&(null==(t=this.interactionManager)||t.off("pointermove",j,this),this.interactionManager=void 0)}}function G(t){this.tap(t.data.global.x,t.data.global.y)}function j(t){this.focus(t.data.global.x,t.data.global.y)}class X extends i.Transform{}const z=new i.Point,W=new i.Matrix;let Y;class H extends r.Container{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new X,this.anchor=new i.ObservablePoint(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",(()=>this.init(t)))}static from(t,e){const i=new this(e);return N.setupLive2DModel(i,t,e).then((()=>i))}static fromSync(t,e){const i=new this(e);return N.setupLive2DModel(i,t,e).then(null==e?void 0:e.onLoad).catch(null==e?void 0:e.onError),i}static registerTicker(t){Y=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;Y||(Y=null==(e=window.PIXI)?void 0:e.Ticker),t?this._destroyed||(Y?(Y.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):l.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(null==Y||Y.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,i){return void 0===e?this.internalModel.motionManager.startRandomMotion(t,i):this.internalModel.motionManager.startMotion(t,e,i)}expression(t){return this.internalModel.motionManager.expressionManager?void 0===t?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,i=!1){z.x=t,z.y=e,this.toModelPosition(z,z,!0);let s=z.x/this.internalModel.originalWidth*2-1,r=z.y/this.internalModel.originalHeight*2-1,a=Math.atan2(r,s);this.internalModel.focusController.focus(Math.cos(a),-Math.sin(a),i)}tap(t,e){const i=this.hitTest(t,e);i.length&&(l.log(this.tag,"Hit",i),this.emit("hit",i))}hitTest(t,e){return z.x=t,z.y=e,this.toModelPosition(z,z),this.internalModel.hitTest(z.x,z.y)}toModelPosition(t,e=t.clone(),i){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(Y.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let r=0;re.destroy(t.baseTexture))),this.internalModel.destroy(),super.destroy(t)}}g(H,[V]);const q=class{static resolveURL(t,e){var i;const s=null==(i=q.filesMap[t])?void 0:i[e];if(void 0===s)throw new Error("Cannot find this file from uploaded files: "+e);return s}static upload(t,i){return __async(this,null,(function*(){const s={};for(const r of i.getDefinedFiles()){const a=decodeURI(e.url.resolve(i.url,r)),o=t.find((t=>t.webkitRelativePath===a));o&&(s[r]=URL.createObjectURL(o))}q.filesMap[i._objectURL]=s}))}static createSettings(t){return __async(this,null,(function*(){const e=t.find((t=>t.name.endsWith("model.json")||t.name.endsWith("model3.json")));if(!e)throw new TypeError("Settings file not found");const i=yield q.readText(e),s=JSON.parse(i);s.url=e.webkitRelativePath;const r=N.findRuntime(s);if(!r)throw new Error("Unknown settings JSON");const a=r.createModelSettings(s);return a._objectURL=URL.createObjectURL(e),a}))}static readText(t){return __async(this,null,(function*(){return new Promise(((e,i)=>{const s=new FileReader;s.onload=()=>e(s.result),s.onerror=i,s.readAsText(t,"utf8")}))}))}};let $=q;$.filesMap={},$.factory=(t,e)=>__async(this,null,(function*(){if(Array.isArray(t.source)&&t.source[0]instanceof File){const e=t.source;let i=e.settings;if(i){if(!i._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings')}else i=yield q.createSettings(e);i.validateFiles(e.map((t=>encodeURI(t.webkitRelativePath)))),yield q.upload(e,i),i.resolveURL=function(t){return q.resolveURL(this._objectURL,t)},t.source=i,t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){const t=this.settings._objectURL;if(URL.revokeObjectURL(t),q.filesMap[t])for(const e of Object.values(q.filesMap[t]))URL.revokeObjectURL(e);delete q.filesMap[t]}))}))}return e()})),N.live2DModelMiddlewares.unshift($.factory);const Z=class{static unzip(t,i){return __async(this,null,(function*(){const s=yield Z.getFilePaths(t),r=[];for(const t of i.getDefinedFiles()){const a=decodeURI(e.url.resolve(i.url,t));s.includes(a)&&r.push(a)}const a=yield Z.getFiles(t,r);for(let t=0;tt.endsWith("model.json")||t.endsWith("model3.json")));if(!e)throw new Error("Settings file not found");const i=yield Z.readText(t,e);if(!i)throw new Error("Empty settings file: "+e);const s=JSON.parse(i);s.url=e;const r=N.findRuntime(s);if(!r)throw new Error("Unknown settings JSON");return r.createModelSettings(s)}))}static zipReader(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFilePaths(t){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static getFiles(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static readText(t,e){return __async(this,null,(function*(){throw new Error("Not implemented")}))}static releaseReader(t){}};let J=Z;if(J.ZIP_PROTOCOL="zip://",J.uid=0,J.factory=(t,e)=>__async(this,null,(function*(){const i=t.source;let s,r,a;if("string"==typeof i&&(i.endsWith(".zip")||i.startsWith(Z.ZIP_PROTOCOL))?(s=i.startsWith(Z.ZIP_PROTOCOL)?i.slice(Z.ZIP_PROTOCOL.length):i,r=yield E.load({url:s,type:"blob",target:t.live2dModel})):Array.isArray(i)&&1===i.length&&i[0]instanceof File&&i[0].name.endsWith(".zip")&&(r=i[0],s=URL.createObjectURL(r),a=i.settings),r){if(!r.size)throw new Error("Empty zip file");const e=yield Z.zipReader(r,s);a||(a=yield Z.createSettings(e)),a._objectURL=Z.ZIP_PROTOCOL+Z.uid+"/"+a.url;const i=yield Z.unzip(e,a);i.settings=a,t.source=i,s.startsWith("blob:")&&t.live2dModel.once("modelLoaded",(t=>{t.once("destroy",(function(){URL.revokeObjectURL(s)}))})),Z.releaseReader(e)}return e()})),N.live2DModelMiddlewares.unshift(J.factory),!window.Live2D)throw new Error("Could not find Cubism 2 runtime. This plugin requires live2d.min.js to be loaded.");const Q=Live2DMotion.prototype.updateParam;Live2DMotion.prototype.updateParam=function(t,e){Q.call(this,t,e),e.isFinished()&&this.onFinishHandler&&(this.onFinishHandler(this),delete this.onFinishHandler)};class K extends AMotion{constructor(e){super(),this.params=[],this.setFadeIn(e.fade_in>0?e.fade_in:t.config.expressionFadingDuration),this.setFadeOut(e.fade_out>0?e.fade_out:t.config.expressionFadingDuration),Array.isArray(e.params)&&e.params.forEach((t=>{const e=t.calc||"add";if("add"===e){const e=t.def||0;t.val-=e}else if("mult"===e){const e=t.def||1;t.val/=e}this.params.push({calc:e,val:t.val,id:t.id})}))}updateParamExe(t,e,i,s){this.params.forEach((e=>{t.setParamFloat(e.id,e.val*i)}))}}class tt extends _{constructor(t,e){var i;super(t,e),this.queueManager=new MotionQueueManager,this.definitions=null!=(i=this.settings.expressions)?i:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex((e=>e.name===t))}getExpressionFile(t){return t.file}createExpression(t,e){return new K(t)}_setExpression(t){return this.queueManager.startMotion(t)}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}}class et extends C{constructor(t,e){super(t,e),this.groups={idle:"idle"},this.motionDataType="arraybuffer",this.queueManager=new MotionQueueManager,this.definitions=this.settings.motions,this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new tt(this.settings,t))}isFinished(){return this.queueManager.isFinished()}createMotion(e,i,s){const r=Live2DMotion.loadMotion(e),a=i===this.groups.idle?t.config.idleMotionFadingDuration:t.config.motionFadingDuration;return r.setFadeIn(s.fade_in>0?s.fade_in:a),r.setFadeOut(s.fade_out>0?s.fade_out:a),r}getMotionFile(t){return t.file}getMotionName(t){return t.file}getSoundFile(t){return t.sound}_startMotion(t,e){return t.onFinishHandler=e,this.queueManager.stopAllMotions(),this.queueManager.startMotion(t)}_stopAllMotions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.updateParam(t)}destroy(){super.destroy(),this.queueManager=void 0}}class it{constructor(t){this.coreModel=t,this.blinkInterval=4e3,this.closingDuration=100,this.closedDuration=50,this.openingDuration=150,this.eyeState=0,this.eyeParamValue=1,this.closedTimer=0,this.nextBlinkTimeLeft=this.blinkInterval,this.leftParam=t.getParamIndex("PARAM_EYE_L_OPEN"),this.rightParam=t.getParamIndex("PARAM_EYE_R_OPEN")}setEyeParams(t){this.eyeParamValue=h(t,0,1),this.coreModel.setParamFloat(this.leftParam,this.eyeParamValue),this.coreModel.setParamFloat(this.rightParam,this.eyeParamValue)}update(t){switch(this.eyeState){case 0:this.nextBlinkTimeLeft-=t,this.nextBlinkTimeLeft<0&&(this.eyeState=1,this.nextBlinkTimeLeft=this.blinkInterval+this.closingDuration+this.closedDuration+this.openingDuration+d(0,2e3));break;case 1:this.setEyeParams(this.eyeParamValue+t/this.closingDuration),this.eyeParamValue<=0&&(this.eyeState=2,this.closedTimer=0);break;case 2:this.closedTimer+=t,this.closedTimer>=this.closedDuration&&(this.eyeState=3);break;case 3:this.setEyeParams(this.eyeParamValue+t/this.openingDuration),this.eyeParamValue>=1&&(this.eyeState=0)}}}const st=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class rt extends b{constructor(t,e,i){super(),this.textureFlipY=!0,this.drawDataCount=0,this.disableCulling=!1,this.coreModel=t,this.settings=e,this.motionManager=new et(e,i),this.eyeBlink=new it(t),this.eyeballXParamIndex=t.getParamIndex("PARAM_EYE_BALL_X"),this.eyeballYParamIndex=t.getParamIndex("PARAM_EYE_BALL_Y"),this.angleXParamIndex=t.getParamIndex("PARAM_ANGLE_X"),this.angleYParamIndex=t.getParamIndex("PARAM_ANGLE_Y"),this.angleZParamIndex=t.getParamIndex("PARAM_ANGLE_Z"),this.bodyAngleXParamIndex=t.getParamIndex("PARAM_BODY_ANGLE_X"),this.breathParamIndex=t.getParamIndex("PARAM_BREATH"),this.init()}init(){super.init(),this.settings.initParams&&this.settings.initParams.forEach((({id:t,value:e})=>this.coreModel.setParamFloat(t,e))),this.settings.initOpacities&&this.settings.initOpacities.forEach((({id:t,value:e})=>this.coreModel.setPartsOpacity(t,e))),this.coreModel.saveParam();const t=this.coreModel.getModelContext()._$aS;(null==t?void 0:t.length)&&(this.drawDataCount=t.length);let e=this.coreModel.drawParamWebGL.culling;Object.defineProperty(this.coreModel.drawParamWebGL,"culling",{set:t=>e=t,get:()=>!this.disableCulling&&e});const i=this.coreModel.getModelContext().clipManager,s=i.setupClip;i.setupClip=(t,e)=>{s.call(i,t,e),e.gl.viewport(...this.viewport)}}getSize(){return[this.coreModel.getCanvasWidth(),this.coreModel.getCanvasHeight()]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){let i=e;"center_x"===e?i="centerX":"center_y"===e&&(i="centerY"),t[i]=this.settings.layout[e]}return t}updateWebGLContext(t,e){const i=this.coreModel.drawParamWebGL;i.firstDraw=!0,i.setGL(t),i.glno=e;for(const a in i)i.hasOwnProperty(a)&&i[a]instanceof WebGLBuffer&&(i[a]=null);const s=this.coreModel.getModelContext().clipManager;s.curFrameNo=e;const r=t.getParameter(t.FRAMEBUFFER_BINDING);s.getMaskRenderTexture(),t.bindFramebuffer(t.FRAMEBUFFER,r)}bindTexture(t,e){this.coreModel.setTexture(t,e)}getHitAreaDefs(){var t;return(null==(t=this.settings.hitAreas)?void 0:t.map((t=>({id:t.id,name:t.name,index:this.coreModel.getDrawDataIndex(t.id)}))))||[]}getDrawableIDs(){const t=this.coreModel.getModelContext(),e=[];for(let i=0;i0&&t.textures.every((t=>"string"==typeof t))}copy(t){u("string",t,this,"name","name"),u("string",t,this,"pose","pose"),u("string",t,this,"physics","physics"),u("object",t,this,"layout","layout"),u("object",t,this,"motions","motions"),c("object",t,this,"hit_areas","hitAreas"),c("object",t,this,"expressions","expressions"),c("object",t,this,"init_params","initParams"),c("object",t,this,"init_opacities","initOpacities")}replaceFiles(t){super.replaceFiles(t);for(const[e,i]of Object.entries(this.motions))for(let s=0;s{const e=new PhysicsHair;return e.setup(t.setup.length,t.setup.regist,t.setup.mass),t.src.forEach((({id:t,ptype:i,scale:s,weight:r})=>{const a=ot[i];a&&e.addSrcParam(a,t,s,r)})),t.targets.forEach((({id:t,ptype:i,scale:s,weight:r})=>{const a=nt[i];a&&e.addTargetParam(a,t,s,r)})),e})))}update(t){this.physicsHairs.forEach((e=>e.update(this.coreModel,t)))}}class ht{constructor(t){this.id=t,this.paramIndex=-1,this.partsIndex=-1,this.link=[]}initIndex(t){this.paramIndex=t.getParamIndex("VISIBLE:"+this.id),this.partsIndex=t.getPartsDataIndex(PartsDataID.getID(this.id)),t.setParamFloat(this.paramIndex,1)}}class dt{constructor(t,e){this.coreModel=t,this.opacityAnimDuration=500,this.partsGroups=[],e.parts_visible&&(this.partsGroups=e.parts_visible.map((({group:t})=>t.map((({id:t,link:e})=>{const i=new ht(t);return e&&(i.link=e.map((t=>new ht(t)))),i})))),this.init())}init(){this.partsGroups.forEach((t=>{t.forEach((t=>{if(t.initIndex(this.coreModel),t.paramIndex>=0){const e=0!==this.coreModel.getParamFloat(t.paramIndex);this.coreModel.setPartsOpacity(t.partsIndex,e?1:0),this.coreModel.setParamFloat(t.paramIndex,e?1:0),t.link.length>0&&t.link.forEach((t=>t.initIndex(this.coreModel)))}}))}))}normalizePartsOpacityGroup(t,e){const i=this.coreModel,s=.5;let r=1,a=t.findIndex((({paramIndex:t,partsIndex:e})=>e>=0&&0!==i.getParamFloat(t)));if(a>=0){const s=i.getPartsOpacity(t[a].partsIndex);r=h(s+e/this.opacityAnimDuration,0,1)}else a=0,r=1;t.forEach((({partsIndex:t},e)=>{if(t>=0)if(a==e)i.setPartsOpacity(t,r);else{let e,a=i.getPartsOpacity(t);e=r.15&&(e=1-.15/(1-r)),a>e&&(a=e),i.setPartsOpacity(t,a)}}))}copyOpacity(t){const e=this.coreModel;t.forEach((({partsIndex:t,link:i})=>{if(t>=0&&i){const s=e.getPartsOpacity(t);i.forEach((({partsIndex:t})=>{t>=0&&e.setPartsOpacity(t,s)}))}}))}update(t){this.partsGroups.forEach((e=>{this.normalizePartsOpacityGroup(e,t),this.copyOpacity(e)}))}}if(N.registerRuntime({version:2,test:t=>t instanceof at||at.isValidJSON(t),ready:()=>Promise.resolve(),isValidMoc(t){if(t.byteLength<3)return!1;const e=new Int8Array(t,0,3);return"moc"===String.fromCharCode(...e)},createModelSettings:t=>new at(t),createCoreModel(t){const e=Live2DModelWebGL.loadModel(t),i=Live2D.getError();if(i)throw i;return e},createInternalModel:(t,e,i)=>new rt(t,e,i),createPose:(t,e)=>new dt(t,e),createPhysics:(t,e)=>new lt(t,e)}),!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class ut{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new ut(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new ut(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new ut(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new ut(t,t))}division(t){const e=new ut(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new ut(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const ct=class{static range(t,e,i){return ti&&(t=i),t}static sin(t){return Math.sin(t)}static cos(t){return Math.cos(t)}static abs(t){return Math.abs(t)}static sqrt(t){return Math.sqrt(t)}static cbrt(t){if(0===t)return t;let e=t;const i=e<0;let s;return i&&(e=-e),e===1/0?s=1/0:(s=Math.exp(Math.log(e)/3),s=(e/(s*s)+2*s)/3),i?-s:s}static getEasingSine(t){return t<0?0:t>1?1:.5-.5*this.cos(t*Math.PI)}static max(t,e){return t>e?t:e}static min(t,e){return t>e?e:t}static degreesToRadian(t){return t/180*Math.PI}static radianToDegrees(t){return 180*t/Math.PI}static directionToRadian(t,e){let i=Math.atan2(e.y,e.x)-Math.atan2(t.y,t.x);for(;i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;return i}static directionToDegrees(t,e){const i=this.directionToRadian(t,e);let s=this.radianToDegrees(i);return e.x-t.x>0&&(s=-s),s}static radianToDirection(t){const e=new ut;return e.x=this.sin(t),e.y=this.cos(t),e}static quadraticEquation(t,e,i){return this.abs(t)1&&(t=1),e<0?e=0:e>1&&(e=1),i<0?i=0:i>1&&(i=1),s<0?s=0:s>1&&(s=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=i,this._modelColor.A=s}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new ft,this._mvpMatrix4x4=new mt,this._mvpMatrix4x4.loadIdentity()}}var _t=(t=>(t[t.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",t[t.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",t[t.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",t))(_t||{});class ft{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let xt,yt=!1,Mt=!1;const vt=0,Pt=2;class Ct{static startUp(t){if(yt)return It("CubismFramework.startUp() is already done."),yt;if(Live2DCubismCore._isStarted)return yt=!0,!0;if(Live2DCubismCore._isStarted=!0,xt=t,xt&&Live2DCubismCore.Logging.csmSetLogFunction(xt.logFunction),yt=!0,yt){const t=Live2DCubismCore.Version.csmGetVersion(),e=(16711680&t)>>16,i=65535&t,s=t;It("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+((4278190080&t)>>24)).slice(-2),("00"+e).slice(-2),("0000"+i).slice(-4),s)}return It("CubismFramework.startUp() is complete."),yt}static cleanUp(){yt=!1,Mt=!1,xt=void 0}static initialize(){yt?Mt?wt("CubismFramework.initialize() skipped, already initialized."):(Mt=!0,It("CubismFramework.initialize() is complete.")):wt("CubismFramework is not started.")}static dispose(){yt?Mt?(pt.staticRelease(),Mt=!1,It("CubismFramework.dispose() is complete.")):wt("CubismFramework.dispose() skipped, not initialized."):wt("CubismFramework is not started.")}static isStarted(){return yt}static isInitialized(){return Mt}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return null!=xt?xt.loggingLevel:St.LogLevel_Off}constructor(){}}var St=(t=>(t[t.LogLevel_Verbose=0]="LogLevel_Verbose",t[t.LogLevel_Debug=1]="LogLevel_Debug",t[t.LogLevel_Info=2]="LogLevel_Info",t[t.LogLevel_Warning=3]="LogLevel_Warning",t[t.LogLevel_Error=4]="LogLevel_Error",t[t.LogLevel_Off=5]="LogLevel_Off",t))(St||{});function bt(t,...e){Lt.print(St.LogLevel_Debug,"[CSM][D]"+t+"\n",e)}function It(t,...e){Lt.print(St.LogLevel_Info,"[CSM][I]"+t+"\n",e)}function wt(t,...e){Lt.print(St.LogLevel_Warning,"[CSM][W]"+t+"\n",e)}function Tt(t,...e){Lt.print(St.LogLevel_Error,"[CSM][E]"+t+"\n",e)}class Lt{static print(t,e,i){if(ti[e])))}static dumpBytes(t,e,i){for(let s=0;s0?this.print(t,"\n"):s%8==0&&s>0&&this.print(t," "),this.print(t,"{0} ",[255&e[s]]);this.print(t,"\n")}constructor(){}}class Et{constructor(){this._fadeInSeconds=-1,this._fadeOutSeconds=-1,this._weight=1,this._offsetSeconds=0,this._firedEventValues=[]}release(){this._weight=0}updateParameters(t,e,i){if(!e.isAvailable()||e.isFinished())return;if(!e.isStarted()){e.setIsStarted(!0),e.setStartTime(i-this._offsetSeconds),e.setFadeInStartTime(i);const t=this.getDuration();e.getEndTime()<0&&e.setEndTime(t<=0?-1:e.getStartTime()+t)}let s=this._weight;s=s*(0==this._fadeInSeconds?1:gt.getEasingSine((i-e.getFadeInStartTime())/this._fadeInSeconds))*(0==this._fadeOutSeconds||e.getEndTime()<0?1:gt.getEasingSine((e.getEndTime()-i)/this._fadeOutSeconds)),e.setState(i,s),this.doUpdateParameters(t,i,s,e),e.getEndTime()>0&&e.getEndTime()(t[t.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",t[t.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",t[t.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",t))(Dt||{});class At{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const i=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||inull!=e&&e._motionQueueEntryHandle==t))}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let i=!1,s=0;for(;se.Name===t))}getExpressionFile(t){return t.File}createExpression(t,e){return Ft.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class kt{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find((t=>"EyeBlink"===t.Name)))?void 0:e.Ids}getLipSyncParameters(){var t,e;return null==(e=null==(t=this.groups)?void 0:t.find((t=>"LipSync"===t.Name)))?void 0:e.Ids}}class Ut extends x{constructor(t){if(super(t),!Ut.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new kt(t))}static isValidJSON(t){var e;return!!(null==t?void 0:t.FileReferences)&&"string"==typeof t.FileReferences.Moc&&(null==(e=t.FileReferences.Textures)?void 0:e.length)>0&&t.FileReferences.Textures.every((t=>"string"==typeof t))}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,i]of Object.entries(this.motions))for(let s=0;s(t[t.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",t[t.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",t[t.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",t))(Nt||{}),Vt=(t=>(t[t.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",t[t.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",t[t.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",t[t.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",t))(Vt||{});class Gt{constructor(t=0,e=0){this.time=t,this.value=e}}class jt{constructor(){this.basePointIndex=0,this.segmentType=0}}class Xt{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class zt{constructor(){this.fireTime=0,this.value=""}}class Wt{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class Yt{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return Ht.EvaluationOptionFlag_AreBeziersRistricted==t&&!!this._json.Meta.AreBeziersRestricted}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var Ht=(t=>(t[t.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",t))(Ht||{});function qt(t,e,i){const s=new Gt;return s.time=t.time+(e.time-t.time)*i,s.value=t.value+(e.value-t.value)*i,s}function $t(t,e){let i=(e-t[0].time)/(t[1].time-t[0].time);return i<0&&(i=0),t[0].value+(t[1].value-t[0].value)*i}function Zt(t,e){let i=(e-t[0].time)/(t[3].time-t[0].time);i<0&&(i=0);const s=qt(t[0],t[1],i),r=qt(t[1],t[2],i),a=qt(t[2],t[3],i),o=qt(s,r,i),n=qt(r,a,i);return qt(o,n,i).value}function Jt(t,e){const i=e,s=t[0].time,r=t[3].time,a=t[1].time,o=t[2].time,n=r-3*o+3*a-s,l=3*o-6*a+3*s,h=3*a-3*s,d=s-i,u=gt.cardanoAlgorithmForBezier(n,l,h,d),c=qt(t[0],t[1],u),g=qt(t[1],t[2],u),m=qt(t[2],t[3],u),p=qt(c,g,u),_=qt(g,m,u);return qt(p,_,u).value}function Qt(t,e){return t[0].value}function Kt(t,e){return t[1].value}function te(t,e,i){const s=t.curves[e];let r=-1;const a=s.baseSegmentIndex+s.segmentCount;let o=0;for(let l=s.baseSegmentIndex;li){r=l;break}if(-1==r)return t.points[o].value;const n=t.segments[r];return n.evaluate(t.points.slice(n.basePointIndex),i)}class ee extends Et{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const i=new ee;return i.parse(t),i._sourceFrameRate=i._motionData.fps,i._loopDurationSeconds=i._motionData.duration,i._onFinishedMotion=e,i}doUpdateParameters(t,e,i,s){null==this._modelCurveIdEyeBlink&&(this._modelCurveIdEyeBlink="EyeBlink"),null==this._modelCurveIdLipSync&&(this._modelCurveIdLipSync="LipSync");let r=e-s.getStartTime();r<0&&(r=0);let o=Number.MAX_VALUE,n=Number.MAX_VALUE;const l=64;let h=0,d=0;this._eyeBlinkParameterIds.length>l&&bt("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&bt("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const u=this._fadeInSeconds<=0?1:gt.getEasingSine((e-s.getFadeInStartTime())/this._fadeInSeconds),c=this._fadeOutSeconds<=0||s.getEndTime()<0?1:gt.getEasingSine((s.getEndTime()-e)/this._fadeOutSeconds);let g,m,p,_=r;if(this._isLoop)for(;_>this._motionData.duration;)_-=this._motionData.duration;const f=this._motionData.curves;for(m=0;m>a&1)continue;const s=e+(n-e)*i;t.setParameterValueById(this._eyeBlinkParameterIds[a],s)}if(o!=Number.MAX_VALUE)for(let a=0;a>a&1)continue;const s=e+(o-e)*i;t.setParameterValueById(this._lipSyncParameterIds[a],s)}for(;m=this._motionData.duration&&(this._isLoop?(s.setStartTime(e),this._isLoopFadeIn&&s.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),s.setIsFinished(!0))),this._lastWeight=i}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const i=this._motionData.curves;for(let s=0;snew Xt)),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map((()=>new jt)),this._motionData.events=Array.from({length:this._motionData.eventCount}).map((()=>new zt)),this._motionData.points=[];let a=0,o=0;for(let n=0;nt&&this._motionData.events[i].fireTime<=e&&this._firedEventValues.push(this._motionData.events[i].value);return this._firedEventValues}}class ie extends C{constructor(t,e){var i;super(t,e),this.groups={idle:"Idle"},this.motionDataType="json",this.queueManager=new Bt,this.definitions=null!=(i=t.motions)?i:{},this.eyeBlinkIds=t.getEyeBlinkParameters()||[],this.lipSyncIds=t.getLipSyncParameters()||[],this.init(e)}init(t){super.init(t),this.settings.expressions&&(this.expressionManager=new Ot(this.settings,t)),this.queueManager.setEventCallback(((t,e,i)=>{this.emit("motion:"+e)}))}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(e,i,s){const r=ee.create(e),a=new Yt(e),o=(i===this.groups.idle?t.config.idleMotionFadingDuration:t.config.motionFadingDuration)/1e3;return void 0===a.getMotionFadeInTime()&&r.setFadeInTime(s.FadeInTime>0?s.FadeInTime:o),void 0===a.getMotionFadeOutTime()&&r.setFadeOutTime(s.FadeOutTime>0?s.FadeOutTime:o),r.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),r}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}class se{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new se}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const i=2*this._currentTime*3.14159;for(let s=0;s=1&&(s=1,this._blinkingState=ne.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),i=1-s;break;case ne.EyeState_Closed:s=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,s>=1&&(this._blinkingState=ne.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),i=0;break;case ne.EyeState_Opening:s=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,s>=1&&(s=1,this._blinkingState=ne.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),i=s;break;case ne.EyeState_Interval:this._nextBlinkingTime(t[t.EyeState_First=0]="EyeState_First",t[t.EyeState_Interval=1]="EyeState_Interval",t[t.EyeState_Closing=2]="EyeState_Closing",t[t.EyeState_Closed=3]="EyeState_Closed",t[t.EyeState_Opening=4]="EyeState_Opening",t))(ne||{});class le{constructor(t=0,e=0,i=0,s=0){this.x=t,this.y=e,this.width=i,this.height=s}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e}}let he,de,ue;class ce{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&0!=this._maskTexture.texture&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),0==t){const e=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ue),this._maskTexture=new ge(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let i=Number.MAX_VALUE,s=Number.MAX_VALUE,r=Number.MIN_VALUE,a=Number.MIN_VALUE;const o=e._clippedDrawableIndexList.length;for(let n=0;nc&&(c=e),ig&&(g=i)}if(d!=Number.MAX_VALUE)if(dr&&(r=c),g>a&&(a=g),i==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const t=r-i,o=a-s;e._allClippedDrawRect.x=i,e._allClippedDrawRect.y=s,e._allClippedDrawRect.width=t,e._allClippedDrawRect.height=o}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new le,this._tmpMatrix=new mt,this._tmpMatrixForMask=new mt,this._tmpMatrixForDraw=new mt;let t=new ft;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new ft,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new ft,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new ft,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,i;const s=this;for(let r=0;r0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.preDraw(),this.setupLayoutBounds(i),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i(t[t.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",t[t.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",t[t.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",t[t.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",t[t.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",t[t.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",t[t.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",t[t.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",t))(_e||{});const fe="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",xe="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",ye="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Me="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",ve="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",Pe="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",Ce="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class Se extends pt{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new ce,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new ce,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new ce,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,i;const s=this;this._clippingManager.release(),s._clippingManager=void 0,null==(t=this.gl)||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,null==(e=this.gl)||e.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,null==(i=this.gl)||i.deleteBuffer(this._bufferData.index),this._bufferData.index=null,s._bufferData=void 0,s._textures=void 0}doDrawModel(){this.preDraw(),null!=this._clippingManager&&this._clippingManager.setupClippingContext(this.getModel(),this);const t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let i=0;i{Se.doStaticRelease()};const be=new mt;class Ie extends b{constructor(t,e,s){super(),this.lipSync=!0,this.breath=se.create(),this.renderer=new Se,this.idParamAngleX="ParamAngleX",this.idParamAngleY="ParamAngleY",this.idParamAngleZ="ParamAngleZ",this.idParamEyeBallX="ParamEyeBallX",this.idParamEyeBallY="ParamEyeBallY",this.idParamBodyAngleX="ParamBodyAngleX",this.idParamBreath="ParamBreath",this.pixelsPerUnit=1,this.centeringTransform=new i.Matrix,this.coreModel=t,this.settings=e,this.motionManager=new ie(e,s),this.init()}init(){var t;super.init(),(null==(t=this.settings.getEyeBlinkParameters())?void 0:t.length)>0&&(this.eyeBlink=oe.create(this.settings)),this.breath.setParameters([new re(this.idParamAngleX,0,15,6.5345,.5),new re(this.idParamAngleY,0,8,3.5345,.5),new re(this.idParamAngleZ,0,10,5.5345,.5),new re(this.idParamBodyAngleX,0,4,15.5345,.5),new re(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){t[e.charAt(0).toLowerCase()+e.slice(1)]=this.settings.layout[e]}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,pe.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return null!=(e=null==(t=this.settings.hitAreas)?void 0:t.map((t=>({id:t.Id,name:t.Name,index:this.coreModel.getDrawableIndex(t.Id)}))))?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if("string"==typeof t&&-1===(t=this.coreModel.getDrawableIndex(t)))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let i=0;i{!function i(){try{Ee(),t()}catch(s){if(Te--,Te<0){const t=new Error("Failed to start up Cubism 4 framework.");return t.cause=s,void e(t)}l.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(i,10)}}()}))),we)}function Ee(t){t=Object.assign({logFunction:console.log,loggingLevel:St.LogLevel_Verbose},t),Ct.startUp(t),Ct.initialize()}class Fe{static create(t){const e=new Fe;"number"==typeof t.FadeInTime&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=.5));const i=t.Groups,s=i.length;for(let r=0;r.001){if(r>=0)break;r=n,a=t.getPartOpacityByIndex(i),a+=e/this._fadeTimeSeconds,a>1&&(a=1)}}r<0&&(r=0,a=1);for(let n=i;n.15&&(i=1-.15/(1-a)),s>i&&(s=i),t.setPartOpacityByIndex(e,s)}}}constructor(){this._fadeTimeSeconds=.5,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class De{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],null!=t&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map((t=>t.clone())),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new De;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map((t=>t.clone())),t}}class Ae{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return null==this._model?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return null==this._model?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,e=this._savedParameters.length;for(let i=0;ie&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=1==i?e:this._parameterValues[t]=this._parameterValues[t]*(1-i)+e*i)}setParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.setParameterValueByIndex(s,e,i)}addParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*i)}addParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.addParameterValueByIndex(s,e,i)}multiplyParameterValueById(t,e,i=1){const s=this.getParameterIndex(t);this.multiplyParameterValueByIndex(s,e,i)}multiplyParameterValueByIndex(t,e,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*i))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let i=0;ie&&(t=e);for(let i=0;i(t[t.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",t))(Re||{}),Oe=(t=>(t[t.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",t[t.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",t[t.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",t))(Oe||{});class ke{constructor(){this.initialPosition=new ut(0,0),this.position=new ut(0,0),this.lastPosition=new ut(0,0),this.lastGravity=new ut(0,0),this.force=new ut(0,0),this.velocity=new ut(0,0)}}class Ue{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class Ne{constructor(){this.source={}}}class Ve{constructor(){this.destination={},this.translationScale=new ut(0,0)}}class Ge{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new ut(0,0),this.wind=new ut(0,0)}}class je{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new ut(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new ut(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const i=new ut(0,0);return i.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,i.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,i}}const Xe="Angle";class ze{static create(t){const e=new ze;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let i,s,r,a;const o=new ut;let n,l,h,d,u,c,g,m;u=t.getModel().parameters.values,c=t.getModel().parameters.maximumValues,g=t.getModel().parameters.minimumValues,m=t.getModel().parameters.defaultValues;for(let p=0;p=n.particleCount)break;-1==h[e].destinationParameterIndex&&(h[e].destinationParameterIndex=t.getParameterIndex(h[e].destination.id));const s=new ut;s.x=d[i].position.x-d[i-1].position.x,s.y=d[i].position.y-d[i-1].position.y,a=h[e].getValue(s,d,i,h[e].reflect,this._options.gravity);const r=h[e].destinationParameterIndex,o=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(u.subarray(r))):u.slice(r);si(o,g[r],c[r],a,h[e]);for(let t=r,e=0;t=2?e[i-1].position.substract(e[i-2].position):r.multiplyByScaler(-1),a=gt.directionToRadian(r,t),s&&(a*=-1),a}function Qe(t,e){return Math.min(t,e)+function(t,e){return Math.abs(Math.max(t,e)-Math.min(t,e))}(t,e)/2}function Ke(t,e){return t.x}function ti(t,e){return t.y}function ei(t,e){return e}function ii(t,e,i,s,r,a,o,n){let l,h,d,u,c=new ut(0,0),g=new ut(0,0),m=new ut(0,0),p=new ut(0,0);t[0].position=new ut(i.x,i.y),l=gt.degreesToRadian(s),u=gt.radianToDirection(l),u.normalize();for(let _=1;_i&&(o>r.valueExceededMaximum&&(r.valueExceededMaximum=o),o=i),n=r.weight/100,n>=1||(o=t[0]*(1-n)+o*n),t[0]=o}function ri(t,e,i,s,r,a,o,n){let l=0;const h=gt.max(i,e);ht&&(t=d);const u=gt.min(r,a),c=gt.max(r,a),g=o,m=Qe(d,h),p=t-m;switch(Math.sign(p)){case 1:{const t=c-g,e=h-m;0!=e&&(l=p*(t/e),l+=g);break}case-1:{const t=u-g,e=d-m;0!=e&&(l=p*(t/e),l+=g);break}case 0:l=g}return n?l:-1*l}function ai(){var t;null==(t=this.__moc)||t.release()}N.registerRuntime({version:4,ready:Le,test:t=>t instanceof Ut||Ut.isValidJSON(t),isValidMoc(t){if(t.byteLength<4)return!1;const e=new Int8Array(t,0,4);return"MOC3"===String.fromCharCode(...e)},createModelSettings:t=>new Ut(t),createCoreModel(t){const e=Be.create(t);try{const t=e.createModel();return t.__moc=e,t}catch(i){try{e.release()}catch(s){}throw i}},createInternalModel(t,e,i){const s=new Ie(t,e,i),r=t;return r.__moc&&(s.__moc=r.__moc,delete r.__moc,s.once("destroy",ai)),s},createPhysics:(t,e)=>ze.create(e),createPose:(t,e)=>Fe.create(e)}),t.Cubism2ExpressionManager=tt,t.Cubism2InternalModel=rt,t.Cubism2ModelSettings=at,t.Cubism2MotionManager=et,t.Cubism4ExpressionManager=Ot,t.Cubism4InternalModel=Ie,t.Cubism4ModelSettings=Ut,t.Cubism4MotionManager=ie,t.ExpressionManager=_,t.FileLoader=$,t.FocusController=f,t.InteractionMixin=V,t.InternalModel=b,t.LOGICAL_HEIGHT=2,t.LOGICAL_WIDTH=2,t.Live2DExpression=K,t.Live2DEyeBlink=it,t.Live2DFactory=N,t.Live2DLoader=E,t.Live2DModel=H,t.Live2DPhysics=lt,t.Live2DPose=dt,t.Live2DTransform=X,t.ModelSettings=x,t.MotionManager=C,t.MotionPreloadStrategy=P,t.MotionPriority=y,t.MotionState=M,t.SoundManager=v,t.VERSION="0.4.0",t.XHRLoader=T,t.ZipLoader=J,t.applyMixins=g,t.clamp=h,t.copyArray=c,t.copyProperty=u,t.cubism4Ready=Le,t.folderName=m,t.logger=l,t.rand=d,t.remove=p,t.startUpCubism4=Ee,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); diff --git a/live2d/node_modules/pixi-live2d-display/package.json b/live2d/node_modules/pixi-live2d-display/package.json new file mode 100644 index 0000000..2da51af --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/package.json @@ -0,0 +1,91 @@ +{ + "name": "pixi-live2d-display", + "version": "0.4.0", + "description": "Live2D plugin for PixiJS", + "main": "dist/index.js", + "exports": { + ".": { + "types": "./types/index.d.ts", + "import": "./dist/index.es.js", + "require": "./dist/index.js" + }, + "./cubism2": { + "types": "./types/index.d.ts", + "import": "./dist/cubism2.es.js", + "require": "./dist/cubism2.js" + }, + "./cubism4": { + "types": "./types/index.d.ts", + "import": "./dist/cubism4.es.js", + "require": "./dist/cubism4.js" + }, + "./extra": { + "types": "./types/extra.d.ts", + "import": "./dist/extra.es.js", + "require": "./dist/extra.js" + } + }, + "repository": { + "type": "git", + "url": "https://github.com/guansss/pixi-live2d-display.git" + }, + "author": "guansss <821143943@qq.com>", + "license": "MIT", + "scripts": { + "setup": "node scripts/setup.js", + "playground": "vite", + "test": "node scripts/build-tests.js && npx floss --path=test.build --reporter=tap", + "test:ci": "yarn type && yarn build && yarn test", + "test:debug": "node scripts/build-tests.js && npx floss --path=test.build -d", + "build": "rimraf dist && node scripts/build.js", + "pretype": "node scripts/patch-dts-generator.js", + "type": "rimraf types && dts-bundle-generator src/index.ts --no-check --project=tsconfig.build.json -o=types/index.d.ts && dts-bundle-generator src/extra.ts --no-check --project=tsconfig.build.json -o=types/extra.d.ts ", + "posttype": "node scripts/patch-types.js", + "doc": "node scripts/gen-docs.js", + "serve-docs": "mkdocs serve -f docs/mkdocs.yml", + "deploy": "gh-pages -d site", + "prepublishOnly": "yarn build && yarn test && yarn type" + }, + "files": [ + "dist", + "types" + ], + "types": "types/index.d.ts", + "peerDependencies": { + "@pixi/core": "^6", + "@pixi/display": "^6", + "@pixi/loaders": "^6", + "@pixi/math": "^6", + "@pixi/sprite": "^6", + "@pixi/utils": "^6" + }, + "devDependencies": { + "@types/chai": "^4.3.1", + "@types/chai-as-promised": "^7.1.5", + "@types/lodash-es": "^4.17.6", + "@types/node": "17.0.41", + "@types/offscreencanvas": "^2019.7.0", + "adm-zip": "^0.5.9", + "chai": "^4.3.6", + "chai-as-promised": "^7.1.1", + "chalk": "^4", + "dts-bundle-generator": "^6.11.0", + "electron": "^13", + "floss": "^5.0.1", + "glob": "^8.0.3", + "handlebars": "^4.7.7", + "jszip": "^3.10.0", + "lodash-es": "^4.17.21", + "node-fetch": "^2", + "pixi.js": "^6.4.2", + "rimraf": "^3.0.2", + "sinon": "^14.0.0", + "sinon-chai": "^3.7.0", + "typedoc": "0.23.10", + "typescript": "^4.7.3", + "vite": "^2.9.13" + }, + "dependencies": { + "gh-pages": "^4.0.0" + } +} diff --git a/live2d/node_modules/pixi-live2d-display/types/extra.d.ts b/live2d/node_modules/pixi-live2d-display/types/extra.d.ts new file mode 100644 index 0000000..e65bf50 --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/types/extra.d.ts @@ -0,0 +1,21 @@ +// Generated by dts-bundle-generator v6.11.0 + +import { Renderer } from '@pixi/core'; +import { Graphics } from '@pixi/graphics'; +import { InteractionEvent } from '@pixi/interaction'; +import { Text } from '@pixi/text'; + +export declare class HitAreaFrames extends Graphics { + initialized: boolean; + texts: Text[]; + strokeWidth: number; + normalColor: number; + activeColor: number; + constructor(); + init(): void; + onPointerMove(e: InteractionEvent): void; + /** @override */ + protected _render(renderer: Renderer): void; +} + +export {}; diff --git a/live2d/node_modules/pixi-live2d-display/types/index.d.ts b/live2d/node_modules/pixi-live2d-display/types/index.d.ts new file mode 100644 index 0000000..dff08ce --- /dev/null +++ b/live2d/node_modules/pixi-live2d-display/types/index.d.ts @@ -0,0 +1,4712 @@ +// Generated by dts-bundle-generator v6.11.0 + +import { Renderer, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { InteractionManager } from '@pixi/interaction'; +import { Matrix, ObservablePoint, Point, Transform } from '@pixi/math'; +import { Ticker } from '@pixi/ticker'; +import { EventEmitter } from '@pixi/utils'; + +declare class Live2DModelWebGL { + static loadModel(buffer: ArrayBuffer): Live2DModelWebGL; + private constructor(); + drawParamWebGL: Live2DObfuscated.DrawParamWebGL; + getModelContext(): Live2DObfuscated.ModelContext; + /** + * @return The width of model's Live2D drawing canvas but NOT the html canvas element. + */ + getCanvasWidth(): number; + /** + * @return The height of model's Live2D drawing canvas but NOT the html canvas element. + */ + getCanvasHeight(): number; + setTexture(index: number, texture: WebGLTexture): void; + setMatrix(matrix: ArrayLike): void; + setParamFloat(id: string | number, value: number, weight?: number): unknown; + addToParamFloat(id: string | number, value: number, weight?: number): unknown; + multParamFloat(id: string | number, value: number, weight?: number): unknown; + setPartsOpacity(id: string | number, value: number): unknown; + getPartsOpacity(id: string | number): number; + getParamFloat(id: string | number): number; + getParamIndex(id: string): number; + getPartsDataIndex(id: string): number; + getDrawDataIndex(id: string): number; + getTransformedPoints(index: number): Float32Array; + loadParam(): void; + saveParam(): void; + update(): void; + draw(): void; +} +declare class AMotion { + setFadeIn(time: number): unknown; + setFadeOut(time: number): unknown; + updateParam(model: Live2DModelWebGL, entry: Live2DObfuscated.MotionQueueEnt): void; + updateParamExe(model: Live2DModelWebGL, time: number, weight: number, MotionQueueEnt: unknown): unknown; +} +declare class Live2DMotion extends AMotion { + private constructor(); + static loadMotion(buffer: ArrayBuffer): Live2DMotion; +} +declare class MotionQueueManager { + motions: unknown[]; + /** + * @return The size of internal motion arrays. + */ + startMotion(motion: AMotion, neverUsedArg?: boolean): number; + stopAllMotions(): void; + isFinished(): boolean; + /** + * @return True if parameters are updated by any motion. + */ + updateParam(model: Live2DModelWebGL): boolean; +} +declare class PhysicsHair { + static Src: { + SRC_TO_X: string; + SRC_TO_Y: string; + SRC_TO_G_ANGLE: string; + }; + static Target: { + TARGET_FROM_ANGLE: string; + TARGET_FROM_ANGLE_V: string; + }; + setup(length: number, regist: number, mass: number): unknown; + addSrcParam(type: string, id: string, scale: number, weight: number): unknown; + addTargetParam(type: string, id: string, scale: number, weight: number): unknown; + update(model: Live2DModelWebGL, time: number): unknown; +} +declare class DrawDataID { + id: string; +} +/** + * Members that have been obfuscated. + */ +export declare namespace Live2DObfuscated { + class MotionQueueEnt { + isFinished(): boolean; + } + class DrawParamWebGL { + gl: WebGLRenderingContext; + glno: number; + firstDraw: boolean; + culling: boolean; + setGL(gl: WebGLRenderingContext): void; + } + class ModelContext { + clipManager: ClipManager; + /** + * This is basically `DrawData[]`, but not reliable since it's an obfuscated property. + * Always check the type before using it! + */ + _$aS?: unknown; // DrawData[] + getDrawData(index: number): DrawData | null; + } + class IDrawData { + getDrawDataID(): DrawDataID; + } + class DrawData extends IDrawData { + getNumPoints?(): unknown; + draw(aN: unknown, aK: unknown, aI: Unknown_aB): void; + } + class Unknown_aB { + baseOpacity: number; + } + class ClipManager { + curFrameNo: number; + getMaskRenderTexture(): number; + setupClip(modelContext: ModelContext, drawParam: DrawParamWebGL): void; + } +} +/** + * Copyright(c) Live2D Inc. All rights reserved. + * + * Use of this source code is governed by the Live2D Proprietary Software license + * that can be found at https://www.live2d.com/eula/live2d-proprietary-software-license-agreement_en.html. + */ +export declare namespace Live2DCubismCore { + /** Cubism version identifier. */ + type csmVersion = number; + /** moc3 version identifier. */ + type csmMocVersion = number; + /** Log handler. + * + * @param message Null-terminated string message to log. + */ + interface csmLogFunction { + (message: string): void; + } + /** Cubism version. */ + class Version { + /** + * Queries Core version. + * + * @return Core version. + */ + static csmGetVersion(): csmVersion; + /** + * Gets Moc file supported latest version. + * + * @return Moc file latest format version. + */ + static csmGetLatestMocVersion(): csmMocVersion; + /** + * Gets Moc file format version. + * + * @param moc Moc + * + * @return csmMocVersion + */ + static csmGetMocVersion(moc: Moc): csmMocVersion; + private constructor(); + } + /** Cubism logging. */ + class Logging { + private static logFunction; + /** + * Sets log handler. + * + * @param handler Handler to use. + */ + static csmSetLogFunction(handler: csmLogFunction): void; + /** + * Queries log handler. + * + * @return Log handler. + */ + static csmGetLogFunction(): csmLogFunction; + /** + * Wrap log function. + * + * @param messagePtr number + * + * @return string + */ + private static wrapLogFunction; + private constructor(); + } + /** Cubism moc. */ + class Moc { + /** Creates [[Moc]] from [[ArrayBuffer]]. + * + * @param buffer Array buffer + * + * @return [[Moc]] on success; [[null]] otherwise. + */ + static fromArrayBuffer(buffer: ArrayBuffer): Moc; + /** Releases instance. */ + _release(): void; + /** Native moc. */ + _ptr: number; + /** + * Initializes instance. + * + * @param mocBytes Moc bytes. + */ + private constructor(); + } + /** Cubism model. */ + class Model { + /** Parameters. */ + parameters: Parameters; + /** Parts. */ + parts: Parts; + /** Drawables. */ + drawables: Drawables; + /** Canvas information. */ + canvasinfo: CanvasInfo; + /** + * Creates [[Model]] from [[Moc]]. + * + * @param moc Moc + * + * @return [[Model]] on success; [[null]] otherwise. + */ + static fromMoc(moc: Moc): Model; + /** Updates instance. */ + update(): void; + /** Releases instance. */ + release(): void; + /** Native model. */ + _ptr: number; + /** + * Initializes instance. + * + * @param moc Moc + */ + private constructor(); + } + /** Canvas information interface. */ + class CanvasInfo { + /** Width of native model canvas. */ + CanvasWidth: number; + /** Height of native model canvas. */ + CanvasHeight: number; + /** Coordinate origin of X axis. */ + CanvasOriginX: number; + /** Coordinate origin of Y axis. */ + CanvasOriginY: number; + /** Pixels per unit of native model. */ + PixelsPerUnit: number; + /** + * Initializes instance. + * + * @param modelPtr Native model pointer. + */ + constructor(modelPtr: number); + } + /** Cubism model parameters */ + class Parameters { + /** Parameter count. */ + count: number; + /** Parameter IDs. */ + ids: Array; + /** Minimum parameter values. */ + minimumValues: Float32Array; + /** Maximum parameter values. */ + maximumValues: Float32Array; + /** Default parameter values. */ + defaultValues: Float32Array; + /** Parameter values. */ + values: Float32Array; + /** + * Initializes instance. + * + * @param modelPtr Native model. + */ + constructor(modelPtr: number); + } + /** Cubism model parts */ + class Parts { + /** Part count. */ + count: number; + /** Part IDs. */ + ids: Array; + /** Opacity values. */ + opacities: Float32Array; + /** Part's parent part indices. */ + parentIndices: Int32Array; + /** + * Initializes instance. + * + * @param modelPtr Native model. + */ + constructor(modelPtr: number); + } + /** Cubism model drawables */ + class Drawables { + /** Drawable count. */ + count: number; + /** Drawable IDs. */ + ids: Array; + /** Constant drawable flags. */ + constantFlags: Uint8Array; + /** Dynamic drawable flags. */ + dynamicFlags: Uint8Array; + /** Drawable texture indices. */ + textureIndices: Int32Array; + /** Drawable draw orders. */ + drawOrders: Int32Array; + /** Drawable render orders. */ + renderOrders: Int32Array; + /** Drawable opacities. */ + opacities: Float32Array; + /** Mask count for each drawable. */ + maskCounts: Int32Array; + /** Masks for each drawable. */ + masks: Array; + /** Number of vertices of each drawable. */ + vertexCounts: Int32Array; + /** 2D vertex position data of each drawable. */ + vertexPositions: Array; + /** 2D texture coordinate data of each drawables. */ + vertexUvs: Array; + /** Number of triangle indices for each drawable. */ + indexCounts: Int32Array; + /** Triangle index data for each drawable. */ + indices: Array; + /** Resets all dynamic drawable flags.. */ + resetDynamicFlags(): void; + /** Native model. */ + private _modelPtr; + /** + * Initializes instance. + * + * @param modelPtr Native model. + */ + constructor(modelPtr: number); + } + /** Utility functions. */ + class Utils { + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasBlendAdditiveBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasBlendMultiplicativeBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasIsDoubleSidedBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasIsInvertedMaskBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasIsVisibleBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasVisibilityDidChangeBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasOpacityDidChangeBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasDrawOrderDidChangeBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasRenderOrderDidChangeBit(bitfield: number): boolean; + /** + * Checks whether flag is set in bitfield. + * + * @param bitfield Bitfield to query against. + * + * @return [[true]] if bit set; [[false]] otherwise + */ + static hasVertexPositionsDidChangeBit(bitfield: number): boolean; + } + /** Emscripten Cubism Core module. */ +} +export declare const LOGICAL_WIDTH = 2; +export declare const LOGICAL_HEIGHT = 2; +export type JSONObject = object; +export type Mutable = { + -readonly [P in keyof T]: T[P]; +}; +/** + * Parses, and provides access to the settings JSON. + */ +export declare abstract class ModelSettings { + json: JSONObject; + /** + * The model's name, typically used for displaying or logging. By default it's inferred from + * the URL by taking the folder name (the second to last component). In Cubism 2 it'll be overwritten + * by the `name` field of settings JSON. + */ + name: string; + /** + * URL of the model settings file, used to resolve paths of the resource files defined in settings. + * This typically ends with `.model.json` in Cubism 2 and `.model3.json` in Cubism 4. + */ + url: string; + /** + * Relative path of he moc file, typically ends with `.moc` in Cubism 2 and `.moc3` in Cubism 4. + */ + abstract moc: string; + /** + * Relative paths of the texture images. + */ + abstract textures: string[]; + /** + * Relative path of the pose file. + */ + pose?: string; + /** + * Relative path of the physics file. + */ + physics?: string; + /** + * @param json - The settings JSON object. + * @param json.url - The `url` field must be defined to specify the settings file's URL. + */ + protected constructor(json: JSONObject & { + url: string; + }); + /** + * Resolves a relative path using the {@link url}. This is used to resolve the resource files + * defined in the settings. + * @param path - Relative path. + * @return Resolved path. + */ + resolveURL(path: string): string; + /** + * Replaces the resource files by running each file through the `replacer`. + * @param replacer - Invoked with two arguments: `(file, path)`, where `file` is the file definition, + * and `path` is its property path in the ModelSettings instance. A string must be returned to be the replacement. + * + * ```js + * modelSettings.replaceFiles((file, path) => { + * // file = "foo.moc", path = "moc" + * // file = "foo.png", path = "textures[0]" + * // file = "foo.mtn", path = "motions.idle[0].file" + * // file = "foo.motion3.json", path = "motions.idle[0].File" + * + * return "bar/" + file; + * }); + * ``` + */ + replaceFiles(replacer: (file: string, path: string) => string): void; + /** + * Retrieves all resource files defined in the settings. + * @return A flat array of the paths of all resource files. + * + * ```js + * modelSettings.getDefinedFiles(); + * // returns: ["foo.moc", "foo.png", ...] + * ``` + */ + getDefinedFiles(): string[]; + /** + * Validates that the files defined in the settings exist in given files. Each file will be + * resolved by {@link resolveURL} before comparison. + * @param files - A flat array of file paths. + * @return All the files which are defined in the settings and also exist in given files, + * *including the optional files*. + * @throws Error if any *essential* file is defined in settings but not included in given files. + */ + validateFiles(files: string[]): string[]; +} +/** + * Indicates the motion priority. + */ +export declare enum MotionPriority { + /** States that the model is currently not playing any motion. This priority cannot be applied to a motion. */ + NONE = 0, + /** Low priority, used when starting idle motions automatically. */ + IDLE = 1, + /** Medium priority. */ + NORMAL = 2, + /** High priority. Motions as this priority will always be played regardless of the current priority. */ + FORCE = 3 +} +/** + * Handles the state of a MotionManager. + */ +export declare class MotionState { + /** + * Tag for logging. + */ + tag: string; + /** + * When enabled, the states will be dumped to the logger when an exception occurs. + */ + debug: boolean; + /** + * Priority of the current motion. Will be `MotionPriority.NONE` if there's no playing motion. + */ + currentPriority: MotionPriority; + /** + * Priority of the reserved motion, which is still in loading and will be played once loaded. + * Will be `MotionPriority.NONE` if there's no reserved motion. + */ + reservePriority: MotionPriority; + /** + * Group of current motion. + */ + currentGroup?: string; + /** + * Index of current motion in its group. + */ + currentIndex?: number; + /** + * Group of the reserved motion. + */ + reservedGroup?: string; + /** + * Index of the reserved motion in its group. + */ + reservedIndex?: number; + /** + * Group of the reserved idle motion. + */ + reservedIdleGroup?: string; + /** + * Index of the reserved idle motion in its group. + */ + reservedIdleIndex?: number; + /** + * Reserves the playback for a motion. + * @param group - The motion group. + * @param index - Index in the motion group. + * @param priority - The priority to be applied. + * @return True if the reserving has succeeded. + */ + reserve(group: string, index: number, priority: MotionPriority): boolean; + /** + * Requests the playback for a motion. + * @param motion - The Motion, can be undefined. + * @param group - The motion group. + * @param index - Index in the motion group. + * @param priority - The priority to be applied. + * @return True if the request has been approved, i.e. the motion is allowed to play. + */ + start(motion: any, group: string, index: number, priority: MotionPriority): boolean; + /** + * Notifies the motion playback has finished. + */ + complete(): void; + /** + * Sets the current motion. + */ + setCurrent(group: string | undefined, index: number | undefined, priority: MotionPriority): void; + /** + * Sets the reserved motion. + */ + setReserved(group: string | undefined, index: number | undefined, priority: MotionPriority): void; + /** + * Sets the reserved idle motion. + */ + setReservedIdle(group: string | undefined, index: number | undefined): void; + /** + * Checks if a Motion is currently playing or has reserved. + * @return True if active. + */ + isActive(group: string, index: number): boolean; + /** + * Resets the state. + */ + reset(): void; + /** + * Checks if an idle motion should be requests to play. + */ + shouldRequestIdleMotion(): boolean; + /** + * Checks if the model's expression should be overridden by the motion. + */ + shouldOverrideExpression(): boolean; + /** + * Dumps the state for debugging. + */ + dump(requestedGroup?: string, requestedIndex?: number): string; +} +export interface MotionManagerOptions { + /** + * How to preload the motions. + * @default {@link MotionPreloadStrategy.NONE} + */ + motionPreload?: MotionPreloadStrategy; + /** + * Specifies the idle motion group. + * @default "idle" in Cubism 2 and "Idle" in Cubism 4. + */ + idleMotionGroup?: string; +} +/** + * Indicates how the motions will be preloaded. + */ +export declare enum MotionPreloadStrategy { + /** Preload all the motions. */ + ALL = "ALL", + /** Preload only the idle motions. */ + IDLE = "IDLE", + /** No preload. */ + NONE = "NONE" +} +/** + * Handles the motion playback. + * @emits {@link MotionManagerEvents} + */ +export declare abstract class MotionManager extends EventEmitter { + /** + * Tag for logging. + */ + tag: string; + /** + * Motion definitions copied from ModelSettings. + */ + abstract readonly definitions: Partial>; + /** + * Motion groups with particular internal usages. Currently there's only the `idle` field, + * which specifies the actual name of the idle motion group, so the idle motions + * can be correctly found from the settings JSON of various Cubism versions. + */ + abstract readonly groups: { + idle: string; + }; + /** + * Indicates the content type of the motion files, varies in different Cubism versions. + * This will be used as `xhr.responseType`. + */ + abstract readonly motionDataType: "json" | "arraybuffer"; + /** + * Can be undefined if the settings defines no expression. + */ + abstract expressionManager?: ExpressionManager; + /** + * The ModelSettings reference. + */ + readonly settings: ModelSettings; + /** + * The Motions. The structure is the same as {@link definitions}, initially each group contains + * an empty array, which means all motions will be `undefined`. When a Motion has been loaded, + * it'll fill the place in which it should be; when it fails to load, the place will be filled + * with `null`. + */ + motionGroups: Partial>; + /** + * Maintains the state of this MotionManager. + */ + state: MotionState; + /** + * Audio element of the current motion if a sound file is defined with it. + */ + currentAudio?: HTMLAudioElement; + /** + * Flags there's a motion playing. + */ + playing: boolean; + /** + * Flags the instances has been destroyed. + */ + destroyed: boolean; + protected constructor(settings: ModelSettings, options?: MotionManagerOptions); + /** + * Should be called in the constructor of derived class. + */ + protected init(options?: MotionManagerOptions): void; + /** + * Sets up motions from the definitions, and preloads them according to the preload strategy. + */ + protected setupMotions(options?: MotionManagerOptions): void; + /** + * Loads a Motion in a motion group. Errors in this method will not be thrown, + * but be emitted with a "motionLoadError" event. + * @param group - The motion group. + * @param index - Index in the motion group. + * @return Promise that resolves with the Motion, or with undefined if it can't be loaded. + * @emits {@link MotionManagerEvents.motionLoaded} + * @emits {@link MotionManagerEvents.motionLoadError} + */ + loadMotion(group: string, index: number): Promise; + /** + * Loads the Motion. Will be implemented by Live2DFactory in order to avoid circular dependency. + * @ignore + */ + private _loadMotion; + /** + * Starts a motion as given priority. + * @param group - The motion group. + * @param index - Index in the motion group. + * @param priority - The priority to be applied. + * @return Promise that resolves with true if the motion is successfully started, with false otherwise. + */ + startMotion(group: string, index: number, priority?: MotionPriority): Promise; + /** + * Starts a random Motion as given priority. + * @param group - The motion group. + * @param priority - The priority to be applied. + * @return Promise that resolves with true if the motion is successfully started, with false otherwise. + */ + startRandomMotion(group: string, priority?: MotionPriority): Promise; + /** + * Stops all playing motions as well as the sound. + */ + stopAllMotions(): void; + /** + * Updates parameters of the core model. + * @param model - The core model. + * @param now - Current time in milliseconds. + * @return True if the parameters have been actually updated. + */ + update(model: object, now: DOMHighResTimeStamp): boolean; + /** + * Destroys the instance. + * @emits {@link MotionManagerEvents.destroy} + */ + destroy(): void; + /** + * Checks if the motion playback has finished. + */ + abstract isFinished(): boolean; + /** + * Creates a Motion from the data. + * @param data - Content of the motion file. The format must be consistent with {@link MotionManager#motionDataType}. + * @param group - The motion group. + * @param definition - The motion definition. + * @return The created Motion. + */ + abstract createMotion(data: ArrayBuffer | JSONObject, group: string, definition: MotionSpec): Motion; + /** + * Retrieves the motion's file path by its definition. + * @return The file path extracted from given definition. Not resolved. + */ + abstract getMotionFile(definition: MotionSpec): string; + /** + * Retrieves the motion's name by its definition. + * @return The motion's name. + */ + protected abstract getMotionName(definition: MotionSpec): string; + /** + * Retrieves the motion's sound file by its definition. + * @return The motion's sound file, can be undefined. + */ + protected abstract getSoundFile(definition: MotionSpec): string | undefined; + /** + * Starts the Motion. + */ + protected abstract _startMotion(motion: Motion, onFinish?: (motion: Motion) => void): number; + /** + * Stops all playing motions. + */ + protected abstract _stopAllMotions(): void; + /** + * Updates parameters of the core model. + * @param model - The core model. + * @param now - Current time in milliseconds. + * @return True if the parameters have been actually updated. + */ + protected abstract updateParameters(model: object, now: DOMHighResTimeStamp): boolean; +} +export interface Live2DModelEvents { + /** + * @event - One or more hit areas are hit. + * @param - The names of *hit* hit areas. + */ + hit: [ + string[] + ]; + /** + * @event - The settings JSON has been loaded. + * @param - The settings JSON object. + */ + settingsJSONLoaded: [ + JSONObject + ]; + /** + * @event - The ModelSettings has been loaded. + * @param - The ModelSettings instance. + */ + settingsLoaded: [ + ModelSettings + ]; + /** + * @event - The textures have all been loaded. + * @param - The texture array. + */ + textureLoaded: [ + Texture[] + ]; + /** + * @event - The InternalModel has been loaded. + * @param - The InternalModel instance. + */ + modelLoaded: [ + InternalModel + ]; + /** + * @event - The Pose has been loaded. + * @param - The Pose instance, varies in different Cubism version. + */ + poseLoaded: [ + unknown + ]; + /** + * @event - The Physics has been loaded. + * @param - The Physics instance, varies in different Cubism version. + */ + physicsLoaded: [ + unknown + ]; + /** + * @event - All the essential resources have been loaded. + */ + ready: [ + ]; + /** + * @event - All the resources have been loaded. + */ + load: [ + ]; +} +export interface MotionManagerEvents { + /** + * @event - A Motion has been loaded. + * @param - The Motion instance, varies in different Cubism version. + */ + motionLoaded: [ + Motion + ]; + /** + * @event - An error occurs when loading a Motion. + * @param - The error. + */ + motionLoadError: [ + unknown + ]; + /** + * @event - Before destroyed. + */ + destroy: [ + ]; +} +export interface ExpressionManagerEvents { + /** + * @event - An Expression has been loaded. + * @param - The Expression instance, varies in different Cubism version. + */ + expressionLoaded: [ + Expression + ]; + /** + * @event - An error occurs when loading an Expression. + * @param - The error. + */ + expressionLoadError: [ + unknown + ]; + /** + * @event - Before destroyed. + */ + destroy: [ + ]; +} +export interface InternalModelEvents { + /** + * @event - Before the model's parameters are updated by the motion. + */ + beforeMotionUpdate: [ + ]; + /** + * @event - After the model's parameters are updated by the motion. + */ + afterMotionUpdate: [ + ]; + /** + * @event - Before the model is updated with its parameters applied. + */ + beforeModelUpdate: [ + ]; + /** + * @event - Before destroyed. + */ + destroy: [ + ]; +} +/** + * Abstract expression manager. + * @emits {@link ExpressionManagerEvents} + */ +export declare abstract class ExpressionManager extends EventEmitter { + /** + * Tag for logging. + */ + tag: string; + /** + * Expression definitions copied from ModelSettings. + */ + abstract readonly definitions: ExpressionSpec[]; + /** + * The ModelSettings reference. + */ + readonly settings: ModelSettings; + /** + * The Expressions. The structure is the same as {@link definitions}, initially there's only + * an empty array, which means all expressions will be `undefined`. When an Expression has + * been loaded, it'll fill the place in which it should be; when it fails to load, + * the place will be filled with `null`. + */ + expressions: (Expression | null | undefined)[]; + /** + * An empty Expression to reset all the expression parameters. + */ + defaultExpression: Expression; + /** + * Current Expression. This will not be overwritten by {@link ExpressionManager#defaultExpression}. + */ + currentExpression: Expression; + /** + * The pending Expression. + */ + reserveExpressionIndex: number; + /** + * Flags the instance has been destroyed. + */ + destroyed: boolean; + protected constructor(settings: ModelSettings, options?: MotionManagerOptions); + /** + * Should be called in the constructor of derived class. + */ + protected init(): void; + /** + * Loads an Expression. Errors in this method will not be thrown, + * but be emitted with an "expressionLoadError" event. + * @param index - Index of the expression in definitions. + * @return Promise that resolves with the Expression, or with undefined if it can't be loaded. + * @emits {@link ExpressionManagerEvents.expressionLoaded} + * @emits {@link ExpressionManagerEvents.expressionLoadError} + */ + protected loadExpression(index: number): Promise; + /** + * Loads the Expression. Will be implemented by Live2DFactory in order to avoid circular dependency. + * @ignore + */ + private _loadExpression; + /** + * Sets a random Expression that differs from current one. + * @return Promise that resolves with true if succeeded, with false otherwise. + */ + setRandomExpression(): Promise; + /** + * Resets model's expression using {@link ExpressionManager#defaultExpression}. + */ + resetExpression(): void; + /** + * Restores model's expression to {@link currentExpression}. + */ + restoreExpression(): void; + /** + * Sets an Expression. + * @param index - Either the index, or the name of the expression. + * @return Promise that resolves with true if succeeded, with false otherwise. + */ + setExpression(index: number | string): Promise; + /** + * Updates parameters of the core model. + * @return True if the parameters are actually updated. + */ + update(model: object, now: DOMHighResTimeStamp): boolean; + /** + * Destroys the instance. + * @emits {@link ExpressionManagerEvents.destroy} + */ + destroy(): void; + /** + * Checks if the expression playback has finished. + */ + abstract isFinished(): boolean; + /** + * Retrieves the expression's index by its name. + * @return The index. `-1` if not found. + */ + abstract getExpressionIndex(name: string): number; + /** + * Retrieves the expression's file path by its definition. + * @return The file path extracted from given definition. Not resolved. + */ + abstract getExpressionFile(definition: ExpressionSpec): string; + /** + * Creates an Expression from the data. + * @param data - Content of the expression file. + * @param definition - The expression definition. Can be undefined in order to create {@link ExpressionManager#defaultExpression}. + * @return The created Expression. + */ + abstract createExpression(data: JSONObject, definition: ExpressionSpec | undefined): Expression; + /** + * Applies the Expression to the model. + */ + protected abstract _setExpression(motion: Expression): number; + /** + * Cancels expression playback. + */ + protected abstract stopAllExpressions(): void; + /** + * Updates parameters of the core model. + * @return True if the parameters are actually updated. + */ + protected abstract updateParameters(model: object, now: DOMHighResTimeStamp): boolean; +} +/** + * Interpolates the transition of focus position. + */ +export declare class FocusController { + /** The focus position. */ + targetX: number; + /** The focus position. */ + targetY: number; + /** Current position. */ + x: number; + /** Current position. */ + y: number; + /** Current velocity. */ + vx: number; + /** Current velocity. */ + vy: number; + /** + * Sets the focus position. + * @param x - X position in range `[-1, 1]`. + * @param y - Y position in range `[-1, 1]`. + * @param instant - Should the focus position be instantly applied. + */ + focus(x: number, y: number, instant?: boolean): void; + /** + * Updates the interpolation. + * @param dt - Delta time in milliseconds. + */ + update(dt: DOMHighResTimeStamp): void; +} +/** + * Manages all the sounds. + */ +export declare class SoundManager { + /** + * Audio elements playing or pending to play. Finished audios will be removed automatically. + */ + static audios: HTMLAudioElement[]; + protected static _volume: number; + /** + * Global volume that applies to all the sounds. + */ + static get volume(): number; + static set volume(value: number); + /** + * Creates an audio element and adds it to the {@link audios}. + * @param file - URL of the sound file. + * @param onFinish - Callback invoked when the playback has finished. + * @param onError - Callback invoked when error occurs. + * @return Created audio element. + */ + static add(file: string, onFinish?: () => void, onError?: (e: Error) => void): HTMLAudioElement; + /** + * Plays the sound. + * @param audio - An audio element. + * @return Promise that resolves when the audio is ready to play, rejects when error occurs. + */ + static play(audio: HTMLAudioElement): Promise; + /** + * Disposes an audio element and removes it from {@link audios}. + * @param audio - An audio element. + */ + static dispose(audio: HTMLAudioElement): void; + /** + * Destroys all managed audios. + */ + static destroy(): void; +} +/** + * Common layout definition shared between all Cubism versions. + */ +export interface CommonLayout { + centerX?: number; + centerY?: number; + x?: number; + y?: number; + width?: number; + height?: number; + top?: number; + bottom?: number; + left?: number; + right?: number; +} +/** + * Common hit area definition shared between all Cubism versions. + */ +export interface CommonHitArea { + id: string; + name: string; + index: number; +} +export interface Bounds { + x: number; + y: number; + width: number; + height: number; +} +export interface InternalModelOptions extends MotionManagerOptions { +} +/** + * A wrapper that manages the states of a Live2D core model, and delegates all operations to it. + * @emits {@link InternalModelEvents} + */ +export declare abstract class InternalModel extends EventEmitter { + /** + * The managed Live2D core model. + */ + abstract readonly coreModel: object; + abstract readonly settings: ModelSettings; + focusController: FocusController; + abstract motionManager: MotionManager; + pose?: any; + physics?: any; + /** + * Original canvas width of the model. Note this doesn't represent the model's real size, + * as the model can overflow from its canvas. + */ + readonly originalWidth: number; + /** + * Original canvas height of the model. Note this doesn't represent the model's real size, + * as the model can overflow from its canvas. + */ + readonly originalHeight: number; + /** + * Canvas width of the model, scaled by the `width` of the model's layout. + */ + readonly width: number; + /** + * Canvas height of the model, scaled by the `height` of the model's layout. + */ + readonly height: number; + /** + * Local transformation, calculated from the model's layout. + */ + localTransform: Matrix; + /** + * The final matrix to draw the model. + */ + drawingMatrix: Matrix; + /** + * The hit area definitions, keyed by their names. + */ + hitAreas: Record; + /** + * Flags whether `gl.UNPACK_FLIP_Y_WEBGL` should be enabled when binding the textures. + */ + textureFlipY: boolean; + /** + * WebGL viewport when drawing the model. The format is `[x, y, width, height]`. + */ + viewport: [ + number, + number, + number, + number + ]; + /** + * Flags this instance has been destroyed. + */ + destroyed: boolean; + /** + * Should be called in the constructor of derived class. + */ + protected init(): void; + /** + * Sets up the model's size and local transform by the model's layout. + */ + protected setupLayout(): void; + /** + * Sets up the hit areas by their definitions in settings. + */ + protected setupHitAreas(): void; + /** + * Hit-test on the model. + * @param x - Position in model canvas. + * @param y - Position in model canvas. + * @return The names of the *hit* hit areas. Can be empty if none is hit. + */ + hitTest(x: number, y: number): string[]; + /** + * Hit-test for a single hit area. + * @param hitAreaName - The hit area's name. + * @param x - Position in model canvas. + * @param y - Position in model canvas. + * @return True if hit. + */ + isHit(hitAreaName: string, x: number, y: number): boolean; + /** + * Gets a drawable's bounds. + * @param index - Index of the drawable. + * @param bounds - Object to store the output values. + * @return The bounds in model canvas space. + */ + getDrawableBounds(index: number, bounds?: Bounds): Bounds; + /** + * Updates the model's transform. + * @param transform - The world transform. + */ + updateTransform(transform: Matrix): void; + /** + * Updates the model's parameters. + * @param dt - Elapsed time in milliseconds from last frame. + * @param now - Current time in milliseconds. + */ + update(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void; + /** + * Destroys the model and all related resources. + * @emits {@link InternalModelEvents.destroy | destroy} + */ + destroy(): void; + /** + * Gets all the hit area definitions. + * @return Normalized definitions. + */ + protected abstract getHitAreaDefs(): CommonHitArea[]; + /** + * Gets the model's original canvas size. + * @return `[width, height]` + */ + protected abstract getSize(): [ + number, + number + ]; + /** + * Gets the layout definition. + * @return Normalized definition. + */ + protected abstract getLayout(): CommonLayout; + /** + * Gets all the drawables' IDs. + * @return IDs. + */ + abstract getDrawableIDs(): string[]; + /** + * Finds the index of a drawable by its ID. + * @return The index. + */ + abstract getDrawableIndex(id: string): number; + /** + * Gets a drawable's vertices. + * @param index - Either the index or the ID of the drawable. + * @throws Error when the drawable cannot be found. + */ + abstract getDrawableVertices(index: number | string): Float32Array; + /** + * Updates WebGL context bound to this model. + * @param gl - WebGL context. + * @param glContextID - Unique ID for given WebGL context. + */ + abstract updateWebGLContext(gl: WebGLRenderingContext, glContextID: number): void; + /** + * Binds a texture to the model. The index must be the same as that of this texture + * in the {@link ModelSettings.textures} array. + */ + abstract bindTexture(index: number, texture: WebGLTexture): void; + /** + * Draws the model. + */ + abstract draw(gl: WebGLRenderingContext): void; +} +export declare type Middleware = (context: T, next: (err?: any) => Promise) => Promise; +export interface Live2DFactoryOptions extends Live2DModelOptions { + /** + * String to use for crossOrigin properties on `` elements when loading textures. + * @default undefined + */ + crossOrigin?: string; + /** + * Callback invoked when the model has been loaded. + * @default undefined + */ + onLoad?(): void; + /** + * Callback invoked when error occurs while loading the model. + * @default undefined + */ + onError?(e: Error): void; +} +/** + * The context transferred through the model creation middlewares. + */ +export interface Live2DFactoryContext { + source: any; + options: Live2DFactoryOptions; + live2dModel: Live2DModel; + internalModel?: InternalModel; + settings?: ModelSettings; +} +/** + * Represents a Cubism version. + */ +export interface Live2DRuntime { + /** + * The version number. Higher version takes priority when matching the runtime. + */ + version: number; + /** + * Checks if the source belongs to this runtime. + * @param source - Either a settings JSON object or a ModelSettings instance. + * @return True if the source belongs to this runtime. + */ + test(source: any): boolean; + ready(): Promise; + /** + * Checks if the data is a valid moc to create the core model. + * @param modelData - The moc content. + * @return True if the data is valid. + */ + isValidMoc(modelData: ArrayBuffer): boolean; + /** + * Creates a ModelSettings. + * @param json - The settings JSON object. + * @return Created ModelSettings. + */ + createModelSettings(json: JSONObject): ModelSettings; + /** + * Creates a core model. + * @param data - Content of the moc file. + * @return Created core model. + */ + createCoreModel(data: ArrayBuffer): any; + /** + * Creates an InternalModel. + * @param coreModel - Core model that *must* belong to this runtime. + * @param settings - ModelSettings of this model. + * @param options - Options that will be passed to the InternalModel's constructor. + * @return Created InternalModel. + */ + createInternalModel(coreModel: any, settings: ModelSettings, options?: Live2DFactoryOptions): InternalModel; + /** + * Creates a pose. + * @param coreModel - Core model that *must* belong to this runtime. + * @param data - Content of the pose file. + * @return Created pose. + */ + createPose(coreModel: any, data: any): any; + /** + * Creates a physics. + * @param coreModel - Core model that *must* belong to this runtime. + * @param data - Content of the physics file. + * @return Created physics. + */ + createPhysics(coreModel: any, data: any): any; +} +/** + * Handles all the network load tasks. + * + * - Model creation: requested by {@link Live2DModel.from}. + * - Motion loading: implements the load method of MotionManager. + * - Expression loading: implements the load method of ExpressionManager. + */ +export declare class Live2DFactory { + /** + * All registered runtimes, sorted by versions in descending order. + */ + static runtimes: Live2DRuntime[]; + static urlToJSON: Middleware; + static jsonToSettings: Middleware; + static waitUntilReady: Middleware; + static setupOptionals: Middleware; + static setupEssentials: Middleware; + static createInternalModel: Middleware; + /** + * Middlewares to run through when setting up a Live2DModel. + */ + static live2DModelMiddlewares: Middleware[]; + /** + * load tasks of each motion. The structure of each value in this map + * is the same as respective {@link MotionManager.definitions}. + */ + static motionTasksMap: WeakMap, Record | undefined)[]>>; + /** + * Load tasks of each expression. + */ + static expressionTasksMap: WeakMap, (Promise | undefined)[]>; + /** + * Registers a Live2DRuntime. + */ + static registerRuntime(runtime: Live2DRuntime): void; + /** + * Finds a runtime that matches given source. + * @param source - Either a settings JSON object or a ModelSettings instance. + * @return The Live2DRuntime, or undefined if not found. + */ + static findRuntime(source: any): Live2DRuntime | undefined; + /** + * Sets up a Live2DModel, populating it with all defined resources. + * @param live2dModel - The Live2DModel instance. + * @param source - Can be one of: settings file URL, settings JSON object, ModelSettings instance. + * @param options - Options for the process. + * @return Promise that resolves when all resources have been loaded, rejects when error occurs. + */ + static setupLive2DModel(live2dModel: Live2DModel, source: string | object | IM["settings"], options?: Live2DFactoryOptions): Promise; + /** + * Loads a Motion and registers the task to {@link motionTasksMap}. The task will be automatically + * canceled when its owner - the MotionManager instance - has been destroyed. + * @param motionManager - MotionManager that owns this Motion. + * @param group - The motion group. + * @param index - Index in the motion group. + * @return Promise that resolves with the Motion, or with undefined if it can't be loaded. + */ + static loadMotion(motionManager: MotionManager, group: string, index: number): Promise; + /** + * Loads an Expression and registers the task to {@link expressionTasksMap}. The task will be automatically + * canceled when its owner - the ExpressionManager instance - has been destroyed. + * @param expressionManager - ExpressionManager that owns this Expression. + * @param index - Index of the Expression. + * @return Promise that resolves with the Expression, or with undefined if it can't be loaded. + */ + static loadExpression(expressionManager: ExpressionManager, index: number): Promise; + static releaseTasks(this: MotionManager | ExpressionManager): void; +} +/** + * The interaction control split from Live2DModel class for code clarity. This mixin should *only* + * be used on the Live2DModel. + */ +export declare class InteractionMixin { + private _autoInteract; + /** + * Enables automatic interaction. Only takes effect if Pixi's interaction + * feature has been enabled (by registering the `PIXI.InteractionManager` into `PIXI.Renderer`). + */ + get autoInteract(): boolean; + set autoInteract(autoInteract: boolean); + /** + * Local reference used to clean up the event listeners when destroying the model. + */ + interactionManager?: InteractionManager; + /** + * Registers interaction by subscribing to the `PIXI.InteractionManager`. + */ + registerInteraction(this: Live2DModel, manager?: InteractionManager): void; + /** + * Unregisters interaction. + */ + unregisterInteraction(this: Live2DModel): void; +} +/** + * Useless class. May be useful in the future. + */ +export declare class Live2DTransform extends Transform { +} +export interface Live2DModelOptions extends MotionManagerOptions { + /** + * Should the internal model be automatically updated by `PIXI.Ticker.shared`. + * @default ture + */ + autoUpdate?: boolean; + /** + * Should the internal model automatically reacts to interactions by listening for pointer events. + * @see {@link InteractionMixin} + * @default true + */ + autoInteract?: boolean; +} +export declare type TickerClass = typeof Ticker; +export interface Live2DModel extends InteractionMixin { +} +export declare type Live2DConstructor = { + new (options?: Live2DModelOptions): Live2DModel; +}; +/** + * A wrapper that allows the Live2D model to be used as a DisplayObject in PixiJS. + * + * ```js + * const model = await Live2DModel.from('shizuku.model.json'); + * container.add(model); + * ``` + * @emits {@link Live2DModelEvents} + */ +export declare class Live2DModel extends Container { + /** + * Creates a Live2DModel from given source. + * @param source - Can be one of: settings file URL, settings JSON object, ModelSettings instance. + * @param options - Options for the creation. + * @return Promise that resolves with the Live2DModel. + */ + static from(this: M, source: string | JSONObject | ModelSettings, options?: Live2DFactoryOptions): Promise>; + /** + * Synchronous version of `Live2DModel.from()`. This method immediately returns a Live2DModel instance, + * whose resources have not been loaded. Therefore this model can't be manipulated or rendered + * until the "load" event has been emitted. + * + * ```js + * // no `await` here as it's not a Promise + * const model = Live2DModel.fromSync('shizuku.model.json'); + * + * // these will cause errors! + * // app.stage.addChild(model); + * // model.motion('tap_body'); + * + * model.once('load', () => { + * // now it's safe + * app.stage.addChild(model); + * model.motion('tap_body'); + * }); + * ``` + */ + static fromSync(this: M, source: string | JSONObject | ModelSettings, options?: Live2DFactoryOptions): InstanceType; + /** + * Registers the class of `PIXI.Ticker` for auto updating. + */ + static registerTicker(tickerClass: TickerClass): void; + /** + * Tag for logging. + */ + tag: string; + /** + * The internal model. Though typed as non-nullable, it'll be undefined until the "ready" event is emitted. + */ + internalModel: IM; + /** + * Pixi textures. + */ + textures: Texture[]; + /** @override */ + transform: Live2DTransform; + /** + * The anchor behaves like the one in `PIXI.Sprite`, where `(0, 0)` means the top left + * and `(1, 1)` means the bottom right. + */ + anchor: ObservablePoint; + /** + * An ID of Gl context that syncs with `renderer.CONTEXT_UID`. Used to check if the GL context has changed. + */ + protected glContextID: number; + /** + * Elapsed time in milliseconds since created. + */ + elapsedTime: DOMHighResTimeStamp; + /** + * Elapsed time in milliseconds from last frame to this frame. + */ + deltaTime: DOMHighResTimeStamp; + protected _autoUpdate: boolean; + /** + * Enables automatic updating. Requires {@link Live2DModel.registerTicker} or the global `window.PIXI.Ticker`. + */ + get autoUpdate(): boolean; + set autoUpdate(autoUpdate: boolean); + constructor(options?: Live2DModelOptions); + /** + * A handler of the "modelLoaded" event, invoked when the internal model has been loaded. + */ + protected init(options?: Live2DModelOptions): void; + /** + * A callback that observes {@link anchor}, invoked when the anchor's values have been changed. + */ + protected onAnchorChange(): void; + /** + * Shorthand to start a motion. + * @param group - The motion group. + * @param index - The index in this group. If not presented, a random motion will be started. + * @param priority - The motion priority. Defaults to `MotionPriority.NORMAL`. + * @return Promise that resolves with true if the motion is successfully started, with false otherwise. + */ + motion(group: string, index?: number, priority?: MotionPriority): Promise; + /** + * Shorthand to set an expression. + * @param id - Either the index, or the name of the expression. If not presented, a random expression will be set. + * @return Promise that resolves with true if succeeded, with false otherwise. + */ + expression(id?: number | string): Promise; + /** + * Updates the focus position. This will not cause the model to immediately look at the position, + * instead the movement will be interpolated. + * @param x - Position in world space. + * @param y - Position in world space. + * @param instant - Should the focus position be instantly applied. + */ + focus(x: number, y: number, instant?: boolean): void; + /** + * Tap on the model. This will perform a hit-testing, and emit a "hit" event + * if at least one of the hit areas is hit. + * @param x - Position in world space. + * @param y - Position in world space. + * @emits {@link Live2DModelEvents.hit} + */ + tap(x: number, y: number): void; + /** + * Hit-test on the model. + * @param x - Position in world space. + * @param y - Position in world space. + * @return The names of the *hit* hit areas. Can be empty if none is hit. + */ + hitTest(x: number, y: number): string[]; + /** + * Calculates the position in the canvas of original, unscaled Live2D model. + * @param position - A Point in world space. + * @param result - A Point to store the new value. Defaults to a new Point. + * @param skipUpdate - True to skip the update transform. + * @return The Point in model canvas space. + */ + toModelPosition(position: Point, result?: Point, skipUpdate?: boolean): Point; + /** + * A method required by `PIXI.InteractionManager` to perform hit-testing. + * @param point - A Point in world space. + * @return True if the point is inside this model. + */ + containsPoint(point: Point): boolean; + /** @override */ + protected _calculateBounds(): void; + /** + * An update callback to be added to `PIXI.Ticker` and invoked every tick. + */ + onTickerUpdate(): void; + /** + * Updates the model. Note this method just updates the timer, + * and the actual update will be done right before rendering the model. + * @param dt - The elapsed time in milliseconds since last frame. + */ + update(dt: DOMHighResTimeStamp): void; + _render(renderer: Renderer): void; + /** + * Destroys the model and all related resources. This takes the same options and also + * behaves the same as `PIXI.Container#destroy`. + * @param options - Options parameter. A boolean will act as if all options + * have been set to that value + * @param [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + destroy(options?: { + children?: boolean; + texture?: boolean; + baseTexture?: boolean; + }): void; +} +export declare namespace CubismConfig { + /** + * Support 4x4 mask division, which is unofficial and experimental. + * @see https://docs.live2d.com/cubism-sdk-manual/ow-sdk-mask-premake-web/?locale=en_us + * @default true + */ + let supportMoreMaskDivisions: boolean; + /** + * Set opacity values directly from motion curves, instead of getting the values calculated by Pose. + * This can prevent opacity values from being ignored when the model does not have a Pose. + * @see https://github.com/guansss/CubismWebFramework/pull/1 + * @default false + */ + let setOpacityFromMotion: boolean; +} +/** + * Global configs. + */ +export declare namespace config { + const LOG_LEVEL_VERBOSE = 0; + const LOG_LEVEL_WARNING = 1; + const LOG_LEVEL_ERROR = 2; + const LOG_LEVEL_NONE = 999; + /** + * Global log level. + * @default {@link LOG_LEVEL_WARNING} + */ + let logLevel: number; + /** + * Enabling sound for motions. + */ + let sound: boolean; + /** + * Deferring motion and corresponding sound until both are loaded. + */ + let motionSync: boolean; + /** + * Default fading duration for motions without such value specified. + */ + let motionFadingDuration: number; + /** + * Default fading duration for idle motions without such value specified. + */ + let idleMotionFadingDuration: number; + /** + * Default fading duration for expressions without such value specified. + */ + let expressionFadingDuration: number; + /** + * If false, expression will be reset to default when playing non-idle motions. + */ + let preserveExpressionOnMotion: boolean; + let cubism4: typeof CubismConfig; +} +/** + * Consistent with the `version` in package.json. + */ +export declare const VERSION: string; +export declare type Live2DLoaderTarget = Live2DModel | InternalModel | MotionManager | ExpressionManager; +/** + * The context transferred through Live2DLoader middlewares. + */ +export interface Live2DLoaderContext { + /** The XHR's response type. */ + type: XMLHttpRequestResponseType; + /** Will be resolved by {@link ModelSettings.resolveURL} if a ModelSettings is provided. */ + url: string; + /** If provided, the given URL will be resolved by {@link ModelSettings.resolveURL}. */ + settings?: ModelSettings; + /** + * Owner of this resource. The load task will be automatically canceled + * when receiving an "destroy" event from the target. + */ + target?: Live2DLoaderTarget; + /** Loaded data. */ + result?: any; +} +export declare class Live2DLoader { + static middlewares: Middleware[]; + /** + * Loads a resource. + * @return Promise that resolves with the loaded data in a format that's consistent with the specified `type`. + */ + static load(context: Live2DLoaderContext): Promise; +} +/** + * The basic XHR loader. + * + * A network error will be thrown with the following properties: + * - `url` - The request URL. + * - `status` - The HTTP status. + * - `aborted` - True if the error is caused by aborting the XHR. + */ +export declare class XHRLoader { + /** + * All the created XHRs, keyed by their owners respectively. + */ + static xhrMap: WeakMap>; + /** + * All the created XHRs as a flat array. + */ + static allXhrSet: Set; + /** + * Middleware for Live2DLoader. + */ + static loader: Middleware; + /** + * Creates a managed XHR. + * @param target - If provided, the XHR will be canceled when receiving an "destroy" event from the target. + * @param url - The URL. + * @param type - The XHR response type. + * @param onload - Load listener. + * @param onerror - Error handler. + */ + static createXHR(target: Live2DLoaderTarget | undefined, url: string, type: XMLHttpRequestResponseType, onload: (data: T) => void, onerror: (e: Error) => void): XMLHttpRequest; + /** + * Cancels all XHRs related to this target. + */ + static cancelXHRs(this: Live2DLoaderTarget): void; + /** + * Release all XHRs. + */ + static release(): void; +} +export declare type ExtendedFileList = File[] & { + settings?: ModelSettings; +}; +/** + * Experimental loader to load resources from uploaded files. + * + * This loader relies on + * [webkitRelativePath](https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath) + * to recognize the file path. + * + * Though named as a "Loader", this class has nothing to do with Live2DLoader, + * it only contains a middleware for the Live2DFactory. + */ +export declare class FileLoader { + /** + * Stores all the object URLs of uploaded files. + */ + static filesMap: { + [settingsFileURL: string]: { + [resourceFileURL: string]: string; + }; + }; + /** + * Resolves the path of a resource file to the object URL. + * @param settingsURL - Object URL of the settings file. + * @param filePath - Resource file path. + * @return Resolved object URL. + */ + static resolveURL(settingsURL: string, filePath: string): string; + /** + * Middleware for Live2DFactory. + */ + static factory: Middleware; + /** + * Consumes the files by storing their object URLs. Files not defined in the settings will be ignored. + */ + static upload(files: File[], settings: ModelSettings): Promise; + /** + * Creates a ModelSettings by given files. + * @return Promise that resolves with the created ModelSettings. + */ + static createSettings(files: File[]): Promise; + /** + * Reads a file as text in UTF-8. + */ + static readText(file: File): Promise; +} +export declare type ZipReader = any; +/** + * Experimental loader to load resources from a zip file. + * + * Though named as a "Loader", this class has nothing to do with Live2DLoader, + * it only contains a middleware for the Live2DFactory. + */ +export declare class ZipLoader { + static ZIP_PROTOCOL: string; + static uid: number; + static factory: Middleware; + static unzip(reader: ZipReader, settings: ModelSettings): Promise; + static createSettings(reader: ZipReader): Promise; + static zipReader(data: Blob, url: string): Promise; + static getFilePaths(reader: ZipReader): Promise; + static getFiles(reader: ZipReader, paths: string[]): Promise; + static readText(reader: ZipReader, path: string): Promise; + static releaseReader(reader: ZipReader): void; +} +/** + * A simple tagged logger. + * + * You can replace the methods with your own ones. + * + * ```js + * import { logger } from 'pixi-live2d-display'; + * + * logger.log = (tag, ...messages) => { + * console.log(tag, 'says:', ...messages); + * }; + * ``` + */ +export declare const logger: { + log(tag: string, ...messages: any[]): void; + warn(tag: string, ...messages: any[]): void; + error(tag: string, ...messages: any[]): void; +}; +/** + * These functions can be slightly faster than the ones in Lodash. + * @packageDocumentation + */ +export declare function clamp(num: number, lower: number, upper: number): number; +export declare function rand(min: number, max: number): number; +/** + * Copies a property at only if it matches the `type`. + * @param type - Type expected to match `typeof` on the property. + * @param from - Source object. + * @param to - Destination object. + * @param fromKey - Key of the property in source object. + * @param toKey - Key of the property in destination object. + */ +export declare function copyProperty>>(type: string, from: From, to: To, fromKey: FromKey, toKey: ToKey): void; +/** + * Copies an array at `key`, filtering the items that match the `type`. + * @param type - Type expected to match `typeof` on the items. + * @param from - Source object. + * @param to - Destination object. + * @param fromKey - Key of the array property in source object. + * @param toKey - Key of the array property in destination object. + */ +export declare function copyArray>, ToKey extends keyof any, To extends Partial>>(type: string, from: From, to: To, fromKey: FromKey, toKey: ToKey): void; +/** + * @see {@link https://www.typescriptlang.org/docs/handbook/mixins.html} + */ +export declare function applyMixins(derivedCtor: any, baseCtors: any[]): void; +/** + * Gets the name of parent folder in a url. + * @param url - URL of a file. + * @return Name of the parent folder, or the file itself if it has no parent folder. + */ +export declare function folderName(url: string): string; +/** + * Remove an element from array. + */ +export declare function remove(array: T[], item: T): void; +declare interface Live2DMotion { + onFinishHandler?(motion: this): void; +} +export namespace Cubism2Spec { + interface ModelJSON { + name?: string; + // files + model: string; + pose?: string; + physics?: string; + textures: string[]; + // metadata + layout?: Layout; + hit_areas?: HitArea[]; + init_params?: InitParam[]; + init_opacities?: InitOpacity[]; + // motions + expressions?: Expression[]; + motions?: Record; + } + interface Layout { + width?: number; + height?: number; + x?: number; + y?: number; + center_x?: number; + center_y?: number; + top?: number; + bottom?: number; + left?: number; + right?: number; + } + interface Motion { + /** `*.mtn` file. */ + file: string; + /** Sound file. */ + sound?: string; + /** Motion fade-in timeout. */ + fade_in?: number; + /** Motion fade-out timeout. */ + fade_out?: number; + } + interface Expression { + name: string; + /** `*.json` file. */ + file: string; + } + interface HitArea { + name: string; + id: string; + } + interface InitParam { + id: string; + value: number; + } + interface InitOpacity { + id: string; + value: number; + } + interface ExpressionJSON { + fade_in?: number; + fade_out?: number; + params?: { + id: string; + val: number; + def?: number; + calc?: "set" | "add" | "mult"; + }[]; + } + interface PhysicsJSON { + physics_hair?: { + "comment": string; + "setup": { + "length": number; + "regist": number; + "mass": number; + }; + "src": { + "id": string; + "ptype": "x" | "y" | "angle"; + "scale": number; + "weight": number; + }[]; + "targets": { + "id": string; + "ptype": "x" | "y" | "angle"; + "scale": number; + "weight": number; + }[]; + }[]; + } + interface PoseJSON { + "parts_visible": { + group: { + id: string; + link?: string[]; + }[]; + }[]; + } +} +export declare class Cubism2ModelSettings extends ModelSettings { + json: Cubism2Spec.ModelJSON; + moc: string; + textures: string[]; + pose?: string; + physics?: string; + layout?: Cubism2Spec.Layout; + hitAreas?: Cubism2Spec.HitArea[]; + initParams?: Cubism2Spec.InitParam[]; + initOpacities?: Cubism2Spec.InitOpacity[]; + expressions?: Cubism2Spec.Expression[]; + motions: Record; + /** + * Checks if a JSON object is valid model settings. + * @param json + */ + static isValidJSON(json: any): json is Cubism2Spec.ModelJSON; + constructor(json: Cubism2Spec.ModelJSON & { + url: string; + }); + /** + * Validates and copies *optional* properties from raw JSON. + */ + protected copy(json: Cubism2Spec.ModelJSON): void; + replaceFiles(replace: (file: string, path: string) => string): void; +} +export declare class Live2DExpression extends AMotion { + readonly params: NonNullable; + constructor(json: Cubism2Spec.ExpressionJSON); + /** @override */ + updateParamExe(model: Live2DModelWebGL, time: number, weight: number, motionQueueEnt: unknown): void; +} +export declare class Cubism2ExpressionManager extends ExpressionManager { + readonly queueManager: MotionQueueManager; + readonly definitions: Cubism2Spec.Expression[]; + readonly settings: Cubism2ModelSettings; + constructor(settings: Cubism2ModelSettings, options?: MotionManagerOptions); + isFinished(): boolean; + getExpressionIndex(name: string): number; + getExpressionFile(definition: Cubism2Spec.Expression): string; + createExpression(data: object, definition: Cubism2Spec.Expression | undefined): Live2DExpression; + protected _setExpression(motion: Live2DExpression): number; + protected stopAllExpressions(): void; + protected updateParameters(model: Live2DModelWebGL, dt: number): boolean; +} +export declare class Cubism2MotionManager extends MotionManager { + readonly definitions: Partial>; + readonly groups: { + readonly idle: "idle"; + }; + readonly motionDataType = "arraybuffer"; + readonly queueManager: MotionQueueManager; + readonly settings: Cubism2ModelSettings; + expressionManager?: Cubism2ExpressionManager; + constructor(settings: Cubism2ModelSettings, options?: MotionManagerOptions); + protected init(options?: MotionManagerOptions): void; + isFinished(): boolean; + createMotion(data: ArrayBuffer, group: string, definition: Cubism2Spec.Motion): Live2DMotion; + getMotionFile(definition: Cubism2Spec.Motion): string; + protected getMotionName(definition: Cubism2Spec.Motion): string; + protected getSoundFile(definition: Cubism2Spec.Motion): string | undefined; + protected _startMotion(motion: Live2DMotion, onFinish?: (motion: Live2DMotion) => void): number; + protected _stopAllMotions(): void; + protected updateParameters(model: Live2DModelWebGL, now: DOMHighResTimeStamp): boolean; + destroy(): void; +} +export declare const enum EyeState { + Idle = 0, + Closing = 1, + Closed = 2, + Opening = 3 +} +export declare class Live2DEyeBlink { + readonly coreModel: Live2DModelWebGL; + leftParam: number; + rightParam: number; + blinkInterval: DOMHighResTimeStamp; + closingDuration: DOMHighResTimeStamp; + closedDuration: DOMHighResTimeStamp; + openingDuration: DOMHighResTimeStamp; + eyeState: EyeState; + eyeParamValue: number; + closedTimer: number; + nextBlinkTimeLeft: number; + constructor(coreModel: Live2DModelWebGL); + setEyeParams(value: number): void; + update(dt: DOMHighResTimeStamp): void; +} +export declare class Live2DPhysics { + readonly coreModel: Live2DModelWebGL; + physicsHairs: PhysicsHair[]; + constructor(coreModel: Live2DModelWebGL, json: Cubism2Spec.PhysicsJSON); + update(elapsed: DOMHighResTimeStamp): void; +} +declare class Live2DPartsParam { + readonly id: string; + paramIndex: number; + partsIndex: number; + link: Live2DPartsParam[]; + constructor(id: string); + initIndex(model: Live2DModelWebGL): void; +} +export declare class Live2DPose { + readonly coreModel: Live2DModelWebGL; + opacityAnimDuration: DOMHighResTimeStamp; + partsGroups: Live2DPartsParam[][]; + constructor(coreModel: Live2DModelWebGL, json: Cubism2Spec.PoseJSON); + init(): void; + normalizePartsOpacityGroup(partsGroup: Live2DPartsParam[], dt: DOMHighResTimeStamp): void; + copyOpacity(partsGroup: Live2DPartsParam[]): void; + update(dt: DOMHighResTimeStamp): void; +} +export declare class Cubism2InternalModel extends InternalModel { + settings: Cubism2ModelSettings; + coreModel: Live2DModelWebGL; + motionManager: Cubism2MotionManager; + eyeBlink?: Live2DEyeBlink; + physics?: Live2DPhysics; + pose?: Live2DPose; + eyeballXParamIndex: number; + eyeballYParamIndex: number; + angleXParamIndex: number; + angleYParamIndex: number; + angleZParamIndex: number; + bodyAngleXParamIndex: number; + breathParamIndex: number; + textureFlipY: boolean; + /** + * Number of the drawables in this model. + */ + drawDataCount: number; + /** + * If true, the face culling will always be disabled when drawing the model, + * regardless of the model's internal flags. + */ + disableCulling: boolean; + constructor(coreModel: Live2DModelWebGL, settings: Cubism2ModelSettings, options?: InternalModelOptions); + protected init(): void; + protected getSize(): [ + number, + number + ]; + protected getLayout(): CommonLayout; + updateWebGLContext(gl: WebGLRenderingContext, glContextID: number): void; + bindTexture(index: number, texture: WebGLTexture): void; + protected getHitAreaDefs(): CommonHitArea[]; + getDrawableIDs(): string[]; + getDrawableIndex(id: string): number; + getDrawableVertices(drawIndex: number | string): Float32Array; + update(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void; + updateFocus(): void; + updateNaturalMovements(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void; + draw(gl: WebGLRenderingContext): void; + destroy(): void; +} +export namespace CubismSpec { + export interface ModelJSON { + /** + * Json file format version. + */ + Version: number; + /** + * Relative paths from the model3.json to other files. + */ + FileReferences: { + /** + * Relative path to the moc3 file. + */ + Moc: string; + /** + * Relative paths to the textures. + */ + Textures: string[]; + /** + * [Optional] Relative path to the physics3.json file. + */ + Physics?: string; + /** + * [Optional] Relative path to the userdata3.json file. + */ + UserData?: string; + /** + * [Optional] Relative path to the pose3.json file. + */ + Pose?: string; + /** + * [Optional] Relative path to the cdi3.json file. + */ + DisplayInfo?: string; + /** + * [Optional] Relative path to the exp3.json file. + */ + Expressions?: Expression[]; + /** + * [Optional] Relative path to the motion3.json file. + */ + Motions?: { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".+". + */ + [k: string]: Motion[]; + }; + }; + /** + * [Optional] groups. + */ + Groups?: Group[]; + /** + * [Optional]Collision detection + */ + HitAreas?: HitArea[]; + /** + * [Optional]Layout + */ + Layout?: { + Width?: number; + Height?: number; + X?: number; + Y?: number; + CenterX?: number; + CenterY?: number; + }; + } + /** + * Motion. + */ + export interface Motion { + /** + * File name. + */ + File: string; + /** + * [Optional] Time of the Fade-out for motion easing in seconds. + */ + FadeOutTime?: number; + /** + * [Optional] Time of the Fade-In for motion easing in seconds.. + */ + FadeInTime?: number; + /** + * [Optional] Audio files playback with motion. + */ + Sound?: string; + } + /** + * Group entry. + */ + export interface Group { + /** + * Target of group. + */ + Target: { + [k: string]: unknown; + }; + /** + * Unique name of group. + */ + Name: string; + /** + * IDs for mapping to target. + */ + Ids: string[]; + } + /** + * Collision detection. + */ + export interface HitArea { + /** + * Unique name of group. + */ + Name: string; + /** + * IDs for mapping to target. + */ + Id: string; + } + export interface Expression { + Name: string; + File: string; + } + export interface MotionJSON { + /** + * Json file format version. + */ + Version: number; + /** + * Additional data describing the motion. + */ + Meta: { + /** + * Duration of the motion in seconds. + */ + Duration: number; + /** + * Framerate of the motion in seconds. + */ + Fps: number; + /** + * [Optional] Status of the looping of the motion. + */ + Loop?: boolean; + /** + * [Optional] Status of the restriction of Bezier handles'X translations. + */ + AreBeziersRestricted?: boolean; + /** + * [Optional] Time of the overall Fade-In for easing in seconds. + */ + FadeInTime?: number; + /** + * [Optional] Time of the overall Fade-Out for easing in seconds. + */ + FadeOutTime?: number; + /** + * The total number of curves. + */ + CurveCount: number; + /** + * The total number of segments (from all curves). + */ + TotalSegmentCount: number; + /** + * The total number of points (from all segments of all curves). + */ + TotalPointCount: number; + /** + * [Optional] The total number of UserData. + */ + UserDataCount?: number; + /** + * [Optional] The total size of UserData in bytes. + */ + TotalUserDataSize?: number; + }; + /** + * Motion curves. + */ + Curves: Curve[]; + /** + * [Optional] User data. + */ + UserData?: { + /** + * Time in seconds. + */ + Time: number; + /** + * Content of user data. + */ + Value: string; + }[]; + } + /** + * Single curve. + */ + export interface Curve { + /** + * Target type. + */ + Target: string; + /** + * Identifier for mapping curve to target. + */ + Id: string; + /** + * [Optional] Time of the Fade-In for easing in seconds. + */ + FadeInTime?: number; + /** + * [Optional] Time of the Fade-Out for easing in seconds. + */ + FadeOutTime?: number; + /** + * Flattened segments. + */ + Segments: number[]; + } + export interface ExpressionJSON { + /** + * Json file format type. + */ + Type: "Live2D Expression"; + /** + * [Optional] Time of the Fade-In for easing in seconds. + */ + FadeInTime?: number; + /** + * [Optional] Time of the Fade-Out for easing in seconds. + */ + FadeOutTime?: number; + Parameters: { + Id: string; + Value: number; + Blend?: "Add" | "Multiply" | "Overwrite"; + }[]; + } + export interface PhysicsJSON { + /** + * Physics Settings. + */ + PhysicsSettings: { + /** + * Identifier for Physics settings(each model is different). + */ + Id: string; + /** + * Input. + */ + Input: { + /** + * Targeted parameter. + */ + Source: { + /** + * Target type. + */ + Target: string; + /** + * Parameter ID. + */ + Id: string; + }; + /** + * Effectiveness:propotion of each type(0~100%). + */ + Weight: number; + /** + * Type X or Angle. + */ + Type: string; + /** + * Reflect. + */ + Reflect: boolean; + }[]; + /** + * Output. + */ + Output: { + /** + * Targeted parameter. + */ + Destination: { + /** + * Target type. + */ + Target: string; + /** + * Parameter ID. + */ + Id: string; + }; + /** + * Number(0 origin) of parent pendulum(Vertex). + */ + VertexIndex: number; + /** + * Scale + */ + Scale: number; + /** + * Effectiveness:propotion of each type(0~100%). + */ + Weight: number; + /** + * Type X or Angle (Angle might be fixed) + */ + Type: string; + /** + * Reflect + */ + Reflect: boolean; + }[]; + /** + * Array of the pendulums + */ + Vertices: Vertex[]; + /** + * Parameter(input value normalized). + */ + Normalization: { + /** + * Normalization value of position. + */ + Position: { + /** + * Normalized minimum. + */ + Minimum: number; + /** + * Center of the range of normalization. + */ + Default: number; + /** + * Normalized maximum. + */ + Maximum: number; + }; + /** + * Normalization value of angle. + */ + Angle: { + /** + * Normalized minimum. + */ + Minimum: number; + /** + * Center of the range of normalization. + */ + Default: number; + /** + * Normalized maximum. + */ + Maximum: number; + }; + }; + }[]; + /** + * Json file format version. + */ + Version: number; + /** + * Additional data describing the physics. + */ + Meta: { + /** + * Number of physics settings. + */ + PhysicsSettingCount: number; + /** + * Total number of input parameters. + */ + TotalInputCount: number; + /** + * Total number of output parameters. + */ + TotalOutputCount: number; + /** + * Total number of vertices. + */ + VertexCount: number; + /** + * Settings of gravity and wind. + */ + EffectiveForces: { + /** + * Gravity. + */ + Gravity: { + X: number; + Y: number; + }; + /** + * Wind. + */ + Wind: { + X: number; + Y: number; + }; + }; + /** + * List of names and identifiers of Physics setting. + */ + PhysicsDictionary: { + /** + * Identifier for Physics settings(each model is different). + */ + Id: string; + /** + * Name of Physics settings(group name). + */ + Name: string; + }[]; + }; + } + /** + * Single vertex. + */ + export interface Vertex { + /** + * Default position. + */ + Position: { + X: number; + Y: number; + }; + /** + * Shaking influence. + */ + Mobility: number; + /** + * Reaction time. + */ + Delay: number; + /** + * Overall acceleration. + */ + Acceleration: number; + /** + * Radius of pendulum. + */ + Radius: number; + } + export interface PoseJSON { + Type: "Live2D Pose"; + /** + * Time of the Fade-In for easing in seconds. + */ + FadeInTime?: number; + /** + * List of the switching control groups. + */ + Groups: { + /** + * Main switching Part ID. + */ + Id: string; + /** + * List of the linked switching Part IDs. + */ + Link?: string[]; + }[][]; + } + export interface UserDataJSON { + /** + * Json file format version. + */ + Version: number; + /** + * Additional data describing the user data. + */ + Meta: { + /** + * The total number of UserData. + */ + UserDataCount: number; + /** + * The total size of UserData in bytes. + */ + TotalUserDataSize: number; + }; + /** + * User data. + */ + UserData: UserData[]; + } + /** + * User data. + */ + export interface UserData { + /** + * Target type. + */ + Target: string; + /** + * Identifier for mapping to target. + */ + Id: string; + /** + * Content of user data. + */ + Value: string; + } +} +declare class CubismModelSettingsJson { + constructor(json: CubismSpec.ModelJSON); + getEyeBlinkParameters(): string[] | undefined; + getLipSyncParameters(): string[] | undefined; + groups?: CubismSpec.Group[]; + moc: string; + expressions?: CubismSpec.Expression[]; + motions?: Record; + textures: string[]; + physics?: string; + pose?: string; + hitAreas?: CubismSpec.HitArea[]; + layout?: CubismSpec.ModelJSON["Layout"]; +} +export interface Cubism4ModelSettings extends CubismModelSettingsJson { +} +export declare class Cubism4ModelSettings extends ModelSettings { + json: CubismSpec.ModelJSON; + moc: string; + textures: string[]; + static isValidJSON(json: any): json is CubismSpec.ModelJSON; + constructor(json: CubismSpec.ModelJSON & { + url: string; + }); + replaceFiles(replace: (file: string, path: string) => string): void; +} +declare class CubismMatrix44 { + /** + * コンストラクタ + */ + constructor(); + /** + * 受け取った2つの行列の乗算を行う。 + * + * @param a 行列a + * @param b 行列b + * @return 乗算結果の行列 + */ + static multiply(a: Float32Array, b: Float32Array, dst: Float32Array): void; + /** + * 単位行列に初期化する + */ + loadIdentity(): void; + /** + * 行列を設定 + * + * @param tr 16個の浮動小数点数で表される4x4の行列 + */ + setMatrix(tr: Float32Array): void; + /** + * 行列を浮動小数点数の配列で取得 + * + * @return 16個の浮動小数点数で表される4x4の行列 + */ + getArray(): Float32Array; + /** + * X軸の拡大率を取得 + * @return X軸の拡大率 + */ + getScaleX(): number; + /** + * Y軸の拡大率を取得する + * + * @return Y軸の拡大率 + */ + getScaleY(): number; + /** + * X軸の移動量を取得 + * @return X軸の移動量 + */ + getTranslateX(): number; + /** + * Y軸の移動量を取得 + * @return Y軸の移動量 + */ + getTranslateY(): number; + /** + * X軸の値を現在の行列で計算 + * + * @param src X軸の値 + * @return 現在の行列で計算されたX軸の値 + */ + transformX(src: number): number; + /** + * Y軸の値を現在の行列で計算 + * + * @param src Y軸の値 + * @return 現在の行列で計算されたY軸の値 + */ + transformY(src: number): number; + /** + * X軸の値を現在の行列で逆計算 + */ + invertTransformX(src: number): number; + /** + * Y軸の値を現在の行列で逆計算 + */ + invertTransformY(src: number): number; + /** + * 現在の行列の位置を起点にして移動 + * + * 現在の行列の位置を起点にして相対的に移動する。 + * + * @param x X軸の移動量 + * @param y Y軸の移動量 + */ + translateRelative(x: number, y: number): void; + /** + * 現在の行列の位置を移動 + * + * 現在の行列の位置を指定した位置へ移動する + * + * @param x X軸の移動量 + * @param y y軸の移動量 + */ + translate(x: number, y: number): void; + /** + * 現在の行列のX軸の位置を指定した位置へ移動する + * + * @param x X軸の移動量 + */ + translateX(x: number): void; + /** + * 現在の行列のY軸の位置を指定した位置へ移動する + * + * @param y Y軸の移動量 + */ + translateY(y: number): void; + /** + * 現在の行列の拡大率を相対的に設定する + * + * @param x X軸の拡大率 + * @param y Y軸の拡大率 + */ + scaleRelative(x: number, y: number): void; + /** + * 現在の行列の拡大率を指定した倍率に設定する + * + * @param x X軸の拡大率 + * @param y Y軸の拡大率 + */ + scale(x: number, y: number): void; + /** + * 現在の行列に行列を乗算 + * + * @param m 行列 + */ + multiplyByMatrix(m: CubismMatrix44): void; + /** + * オブジェクトのコピーを生成する + */ + clone(): CubismMatrix44; + protected _tr: Float32Array; +} +declare abstract class CubismRenderer { + /** + * レンダラの初期化処理を実行する + * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる + * @param model モデルのインスタンス + */ + initialize(model: CubismModel): void; + /** + * モデルを描画する + */ + drawModel(): void; + /** + * Model-View-Projection 行列をセットする + * 配列は複製されるので、元の配列は外で破棄して良い + * @param matrix44 Model-View-Projection 行列 + */ + setMvpMatrix(matrix44: CubismMatrix44): void; + /** + * Model-View-Projection 行列を取得する + * @return Model-View-Projection 行列 + */ + getMvpMatrix(): CubismMatrix44; + /** + * モデルの色をセットする + * 各色0.0~1.0の間で指定する(1.0が標準の状態) + * @param red 赤チャンネルの値 + * @param green 緑チャンネルの値 + * @param blue 青チャンネルの値 + * @param alpha αチャンネルの値 + */ + setModelColor(red: number, green: number, blue: number, alpha: number): void; + /** + * モデルの色を取得する + * 各色0.0~1.0の間で指定する(1.0が標準の状態) + * + * @return RGBAのカラー情報 + */ + getModelColor(): CubismTextureColor; + /** + * 乗算済みαの有効・無効をセットする + * 有効にするならtrue、無効にするならfalseをセットする + */ + setIsPremultipliedAlpha(enable: boolean): void; + /** + * 乗算済みαの有効・無効を取得する + * @return true 乗算済みのα有効 + * @return false 乗算済みのα無効 + */ + isPremultipliedAlpha(): boolean; + /** + * カリング(片面描画)の有効・無効をセットする。 + * 有効にするならtrue、無効にするならfalseをセットする + */ + setIsCulling(culling: boolean): void; + /** + * カリング(片面描画)の有効・無効を取得する。 + * @return true カリング有効 + * @return false カリング無効 + */ + isCulling(): boolean; + /** + * テクスチャの異方性フィルタリングのパラメータをセットする + * パラメータ値の影響度はレンダラの実装に依存する + * @param n パラメータの値 + */ + setAnisotropy(n: number): void; + /** + * テクスチャの異方性フィルタリングのパラメータをセットする + * @return 異方性フィルタリングのパラメータ + */ + getAnisotropy(): number; + /** + * レンダリングするモデルを取得する + * @return レンダリングするモデル + */ + getModel(): CubismModel; + /** + * コンストラクタ + */ + protected constructor(); + /** + * モデル描画の実装 + */ + abstract doDrawModel(): void; + /** + * 描画オブジェクト(アートメッシュ)を描画する + * ポリゴンメッシュとテクスチャ番号をセットで渡す。 + * @param textureNo 描画するテクスチャ番号 + * @param indexCount 描画オブジェクトのインデックス値 + * @param vertexCount ポリゴンメッシュの頂点数 + * @param indexArray ポリゴンメッシュ頂点のインデックス配列 + * @param vertexArray ポリゴンメッシュの頂点配列 + * @param uvArray uv配列 + * @param opacity 不透明度 + * @param colorBlendMode カラーブレンディングのタイプ + * @param invertedMask マスク使用時のマスクの反転使用 + */ + abstract drawMesh(textureNo: number, indexCount: number, vertexCount: number, indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array, opacity: number, colorBlendMode: CubismBlendMode, invertedMask: boolean): void; + /** + * レンダラが保持する静的なリソースを開放する + */ + static staticRelease: Function; + protected _mvpMatrix4x4: CubismMatrix44; + protected _modelColor: CubismTextureColor; + protected _isCulling: boolean; + protected _isPremultipliedAlpha: boolean; + protected _anisortopy: any; + protected _model: CubismModel; +} +declare enum CubismBlendMode { + CubismBlendMode_Normal = 0, + CubismBlendMode_Additive = 1, + CubismBlendMode_Multiplicative = 2 +} +declare class CubismTextureColor { + /** + * コンストラクタ + */ + constructor(); + R: number; + G: number; + B: number; + A: number; +} +declare class CubismModel { + /** + * モデルのパラメータの更新 + */ + update(): void; + /** + * キャンバスの幅を取得する + */ + getCanvasWidth(): number; + /** + * キャンバスの高さを取得する + */ + getCanvasHeight(): number; + /** + * パラメータを保存する + */ + saveParameters(): void; + /** + * モデルを取得 + */ + getModel(): Live2DCubismCore.Model; + /** + * パーツのインデックスを取得 + * @param partId パーツのID + * @return パーツのインデックス + */ + getPartIndex(partId: string): number; + /** + * パーツの個数の取得 + * @return パーツの個数 + */ + getPartCount(): number; + /** + * パーツの不透明度の設定(Index) + * @param partIndex パーツのインデックス + * @param opacity 不透明度 + */ + setPartOpacityByIndex(partIndex: number, opacity: number): void; + /** + * パーツの不透明度の設定(Id) + * @param partId パーツのID + * @param opacity パーツの不透明度 + */ + setPartOpacityById(partId: string, opacity: number): void; + /** + * パーツの不透明度の取得(index) + * @param partIndex パーツのインデックス + * @return パーツの不透明度 + */ + getPartOpacityByIndex(partIndex: number): number; + /** + * パーツの不透明度の取得(id) + * @param partId パーツのId + * @return パーツの不透明度 + */ + getPartOpacityById(partId: string): number; + /** + * パラメータのインデックスの取得 + * @param パラメータID + * @return パラメータのインデックス + */ + getParameterIndex(parameterId: string): number; + /** + * パラメータの個数の取得 + * @return パラメータの個数 + */ + getParameterCount(): number; + /** + * パラメータの最大値の取得 + * @param parameterIndex パラメータのインデックス + * @return パラメータの最大値 + */ + getParameterMaximumValue(parameterIndex: number): number; + /** + * パラメータの最小値の取得 + * @param parameterIndex パラメータのインデックス + * @return パラメータの最小値 + */ + getParameterMinimumValue(parameterIndex: number): number; + /** + * パラメータのデフォルト値の取得 + * @param parameterIndex パラメータのインデックス + * @return パラメータのデフォルト値 + */ + getParameterDefaultValue(parameterIndex: number): number; + /** + * パラメータの値の取得 + * @param parameterIndex パラメータのインデックス + * @return パラメータの値 + */ + getParameterValueByIndex(parameterIndex: number): number; + /** + * パラメータの値の取得 + * @param parameterId パラメータのID + * @return パラメータの値 + */ + getParameterValueById(parameterId: string): number; + /** + * パラメータの値の設定 + * @param parameterIndex パラメータのインデックス + * @param value パラメータの値 + * @param weight 重み + */ + setParameterValueByIndex(parameterIndex: number, value: number, weight?: number): void; + /** + * パラメータの値の設定 + * @param parameterId パラメータのID + * @param value パラメータの値 + * @param weight 重み + */ + setParameterValueById(parameterId: string, value: number, weight?: number): void; + /** + * パラメータの値の加算(index) + * @param parameterIndex パラメータインデックス + * @param value 加算する値 + * @param weight 重み + */ + addParameterValueByIndex(parameterIndex: number, value: number, weight?: number): void; + /** + * パラメータの値の加算(id) + * @param parameterId パラメータID + * @param value 加算する値 + * @param weight 重み + */ + addParameterValueById(parameterId: any, value: number, weight?: number): void; + /** + * パラメータの値の乗算 + * @param parameterId パラメータのID + * @param value 乗算する値 + * @param weight 重み + */ + multiplyParameterValueById(parameterId: string, value: number, weight?: number): void; + /** + * パラメータの値の乗算 + * @param parameterIndex パラメータのインデックス + * @param value 乗算する値 + * @param weight 重み + */ + multiplyParameterValueByIndex(parameterIndex: number, value: number, weight?: number): void; + getDrawableIds(): string[]; + /** + * Drawableのインデックスの取得 + * @param drawableId DrawableのID + * @return Drawableのインデックス + */ + getDrawableIndex(drawableId: string): number; + /** + * Drawableの個数の取得 + * @return drawableの個数 + */ + getDrawableCount(): number; + /** + * DrawableのIDを取得する + * @param drawableIndex Drawableのインデックス + * @return drawableのID + */ + getDrawableId(drawableIndex: number): string; + /** + * Drawableの描画順リストの取得 + * @return Drawableの描画順リスト + */ + getDrawableRenderOrders(): Int32Array; + /** + * Drawableのテクスチャインデックスリストの取得 + * @param drawableIndex Drawableのインデックス + * @return drawableのテクスチャインデックスリスト + */ + getDrawableTextureIndices(drawableIndex: number): number; + /** + * DrawableのVertexPositionsの変化情報の取得 + * + * 直近のCubismModel.update関数でDrawableの頂点情報が変化したかを取得する。 + * + * @param drawableIndex Drawableのインデックス + * @retval true Drawableの頂点情報が直近のCubismModel.update関数で変化した + * @retval false Drawableの頂点情報が直近のCubismModel.update関数で変化していない + */ + getDrawableDynamicFlagVertexPositionsDidChange(drawableIndex: number): boolean; + /** + * Drawableの頂点インデックスの個数の取得 + * @param drawableIndex Drawableのインデックス + * @return drawableの頂点インデックスの個数 + */ + getDrawableVertexIndexCount(drawableIndex: number): number; + /** + * Drawableの頂点の個数の取得 + * @param drawableIndex Drawableのインデックス + * @return drawableの頂点の個数 + */ + getDrawableVertexCount(drawableIndex: number): number; + /** + * Drawableの頂点リストの取得 + * @param drawableIndex drawableのインデックス + * @return drawableの頂点リスト + */ + getDrawableVertices(drawableIndex: number): Float32Array; + /** + * Drawableの頂点インデックスリストの取得 + * @param drarableIndex Drawableのインデックス + * @return drawableの頂点インデックスリスト + */ + getDrawableVertexIndices(drawableIndex: number): Uint16Array; + /** + * Drawableの頂点リストの取得 + * @param drawableIndex Drawableのインデックス + * @return drawableの頂点リスト + */ + getDrawableVertexPositions(drawableIndex: number): Float32Array; + /** + * Drawableの頂点のUVリストの取得 + * @param drawableIndex Drawableのインデックス + * @return drawableの頂点UVリスト + */ + getDrawableVertexUvs(drawableIndex: number): Float32Array; + /** + * Drawableの不透明度の取得 + * @param drawableIndex Drawableのインデックス + * @return drawableの不透明度 + */ + getDrawableOpacity(drawableIndex: number): number; + /** + * Drawableのカリング情報の取得 + * @param drawableIndex Drawableのインデックス + * @return drawableのカリング情報 + */ + getDrawableCulling(drawableIndex: number): boolean; + /** + * Drawableのブレンドモードを取得 + * @param drawableIndex Drawableのインデックス + * @return drawableのブレンドモード + */ + getDrawableBlendMode(drawableIndex: number): CubismBlendMode; + /** + * Drawableのマスクの反転使用の取得 + * + * Drawableのマスク使用時の反転設定を取得する。 + * マスクを使用しない場合は無視される。 + * + * @param drawableIndex Drawableのインデックス + * @return Drawableの反転設定 + */ + getDrawableInvertedMaskBit(drawableIndex: number): boolean; + /** + * Drawableのクリッピングマスクリストの取得 + * @return Drawableのクリッピングマスクリスト + */ + getDrawableMasks(): Int32Array[]; + /** + * Drawableのクリッピングマスクの個数リストの取得 + * @return Drawableのクリッピングマスクの個数リスト + */ + getDrawableMaskCounts(): Int32Array; + /** + * クリッピングマスクの使用状態 + * + * @return true クリッピングマスクを使用している + * @return false クリッピングマスクを使用していない + */ + isUsingMasking(): boolean; + /** + * Drawableの表示情報を取得する + * + * @param drawableIndex Drawableのインデックス + * @return true Drawableが表示 + * @return false Drawableが非表示 + */ + getDrawableDynamicFlagIsVisible(drawableIndex: number): boolean; + /** + * DrawableのDrawOrderの変化情報の取得 + * + * 直近のCubismModel.update関数でdrawableのdrawOrderが変化したかを取得する。 + * drawOrderはartMesh上で指定する0から1000の情報 + * @param drawableIndex drawableのインデックス + * @return true drawableの不透明度が直近のCubismModel.update関数で変化した + * @return false drawableの不透明度が直近のCubismModel.update関数で変化している + */ + getDrawableDynamicFlagVisibilityDidChange(drawableIndex: number): boolean; + /** + * Drawableの不透明度の変化情報の取得 + * + * 直近のCubismModel.update関数でdrawableの不透明度が変化したかを取得する。 + * + * @param drawableIndex drawableのインデックス + * @return true Drawableの不透明度が直近のCubismModel.update関数で変化した + * @return false Drawableの不透明度が直近のCubismModel.update関数で変化してない + */ + getDrawableDynamicFlagOpacityDidChange(drawableIndex: number): boolean; + /** + * Drawableの描画順序の変化情報の取得 + * + * 直近のCubismModel.update関数でDrawableの描画の順序が変化したかを取得する。 + * + * @param drawableIndex Drawableのインデックス + * @return true Drawableの描画の順序が直近のCubismModel.update関数で変化した + * @return false Drawableの描画の順序が直近のCubismModel.update関数で変化してない + */ + getDrawableDynamicFlagRenderOrderDidChange(drawableIndex: number): boolean; + /** + * 保存されたパラメータの読み込み + */ + loadParameters(): void; + /** + * 初期化する + */ + initialize(): void; + /** + * コンストラクタ + * @param model モデル + */ + constructor(model: Live2DCubismCore.Model); + /** + * デストラクタ相当の処理 + */ + release(): void; + private _notExistPartOpacities; + private _notExistPartId; + private _notExistParameterValues; + private _notExistParameterId; + private _savedParameters; + private _model; + private _parameterValues; + private _parameterMaximumValues; + private _parameterMinimumValues; + private _partOpacities; + private _parameterIds; + private _partIds; + private _drawableIds; +} +declare class CubismMotionQueueManager { + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ + */ + release(): void; + /** + * 指定したモーションの開始 + * + * 指定したモーションを開始する。同じタイプのモーションが既にある場合は、既存のモーションに終了フラグを立て、フェードアウトを開始させる。 + * + * @param motion 開始するモーション + * @param autoDelete 再生が終了したモーションのインスタンスを削除するなら true + * @param userTimeSeconds デルタ時間の積算値[秒] + * @return 開始したモーションの識別番号を返す。個別のモーションが終了したか否かを判定するIsFinished()の引数で使用する。開始できない時は「-1」 + */ + startMotion(motion: ACubismMotion, autoDelete: boolean, userTimeSeconds: number): CubismMotionQueueEntryHandle; + /** + * 全てのモーションの終了の確認 + * @return true 全て終了している + * @return false 終了していない + */ + isFinished(): boolean; + /** + * 指定したモーションの終了の確認 + * @param motionQueueEntryNumber モーションの識別番号 + * @return true 全て終了している + * @return false 終了していない + */ + isFinishedByHandle(motionQueueEntryNumber: CubismMotionQueueEntryHandle): boolean; + /** + * 全てのモーションを停止する + */ + stopAllMotions(): void; + /** + * 指定したCubismMotionQueueEntryの取得 + + * @param motionQueueEntryNumber モーションの識別番号 + * @return 指定したCubismMotionQueueEntry + * @return null 見つからなかった + */ + getCubismMotionQueueEntry(motionQueueEntryNumber: any): CubismMotionQueueEntry | undefined; + /** + * イベントを受け取るCallbackの登録 + * + * @param callback コールバック関数 + * @param customData コールバックに返されるデータ + */ + setEventCallback(callback: CubismMotionEventFunction, customData?: any): void; + /** + * モーションを更新して、モデルにパラメータ値を反映する。 + * + * @param model 対象のモデル + * @param userTimeSeconds デルタ時間の積算値[秒] + * @return true モデルへパラメータ値の反映あり + * @return false モデルへパラメータ値の反映なし(モーションの変化なし) + */ + doUpdateMotion(model: CubismModel, userTimeSeconds: number): boolean; + _userTimeSeconds: number; + _motions: CubismMotionQueueEntry[]; + _eventCallBack: CubismMotionEventFunction; + _eventCustomData: any; +} +/** + * イベントのコールバック関数を定義 + * + * イベントのコールバックに登録できる関数の型情報 + * @param caller 発火したイベントを再生させたCubismMotionQueueManager + * @param eventValue 発火したイベントの文字列データ + * @param customData コールバックに返される登録時に指定されたデータ + */ +export interface CubismMotionEventFunction { + (caller: CubismMotionQueueManager, eventValue: string, customData: any): void; +} +/** + * モーションの識別番号 + * + * モーションの識別番号の定義 + */ +export declare type CubismMotionQueueEntryHandle = any; +declare class CubismMotionQueueEntry { + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * フェードアウト時間と開始判定の設定 + * @param fadeOutSeconds フェードアウトにかかる時間[秒] + */ + setFadeOut(fadeOutSeconds: number): void; + /** + * フェードアウトの開始 + * @param fadeOutSeconds フェードアウトにかかる時間[秒] + * @param userTimeSeconds デルタ時間の積算値[秒] + */ + startFadeOut(fadeOutSeconds: number, userTimeSeconds: number): void; + /** + * モーションの終了の確認 + * + * @return true モーションが終了した + * @return false 終了していない + */ + isFinished(): boolean; + /** + * モーションの開始の確認 + * @return true モーションが開始した + * @return false 開始していない + */ + isStarted(): boolean; + /** + * モーションの開始時刻の取得 + * @return モーションの開始時刻[秒] + */ + getStartTime(): number; + /** + * フェードインの開始時刻の取得 + * @return フェードインの開始時刻[秒] + */ + getFadeInStartTime(): number; + /** + * フェードインの終了時刻の取得 + * @return フェードインの終了時刻の取得 + */ + getEndTime(): number; + /** + * モーションの開始時刻の設定 + * @param startTime モーションの開始時刻 + */ + setStartTime(startTime: number): void; + /** + * フェードインの開始時刻の設定 + * @param startTime フェードインの開始時刻[秒] + */ + setFadeInStartTime(startTime: number): void; + /** + * フェードインの終了時刻の設定 + * @param endTime フェードインの終了時刻[秒] + */ + setEndTime(endTime: number): void; + /** + * モーションの終了の設定 + * @param f trueならモーションの終了 + */ + setIsFinished(f: boolean): void; + /** + * モーション開始の設定 + * @param f trueならモーションの開始 + */ + setIsStarted(f: boolean): void; + /** + * モーションの有効性の確認 + * @return true モーションは有効 + * @return false モーションは無効 + */ + isAvailable(): boolean; + /** + * モーションの有効性の設定 + * @param v trueならモーションは有効 + */ + setIsAvailable(v: boolean): void; + /** + * モーションの状態の設定 + * @param timeSeconds 現在時刻[秒] + * @param weight モーション尾重み + */ + setState(timeSeconds: number, weight: number): void; + /** + * モーションの現在時刻の取得 + * @return モーションの現在時刻[秒] + */ + getStateTime(): number; + /** + * モーションの重みの取得 + * @return モーションの重み + */ + getStateWeight(): number; + /** + * 最後にイベントの発火をチェックした時間を取得 + * + * @return 最後にイベントの発火をチェックした時間[秒] + */ + getLastCheckEventSeconds(): number; + /** + * 最後にイベントをチェックした時間を設定 + * @param checkSeconds 最後にイベントをチェックした時間[秒] + */ + setLastCheckEventSeconds(checkSeconds: number): void; + /** + * フェードアウト開始判定の取得 + * @return フェードアウト開始するかどうか + */ + isTriggeredFadeOut(): boolean; + /** + * フェードアウト時間の取得 + * @return フェードアウト時間[秒] + */ + getFadeOutSeconds(): number; + _autoDelete: boolean; + _motion: ACubismMotion; + _available: boolean; + _finished: boolean; + _started: boolean; + _startTimeSeconds: number; + _fadeInStartTimeSeconds: number; + _endTimeSeconds: number; + _stateTimeSeconds: number; + _stateWeight: number; + _lastEventCheckSeconds: number; + private _fadeOutSeconds; + private _isTriggeredFadeOut; + _motionQueueEntryHandle: CubismMotionQueueEntryHandle; +} +declare abstract class ACubismMotion { + /** + >>>>>>> 13ba60d (Update to Cubism SDK for Web R4) + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * モデルのパラメータ + * @param model 対象のモデル + * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション + * @param userTimeSeconds デルタ時間の積算値[秒] + */ + updateParameters(model: CubismModel, motionQueueEntry: CubismMotionQueueEntry, userTimeSeconds: number): void; + /** + * フェードインの時間を設定する + * @param fadeInSeconds フェードインにかかる時間[秒] + */ + setFadeInTime(fadeInSeconds: number): void; + /** + * フェードアウトの時間を設定する + * @param fadeOutSeconds フェードアウトにかかる時間[秒] + */ + setFadeOutTime(fadeOutSeconds: number): void; + /** + * フェードアウトにかかる時間の取得 + * @return フェードアウトにかかる時間[秒] + */ + getFadeOutTime(): number; + /** + * フェードインにかかる時間の取得 + * @return フェードインにかかる時間[秒] + */ + getFadeInTime(): number; + /** + * モーション適用の重みの設定 + * @param weight 重み(0.0 - 1.0) + */ + setWeight(weight: number): void; + /** + * モーション適用の重みの取得 + * @return 重み(0.0 - 1.0) + */ + getWeight(): number; + /** + * モーションの長さの取得 + * @return モーションの長さ[秒] + * + * @note ループの時は「-1」。 + * ループでない場合は、オーバーライドする。 + * 正の値の時は取得される時間で終了する。 + * 「-1」の時は外部から停止命令がない限り終わらない処理となる。 + */ + getDuration(): number; + /** + * モーションのループ1回分の長さの取得 + * @return モーションのループ一回分の長さ[秒] + * + * @note ループしない場合は、getDuration()と同じ値を返す + * ループ一回分の長さが定義できない場合(プログラム的に動き続けるサブクラスなど)の場合は「-1」を返す + */ + getLoopDuration(): number; + /** + * モーション再生の開始時刻の設定 + * @param offsetSeconds モーション再生の開始時刻[秒] + */ + setOffsetTime(offsetSeconds: number): void; + /** + * モデルのパラメータ更新 + * + * イベント発火のチェック。 + * 入力する時間は呼ばれるモーションタイミングを0とした秒数で行う。 + * + * @param beforeCheckTimeSeconds 前回のイベントチェック時間[秒] + * @param motionTimeSeconds 今回の再生時間[秒] + */ + getFiredEvent(beforeCheckTimeSeconds: number, motionTimeSeconds: number): string[]; + /** + * モーションを更新して、モデルにパラメータ値を反映する + * @param model 対象のモデル + * @param userTimeSeconds デルタ時間の積算値[秒] + * @param weight モーションの重み + * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション + * @return true モデルへパラメータ値の反映あり + * @return false モデルへのパラメータ値の反映なし(モーションの変化なし) + */ + abstract doUpdateParameters(model: CubismModel, userTimeSeconds: number, weight: number, motionQueueEntry: CubismMotionQueueEntry): void; + /** + * モーション再生終了コールバックの登録 + * + * モーション再生終了コールバックを登録する。 + * isFinishedフラグを設定するタイミングで呼び出される。 + * 以下の状態の際には呼び出されない: + * 1. 再生中のモーションが「ループ」として設定されているとき + * 2. コールバックが登録されていない時 + * + * @param onFinishedMotionHandler モーション再生終了コールバック関数 + */ + setFinishedMotionHandler(onFinishedMotionHandler?: (self: ACubismMotion) => void): void; + /** + * モーション再生終了コールバックの取得 + * + * モーション再生終了コールバックを取得する。 + * + * @return 登録されているモーション再生終了コールバック関数 + */ + getFinishedMotionHandler(): ((self: ACubismMotion) => void) | undefined; + _fadeInSeconds: number; + _fadeOutSeconds: number; + _weight: number; + _offsetSeconds: number; + _firedEventValues: string[]; + _onFinishedMotion?: (self: ACubismMotion) => void; +} +declare class CubismExpressionMotion extends ACubismMotion { + /** + * インスタンスを作成する。 + * @param json expファイルが読み込まれているバッファ + * @param size バッファのサイズ + * @return 作成されたインスタンス + */ + static create(json: CubismSpec.ExpressionJSON): CubismExpressionMotion; + /** + * モデルのパラメータの更新の実行 + * @param model 対象のモデル + * @param userTimeSeconds デルタ時間の積算値[秒] + * @param weight モーションの重み + * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション + */ + doUpdateParameters(model: CubismModel, userTimeSeconds: number, weight: number, motionQueueEntry: CubismMotionQueueEntry): void; + /** + * コンストラクタ + */ + constructor(); + _parameters: ExpressionParameter[]; +} +declare enum ExpressionBlendType { + ExpressionBlendType_Add = 0, + ExpressionBlendType_Multiply = 1, + ExpressionBlendType_Overwrite = 2 +} +/** + * 表情のパラメータ情報 + */ +export interface ExpressionParameter { + parameterId: string; + blendType: ExpressionBlendType; + value: number; +} +export declare class Cubism4ExpressionManager extends ExpressionManager { + readonly queueManager: CubismMotionQueueManager; + readonly definitions: CubismSpec.Expression[]; + constructor(settings: Cubism4ModelSettings, options?: MotionManagerOptions); + isFinished(): boolean; + getExpressionIndex(name: string): number; + getExpressionFile(definition: CubismSpec.Expression): string; + createExpression(data: object, definition: CubismSpec.Expression | undefined): CubismExpressionMotion; + protected _setExpression(motion: CubismExpressionMotion): number; + protected stopAllExpressions(): void; + protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean; +} +declare enum CubismMotionCurveTarget { + CubismMotionCurveTarget_Model = 0, + CubismMotionCurveTarget_Parameter = 1, + CubismMotionCurveTarget_PartOpacity = 2 +} +declare class CubismMotionPoint { + constructor(time?: number, value?: number); + time: number; + value: number; +} +/** + * モーションカーブのセグメントの評価関数 + * + * @param points モーションカーブの制御点リスト + * @param time 評価する時間[秒] + */ +export interface csmMotionSegmentEvaluationFunction { + (points: CubismMotionPoint[], time: number): number; +} +declare class CubismMotionSegment { + /** + * @brief コンストラクタ + * + * コンストラクタ。 + */ + constructor(); + evaluate: csmMotionSegmentEvaluationFunction; + basePointIndex: number; + segmentType: number; +} +declare class CubismMotionCurve { + constructor(); + type: CubismMotionCurveTarget; + id: string; + segmentCount: number; + baseSegmentIndex: number; + fadeInTime: number; + fadeOutTime: number; +} +declare class CubismMotionEvent { + fireTime: number; + value: string; +} +declare class CubismMotionData { + constructor(); + duration: number; + loop: boolean; + curveCount: number; + eventCount: number; + fps: number; + curves: CubismMotionCurve[]; + segments: CubismMotionSegment[]; + points: CubismMotionPoint[]; + events: CubismMotionEvent[]; +} +declare class CubismMotion extends ACubismMotion { + /** + * インスタンスを作成する + * + * @param json motion3.jsonが読み込まれているバッファ + * @param onFinishedMotionHandler モーション再生終了時に呼び出されるコールバック関数 + * @return 作成されたインスタンス + */ + static create(json: CubismSpec.MotionJSON, onFinishedMotionHandler?: (self: ACubismMotion) => void): CubismMotion; + /** + * モデルのパラメータの更新の実行 + * @param model 対象のモデル + * @param userTimeSeconds 現在の時刻[秒] + * @param fadeWeight モーションの重み + * @param motionQueueEntry CubismMotionQueueManagerで管理されているモーション + */ + doUpdateParameters(model: CubismModel, userTimeSeconds: number, fadeWeight: number, motionQueueEntry: CubismMotionQueueEntry): void; + /** + * ループ情報の設定 + * @param loop ループ情報 + */ + setIsLoop(loop: boolean): void; + /** + * ループ情報の取得 + * @return true ループする + * @return false ループしない + */ + isLoop(): boolean; + /** + * ループ時のフェードイン情報の設定 + * @param loopFadeIn ループ時のフェードイン情報 + */ + setIsLoopFadeIn(loopFadeIn: boolean): void; + /** + * ループ時のフェードイン情報の取得 + * + * @return true する + * @return false しない + */ + isLoopFadeIn(): boolean; + /** + * モーションの長さを取得する。 + * + * @return モーションの長さ[秒] + */ + getDuration(): number; + /** + * モーションのループ時の長さを取得する。 + * + * @return モーションのループ時の長さ[秒] + */ + getLoopDuration(): number; + /** + * パラメータに対するフェードインの時間を設定する。 + * + * @param parameterId パラメータID + * @param value フェードインにかかる時間[秒] + */ + setParameterFadeInTime(parameterId: string, value: number): void; + /** + * パラメータに対するフェードアウトの時間の設定 + * @param parameterId パラメータID + * @param value フェードアウトにかかる時間[秒] + */ + setParameterFadeOutTime(parameterId: string, value: number): void; + /** + * パラメータに対するフェードインの時間の取得 + * @param parameterId パラメータID + * @return フェードインにかかる時間[秒] + */ + getParameterFadeInTime(parameterId: string): number; + /** + * パラメータに対するフェードアウトの時間を取得 + * + * @param parameterId パラメータID + * @return フェードアウトにかかる時間[秒] + */ + getParameterFadeOutTime(parameterId: string): number; + /** + * 自動エフェクトがかかっているパラメータIDリストの設定 + * @param eyeBlinkParameterIds 自動まばたきがかかっているパラメータIDのリスト + * @param lipSyncParameterIds リップシンクがかかっているパラメータIDのリスト + */ + setEffectIds(eyeBlinkParameterIds: string[], lipSyncParameterIds: string[]): void; + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * motion3.jsonをパースする。 + * + * @param motionJson motion3.jsonが読み込まれているバッファ + */ + parse(motionJson: CubismSpec.MotionJSON): void; + /** + * モデルのパラメータ更新 + * + * イベント発火のチェック。 + * 入力する時間は呼ばれるモーションタイミングを0とした秒数で行う。 + * + * @param beforeCheckTimeSeconds 前回のイベントチェック時間[秒] + * @param motionTimeSeconds 今回の再生時間[秒] + */ + getFiredEvent(beforeCheckTimeSeconds: number, motionTimeSeconds: number): string[]; + _sourceFrameRate: number; + _loopDurationSeconds: number; + _isLoop: boolean; + _isLoopFadeIn: boolean; + _lastWeight: number; + _motionData: CubismMotionData; + _eyeBlinkParameterIds: string[]; + _lipSyncParameterIds: string[]; + _modelCurveIdEyeBlink?: string; + _modelCurveIdLipSync?: string; +} +export declare class Cubism4MotionManager extends MotionManager { + readonly definitions: Partial>; + readonly groups: { + readonly idle: "Idle"; + }; + readonly motionDataType = "json"; + readonly queueManager: CubismMotionQueueManager; + readonly settings: Cubism4ModelSettings; + expressionManager?: Cubism4ExpressionManager; + eyeBlinkIds: string[]; + lipSyncIds: string[]; + constructor(settings: Cubism4ModelSettings, options?: MotionManagerOptions); + protected init(options?: MotionManagerOptions): void; + isFinished(): boolean; + protected _startMotion(motion: CubismMotion, onFinish?: (motion: CubismMotion) => void): number; + protected _stopAllMotions(): void; + createMotion(data: object, group: string, definition: CubismSpec.Motion): CubismMotion; + getMotionFile(definition: CubismSpec.Motion): string; + protected getMotionName(definition: CubismSpec.Motion): string; + protected getSoundFile(definition: CubismSpec.Motion): string | undefined; + protected updateParameters(model: CubismModel, now: DOMHighResTimeStamp): boolean; + destroy(): void; +} +declare class CubismBreath { + /** + * インスタンスの作成 + */ + static create(): CubismBreath; + /** + * 呼吸のパラメータの紐づけ + * @param breathParameters 呼吸を紐づけたいパラメータのリスト + */ + setParameters(breathParameters: BreathParameterData[]): void; + /** + * 呼吸に紐づいているパラメータの取得 + * @return 呼吸に紐づいているパラメータのリスト + */ + getParameters(): BreathParameterData[]; + /** + * モデルのパラメータの更新 + * @param model 対象のモデル + * @param deltaTimeSeconds デルタ時間[秒] + */ + updateParameters(model: CubismModel, deltaTimeSeconds: number): void; + /** + * コンストラクタ + */ + constructor(); + _breathParameters: BreathParameterData[]; + _currentTime: number; +} +declare class BreathParameterData { + /** + * コンストラクタ + * @param parameterId 呼吸をひもづけるパラメータID + * @param offset 呼吸を正弦波としたときの、波のオフセット + * @param peak 呼吸を正弦波としたときの、波の高さ + * @param cycle 呼吸を正弦波としたときの、波の周期 + * @param weight パラメータへの重み + */ + constructor(parameterId?: string, offset?: number, peak?: number, cycle?: number, weight?: number); + parameterId?: string; + offset: number; + peak: number; + cycle: number; + weight: number; +} +declare class CubismEyeBlink { + /** + * インスタンスを作成する + * @param modelSetting モデルの設定情報 + * @return 作成されたインスタンス + * @note 引数がNULLの場合、パラメータIDが設定されていない空のインスタンスを作成する。 + */ + static create(modelSetting: CubismModelSettingsJson): CubismEyeBlink; + /** + * まばたきの間隔の設定 + * @param blinkingInterval まばたきの間隔の時間[秒] + */ + setBlinkingInterval(blinkingInterval: number): void; + /** + * まばたきのモーションの詳細設定 + * @param closing まぶたを閉じる動作の所要時間[秒] + * @param closed まぶたを閉じている動作の所要時間[秒] + * @param opening まぶたを開く動作の所要時間[秒] + */ + setBlinkingSetting(closing: number, closed: number, opening: number): void; + /** + * まばたきさせるパラメータIDのリストの設定 + * @param parameterIds パラメータのIDのリスト + */ + setParameterIds(parameterIds: string[]): void; + /** + * まばたきさせるパラメータIDのリストの取得 + * @return パラメータIDのリスト + */ + getParameterIds(): string[]; + /** + * モデルのパラメータの更新 + * @param model 対象のモデル + * @param deltaTimeSeconds デルタ時間[秒] + */ + updateParameters(model: CubismModel, deltaTimeSeconds: number): void; + /** + * コンストラクタ + * @param modelSetting モデルの設定情報 + */ + constructor(modelSetting: CubismModelSettingsJson); + /** + * 次の瞬きのタイミングの決定 + * + * @return 次のまばたきを行う時刻[秒] + */ + determinNextBlinkingTiming(): number; + _blinkingState: number; + _parameterIds: string[]; + _nextBlinkingTime: number; + _stateStartTimeSeconds: number; + _blinkingIntervalSeconds: number; + _closingSeconds: number; + _closedSeconds: number; + _openingSeconds: number; + _userTimeSeconds: number; + /** + * IDで指定された目のパラメータが、0のときに閉じるなら true 、1の時に閉じるなら false 。 + */ + static readonly CloseIfZero: boolean; +} +declare class CubismPose { + /** + * インスタンスの作成 + * @param pose3json pose3.jsonのデータ + * @return 作成されたインスタンス + */ + static create(pose3json: CubismSpec.PoseJSON): CubismPose; + /** + * モデルのパラメータの更新 + * @param model 対象のモデル + * @param deltaTimeSeconds デルタ時間[秒] + */ + updateParameters(model: CubismModel, deltaTimeSeconds: number): void; + /** + * 表示を初期化 + * @param model 対象のモデル + * @note 不透明度の初期値が0でないパラメータは、不透明度を1に設定する + */ + reset(model: CubismModel): void; + /** + * パーツの不透明度をコピー + * + * @param model 対象のモデル + */ + copyPartOpacities(model: CubismModel): void; + /** + * パーツのフェード操作を行う。 + * @param model 対象のモデル + * @param deltaTimeSeconds デルタ時間[秒] + * @param beginIndex フェード操作を行うパーツグループの先頭インデックス + * @param partGroupCount フェード操作を行うパーツグループの個数 + */ + doFade(model: CubismModel, deltaTimeSeconds: number, beginIndex: number, partGroupCount: number): void; + /** + * コンストラクタ + */ + constructor(); + _partGroups: PartData[]; + _partGroupCounts: number[]; + _fadeTimeSeconds: number; + _lastModel?: CubismModel; +} +declare class PartData { + /** + * コンストラクタ + */ + constructor(v?: PartData); + /** + * =演算子のオーバーロード + */ + assignment(v: PartData): PartData; + /** + * 初期化 + * @param model 初期化に使用するモデル + */ + initialize(model: CubismModel): void; + /** + * オブジェクトのコピーを生成する + */ + clone(): PartData; + partId: string; + parameterIndex: number; + partIndex: number; + link: PartData[]; +} +/** + * ユーザーデータインターフェース + * + * Jsonから読み込んだユーザーデータを記録しておくための構造体 + */ +export interface CubismModelUserDataNode { + targetType: string; + targetId: string; + value: string; +} +declare class CubismModelUserData { + /** + * インスタンスの作成 + * + * @param json userdata3.jsonが読み込まれているバッファ + * @param size バッファのサイズ + * @return 作成されたインスタンス + */ + static create(json: CubismSpec.UserDataJSON, size: number): CubismModelUserData; + /** + * ArtMeshのユーザーデータのリストの取得 + * + * @return ユーザーデータリスト + */ + getArtMeshUserDatas(): CubismModelUserDataNode[]; + /** + * userdata3.jsonのパース + * + * @param data userdata3.jsonが読み込まれているバッファ + * @param size バッファのサイズ + */ + parseUserData(data: CubismSpec.UserDataJSON, size: number): void; + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + * + * ユーザーデータ構造体配列を解放する + */ + release(): void; + private _userDataNodes; + private _artMeshUserDataNode; +} +declare class CubismVector2 { + x: number; + y: number; + /** + * コンストラクタ + */ + constructor(x?: number, y?: number); + /** + * ベクトルの加算 + * + * @param vector2 加算するベクトル値 + * @return 加算結果 ベクトル値 + */ + add(vector2: CubismVector2): CubismVector2; + /** + * ベクトルの減算 + * + * @param vector2 減算するベクトル値 + * @return 減算結果 ベクトル値 + */ + substract(vector2: CubismVector2): CubismVector2; + /** + * ベクトルの乗算 + * + * @param vector2 乗算するベクトル値 + * @return 乗算結果 ベクトル値 + */ + multiply(vector2: CubismVector2): CubismVector2; + /** + * ベクトルの乗算(スカラー) + * + * @param scalar 乗算するスカラー値 + * @return 乗算結果 ベクトル値 + */ + multiplyByScaler(scalar: number): CubismVector2; + /** + * ベクトルの除算 + * + * @param vector2 除算するベクトル値 + * @return 除算結果 ベクトル値 + */ + division(vector2: CubismVector2): CubismVector2; + /** + * ベクトルの除算(スカラー) + * + * @param scalar 除算するスカラー値 + * @return 除算結果 ベクトル値 + */ + divisionByScalar(scalar: number): CubismVector2; + /** + * ベクトルの長さを取得する + * + * @return ベクトルの長さ + */ + getLength(): number; + /** + * ベクトルの距離の取得 + * + * @param a 点 + * @return ベクトルの距離 + */ + getDistanceWith(a: CubismVector2): number; + /** + * ドット積の計算 + * + * @param a 値 + * @return 結果 + */ + dot(a: CubismVector2): number; + /** + * 正規化の適用 + */ + normalize(): void; + /** + * 等しさの確認(等しいか?) + * + * 値が等しいか? + * + * @param rhs 確認する値 + * @return true 値は等しい + * @return false 値は等しくない + */ + isEqual(rhs: CubismVector2): boolean; + /** + * 等しさの確認(等しくないか?) + * + * 値が等しくないか? + * + * @param rhs 確認する値 + * @return true 値は等しくない + * @return false 値は等しい + */ + isNotEqual(rhs: CubismVector2): boolean; +} +declare enum CubismPhysicsTargetType { + CubismPhysicsTargetType_Parameter = 0 +} +declare enum CubismPhysicsSource { + CubismPhysicsSource_X = 0, + CubismPhysicsSource_Y = 1, + CubismPhysicsSource_Angle = 2 +} +/** + * 物理演算のパラメータ情報 + */ +export interface CubismPhysicsParameter { + id: string; + targetType: CubismPhysicsTargetType; +} +/** + * 物理演算の正規化情報 + */ +export interface CubismPhysicsNormalization { + minimum: number; + maximum: number; + defalut: number; +} +declare class CubismPhysicsParticle { + constructor(); + initialPosition: CubismVector2; + mobility: number; + delay: number; + acceleration: number; + radius: number; + position: CubismVector2; + lastPosition: CubismVector2; + lastGravity: CubismVector2; + force: CubismVector2; + velocity: CubismVector2; +} +declare class CubismPhysicsSubRig { + inputCount: number; + outputCount: number; + particleCount: number; + baseInputIndex: number; + baseOutputIndex: number; + baseParticleIndex: number; + normalizationPosition: CubismPhysicsNormalization; + normalizationAngle: CubismPhysicsNormalization; +} +/** + * 正規化されたパラメータの取得関数の宣言 + * @param targetTranslation // 演算結果の移動値 + * @param targetAngle // 演算結果の角度 + * @param value // パラメータの値 + * @param parameterMinimunValue // パラメータの最小値 + * @param parameterMaximumValue // パラメータの最大値 + * @param parameterDefaultValue // パラメータのデフォルト値 + * @param normalizationPosition // 正規化された位置 + * @param normalizationAngle // 正規化された角度 + * @param isInverted // 値が反転されているか? + * @param weight // 重み + */ +export interface normalizedPhysicsParameterValueGetter { + (targetTranslation: CubismVector2, targetAngle: { + angle: number; + }, value: number, parameterMinimunValue: number, parameterMaximumValue: number, parameterDefaultValue: number, normalizationPosition: CubismPhysicsNormalization, normalizationAngle: CubismPhysicsNormalization, isInverted: boolean, weight: number): void; +} +/** + * 物理演算の値の取得関数の宣言 + * @param translation 移動値 + * @param particles 物理点のリスト + * @param isInverted 値が反映されているか + * @param parentGravity 重力 + * @return 値 + */ +export interface physicsValueGetter { + (translation: CubismVector2, particles: CubismPhysicsParticle[], particleIndex: number, isInverted: boolean, parentGravity: CubismVector2): number; +} +/** + * 物理演算のスケールの取得関数の宣言 + * @param translationScale 移動値のスケール + * @param angleScale 角度のスケール + * @return スケール値 + */ +export interface physicsScaleGetter { + (translationScale: CubismVector2, angleScale: number): number; +} +declare class CubismPhysicsInput { + source: CubismPhysicsParameter; + sourceParameterIndex: number; + weight: number; + type: number; + reflect: boolean; + getNormalizedParameterValue: normalizedPhysicsParameterValueGetter; +} +declare class CubismPhysicsOutput { + destination: CubismPhysicsParameter; + destinationParameterIndex: number; + vertexIndex: number; + translationScale: CubismVector2; + angleScale: number; + weight: number; + type: CubismPhysicsSource; + reflect: boolean; + valueBelowMinimum: number; + valueExceededMaximum: number; + getValue: physicsValueGetter; + getScale: physicsScaleGetter; +} +declare class CubismPhysicsRig { + constructor(); + subRigCount: number; + settings: CubismPhysicsSubRig[]; + inputs: CubismPhysicsInput[]; + outputs: CubismPhysicsOutput[]; + particles: CubismPhysicsParticle[]; + gravity: CubismVector2; + wind: CubismVector2; +} +declare class CubismPhysics { + /** + * インスタンスの作成 + * @param json physics3.jsonが読み込まれているバッファ + * @return 作成されたインスタンス + */ + static create(json: CubismSpec.PhysicsJSON): CubismPhysics; + /** + * 物理演算の評価 + * @param model 物理演算の結果を適用するモデル + * @param deltaTimeSeconds デルタ時間[秒] + */ + evaluate(model: CubismModel, deltaTimeSeconds: number): void; + /** + * オプションの設定 + * @param options オプション + */ + setOptions(options: Options): void; + /** + * オプションの取得 + * @return オプション + */ + getOption(): Options; + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * physics3.jsonをパースする。 + * @param physicsJson physics3.jsonが読み込まれているバッファ + */ + parse(physicsJson: CubismSpec.PhysicsJSON): void; + /** + * 初期化する + */ + initialize(): void; + _physicsRig: CubismPhysicsRig; + _options: Options; +} +declare class Options { + constructor(); + gravity: CubismVector2; + wind: CubismVector2; +} +declare class csmRect { + /** + * コンストラクタ + * @param x 左端X座標 + * @param y 上端Y座標 + * @param w 幅 + * @param h 高さ + */ + constructor(x?: number, y?: number, w?: number, h?: number); + /** + * 矩形中央のX座標を取得する + */ + getCenterX(): number; + /** + * 矩形中央のY座標を取得する + */ + getCenterY(): number; + /** + * 右側のX座標を取得する + */ + getRight(): number; + /** + * 下端のY座標を取得する + */ + getBottom(): number; + /** + * 矩形に値をセットする + * @param r 矩形のインスタンス + */ + setRect(r: csmRect): void; + /** + * 矩形中央を軸にして縦横を拡縮する + * @param w 幅方向に拡縮する量 + * @param h 高さ方向に拡縮する量 + */ + expand(w: number, h: number): void; + x: number; + y: number; + width: number; + height: number; +} +declare class CubismClippingManager_WebGL { + /** + * カラーチャンネル(RGBA)のフラグを取得する + * @param channelNo カラーチャンネル(RGBA)の番号(0:R, 1:G, 2:B, 3:A) + */ + getChannelFlagAsColor(channelNo: number): CubismTextureColor; + /** + * テンポラリのレンダーテクスチャのアドレスを取得する + * FrameBufferObjectが存在しない場合、新しく生成する + * + * @return レンダーテクスチャのアドレス + */ + getMaskRenderTexture(): WebGLFramebuffer | null; + /** + * WebGLレンダリングコンテキストを設定する + * @param gl WebGLレンダリングコンテキスト + */ + setGL(gl: WebGLRenderingContext): void; + /** + * マスクされる描画オブジェクト群全体を囲む矩形(モデル座標系)を計算する + * @param model モデルのインスタンス + * @param clippingContext クリッピングマスクのコンテキスト + */ + calcClippedDrawTotalBounds(model: CubismModel, clippingContext: CubismClippingContext): void; + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * マネージャの初期化処理 + * クリッピングマスクを使う描画オブジェクトの登録を行う + * @param model モデルのインスタンス + * @param drawableCount 描画オブジェクトの数 + * @param drawableMasks 描画オブジェクトをマスクする描画オブジェクトのインデックスのリスト + * @param drawableCounts 描画オブジェクトをマスクする描画オブジェクトの数 + */ + initialize(model: CubismModel, drawableCount: number, drawableMasks: Int32Array[], drawableMaskCounts: Int32Array): void; + /** + * クリッピングコンテキストを作成する。モデル描画時に実行する。 + * @param model モデルのインスタンス + * @param renderer レンダラのインスタンス + */ + setupClippingContext(model: CubismModel, renderer: CubismRenderer_WebGL): void; + /** + * 既にマスクを作っているかを確認 + * 作っている様であれば該当するクリッピングマスクのインスタンスを返す + * 作っていなければNULLを返す + * @param drawableMasks 描画オブジェクトをマスクする描画オブジェクトのリスト + * @param drawableMaskCounts 描画オブジェクトをマスクする描画オブジェクトの数 + * @return 該当するクリッピングマスクが存在すればインスタンスを返し、なければNULLを返す + */ + findSameClip(drawableMasks: Int32Array, drawableMaskCounts: number): CubismClippingContext | null; + /** + * クリッピングコンテキストを配置するレイアウト + * 一つのレンダーテクスチャを極力いっぱいに使ってマスクをレイアウトする + * マスクグループの数が4以下ならRGBA各チャンネルに一つずつマスクを配置し、5以上6以下ならRGBAを2,2,1,1と配置する。 + * + * @param usingClipCount 配置するクリッピングコンテキストの数 + */ + setupLayoutBounds(usingClipCount: number): void; + /** + * カラーバッファを取得する + * @return カラーバッファ + */ + getColorBuffer(): WebGLTexture | null; + /** + * 画面描画に使用するクリッピングマスクのリストを取得する + * @return 画面描画に使用するクリッピングマスクのリスト + */ + getClippingContextListForDraw(): (CubismClippingContext | null)[]; + /** + * クリッピングマスクバッファのサイズを設定する + * @param size クリッピングマスクバッファのサイズ + */ + setClippingMaskBufferSize(size: number): void; + /** + * クリッピングマスクバッファのサイズを取得する + * @return クリッピングマスクバッファのサイズ + */ + getClippingMaskBufferSize(): number; + _maskRenderTexture: WebGLFramebuffer | null; + _colorBuffer: WebGLTexture | null; + _currentFrameNo: number; + _channelColors: CubismTextureColor[]; + _maskTexture?: CubismRenderTextureResource; + _clippingContextListForMask: CubismClippingContext[]; + _clippingContextListForDraw: (CubismClippingContext | null)[]; + _clippingMaskBufferSize: number; + private _tmpMatrix; + private _tmpMatrixForMask; + private _tmpMatrixForDraw; + private _tmpBoundsOnModel; + gl: WebGLRenderingContext; +} +declare class CubismRenderTextureResource { + /** + * 引数付きコンストラクタ + * @param frameNo レンダラーのフレーム番号 + * @param texture テクスチャのアドレス + */ + constructor(frameNo: number, texture: WebGLFramebuffer | null); + frameNo: number; + texture: WebGLFramebuffer | null; +} +declare class CubismClippingContext { + /** + * 引数付きコンストラクタ + */ + constructor(manager: CubismClippingManager_WebGL, clippingDrawableIndices: Int32Array, clipCount: number); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * このマスクにクリップされる描画オブジェクトを追加する + * + * @param drawableIndex クリッピング対象に追加する描画オブジェクトのインデックス + */ + addClippedDrawable(drawableIndex: number): void; + /** + * このマスクを管理するマネージャのインスタンスを取得する + * @return クリッピングマネージャのインスタンス + */ + getClippingManager(): CubismClippingManager_WebGL; + setGl(gl: WebGLRenderingContext): void; + _isUsing: boolean; + readonly _clippingIdList: Int32Array; + _clippingIdCount: number; + _layoutChannelNo: number; + _layoutBounds: csmRect; + _allClippedDrawRect: csmRect; + _matrixForMask: CubismMatrix44; + _matrixForDraw: CubismMatrix44; + _clippedDrawableIndexList: number[]; + private _owner; +} +declare class CubismRenderer_WebGL extends CubismRenderer { + /** + * レンダラの初期化処理を実行する + * 引数に渡したモデルからレンダラの初期化処理に必要な情報を取り出すことができる + * + * @param model モデルのインスタンス + */ + initialize(model: CubismModel): void; + /** + * WebGLテクスチャのバインド処理 + * CubismRendererにテクスチャを設定し、CubismRenderer内でその画像を参照するためのIndex値を戻り値とする + * @param modelTextureNo セットするモデルテクスチャの番号 + * @param glTextureNo WebGLテクスチャの番号 + */ + bindTexture(modelTextureNo: number, glTexture: WebGLTexture): void; + /** + * WebGLにバインドされたテクスチャのリストを取得する + * @return テクスチャのリスト + */ + getBindedTextures(): Record; + /** + * クリッピングマスクバッファのサイズを設定する + * マスク用のFrameBufferを破棄、再作成する為処理コストは高い + * @param size クリッピングマスクバッファのサイズ + */ + setClippingMaskBufferSize(size: number): void; + /** + * クリッピングマスクバッファのサイズを取得する + * @return クリッピングマスクバッファのサイズ + */ + getClippingMaskBufferSize(): number; + /** + * コンストラクタ + */ + constructor(); + /** + * デストラクタ相当の処理 + */ + release(): void; + /** + * モデルを描画する実際の処理 + */ + doDrawModel(): void; + /** + * [オーバーライド] + * 描画オブジェクト(アートメッシュ)を描画する。 + * ポリゴンメッシュとテクスチャ番号をセットで渡す。 + * @param textureNo 描画するテクスチャ番号 + * @param indexCount 描画オブジェクトのインデックス値 + * @param vertexCount ポリゴンメッシュの頂点数 + * @param indexArray ポリゴンメッシュのインデックス配列 + * @param vertexArray ポリゴンメッシュの頂点配列 + * @param uvArray uv配列 + * @param opacity 不透明度 + * @param colorBlendMode カラー合成タイプ + * @param invertedMask マスク使用時のマスクの反転使用 + */ + drawMesh(textureNo: number, indexCount: number, vertexCount: number, indexArray: Uint16Array, vertexArray: Float32Array, uvArray: Float32Array, opacity: number, colorBlendMode: CubismBlendMode, invertedMask: boolean): void; + /** + * レンダラが保持する静的なリソースを解放する + * WebGLの静的なシェーダープログラムを解放する + */ + static doStaticRelease(): void; + /** + * レンダーステートを設定する + * @param fbo アプリケーション側で指定しているフレームバッファ + * @param viewport ビューポート + */ + setRenderState(fbo: WebGLFramebuffer, viewport: number[]): void; + /** + * 描画開始時の追加処理 + * モデルを描画する前にクリッピングマスクに必要な処理を実装している + */ + preDraw(): void; + /** + * マスクテクスチャに描画するクリッピングコンテキストをセットする + */ + setClippingContextBufferForMask(clip: CubismClippingContext | null): void; + /** + * マスクテクスチャに描画するクリッピングコンテキストを取得する + * @return マスクテクスチャに描画するクリッピングコンテキスト + */ + getClippingContextBufferForMask(): CubismClippingContext | null; + /** + * 画面上に描画するクリッピングコンテキストをセットする + */ + setClippingContextBufferForDraw(clip: CubismClippingContext | null): void; + /** + * 画面上に描画するクリッピングコンテキストを取得する + * @return 画面上に描画するクリッピングコンテキスト + */ + getClippingContextBufferForDraw(): CubismClippingContext | null; + /** + * glの設定 + */ + startUp(gl: WebGLRenderingContext): void; + _textures: Record; + _sortedDrawableIndexList: number[]; + _clippingManager: CubismClippingManager_WebGL; + _clippingContextBufferForMask: CubismClippingContext | null; + _clippingContextBufferForDraw: CubismClippingContext | null; + firstDraw: boolean; + _bufferData: { + vertex: WebGLBuffer | null; + uv: WebGLBuffer | null; + index: WebGLBuffer | null; + }; + gl: WebGLRenderingContext; +} +export declare class Cubism4InternalModel extends InternalModel { + settings: Cubism4ModelSettings; + coreModel: CubismModel; + motionManager: Cubism4MotionManager; + lipSync: boolean; + breath: CubismBreath; + eyeBlink?: CubismEyeBlink; + pose?: CubismPose; + physics?: CubismPhysics; + userData?: CubismModelUserData; + renderer: CubismRenderer_WebGL; + idParamAngleX: string; + idParamAngleY: string; + idParamAngleZ: string; + idParamEyeBallX: string; + idParamEyeBallY: string; + idParamBodyAngleX: string; + idParamBreath: string; + /** + * The model's internal scale, defined in the moc3 file. + */ + readonly pixelsPerUnit: number; + /** + * Matrix that scales by {@link pixelsPerUnit}, and moves the origin from top-left to center. + * + * FIXME: This shouldn't be named as "centering"... + */ + protected centeringTransform: Matrix; + constructor(coreModel: CubismModel, settings: Cubism4ModelSettings, options?: InternalModelOptions); + protected init(): void; + protected getSize(): [ + number, + number + ]; + protected getLayout(): CommonLayout; + protected setupLayout(): void; + updateWebGLContext(gl: WebGLRenderingContext, glContextID: number): void; + bindTexture(index: number, texture: WebGLTexture): void; + protected getHitAreaDefs(): CommonHitArea[]; + getDrawableIDs(): string[]; + getDrawableIndex(id: string): number; + getDrawableVertices(drawIndex: number | string): Float32Array; + updateTransform(transform: Matrix): void; + update(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void; + updateFocus(): void; + updateNaturalMovements(dt: DOMHighResTimeStamp, now: DOMHighResTimeStamp): void; + draw(gl: WebGLRenderingContext): void; + destroy(): void; +} +export interface CubismStartupOption { + logFunction: Live2DCubismCore.csmLogFunction; + loggingLevel: LogLevel; +} +declare enum LogLevel { + LogLevel_Verbose = 0, + LogLevel_Debug = 1, + LogLevel_Info = 2, + LogLevel_Warning = 3, + LogLevel_Error = 4, + LogLevel_Off = 5 +} +/** + * Promises that the Cubism 4 framework is ready to work. + * @return Promise that resolves if the startup has succeeded, rejects if failed. + */ +export declare function cubism4Ready(): Promise; +/** + * Starts up Cubism 4 framework. + */ +export declare function startUpCubism4(options?: CubismStartupOption): void; + +export {}; diff --git a/live2d/node_modules/pkg-dir/index.d.ts b/live2d/node_modules/pkg-dir/index.d.ts new file mode 100644 index 0000000..e339404 --- /dev/null +++ b/live2d/node_modules/pkg-dir/index.d.ts @@ -0,0 +1,44 @@ +declare const pkgDir: { + /** + Find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // └── foo + // ├── package.json + // └── bar + // ├── baz + // └── example.js + + // example.js + import pkgDir = require('pkg-dir'); + + (async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' + })(); + ``` + */ + (cwd?: string): Promise; + + /** + Synchronously find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + */ + sync(cwd?: string): string | undefined; + + // TODO: Remove this for the next major release + default: typeof pkgDir; +}; + +export = pkgDir; diff --git a/live2d/node_modules/pkg-dir/index.js b/live2d/node_modules/pkg-dir/index.js new file mode 100644 index 0000000..83e683d --- /dev/null +++ b/live2d/node_modules/pkg-dir/index.js @@ -0,0 +1,17 @@ +'use strict'; +const path = require('path'); +const findUp = require('find-up'); + +const pkgDir = async cwd => { + const filePath = await findUp('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; + +module.exports = pkgDir; +// TODO: Remove this for the next major release +module.exports.default = pkgDir; + +module.exports.sync = cwd => { + const filePath = findUp.sync('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; diff --git a/live2d/node_modules/pkg-dir/license b/live2d/node_modules/pkg-dir/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/live2d/node_modules/pkg-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/pkg-dir/package.json b/live2d/node_modules/pkg-dir/package.json new file mode 100644 index 0000000..aad11e8 --- /dev/null +++ b/live2d/node_modules/pkg-dir/package.json @@ -0,0 +1,56 @@ +{ + "name": "pkg-dir", + "version": "4.2.0", + "description": "Find the root directory of a Node.js project or npm package", + "license": "MIT", + "repository": "sindresorhus/pkg-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "package", + "json", + "root", + "npm", + "entry", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^4.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tempy": "^0.3.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/live2d/node_modules/pkg-dir/readme.md b/live2d/node_modules/pkg-dir/readme.md new file mode 100644 index 0000000..92a77f4 --- /dev/null +++ b/live2d/node_modules/pkg-dir/readme.md @@ -0,0 +1,66 @@ +# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir) + +> Find the root directory of a Node.js project or npm package + + +## Install + +``` +$ npm install pkg-dir +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + └── foo + ├── package.json + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const pkgDir = require('pkg-dir'); + +(async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' +})(); +``` + + +## API + +### pkgDir([cwd]) + +Returns a `Promise` for either the project root path or `undefined` if it couldn't be found. + +### pkgDir.sync([cwd]) + +Returns the project root path or `undefined` if it couldn't be found. + +#### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + + +## Related + +- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/punycode/LICENSE-MIT.txt b/live2d/node_modules/punycode/LICENSE-MIT.txt new file mode 100644 index 0000000..a41e0a7 --- /dev/null +++ b/live2d/node_modules/punycode/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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. diff --git a/live2d/node_modules/punycode/README.md b/live2d/node_modules/punycode/README.md new file mode 100644 index 0000000..7ad7d1f --- /dev/null +++ b/live2d/node_modules/punycode/README.md @@ -0,0 +1,176 @@ +# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js) + +A robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms. + +This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm: + +* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C) +* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c) +* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c) +* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287) +* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072)) + +This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js). + +## Installation + +Via [npm](https://www.npmjs.com/) (only required for Node.js releases older than v0.6.2): + +```bash +npm install punycode +``` + +Via [Bower](http://bower.io/): + +```bash +bower install punycode +``` + +Via [Component](https://github.com/component/component): + +```bash +component install bestiejs/punycode.js +``` + +In a browser: + +```html + +``` + +In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/): + +```js +var punycode = require('punycode'); +``` + +In [Rhino](http://www.mozilla.org/rhino/): + +```js +load('punycode.js'); +``` + +Using an AMD loader like [RequireJS](http://requirejs.org/): + +```js +require( + { + 'paths': { + 'punycode': 'path/to/punycode' + } + }, + ['punycode'], + function(punycode) { + console.log(punycode); + } +); +``` + +## API + +### `punycode.decode(string)` + +Converts a Punycode string of ASCII symbols to a string of Unicode symbols. + +```js +// decode domain name parts +punycode.decode('maana-pta'); // 'mañana' +punycode.decode('--dqo34k'); // '☃-⌘' +``` + +### `punycode.encode(string)` + +Converts a string of Unicode symbols to a Punycode string of ASCII symbols. + +```js +// encode domain name parts +punycode.encode('mañana'); // 'maana-pta' +punycode.encode('☃-⌘'); // '--dqo34k' +``` + +### `punycode.toUnicode(input)` + +Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode. + +```js +// decode domain names +punycode.toUnicode('xn--maana-pta.com'); +// → 'mañana.com' +punycode.toUnicode('xn----dqo34k.com'); +// → '☃-⌘.com' + +// decode email addresses +punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'); +// → 'джумла@джpумлатест.bрфa' +``` + +### `punycode.toASCII(input)` + +Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII. + +```js +// encode domain names +punycode.toASCII('mañana.com'); +// → 'xn--maana-pta.com' +punycode.toASCII('☃-⌘.com'); +// → 'xn----dqo34k.com' + +// encode email addresses +punycode.toASCII('джумла@джpумлатест.bрфa'); +// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq' +``` + +### `punycode.ucs2` + +#### `punycode.ucs2.decode(string)` + +Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16. + +```js +punycode.ucs2.decode('abc'); +// → [0x61, 0x62, 0x63] +// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE: +punycode.ucs2.decode('\uD834\uDF06'); +// → [0x1D306] +``` + +#### `punycode.ucs2.encode(codePoints)` + +Creates a string based on an array of numeric code point values. + +```js +punycode.ucs2.encode([0x61, 0x62, 0x63]); +// → 'abc' +punycode.ucs2.encode([0x1D306]); +// → '\uD834\uDF06' +``` + +### `punycode.version` + +A string representing the current Punycode.js version number. + +## Unit tests & code coverage + +After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. + +Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. + +To generate the code coverage report, use `grunt cover`. + +Feel free to fork if you see possible improvements! + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## Contributors + +| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | +|---| +| [John-David Dalton](http://allyoucanleet.com/) | + +## License + +Punycode.js is available under the [MIT](https://mths.be/mit) license. diff --git a/live2d/node_modules/punycode/package.json b/live2d/node_modules/punycode/package.json new file mode 100644 index 0000000..accb530 --- /dev/null +++ b/live2d/node_modules/punycode/package.json @@ -0,0 +1,60 @@ +{ + "name": "punycode", + "version": "1.4.1", + "description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.", + "homepage": "https://mths.be/punycode", + "main": "punycode.js", + "keywords": [ + "punycode", + "unicode", + "idn", + "idna", + "dns", + "url", + "domain" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "contributors": [ + { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + { + "name": "John-David Dalton", + "url": "http://allyoucanleet.com/" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git" + }, + "bugs": "https://github.com/bestiejs/punycode.js/issues", + "files": [ + "LICENSE-MIT.txt", + "punycode.js" + ], + "scripts": { + "test": "node tests/tests.js" + }, + "devDependencies": { + "coveralls": "^2.11.4", + "grunt": "^0.4.5", + "grunt-contrib-uglify": "^0.11.0", + "grunt-shell": "^1.1.2", + "istanbul": "^0.4.1", + "qunit-extras": "^1.4.4", + "qunitjs": "~1.11.0", + "requirejs": "^2.1.22" + }, + "jspm": { + "map": { + "./punycode.js": { + "node": "@node/punycode" + } + } + } +} diff --git a/live2d/node_modules/punycode/punycode.js b/live2d/node_modules/punycode/punycode.js new file mode 100644 index 0000000..2c87f6c --- /dev/null +++ b/live2d/node_modules/punycode/punycode.js @@ -0,0 +1,533 @@ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); diff --git a/live2d/node_modules/qs/.editorconfig b/live2d/node_modules/qs/.editorconfig new file mode 100644 index 0000000..6adecfb --- /dev/null +++ b/live2d/node_modules/qs/.editorconfig @@ -0,0 +1,46 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 160 +quote_type = single + +[test/*] +max_line_length = off + +[LICENSE.md] +indent_size = off + +[*.md] +max_line_length = off + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[LICENSE] +indent_size = 2 +max_line_length = off + +[coverage/**/*] +indent_size = off +indent_style = off +indent = off +max_line_length = off + +[.nycrc] +indent_style = tab + +[tea.yaml] +indent_size = 2 diff --git a/live2d/node_modules/qs/.eslintrc b/live2d/node_modules/qs/.eslintrc new file mode 100644 index 0000000..b692761 --- /dev/null +++ b/live2d/node_modules/qs/.eslintrc @@ -0,0 +1,38 @@ +{ + "root": true, + + "extends": "@ljharb", + + "ignorePatterns": [ + "dist/", + ], + + "rules": { + "complexity": 0, + "consistent-return": 1, + "func-name-matching": 0, + "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], + "indent": [2, 4], + "max-lines-per-function": [2, { "max": 150 }], + "max-params": [2, 18], + "max-statements": [2, 100], + "multiline-comment-style": 0, + "no-continue": 1, + "no-magic-numbers": 0, + "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "function-paren-newline": 0, + "max-lines-per-function": 0, + "max-statements": 0, + "no-buffer-constructor": 0, + "no-extend-native": 0, + "no-throw-literal": 0, + }, + }, + ], +} diff --git a/live2d/node_modules/qs/.github/FUNDING.yml b/live2d/node_modules/qs/.github/FUNDING.yml new file mode 100644 index 0000000..0355f4f --- /dev/null +++ b/live2d/node_modules/qs/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/qs +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/live2d/node_modules/qs/.nycrc b/live2d/node_modules/qs/.nycrc new file mode 100644 index 0000000..1d57cab --- /dev/null +++ b/live2d/node_modules/qs/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "dist" + ] +} diff --git a/live2d/node_modules/qs/CHANGELOG.md b/live2d/node_modules/qs/CHANGELOG.md new file mode 100644 index 0000000..02a6b50 --- /dev/null +++ b/live2d/node_modules/qs/CHANGELOG.md @@ -0,0 +1,600 @@ +## **6.13.0** +- [New] `parse`: add `strictDepth` option (#511) +- [Tests] use `npm audit` instead of `aud` + +## **6.12.3** +- [Fix] `parse`: properly account for `strictNullHandling` when `allowEmptyArrays` +- [meta] fix changelog indentation + +## **6.12.2** +- [Fix] `parse`: parse encoded square brackets (#506) +- [readme] add CII best practices badge + +## **6.12.1** +- [Fix] `parse`: Disable `decodeDotInKeys` by default to restore previous behavior (#501) +- [Performance] `utils`: Optimize performance under large data volumes, reduce memory usage, and speed up processing (#502) +- [Refactor] `utils`: use `+=` +- [Tests] increase coverage + +## **6.12.0** + +- [New] `parse`/`stringify`: add `decodeDotInKeys`/`encodeDotKeys` options (#488) +- [New] `parse`: add `duplicates` option +- [New] `parse`/`stringify`: add `allowEmptyArrays` option to allow [] in object values (#487) +- [Refactor] `parse`/`stringify`: move allowDots config logic to its own variable +- [Refactor] `stringify`: move option-handling code into `normalizeStringifyOptions` +- [readme] update readme, add logos (#484) +- [readme] `stringify`: clarify default `arrayFormat` behavior +- [readme] fix line wrapping +- [readme] remove dead badges +- [Deps] update `side-channel` +- [meta] make the dist build 50% smaller +- [meta] add `sideEffects` flag +- [meta] run build in prepack, not prepublish +- [Tests] `parse`: remove useless tests; add coverage +- [Tests] `stringify`: increase coverage +- [Tests] use `mock-property` +- [Tests] `stringify`: improve coverage +- [Dev Deps] update `@ljharb/eslint-config `, `aud`, `has-override-mistake`, `has-property-descriptors`, `mock-property`, `npmignore`, `object-inspect`, `tape` +- [Dev Deps] pin `glob`, since v10.3.8+ requires a broken `jackspeak` +- [Dev Deps] pin `jackspeak` since 2.1.2+ depends on npm aliases, which kill the install process in npm < 6 + +## **6.11.2** +- [Fix] `parse`: Fix parsing when the global Object prototype is frozen (#473) +- [Tests] add passing test cases with empty keys (#473) + +## **6.11.1** +- [Fix] `stringify`: encode comma values more consistently (#463) +- [readme] add usage of `filter` option for injecting custom serialization, i.e. of custom types (#447) +- [meta] remove extraneous code backticks (#457) +- [meta] fix changelog markdown +- [actions] update checkout action +- [actions] restrict action permissions +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` + +## **6.11.0** +- [New] [Fix] `stringify`: revert 0e903c0; add `commaRoundTrip` option (#442) +- [readme] fix version badge + +## **6.10.5** +- [Fix] `stringify`: with `arrayFormat: comma`, properly include an explicit `[]` on a single-item array (#434) + +## **6.10.4** +- [Fix] `stringify`: with `arrayFormat: comma`, include an explicit `[]` on a single-item array (#441) +- [meta] use `npmignore` to autogenerate an npmignore file +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbol`, `object-inspect`, `tape` + +## **6.10.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [actions] reuse common workflows +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `tape` + +## **6.10.2** +- [Fix] `stringify`: actually fix cyclic references (#426) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [actions] update codecov uploader +- [actions] update workflows +- [Tests] clean up stringify tests slightly +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `safe-publish-latest`, `tape` + +## **6.10.1** +- [Fix] `stringify`: avoid exception on repeated object values (#402) + +## **6.10.0** +- [New] `stringify`: throw on cycles, instead of an infinite loop (#395, #394, #393) +- [New] `parse`: add `allowSparse` option for collapsing arrays with missing indices (#312) +- [meta] fix README.md (#399) +- [meta] only run `npm run dist` in publish, not install +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `tape` +- [Tests] fix tests on node v0.6 +- [Tests] use `ljharb/actions/node/install` instead of `ljharb/actions/node/run` +- [Tests] Revert "[meta] ignore eclint transitive audit warning" + +## **6.9.7** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [Tests] clean up stringify tests slightly +- [meta] fix README.md (#399) +- Revert "[meta] ignore eclint transitive audit warning" +- [actions] backport actions from main +- [Dev Deps] backport updates from main + +## **6.9.6** +- [Fix] restore `dist` dir; mistakenly removed in d4f6c32 + +## **6.9.5** +- [Fix] `stringify`: do not encode parens for RFC1738 +- [Fix] `stringify`: fix arrayFormat comma with empty array/objects (#350) +- [Refactor] `format`: remove `util.assign` call +- [meta] add "Allow Edits" workflow; update rebase workflow +- [actions] switch Automatic Rebase workflow to `pull_request_target` event +- [Tests] `stringify`: add tests for #378 +- [Tests] migrate tests to Github Actions +- [Tests] run `nyc` on all tests; use `tape` runner +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `mkdirp`, `object-inspect`, `tape`; add `aud` + +## **6.9.4** +- [Fix] `stringify`: when `arrayFormat` is `comma`, respect `serializeDate` (#364) +- [Refactor] `stringify`: reduce branching (part of #350) +- [Refactor] move `maybeMap` to `utils` +- [Dev Deps] update `browserify`, `tape` + +## **6.9.3** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.9.2** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [meta] ignore eclint transitive audit warning +- [meta] fix indentation in package.json +- [meta] add tidelift marketing copy +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `has-symbols`, `tape`, `mkdirp`, `iconv-lite` +- [actions] add automatic rebasing / merge commit blocking + +## **6.9.1** +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [Fix] `parse`: with comma true, do not split non-string values (#334) +- [meta] add `funding` field +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` +- [Tests] use shared travis-ci config + +## **6.9.0** +- [New] `parse`/`stringify`: Pass extra key/value argument to `decoder` (#333) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `evalmd` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] add `posttest` using `npx aud` to run `npm audit` without a lockfile +- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16` +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray + +## **6.8.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Tests] clean up stringify tests slightly +- [Docs] add note and links for coercing primitive values (#408) +- [meta] fix README.md (#399) +- [actions] backport actions from main +- [Dev Deps] backport updates from main +- [Refactor] `stringify`: reduce branching +- [meta] do not publish workflow files + +## **6.8.2** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.8.1** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [fix] `parse`: with comma true, do not split non-string values (#334) +- [meta] add tidelift marketing copy +- [meta] add `funding` field +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `has-symbols`, `iconv-lite`, `mkdirp`, `object-inspect` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] use shared travis-ci configs +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray +- [actions] add automatic rebasing / merge commit blocking + +## **6.8.0** +- [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326) +- [New] [Fix] stringify symbols and bigints +- [Fix] ensure node 0.12 can stringify Symbols +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Refactor] `formats`: tiny bit of cleanup. +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `safe-publish-latest`, `iconv-lite`, `tape` +- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended (#326) +- [Tests] use `eclint` instead of `editorconfig-tools` +- [docs] readme: add security note +- [meta] add github sponsorship +- [meta] add FUNDING.yml +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause + +## **6.7.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `stringify`: avoid encoding arrayformat comma when `encodeValuesOnly = true` (#424) +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] add note and links for coercing primitive values (#408) +- [meta] fix README.md (#399) +- [meta] do not publish workflow files +- [actions] backport actions from main +- [Dev Deps] backport updates from main +- [Tests] use `nyc` for coverage +- [Tests] clean up stringify tests slightly + +## **6.7.2** +- [Fix] proper comma parsing of URL-encoded commas (#361) +- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336) + +## **6.7.1** +- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) +- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) +- [fix] `parse`: with comma true, do not split non-string values (#334) +- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Refactor] `formats`: tiny bit of cleanup. +- readme: add security note +- [meta] add tidelift marketing copy +- [meta] add `funding` field +- [meta] add FUNDING.yml +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `iconv-lite`, `mkdirp`, `object-inspect`, `browserify` +- [Tests] `parse`: add passing `arrayFormat` tests +- [Tests] use shared travis-ci configs +- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray +- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended +- [Tests] use `eclint` instead of `editorconfig-tools` +- [actions] add automatic rebasing / merge commit blocking + +## **6.7.0** +- [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219) +- [Fix] correctly parse nested arrays (#212) +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source, also with an array source +- [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` +- [Refactor] `utils`: `isBuffer`: small tweak; add tests +- [Refactor] use cached `Array.isArray` +- [Refactor] `parse`/`stringify`: make a function to normalize the options +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] `stringify`/`utils`: cache `Array.isArray` +- [Tests] always use `String(x)` over `x.toString()` +- [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 +- [Tests] temporarily allow coverage to fail + +## **6.6.1** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] correctly parse nested arrays +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Robustness] `stringify`: cache `Object.prototype.hasOwnProperty` +- [Refactor] `formats`: tiny bit of cleanup. +- [Refactor] `utils`: `isBuffer`: small tweak; add tests +- [Refactor]: `stringify`/`utils`: cache `Array.isArray` +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] use cached `Array.isArray` +- [Refactor] `parse`/`stringify`: make a function to normalize the options +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] do not publish workflow files +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [meta] Fixes typo in CHANGELOG.md +- [actions] backport actions from main +- [Tests] fix Buffer tests to work in node < 4.5 and node < 5.10 +- [Tests] always use `String(x)` over `x.toString()` +- [Dev Deps] backport from main + +## **6.6.0** +- [New] Add support for iso-8859-1, utf8 "sentinel" and numeric entities (#268) +- [New] move two-value combine to a `utils` function (#189) +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` (#260) +- [Fix] `stringify`: do not crash in an obscure combo of `interpretNumericEntities`, a bad custom `decoder`, & `iso-8859-1` +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Refactor] `parse`: only need to reassign the var once +- [Refactor] `parse`/`stringify`: clean up `charset` options checking; fix defaults +- [Refactor] add missing defaults +- [Refactor] `parse`: one less `concat` call +- [Refactor] `utils`: `compactQueue`: make it explicitly side-effecting +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`, `iconv-lite`, `safe-publish-latest`, `tape` +- [Tests] up to `node` `v10.10`, `v9.11`, `v8.12`, `v6.14`, `v4.9`; pin included builds to LTS + +## **6.5.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] correctly parse nested arrays +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Refactor] `utils`: reduce observable [[Get]]s +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Refactor] `parse`: only need to reassign the var once +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clean up license text so it’s properly detected as BSD-3-Clause +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] always use `String(x)` over `x.toString()` +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.5.2** +- [Fix] use `safer-buffer` instead of `Buffer` constructor +- [Refactor] utils: `module.exports` one thing, instead of mutating `exports` (#230) +- [Dev Deps] update `browserify`, `eslint`, `iconv-lite`, `safer-buffer`, `tape`, `browserify` + +## **6.5.1** +- [Fix] Fix parsing & compacting very deep objects (#224) +- [Refactor] name utils functions +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` +- [Tests] up to `node` `v8.4`; use `nvm install-latest-npm` so newer npm doesn’t break older node +- [Tests] Use precise dist for Node.js 0.6 runtime (#225) +- [Tests] make 0.6 required, now that it’s passing +- [Tests] on `node` `v8.2`; fix npm on node 0.6 + +## **6.5.0** +- [New] add `utils.assign` +- [New] pass default encoder/decoder to custom encoder/decoder functions (#206) +- [New] `parse`/`stringify`: add `ignoreQueryPrefix`/`addQueryPrefix` options, respectively (#213) +- [Fix] Handle stringifying empty objects with addQueryPrefix (#217) +- [Fix] do not mutate `options` argument (#207) +- [Refactor] `parse`: cache index to reuse in else statement (#182) +- [Docs] add various badges to readme (#208) +- [Dev Deps] update `eslint`, `browserify`, `iconv-lite`, `tape` +- [Tests] up to `node` `v8.1`, `v7.10`, `v6.11`; npm v4.6 breaks on node < v1; npm v5+ breaks on node < v4 +- [Tests] add `editorconfig-tools` + +## **6.4.1** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] use `safer-buffer` instead of `Buffer` constructor +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [readme] remove travis badge; add github actions/codecov badges; update URLs +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.4.0** +- [New] `qs.stringify`: add `encodeValuesOnly` option +- [Fix] follow `allowPrototypes` option during merge (#201, #201) +- [Fix] support keys starting with brackets (#202, #200) +- [Fix] chmod a-x +- [Dev Deps] update `eslint` +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds +- [eslint] reduce warnings + +## **6.3.3** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] fix for an impossible situation: when the formatter is called with a non-string value +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `stringify`: fix a crash with `strictNullHandling` and a custom `filter`/`serializeDate` (#279) +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Refactor] `stringify`: Avoid arr = arr.concat(...), push to the existing instance (#269) +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] use `safer-buffer` instead of `Buffer` constructor +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.3.2** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Dev Deps] update `eslint` +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.3.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties (thanks, @snyk!) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `browserify`, `iconv-lite`, `qs-iconv`, `tape` +- [Tests] on all node minors; improve test matrix +- [Docs] document stringify option `allowDots` (#195) +- [Docs] add empty object and array values example (#195) +- [Docs] Fix minor inconsistency/typo (#192) +- [Docs] document stringify option `sort` (#191) +- [Refactor] `stringify`: throw faster with an invalid encoder +- [Refactor] remove unnecessary escapes (#184) +- Remove contributing.md, since `qs` is no longer part of `hapi` (#183) + +## **6.3.0** +- [New] Add support for RFC 1738 (#174, #173) +- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159) +- [Fix] ensure `utils.merge` handles merging two arrays +- [Refactor] only constructors should be capitalized +- [Refactor] capitalized var names are for constructors only +- [Refactor] avoid using a sparse array +- [Robustness] `formats`: cache `String#replace` +- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` +- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix +- [Tests] flesh out arrayLimit/arrayFormat tests (#107) +- [Tests] skip Object.create tests when null objects are not available +- [Tests] Turn on eslint for test files (#175) + +## **6.2.4** +- [Fix] `parse`: ignore `__proto__` keys (#428) +- [Fix] `utils.merge`: avoid a crash with a null target and an array source +- [Fix] `utils.merge`: avoid a crash with a null target and a truthy non-array source +- [Fix] `utils`: `merge`: fix crash when `source` is a truthy primitive & no options are provided +- [Fix] when `parseArrays` is false, properly handle keys ending in `[]` +- [Robustness] `stringify`: avoid relying on a global `undefined` (#427) +- [Refactor] use cached `Array.isArray` +- [Docs] Clarify the need for "arrayLimit" option +- [meta] fix README.md (#399) +- [meta] Clean up license text so it’s properly detected as BSD-3-Clause +- [meta] add FUNDING.yml +- [actions] backport actions from main +- [Tests] use `safer-buffer` instead of `Buffer` constructor +- [Tests] remove nonexistent tape option +- [Dev Deps] backport from main + +## **6.2.3** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.2.2** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## **6.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values +- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call` +- [Tests] remove `parallelshell` since it does not reliably report failures +- [Tests] up to `node` `v6.3`, `v5.12` +- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `qs-iconv` + +## [**6.2.0**](https://github.com/ljharb/qs/issues?milestone=36&state=closed) +- [New] pass Buffers to the encoder/decoder directly (#161) +- [New] add "encoder" and "decoder" options, for custom param encoding/decoding (#160) +- [Fix] fix compacting of nested sparse arrays (#150) + +## **6.1.2** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.1.1** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties + +## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=35&state=closed) +- [New] allowDots option for `stringify` (#151) +- [Fix] "sort" option should work at a depth of 3 or more (#151) +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## **6.0.4** +- [Fix] follow `allowPrototypes` option during merge (#201, #200) +- [Fix] chmod a-x +- [Fix] support keys starting with brackets (#202, #200) +- [Tests] up to `node` `v7.7`, `v6.10`,` v4.8`; disable osx builds since they block linux builds + +## **6.0.3** +- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties +- [Fix] Restore `dist` directory; will be removed in v7 (#148) + +## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) +- Revert ES6 requirement and restore support for node down to v0.8. + +## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) +- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json + +## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) +- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 + +## **5.2.1** +- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values + +## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) +- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string + +## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) +- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional +- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify + +## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) +- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false +- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm + +## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) +- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional + +## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) +- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" + +## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) +- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties +- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost +- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing +- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object +- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option +- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. +- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 +- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 +- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign +- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute + +## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) +- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object # is not a function + +## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) +- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option + +## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) +- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 +- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader + +## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) +- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object + +## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) +- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". + +## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) +- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 + +## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) +- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? +- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 +- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 + +## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) +- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number + +## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) +- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array +- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x + +## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) +- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value +- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty +- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? + +## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) +- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 +- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects + +## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) +- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present +- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays +- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge +- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? + +## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) +- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter + +## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) +- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? +- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit +- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 + +## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) +- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values + +## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) +- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters +- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block + +## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) +- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument +- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed + +## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) +- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted +- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null +- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README + +## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) +- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index diff --git a/live2d/node_modules/qs/LICENSE.md b/live2d/node_modules/qs/LICENSE.md new file mode 100644 index 0000000..fecf6b6 --- /dev/null +++ b/live2d/node_modules/qs/LICENSE.md @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/ljharb/qs/graphs/contributors) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/live2d/node_modules/qs/README.md b/live2d/node_modules/qs/README.md new file mode 100644 index 0000000..1e0d9ad --- /dev/null +++ b/live2d/node_modules/qs/README.md @@ -0,0 +1,709 @@ +

+ qs +

+ +# qs [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/9058/badge)](https://bestpractices.coreinfrastructure.org/projects/9058) + +[![npm badge][npm-badge-png]][package-url] + +A querystring parsing and stringifying library with some added security. + +Lead Maintainer: [Jordan Harband](https://github.com/ljharb) + +The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). + +## Usage + +```javascript +var qs = require('qs'); +var assert = require('assert'); + +var obj = qs.parse('a=c'); +assert.deepEqual(obj, { a: 'c' }); + +var str = qs.stringify(obj); +assert.equal(str, 'a=c'); +``` + +### Parsing Objects + +[](#preventEval) +```javascript +qs.parse(string, [options]); +``` + +**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. +For example, the string `'foo[bar]=baz'` converts to: + +```javascript +assert.deepEqual(qs.parse('foo[bar]=baz'), { + foo: { + bar: 'baz' + } +}); +``` + +When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: + +```javascript +var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); +assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } }); +``` + +By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. +*WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. +Always be careful with this option. + +```javascript +var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); +assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); +``` + +URI encoded strings work too: + +```javascript +assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } +}); +``` + +You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: + +```javascript +assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' + } + } +}); +``` + +By default, when nesting objects **qs** will only parse up to 5 children deep. +This means if you attempt to parse a string like `'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: + +```javascript +var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } +}; +var string = 'a[b][c][d][e][f][g][h][i]=j'; +assert.deepEqual(qs.parse(string), expected); +``` + +This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: + +```javascript +var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); +assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); +``` + +You can configure **qs** to throw an error when parsing nested input beyond this depth using the `strictDepth` option (defaulted to false): + +```javascript +try { + qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true }); +} catch (err) { + assert(err instanceof RangeError); + assert.strictEqual(err.message, 'Input depth exceeded depth option of 1 and strictDepth is true'); +} +``` + +The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. The strictDepth option adds a layer of protection by throwing an error when the limit is exceeded, allowing you to catch and handle such cases. + +For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: + +```javascript +var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); +assert.deepEqual(limited, { a: 'b' }); +``` + +To bypass the leading question mark, use `ignoreQueryPrefix`: + +```javascript +var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true }); +assert.deepEqual(prefixed, { a: 'b', c: 'd' }); +``` + +An optional delimiter can also be passed: + +```javascript +var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); +assert.deepEqual(delimited, { a: 'b', c: 'd' }); +``` + +Delimiters can be a regular expression too: + +```javascript +var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); +assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +``` + +Option `allowDots` can be used to enable dot notation: + +```javascript +var withDots = qs.parse('a.b=c', { allowDots: true }); +assert.deepEqual(withDots, { a: { b: 'c' } }); +``` + +Option `decodeDotInKeys` can be used to decode dots in keys +Note: it implies `allowDots`, so `parse` will error if you set `decodeDotInKeys` to `true`, and `allowDots` to `false`. + +```javascript +var withDots = qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { decodeDotInKeys: true }); +assert.deepEqual(withDots, { 'name.obj': { first: 'John', last: 'Doe' }}); +``` + +Option `allowEmptyArrays` can be used to allowing empty array values in object +```javascript +var withEmptyArrays = qs.parse('foo[]&bar=baz', { allowEmptyArrays: true }); +assert.deepEqual(withEmptyArrays, { foo: [], bar: 'baz' }); +``` + +Option `duplicates` can be used to change the behavior when duplicate keys are encountered +```javascript +assert.deepEqual(qs.parse('foo=bar&foo=baz'), { foo: ['bar', 'baz'] }); +assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'combine' }), { foo: ['bar', 'baz'] }); +assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'first' }), { foo: 'bar' }); +assert.deepEqual(qs.parse('foo=bar&foo=baz', { duplicates: 'last' }), { foo: 'baz' }); +``` + +If you have to deal with legacy browsers or services, there's also support for decoding percent-encoded octets as iso-8859-1: + +```javascript +var oldCharset = qs.parse('a=%A7', { charset: 'iso-8859-1' }); +assert.deepEqual(oldCharset, { a: '§' }); +``` + +Some services add an initial `utf8=✓` value to forms so that old Internet Explorer versions are more likely to submit the form as utf-8. +Additionally, the server can check the value against wrong encodings of the checkmark character and detect that a query string or `application/x-www-form-urlencoded` body was *not* sent as utf-8, eg. if the form had an `accept-charset` parameter or the containing page had a different character set. + +**qs** supports this mechanism via the `charsetSentinel` option. +If specified, the `utf8` parameter will be omitted from the returned object. +It will be used to switch to `iso-8859-1`/`utf-8` mode depending on how the checkmark is encoded. + +**Important**: When you specify both the `charset` option and the `charsetSentinel` option, the `charset` will be overridden when the request contains a `utf8` parameter from which the actual charset can be deduced. +In that sense the `charset` will behave as the default charset rather than the authoritative charset. + +```javascript +var detectedAsUtf8 = qs.parse('utf8=%E2%9C%93&a=%C3%B8', { + charset: 'iso-8859-1', + charsetSentinel: true +}); +assert.deepEqual(detectedAsUtf8, { a: 'ø' }); + +// Browsers encode the checkmark as ✓ when submitting as iso-8859-1: +var detectedAsIso8859_1 = qs.parse('utf8=%26%2310003%3B&a=%F8', { + charset: 'utf-8', + charsetSentinel: true +}); +assert.deepEqual(detectedAsIso8859_1, { a: 'ø' }); +``` + +If you want to decode the `&#...;` syntax to the actual character, you can specify the `interpretNumericEntities` option as well: + +```javascript +var detectedAsIso8859_1 = qs.parse('a=%26%239786%3B', { + charset: 'iso-8859-1', + interpretNumericEntities: true +}); +assert.deepEqual(detectedAsIso8859_1, { a: '☺' }); +``` + +It also works when the charset has been detected in `charsetSentinel` mode. + +### Parsing Arrays + +**qs** can also parse arrays using a similar `[]` notation: + +```javascript +var withArray = qs.parse('a[]=b&a[]=c'); +assert.deepEqual(withArray, { a: ['b', 'c'] }); +``` + +You may specify an index as well: + +```javascript +var withIndexes = qs.parse('a[1]=c&a[0]=b'); +assert.deepEqual(withIndexes, { a: ['b', 'c'] }); +``` + +Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number to create an array. +When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving their order: + +```javascript +var noSparse = qs.parse('a[1]=b&a[15]=c'); +assert.deepEqual(noSparse, { a: ['b', 'c'] }); +``` + +You may also use `allowSparse` option to parse sparse arrays: + +```javascript +var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true }); +assert.deepEqual(sparseArray, { a: [, '2', , '5'] }); +``` + +Note that an empty string is also a value, and will be preserved: + +```javascript +var withEmptyString = qs.parse('a[]=&a[]=b'); +assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + +var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); +assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); +``` + +**qs** will also limit specifying indices in an array to a maximum index of `20`. +Any array members with an index of greater than `20` will instead be converted to an object with the index as the key. +This is needed to handle cases when someone sent, for example, `a[999999999]` and it will take significant time to iterate over this huge array. + +```javascript +var withMaxIndex = qs.parse('a[100]=b'); +assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); +``` + +This limit can be overridden by passing an `arrayLimit` option: + +```javascript +var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); +assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); +``` + +To disable array parsing entirely, set `parseArrays` to `false`. + +```javascript +var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); +assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); +``` + +If you mix notations, **qs** will merge the two items into an object: + +```javascript +var mixedNotation = qs.parse('a[0]=b&a[b]=c'); +assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); +``` + +You can also create arrays of objects: + +```javascript +var arraysOfObjects = qs.parse('a[][b]=c'); +assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); +``` + +Some people use comma to join array, **qs** can parse it: +```javascript +var arraysOfObjects = qs.parse('a=b,c', { comma: true }) +assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] }) +``` +(_this cannot convert nested objects, such as `a={b:1},{c:d}`_) + +### Parsing primitive/scalar values (numbers, booleans, null, etc) + +By default, all values are parsed as strings. +This behavior will not change and is explained in [issue #91](https://github.com/ljharb/qs/issues/91). + +```javascript +var primitiveValues = qs.parse('a=15&b=true&c=null'); +assert.deepEqual(primitiveValues, { a: '15', b: 'true', c: 'null' }); +``` + +If you wish to auto-convert values which look like numbers, booleans, and other values into their primitive counterparts, you can use the [query-types Express JS middleware](https://github.com/xpepermint/query-types) which will auto-convert all request query parameters. + +### Stringifying + +[](#preventEval) +```javascript +qs.stringify(object, [options]); +``` + +When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: + +```javascript +assert.equal(qs.stringify({ a: 'b' }), 'a=b'); +assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); +``` + +This encoding can be disabled by setting the `encode` option to `false`: + +```javascript +var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); +assert.equal(unencoded, 'a[b]=c'); +``` + +Encoding can be disabled for keys by setting the `encodeValuesOnly` option to `true`: +```javascript +var encodedValues = qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true } +); +assert.equal(encodedValues,'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h'); +``` + +This encoding can also be replaced by a custom encoding method set as `encoder` option: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string +}}) +``` + +_(Note: the `encoder` option does not apply if `encode` is `false`)_ + +Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string +}}) +``` + +You can encode keys and values using different logic by using the type argument provided to the encoder: + +```javascript +var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str, defaultEncoder, charset, type) { + if (type === 'key') { + return // Encoded key + } else if (type === 'value') { + return // Encoded value + } +}}) +``` + +The type argument is also provided to the decoder: + +```javascript +var decoded = qs.parse('x=z', { decoder: function (str, defaultDecoder, charset, type) { + if (type === 'key') { + return // Decoded key + } else if (type === 'value') { + return // Decoded value + } +}}) +``` + +Examples beyond this point will be shown as though the output is not URI encoded for clarity. +Please note that the return values in these cases *will* be URI encoded during real usage. + +When arrays are stringified, they follow the `arrayFormat` option, which defaults to `indices`: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }); +// 'a[0]=b&a[1]=c&a[2]=d' +``` + +You may override this by setting the `indices` option to `false`, or to be more explicit, the `arrayFormat` option to `repeat`: + +```javascript +qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); +// 'a=b&a=c&a=d' +``` + +You may use the `arrayFormat` option to specify the format of the output array: + +```javascript +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) +// 'a[0]=b&a[1]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) +// 'a[]=b&a[]=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) +// 'a=b&a=c' +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' }) +// 'a=b,c' +``` + +Note: when using `arrayFormat` set to `'comma'`, you can also pass the `commaRoundTrip` option set to `true` or `false`, to append `[]` on single-item arrays, so that they can round trip through a parse. + +When objects are stringified, by default they use bracket notation: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); +// 'a[b][c]=d&a[b][e]=f' +``` + +You may override this to use dot notation by setting the `allowDots` option to `true`: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); +// 'a.b.c=d&a.b.e=f' +``` + +You may encode the dot notation in the keys of object with option `encodeDotInKeys` by setting it to `true`: +Note: it implies `allowDots`, so `stringify` will error if you set `decodeDotInKeys` to `true`, and `allowDots` to `false`. +Caveat: when `encodeValuesOnly` is `true` as well as `encodeDotInKeys`, only dots in keys and nothing else will be encoded. +```javascript +qs.stringify({ "name.obj": { "first": "John", "last": "Doe" } }, { allowDots: true, encodeDotInKeys: true }) +// 'name%252Eobj.first=John&name%252Eobj.last=Doe' +``` + +You may allow empty array values by setting the `allowEmptyArrays` option to `true`: +```javascript +qs.stringify({ foo: [], bar: 'baz' }, { allowEmptyArrays: true }); +// 'foo[]&bar=baz' +``` + +Empty strings and null values will omit the value, but the equals sign (=) remains in place: + +```javascript +assert.equal(qs.stringify({ a: '' }), 'a='); +``` + +Key with no values (such as an empty object or array) will return nothing: + +```javascript +assert.equal(qs.stringify({ a: [] }), ''); +assert.equal(qs.stringify({ a: {} }), ''); +assert.equal(qs.stringify({ a: [{}] }), ''); +assert.equal(qs.stringify({ a: { b: []} }), ''); +assert.equal(qs.stringify({ a: { b: {}} }), ''); +``` + +Properties that are set to `undefined` will be omitted entirely: + +```javascript +assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); +``` + +The query string may optionally be prepended with a question mark: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d'); +``` + +The delimiter may be overridden with stringify as well: + +```javascript +assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); +``` + +If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option: + +```javascript +var date = new Date(7); +assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A')); +assert.equal( + qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }), + 'a=7' +); +``` + +You may use the `sort` option to affect the order of parameter keys: + +```javascript +function alphabeticalSort(a, b) { + return a.localeCompare(b); +} +assert.equal(qs.stringify({ a: 'c', z: 'y', b : 'f' }, { sort: alphabeticalSort }), 'a=c&b=f&z=y'); +``` + +Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. +If you pass a function, it will be called for each key to obtain the replacement value. +Otherwise, if you pass an array, it will be used to select properties and array indices for stringification: + +```javascript +function filterFunc(prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; +} +qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); +// 'a=b&c=d&e[f]=123&e[g][0]=4' +qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); +// 'a=b&e=f' +qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); +// 'a[0]=b&a[2]=d' +``` + +You could also use `filter` to inject custom serialization for user defined types. +Consider you're working with some api that expects query strings of the format for ranges: + +``` +https://domain.com/endpoint?range=30...70 +``` + +For which you model as: + +```javascript +class Range { + constructor(from, to) { + this.from = from; + this.to = to; + } +} +``` + +You could _inject_ a custom serializer to handle values of this type: + +```javascript +qs.stringify( + { + range: new Range(30, 70), + }, + { + filter: (prefix, value) => { + if (value instanceof Range) { + return `${value.from}...${value.to}`; + } + // serialize the usual way + return value; + }, + } +); +// range=30...70 +``` + +### Handling of `null` values + +By default, `null` values are treated like empty strings: + +```javascript +var withNull = qs.stringify({ a: null, b: '' }); +assert.equal(withNull, 'a=&b='); +``` + +Parsing does not distinguish between parameters with and without equal signs. +Both are converted to empty strings. + +```javascript +var equalsInsensitive = qs.parse('a&b='); +assert.deepEqual(equalsInsensitive, { a: '', b: '' }); +``` + +To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` +values have no `=` sign: + +```javascript +var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); +assert.equal(strictNull, 'a&b='); +``` + +To parse values without `=` back to `null` use the `strictNullHandling` flag: + +```javascript +var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); +assert.deepEqual(parsedStrictNull, { a: null, b: '' }); +``` + +To completely skip rendering keys with `null` values, use the `skipNulls` flag: + +```javascript +var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); +assert.equal(nullsSkipped, 'a=b'); +``` + +If you're communicating with legacy systems, you can switch to `iso-8859-1` using the `charset` option: + +```javascript +var iso = qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' }); +assert.equal(iso, '%E6=%E6'); +``` + +Characters that don't exist in `iso-8859-1` will be converted to numeric entities, similar to what browsers do: + +```javascript +var numeric = qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' }); +assert.equal(numeric, 'a=%26%239786%3B'); +``` + +You can use the `charsetSentinel` option to announce the character by including an `utf8=✓` parameter with the proper encoding if the checkmark, similar to what Ruby on Rails and others do when submitting forms. + +```javascript +var sentinel = qs.stringify({ a: '☺' }, { charsetSentinel: true }); +assert.equal(sentinel, 'utf8=%E2%9C%93&a=%E2%98%BA'); + +var isoSentinel = qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' }); +assert.equal(isoSentinel, 'utf8=%26%2310003%3B&a=%E6'); +``` + +### Dealing with special character sets + +By default the encoding and decoding of characters is done in `utf-8`, and `iso-8859-1` support is also built in via the `charset` parameter. + +If you wish to encode querystrings to a different character set (i.e. +[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the +[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: + +```javascript +var encoder = require('qs-iconv/encoder')('shift_jis'); +var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); +assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); +``` + +This also works for decoding of query strings: + +```javascript +var decoder = require('qs-iconv/decoder')('shift_jis'); +var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); +assert.deepEqual(obj, { a: 'こんにちは!' }); +``` + +### RFC 3986 and RFC 1738 space encoding + +RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible. +In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'. + +``` +assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c'); +assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c'); +``` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +## qs for enterprise + +Available as part of the Tidelift Subscription + +The maintainers of qs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. +Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. +[Learn more.](https://tidelift.com/subscription/pkg/npm-qs?utm_source=npm-qs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +[package-url]: https://npmjs.org/package/qs +[npm-version-svg]: https://versionbadg.es/ljharb/qs.svg +[deps-svg]: https://david-dm.org/ljharb/qs.svg +[deps-url]: https://david-dm.org/ljharb/qs +[dev-deps-svg]: https://david-dm.org/ljharb/qs/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/qs#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/qs.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/qs.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/qs.svg +[downloads-url]: https://npm-stat.com/charts.html?package=qs +[codecov-image]: https://codecov.io/gh/ljharb/qs/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/qs/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/qs +[actions-url]: https://github.com/ljharb/qs/actions + +## Acknowledgements + +qs logo by [NUMI](https://github.com/numi-hq/open-design): + +[NUMI Logo](https://numi.tech/?ref=qs) diff --git a/live2d/node_modules/qs/dist/qs.js b/live2d/node_modules/qs/dist/qs.js new file mode 100644 index 0000000..154e72e --- /dev/null +++ b/live2d/node_modules/qs/dist/qs.js @@ -0,0 +1,90 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i-1?e.split(","):e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i,o=t.parameterLimit===1/0?void 0:t.parameterLimit,l=a.split(t.delimiter,o),s=-1,n=t.charset;if(t.charsetSentinel)for(i=0;i-1&&(c=isArray(c)?[c]:c);var y=has.call(r,p);y&&"combine"===t.duplicates?r[p]=utils.combine(r[p],c):y&&"last"!==t.duplicates||(r[p]=c)}return r},parseObject=function(e,t,r,a){for(var i=a?t:parseArrayValue(t,r),o=e.length-1;o>=0;--o){var l,s=e[o];if("[]"===s&&r.parseArrays)l=r.allowEmptyArrays&&(""===i||r.strictNullHandling&&null===i)?[]:[].concat(i);else{l=r.plainObjects?Object.create(null):{};var n="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,p=r.decodeDotInKeys?n.replace(/%2E/g,"."):n,c=parseInt(p,10);r.parseArrays||""!==p?!isNaN(c)&&s!==p&&String(c)===p&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(l=[])[c]=i:"__proto__"!==p&&(l[p]=i):l={0:i}}i=l}return i},parseKeys=function parseQueryStringKeys(e,t,r,a){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,l=r.depth>0&&/(\[[^[\]]*])/.exec(i),s=l?i.slice(0,l.index):i,n=[];if(s){if(!r.plainObjects&&has.call(Object.prototype,s)&&!r.allowPrototypes)return;n.push(s)}for(var p=0;r.depth>0&&null!==(l=o.exec(i))&&p0?w.join(",")||null:void 0}];else if(isArray(f))E=f;else{var S=Object.keys(w);E=u?S.sort(u):S}var O=l?r.replace(/\./g,"%2E"):r,T=o&&isArray(w)&&1===w.length?O+"[]":O;if(a&&isArray(w)&&0===w.length)return T+"[]";for(var k=0;k0?y+d:""}; + +},{"1":1,"29":29,"5":5}],5:[function(require,module,exports){ +"use strict";var formats=require(1),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,hexTable=function(){for(var e=[],r=0;r<256;++r)e.push("%"+((r<16?"0":"")+r.toString(16)).toUpperCase());return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var o=[],n=0;n=limit?a.slice(i,i+limit):a,p=[],s=0;s=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||n===formats.RFC1738&&(40===f||41===f)?p[p.length]=u.charAt(s):f<128?p[p.length]=hexTable[f]:f<2048?p[p.length]=hexTable[192|f>>6]+hexTable[128|63&f]:f<55296||f>=57344?p[p.length]=hexTable[224|f>>12]+hexTable[128|f>>6&63]+hexTable[128|63&f]:(s+=1,f=65536+((1023&f)<<10|1023&u.charCodeAt(s)),p[p.length]=hexTable[240|f>>18]+hexTable[128|f>>12&63]+hexTable[128|f>>6&63]+hexTable[128|63&f])}c+=p.join("")}return c},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],o=0;o-1?callBind(t):t}; + +},{"20":20,"8":8}],20:[function(require,module,exports){ +"use strict";var undefined,$Error=require(12),$EvalError=require(11),$RangeError=require(13),$ReferenceError=require(14),$SyntaxError=require(15),$TypeError=require(16),$URIError=require(17),$Function=Function,getEvalledConstructor=function(r){try{return $Function('"use strict"; return ('+r+").constructor;")()}catch(r){}},$gOPD=Object.getOwnPropertyDescriptor;if($gOPD)try{$gOPD({},"")}catch(r){$gOPD=null}var throwTypeError=function(){throw new $TypeError},ThrowTypeError=$gOPD?function(){try{return throwTypeError}catch(r){try{return $gOPD(arguments,"callee").get}catch(r){return throwTypeError}}}():throwTypeError,hasSymbols=require(24)(),hasProto=require(23)(),getProto=Object.getPrototypeOf||(hasProto?function(r){return r.__proto__}:null),needsEval={},TypedArray="undefined"!=typeof Uint8Array&&getProto?getProto(Uint8Array):undefined,INTRINSICS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?undefined:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?undefined:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols&&getProto?getProto([][Symbol.iterator]()):undefined,"%AsyncFromSyncIteratorPrototype%":undefined,"%AsyncFunction%":needsEval,"%AsyncGenerator%":needsEval,"%AsyncGeneratorFunction%":needsEval,"%AsyncIteratorPrototype%":needsEval,"%Atomics%":"undefined"==typeof Atomics?undefined:Atomics,"%BigInt%":"undefined"==typeof BigInt?undefined:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?undefined:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?undefined:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?undefined:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$Error,"%eval%":eval,"%EvalError%":$EvalError,"%Float32Array%":"undefined"==typeof Float32Array?undefined:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?undefined:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?undefined:FinalizationRegistry,"%Function%":$Function,"%GeneratorFunction%":needsEval,"%Int8Array%":"undefined"==typeof Int8Array?undefined:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?undefined:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?undefined:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":hasSymbols&&getProto?getProto(getProto([][Symbol.iterator]())):undefined,"%JSON%":"object"==typeof JSON?JSON:undefined,"%Map%":"undefined"==typeof Map?undefined:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&hasSymbols&&getProto?getProto((new Map)[Symbol.iterator]()):undefined,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?undefined:Promise,"%Proxy%":"undefined"==typeof Proxy?undefined:Proxy,"%RangeError%":$RangeError,"%ReferenceError%":$ReferenceError,"%Reflect%":"undefined"==typeof Reflect?undefined:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?undefined:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&hasSymbols&&getProto?getProto((new Set)[Symbol.iterator]()):undefined,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?undefined:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols&&getProto?getProto(""[Symbol.iterator]()):undefined,"%Symbol%":hasSymbols?Symbol:undefined,"%SyntaxError%":$SyntaxError,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%Uint8Array%":"undefined"==typeof Uint8Array?undefined:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?undefined:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?undefined:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?undefined:Uint32Array,"%URIError%":$URIError,"%WeakMap%":"undefined"==typeof WeakMap?undefined:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?undefined:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?undefined:WeakSet};if(getProto)try{null.error}catch(r){var errorProto=getProto(getProto(r));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function doEval(r){var e;if("%AsyncFunction%"===r)e=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===r)e=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===r)e=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===r){var t=doEval("%AsyncGeneratorFunction%");t&&(e=t.prototype)}else if("%AsyncIteratorPrototype%"===r){var o=doEval("%AsyncGenerator%");o&&getProto&&(e=getProto(o.prototype))}return INTRINSICS[r]=e,e},LEGACY_ALIASES={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bind=require(19),hasOwn=require(26),$concat=bind.call(Function.call,Array.prototype.concat),$spliceApply=bind.call(Function.apply,Array.prototype.splice),$replace=bind.call(Function.call,String.prototype.replace),$strSlice=bind.call(Function.call,String.prototype.slice),$exec=bind.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function stringToPath(r){var e=$strSlice(r,0,1),t=$strSlice(r,-1);if("%"===e&&"%"!==t)throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if("%"===t&&"%"!==e)throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var o=[];return $replace(r,rePropName,(function(r,e,t,n){o[o.length]=t?$replace(n,reEscapeChar,"$1"):e||r})),o},getBaseIntrinsic=function getBaseIntrinsic(r,e){var t,o=r;if(hasOwn(LEGACY_ALIASES,o)&&(o="%"+(t=LEGACY_ALIASES[o])[0]+"%"),hasOwn(INTRINSICS,o)){var n=INTRINSICS[o];if(n===needsEval&&(n=doEval(o)),void 0===n&&!e)throw new $TypeError("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:t,name:o,value:n}}throw new $SyntaxError("intrinsic "+r+" does not exist!")};module.exports=function GetIntrinsic(r,e){if("string"!=typeof r||0===r.length)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new $TypeError('"allowMissing" argument must be a boolean');if(null===$exec(/^%?[^%]*%?$/,r))throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var t=stringToPath(r),o=t.length>0?t[0]:"",n=getBaseIntrinsic("%"+o+"%",e),a=n.name,y=n.value,i=!1,p=n.alias;p&&(o=p[0],$spliceApply(t,$concat([0,1],p)));for(var d=1,s=!0;d=t.length){var c=$gOPD(y,f);y=(s=!!c)&&"get"in c&&!("originalValue"in c.get)?c.get:y[f]}else s=hasOwn(y,f),y=y[f];s&&!i&&(INTRINSICS[a]=y)}}return y}; + +},{"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"19":19,"23":23,"24":24,"26":26}],8:[function(require,module,exports){ +"use strict";var bind=require(19),GetIntrinsic=require(20),setFunctionLength=require(28),$TypeError=require(16),$apply=GetIntrinsic("%Function.prototype.apply%"),$call=GetIntrinsic("%Function.prototype.call%"),$reflectApply=GetIntrinsic("%Reflect.apply%",!0)||bind.call($call,$apply),$defineProperty=require(10),$max=GetIntrinsic("%Math.max%");module.exports=function callBind(e){if("function"!=typeof e)throw new $TypeError("a function is required");var n=$reflectApply(bind,$call,arguments);return setFunctionLength(n,1+$max(0,e.length-(arguments.length-1)),!0)};var applyBind=function applyBind(){return $reflectApply(bind,$apply,arguments)};$defineProperty?$defineProperty(module.exports,"apply",{value:applyBind}):module.exports.apply=applyBind; + +},{"10":10,"16":16,"19":19,"20":20,"28":28}],16:[function(require,module,exports){ +"use strict";module.exports=TypeError; + +},{}],19:[function(require,module,exports){ +"use strict";var implementation=require(18);module.exports=Function.prototype.bind||implementation; + +},{"18":18}],10:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),$defineProperty=GetIntrinsic("%Object.defineProperty%",!0)||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty; + +},{"20":20}],28:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),define=require(9),hasDescriptors=require(22)(),gOPD=require(21),$TypeError=require(16),$floor=GetIntrinsic("%Math.floor%");module.exports=function setFunctionLength(e,r){if("function"!=typeof e)throw new $TypeError("`fn` is not a function");if("number"!=typeof r||r<0||r>4294967295||$floor(r)!==r)throw new $TypeError("`length` must be a positive 32-bit integer");var t=arguments.length>2&&!!arguments[2],i=!0,n=!0;if("length"in e&&gOPD){var o=gOPD(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(n=!1)}return(i||n||!t)&&(hasDescriptors?define(e,"length",r,!0,!0):define(e,"length",r)),e}; + +},{"16":16,"20":20,"21":21,"22":22,"9":9}],9:[function(require,module,exports){ +"use strict";var $defineProperty=require(10),$SyntaxError=require(15),$TypeError=require(16),gopd=require(21);module.exports=function defineDataProperty(e,r,o){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new $TypeError("`obj` must be an object or a function`");if("string"!=typeof r&&"symbol"!=typeof r)throw new $TypeError("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new $TypeError("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,t=arguments.length>5?arguments[5]:null,i=arguments.length>6&&arguments[6],a=!!gopd&&gopd(e,r);if($defineProperty)$defineProperty(e,r,{configurable:null===t&&a?a.configurable:!t,enumerable:null===n&&a?a.enumerable:!n,value:o,writable:null===l&&a?a.writable:!l});else{if(!i&&(n||l||t))throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[r]=o}}; + +},{"10":10,"15":15,"16":16,"21":21}],15:[function(require,module,exports){ +"use strict";module.exports=SyntaxError; + +},{}],21:[function(require,module,exports){ +"use strict";var GetIntrinsic=require(20),$gOPD=GetIntrinsic("%Object.getOwnPropertyDescriptor%",!0);if($gOPD)try{$gOPD([],"length")}catch(t){$gOPD=null}module.exports=$gOPD; + +},{"20":20}],11:[function(require,module,exports){ +"use strict";module.exports=EvalError; + +},{}],12:[function(require,module,exports){ +"use strict";module.exports=Error; + +},{}],13:[function(require,module,exports){ +"use strict";module.exports=RangeError; + +},{}],14:[function(require,module,exports){ +"use strict";module.exports=ReferenceError; + +},{}],17:[function(require,module,exports){ +"use strict";module.exports=URIError; + +},{}],18:[function(require,module,exports){ +"use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o-1e3&&t<1e3||$test.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-$floor(-t):$floor(t);if(n!==t){var o=String(n),i=$slice.call(e,o.length+1);return $replace.call(o,r,"$&_")+"."+$replace.call($replace.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $replace.call(e,r,"$&_")}var utilInspect=require(6),inspectCustom=utilInspect.custom,inspectSymbol=isSymbol(inspectCustom)?inspectCustom:null;function wrapQuotes(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function quote(t){return $replace.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isDate(t){return!("[object Date]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isError(t){return!("[object Error]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isString(t){return!("[object String]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isNumber(t){return!("[object Number]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isBoolean(t){return!("[object Boolean]"!==toStr(t)||toStringTag&&"object"==typeof t&&toStringTag in t)}function isSymbol(t){if(hasShammedSymbols)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!symToString)return!1;try{return symToString.call(t),!0}catch(t){}return!1}function isBigInt(t){if(!t||"object"!=typeof t||!bigIntValueOf)return!1;try{return bigIntValueOf.call(t),!0}catch(t){}return!1}module.exports=function inspect_(t,e,r,n){var o=e||{};if(has(o,"quoteStyle")&&"single"!==o.quoteStyle&&"double"!==o.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(o,"maxStringLength")&&("number"==typeof o.maxStringLength?o.maxStringLength<0&&o.maxStringLength!==1/0:null!==o.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=!has(o,"customInspect")||o.customInspect;if("boolean"!=typeof i&&"symbol"!==i)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(o,"indent")&&null!==o.indent&&"\t"!==o.indent&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(o,"numericSeparator")&&"boolean"!=typeof o.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return inspectString(t,o);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var c=String(t);return a?addNumericSeparator(t,c):c}if("bigint"==typeof t){var l=String(t)+"n";return a?addNumericSeparator(t,l):l}var p=void 0===o.depth?5:o.depth;if(void 0===r&&(r=0),r>=p&&p>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var u=getIndent(o,r);if(void 0===n)n=[];else if(indexOf(n,t)>=0)return"[Circular]";function inspect(t,e,i){if(e&&(n=$arrSlice.call(n)).push(e),i){var a={depth:o.depth};return has(o,"quoteStyle")&&(a.quoteStyle=o.quoteStyle),inspect_(t,a,r+1,n)}return inspect_(t,o,r+1,n)}if("function"==typeof t&&!isRegExp(t)){var f=nameOf(t),s=arrObjKeys(t,inspect);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(s.length>0?" { "+$join.call(s,", ")+" }":"")}if(isSymbol(t)){var y=hasShammedSymbols?$replace.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):symToString.call(t);return"object"!=typeof t||hasShammedSymbols?y:markBoxed(y)}if(isElement(t)){for(var S="<"+$toLowerCase.call(String(t.nodeName)),g=t.attributes||[],b=0;b"}if(isArray(t)){if(0===t.length)return"[]";var m=arrObjKeys(t,inspect);return u&&!singleLineValues(m)?"["+indentedJoin(m,u)+"]":"[ "+$join.call(m,", ")+" ]"}if(isError(t)){var h=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||isEnumerable.call(t,"cause")?0===h.length?"["+String(t)+"]":"{ ["+String(t)+"] "+$join.call(h,", ")+" }":"{ ["+String(t)+"] "+$join.call($concat.call("[cause]: "+inspect(t.cause),h),", ")+" }"}if("object"==typeof t&&i){if(inspectSymbol&&"function"==typeof t[inspectSymbol]&&utilInspect)return utilInspect(t,{depth:p-r});if("symbol"!==i&&"function"==typeof t.inspect)return t.inspect()}if(isMap(t)){var d=[];return mapForEach&&mapForEach.call(t,(function(e,r){d.push(inspect(r,t,!0)+" => "+inspect(e,t))})),collectionOf("Map",mapSize.call(t),d,u)}if(isSet(t)){var j=[];return setForEach&&setForEach.call(t,(function(e){j.push(inspect(e,t))})),collectionOf("Set",setSize.call(t),j,u)}if(isWeakMap(t))return weakCollectionOf("WeakMap");if(isWeakSet(t))return weakCollectionOf("WeakSet");if(isWeakRef(t))return weakCollectionOf("WeakRef");if(isNumber(t))return markBoxed(inspect(Number(t)));if(isBigInt(t))return markBoxed(inspect(bigIntValueOf.call(t)));if(isBoolean(t))return markBoxed(booleanValueOf.call(t));if(isString(t))return markBoxed(inspect(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||"undefined"!=typeof global&&t===global)return"{ [object globalThis] }";if(!isDate(t)&&!isRegExp(t)){var O=arrObjKeys(t,inspect),w=gPO?gPO(t)===Object.prototype:t instanceof Object||t.constructor===Object,$=t instanceof Object?"":"null prototype",k=!w&&toStringTag&&Object(t)===t&&toStringTag in t?$slice.call(toStr(t),8,-1):$?"Object":"",v=(w||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(k||$?"["+$join.call($concat.call([],k||[],$||[]),": ")+"] ":"");return 0===O.length?v+"{}":u?v+"{"+indentedJoin(O,u)+"}":v+"{ "+$join.call(O,", ")+" }"}return String(t)};var hasOwn=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,e){return hasOwn.call(t,e)}function toStr(t){return objectToString.call(t)}function nameOf(t){if(t.name)return t.name;var e=$match.call(functionToString.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function indexOf(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return inspectString($slice.call(t,0,e.maxStringLength),e)+n}return wrapQuotes($replace.call($replace.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",e)}function lowbyte(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+$toUpperCase.call(e.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,e,r,n){return t+" ("+e+") {"+(n?indentedJoin(r,n):$join.call(r,", "))+"}"}function singleLineValues(t){for(var e=0;e=0)return!1;return!0}function getIndent(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=$join.call(Array(t.indent+1)," ")}return{base:r,prev:$join.call(Array(e+1),r)}}function indentedJoin(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+$join.call(t,","+r)+"\n"+e.prev}function arrObjKeys(t,e){var r=isArray(t),n=[];if(r){n.length=t.length;for(var o=0;o -1) { + return val.split(','); + } + + return val; +}; + +// This is what browsers will submit when the ✓ character occurs in an +// application/x-www-form-urlencoded body and the encoding of the page containing +// the form is iso-8859-1, or when the submitted form has an accept-charset +// attribute of iso-8859-1. Presumably also with other charsets that do not contain +// the ✓ character, such as us-ascii. +var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') + +// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. +var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') + +var parseValues = function parseQueryStringValues(str, options) { + var obj = { __proto__: null }; + + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + var skipIndex = -1; // Keep track of where the utf8 sentinel was found + var i; + + var charset = options.charset; + if (options.charsetSentinel) { + for (i = 0; i < parts.length; ++i) { + if (parts[i].indexOf('utf8=') === 0) { + if (parts[i] === charsetSentinel) { + charset = 'utf-8'; + } else if (parts[i] === isoSentinel) { + charset = 'iso-8859-1'; + } + skipIndex = i; + i = parts.length; // The eslint settings do not allow break; + } + } + } + + for (i = 0; i < parts.length; ++i) { + if (i === skipIndex) { + continue; + } + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder, charset, 'key'); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); + val = utils.maybeMap( + parseArrayValue(part.slice(pos + 1), options), + function (encodedVal) { + return options.decoder(encodedVal, defaults.decoder, charset, 'value'); + } + ); + } + + if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { + val = interpretNumericEntities(val); + } + + if (part.indexOf('[]=') > -1) { + val = isArray(val) ? [val] : val; + } + + var existing = has.call(obj, key); + if (existing && options.duplicates === 'combine') { + obj[key] = utils.combine(obj[key], val); + } else if (!existing || options.duplicates === 'last') { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options, valuesParsed) { + var leaf = valuesParsed ? val : parseArrayValue(val, options); + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]' && options.parseArrays) { + obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null)) + ? [] + : [].concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot; + var index = parseInt(decodedRoot, 10); + if (!options.parseArrays && decodedRoot === '') { + obj = { 0: leaf }; + } else if ( + !isNaN(index) + && root !== decodedRoot + && String(index) === decodedRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else if (decodedRoot !== '__proto__') { + obj[decodedRoot] = leaf; + } + } + + leaf = obj; + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = options.depth > 0 && brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, check strictDepth option for throw, else just add whatever is left + + if (segment) { + if (options.strictDepth === true) { + throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true'); + } + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options, valuesParsed); +}; + +var normalizeParseOptions = function normalizeParseOptions(opts) { + if (!opts) { + return defaults; + } + + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') { + throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided'); + } + + if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; + + var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates; + + if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') { + throw new TypeError('The duplicates option must be either combine, first, or last'); + } + + var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; + + return { + allowDots: allowDots, + allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, + allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, + allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse, + arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, + decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys, + decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, + delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, + // eslint-disable-next-line no-implicit-coercion, no-extra-parens + depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, + duplicates: duplicates, + ignoreQueryPrefix: opts.ignoreQueryPrefix === true, + interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, + parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, + parseArrays: opts.parseArrays !== false, + plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, + strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (str, opts) { + var options = normalizeParseOptions(opts); + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; + } + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string'); + obj = utils.merge(obj, newObj, options); + } + + if (options.allowSparse === true) { + return obj; + } + + return utils.compact(obj); +}; diff --git a/live2d/node_modules/qs/lib/stringify.js b/live2d/node_modules/qs/lib/stringify.js new file mode 100644 index 0000000..9b934d6 --- /dev/null +++ b/live2d/node_modules/qs/lib/stringify.js @@ -0,0 +1,351 @@ +'use strict'; + +var getSideChannel = require('side-channel'); +var utils = require('./utils'); +var formats = require('./formats'); +var has = Object.prototype.hasOwnProperty; + +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { + return prefix + '[]'; + }, + comma: 'comma', + indices: function indices(prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { + return prefix; + } +}; + +var isArray = Array.isArray; +var push = Array.prototype.push; +var pushToArray = function (arr, valueOrArray) { + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); +}; + +var toISO = Date.prototype.toISOString; + +var defaultFormat = formats['default']; +var defaults = { + addQueryPrefix: false, + allowDots: false, + allowEmptyArrays: false, + arrayFormat: 'indices', + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encodeDotInKeys: false, + encoder: utils.encode, + encodeValuesOnly: false, + format: defaultFormat, + formatter: formats.formatters[defaultFormat], + // deprecated + indices: false, + serializeDate: function serializeDate(date) { + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var isNonNullishPrimitive = function isNonNullishPrimitive(v) { + return typeof v === 'string' + || typeof v === 'number' + || typeof v === 'boolean' + || typeof v === 'symbol' + || typeof v === 'bigint'; +}; + +var sentinel = {}; + +var stringify = function stringify( + object, + prefix, + generateArrayPrefix, + commaRoundTrip, + allowEmptyArrays, + strictNullHandling, + skipNulls, + encodeDotInKeys, + encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + sideChannel +) { + var obj = object; + + var tmpSc = sideChannel; + var step = 0; + var findFlag = false; + while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) { + // Where object last appeared in the ref tree + var pos = tmpSc.get(object); + step += 1; + if (typeof pos !== 'undefined') { + if (pos === step) { + throw new RangeError('Cyclic object value'); + } else { + findFlag = true; // Break while + } + } + if (typeof tmpSc.get(sentinel) === 'undefined') { + step = 0; + } + } + + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { + obj = utils.maybeMap(obj, function (value) { + if (value instanceof Date) { + return serializeDate(value); + } + return value; + }); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix; + } + + obj = ''; + } + + if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (generateArrayPrefix === 'comma' && isArray(obj)) { + // we need to join elements in + if (encodeValuesOnly && encoder) { + obj = utils.maybeMap(obj, encoder); + } + objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; + } else if (isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix; + + var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix; + + if (allowEmptyArrays && isArray(obj) && obj.length === 0) { + return adjustedPrefix + '[]'; + } + + for (var j = 0; j < objKeys.length; ++j) { + var key = objKeys[j]; + var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key]; + + if (skipNulls && value === null) { + continue; + } + + var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key; + var keyPrefix = isArray(obj) + ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix + : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']'); + + sideChannel.set(object, step); + var valueSideChannel = getSideChannel(); + valueSideChannel.set(sentinel, sideChannel); + pushToArray(values, stringify( + value, + keyPrefix, + generateArrayPrefix, + commaRoundTrip, + allowEmptyArrays, + strictNullHandling, + skipNulls, + encodeDotInKeys, + generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + valueSideChannel + )); + } + + return values; +}; + +var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { + if (!opts) { + return defaults; + } + + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') { + throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided'); + } + + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + var format = formats['default']; + if (typeof opts.format !== 'undefined') { + if (!has.call(formats.formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + var formatter = formats.formatters[format]; + + var filter = defaults.filter; + if (typeof opts.filter === 'function' || isArray(opts.filter)) { + filter = opts.filter; + } + + var arrayFormat; + if (opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if ('indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = defaults.arrayFormat; + } + + if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + + var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots; + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + allowDots: allowDots, + allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, + arrayFormat: arrayFormat, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + commaRoundTrip: opts.commaRoundTrip, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + format: format, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = normalizeStringifyOptions(opts); + + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat]; + var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (options.sort) { + objKeys.sort(options.sort); + } + + var sideChannel = getSideChannel(); + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (options.skipNulls && obj[key] === null) { + continue; + } + pushToArray(keys, stringify( + obj[key], + key, + generateArrayPrefix, + commaRoundTrip, + options.allowEmptyArrays, + options.strictNullHandling, + options.skipNulls, + options.encodeDotInKeys, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.format, + options.formatter, + options.encodeValuesOnly, + options.charset, + sideChannel + )); + } + + var joined = keys.join(options.delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +}; diff --git a/live2d/node_modules/qs/lib/utils.js b/live2d/node_modules/qs/lib/utils.js new file mode 100644 index 0000000..7c860f1 --- /dev/null +++ b/live2d/node_modules/qs/lib/utils.js @@ -0,0 +1,265 @@ +'use strict'; + +var formats = require('./formats'); + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + while (queue.length > 1) { + var item = queue.pop(); + var obj = item.obj[item.prop]; + + if (isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } +}; + +var arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +var merge = function merge(target, source, options) { + /* eslint no-param-reassign: 0 */ + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (isArray(target) && !isArray(source)) { + mergeTarget = arrayToObject(target, options); + } + + if (isArray(target) && isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + var targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +var decode = function (str, decoder, charset) { + var strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +}; + +var limit = 1024; + +/* eslint operator-linebreak: [2, "before"] */ + +var encode = function encode(str, defaultEncoder, charset, kind, format) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + var out = ''; + for (var j = 0; j < string.length; j += limit) { + var segment = string.length >= limit ? string.slice(j, j + limit) : string; + var arr = []; + + for (var i = 0; i < segment.length; ++i) { + var c = segment.charCodeAt(i); + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + arr[arr.length] = segment.charAt(i); + continue; + } + + if (c < 0x80) { + arr[arr.length] = hexTable[c]; + continue; + } + + if (c < 0x800) { + arr[arr.length] = hexTable[0xC0 | (c >> 6)] + + hexTable[0x80 | (c & 0x3F)]; + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + arr[arr.length] = hexTable[0xE0 | (c >> 12)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF)); + + arr[arr.length] = hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + out += arr.join(''); + } + + return out; +}; + +var compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compactQueue(queue); + + return value; +}; + +var isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +var isBuffer = function isBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +var combine = function combine(a, b) { + return [].concat(a, b); +}; + +var maybeMap = function maybeMap(val, fn) { + if (isArray(val)) { + var mapped = []; + for (var i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i])); + } + return mapped; + } + return fn(val); +}; + +module.exports = { + arrayToObject: arrayToObject, + assign: assign, + combine: combine, + compact: compact, + decode: decode, + encode: encode, + isBuffer: isBuffer, + isRegExp: isRegExp, + maybeMap: maybeMap, + merge: merge +}; diff --git a/live2d/node_modules/qs/package.json b/live2d/node_modules/qs/package.json new file mode 100644 index 0000000..6dae052 --- /dev/null +++ b/live2d/node_modules/qs/package.json @@ -0,0 +1,91 @@ +{ + "name": "qs", + "description": "A querystring parser that supports nesting and arrays, with a depth limit", + "homepage": "https://github.com/ljharb/qs", + "version": "6.13.0", + "repository": { + "type": "git", + "url": "https://github.com/ljharb/qs.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "main": "lib/index.js", + "sideEffects": false, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "keywords": [ + "querystring", + "qs", + "query", + "url", + "parse", + "stringify" + ], + "engines": { + "node": ">=0.6" + }, + "dependencies": { + "side-channel": "^1.0.6" + }, + "devDependencies": { + "@browserify/envify": "^6.0.0", + "@browserify/uglifyify": "^6.0.0", + "@ljharb/eslint-config": "^21.1.1", + "browserify": "^16.5.2", + "bundle-collapser": "^1.4.0", + "common-shakeify": "~1.0.0", + "eclint": "^2.8.1", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "glob": "=10.3.7", + "has-override-mistake": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-symbols": "^1.0.3", + "iconv-lite": "^0.5.1", + "in-publish": "^2.0.1", + "jackspeak": "=2.1.1", + "mkdirp": "^0.5.5", + "mock-property": "^1.0.3", + "module-deps": "^6.2.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.2", + "qs-iconv": "^1.0.4", + "safe-publish-latest": "^2.0.0", + "safer-buffer": "^2.1.2", + "tape": "^5.8.1", + "unassertify": "^3.0.1" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated && npm run dist", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run --silent readme && npm run --silent lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "npx npm@'>=10.2' audit --production", + "readme": "evalmd README.md", + "postlint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "lint": "eslint --ext=js,mjs .", + "dist": "mkdirp dist && browserify --standalone Qs -g unassertify -g @browserify/envify -g [@browserify/uglifyify --mangle.keep_fnames --compress.keep_fnames --format.indent_level=1 --compress.arrows=false --compress.passes=4 --compress.typeofs=false] -p common-shakeify -p bundle-collapser/plugin lib/index.js > dist/qs.js" + }, + "license": "BSD-3-Clause", + "publishConfig": { + "ignore": [ + "!dist/*", + "bower.json", + "component.json", + ".github/workflows", + "logos", + "tea.yaml" + ] + } +} diff --git a/live2d/node_modules/qs/test/empty-keys-cases.js b/live2d/node_modules/qs/test/empty-keys-cases.js new file mode 100644 index 0000000..2b1190e --- /dev/null +++ b/live2d/node_modules/qs/test/empty-keys-cases.js @@ -0,0 +1,267 @@ +'use strict'; + +module.exports = { + emptyTestCases: [ + { + input: '&', + withEmptyKeys: {}, + stringifyOutput: { + brackets: '', + indices: '', + repeat: '' + }, + noEmptyKeys: {} + }, + { + input: '&&', + withEmptyKeys: {}, + stringifyOutput: { + brackets: '', + indices: '', + repeat: '' + }, + noEmptyKeys: {} + }, + { + input: '&=', + withEmptyKeys: { '': '' }, + stringifyOutput: { + brackets: '=', + indices: '=', + repeat: '=' + }, + noEmptyKeys: {} + }, + { + input: '&=&', + withEmptyKeys: { '': '' }, + stringifyOutput: { + brackets: '=', + indices: '=', + repeat: '=' + }, + noEmptyKeys: {} + }, + { + input: '&=&=', + withEmptyKeys: { '': ['', ''] }, + stringifyOutput: { + brackets: '[]=&[]=', + indices: '[0]=&[1]=', + repeat: '=&=' + }, + noEmptyKeys: {} + }, + { + input: '&=&=&', + withEmptyKeys: { '': ['', ''] }, + stringifyOutput: { + brackets: '[]=&[]=', + indices: '[0]=&[1]=', + repeat: '=&=' + }, + noEmptyKeys: {} + }, + { + input: '=', + withEmptyKeys: { '': '' }, + noEmptyKeys: {}, + stringifyOutput: { + brackets: '=', + indices: '=', + repeat: '=' + } + }, + { + input: '=&', + withEmptyKeys: { '': '' }, + stringifyOutput: { + brackets: '=', + indices: '=', + repeat: '=' + }, + noEmptyKeys: {} + }, + { + input: '=&&&', + withEmptyKeys: { '': '' }, + stringifyOutput: { + brackets: '=', + indices: '=', + repeat: '=' + }, + noEmptyKeys: {} + }, + { + input: '=&=&=&', + withEmptyKeys: { '': ['', '', ''] }, + stringifyOutput: { + brackets: '[]=&[]=&[]=', + indices: '[0]=&[1]=&[2]=', + repeat: '=&=&=' + }, + noEmptyKeys: {} + }, + { + input: '=&a[]=b&a[1]=c', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: '=a', + withEmptyKeys: { '': 'a' }, + noEmptyKeys: {}, + stringifyOutput: { + brackets: '=a', + indices: '=a', + repeat: '=a' + } + }, + { + input: 'a==a', + withEmptyKeys: { a: '=a' }, + noEmptyKeys: { a: '=a' }, + stringifyOutput: { + brackets: 'a==a', + indices: 'a==a', + repeat: 'a==a' + } + }, + { + input: '=&a[]=b', + withEmptyKeys: { '': '', a: ['b'] }, + stringifyOutput: { + brackets: '=&a[]=b', + indices: '=&a[0]=b', + repeat: '=&a=b' + }, + noEmptyKeys: { a: ['b'] } + }, + { + input: '=&a[]=b&a[]=c&a[2]=d', + withEmptyKeys: { '': '', a: ['b', 'c', 'd'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c&a[]=d', + indices: '=&a[0]=b&a[1]=c&a[2]=d', + repeat: '=&a=b&a=c&a=d' + }, + noEmptyKeys: { a: ['b', 'c', 'd'] } + }, + { + input: '=a&=b', + withEmptyKeys: { '': ['a', 'b'] }, + stringifyOutput: { + brackets: '[]=a&[]=b', + indices: '[0]=a&[1]=b', + repeat: '=a&=b' + }, + noEmptyKeys: {} + }, + { + input: '=a&foo=b', + withEmptyKeys: { '': 'a', foo: 'b' }, + noEmptyKeys: { foo: 'b' }, + stringifyOutput: { + brackets: '=a&foo=b', + indices: '=a&foo=b', + repeat: '=a&foo=b' + } + }, + { + input: 'a[]=b&a=c&=', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: 'a[]=b&a=c&=', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: 'a[0]=b&a=c&=', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: 'a=b&a[]=c&=', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: 'a=b&a[0]=c&=', + withEmptyKeys: { '': '', a: ['b', 'c'] }, + stringifyOutput: { + brackets: '=&a[]=b&a[]=c', + indices: '=&a[0]=b&a[1]=c', + repeat: '=&a=b&a=c' + }, + noEmptyKeys: { a: ['b', 'c'] } + }, + { + input: '[]=a&[]=b& []=1', + withEmptyKeys: { '': ['a', 'b'], ' ': ['1'] }, + stringifyOutput: { + brackets: '[]=a&[]=b& []=1', + indices: '[0]=a&[1]=b& [0]=1', + repeat: '=a&=b& =1' + }, + noEmptyKeys: { 0: 'a', 1: 'b', ' ': ['1'] } + }, + { + input: '[0]=a&[1]=b&a[0]=1&a[1]=2', + withEmptyKeys: { '': ['a', 'b'], a: ['1', '2'] }, + noEmptyKeys: { 0: 'a', 1: 'b', a: ['1', '2'] }, + stringifyOutput: { + brackets: '[]=a&[]=b&a[]=1&a[]=2', + indices: '[0]=a&[1]=b&a[0]=1&a[1]=2', + repeat: '=a&=b&a=1&a=2' + } + }, + { + input: '[deep]=a&[deep]=2', + withEmptyKeys: { '': { deep: ['a', '2'] } + }, + stringifyOutput: { + brackets: '[deep][]=a&[deep][]=2', + indices: '[deep][0]=a&[deep][1]=2', + repeat: '[deep]=a&[deep]=2' + }, + noEmptyKeys: { deep: ['a', '2'] } + }, + { + input: '%5B0%5D=a&%5B1%5D=b', + withEmptyKeys: { '': ['a', 'b'] }, + stringifyOutput: { + brackets: '[]=a&[]=b', + indices: '[0]=a&[1]=b', + repeat: '=a&=b' + }, + noEmptyKeys: { 0: 'a', 1: 'b' } + } + ] +}; diff --git a/live2d/node_modules/qs/test/parse.js b/live2d/node_modules/qs/test/parse.js new file mode 100644 index 0000000..8a2f487 --- /dev/null +++ b/live2d/node_modules/qs/test/parse.js @@ -0,0 +1,1170 @@ +'use strict'; + +var test = require('tape'); +var hasPropertyDescriptors = require('has-property-descriptors')(); +var iconv = require('iconv-lite'); +var mockProperty = require('mock-property'); +var hasOverrideMistake = require('has-override-mistake')(); +var SaferBuffer = require('safer-buffer').Buffer; +var v = require('es-value-fixtures'); +var inspect = require('object-inspect'); +var emptyTestCases = require('./empty-keys-cases').emptyTestCases; + +var qs = require('../'); +var utils = require('../lib/utils'); + +test('parse()', function (t) { + t.test('parses a simple string', function (st) { + st.deepEqual(qs.parse('0=foo'), { 0: 'foo' }); + st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' }); + st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } }); + st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } }); + st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } }); + st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null }); + st.deepEqual(qs.parse('foo'), { foo: '' }); + st.deepEqual(qs.parse('foo='), { foo: '' }); + st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' }); + st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' }); + st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' }); + st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' }); + st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' }); + st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null }); + st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' }); + st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), { + cht: 'p3', + chd: 't:60,40', + chs: '250x100', + chl: 'Hello|World' + }); + st.end(); + }); + + t.test('comma: false', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c'), { a: 'b,c' }); + st.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('comma: true', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=c', { comma: true }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { comma: true }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b,c', { comma: true }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a=c', { comma: true }), { a: ['b', 'c'] }); + st.end(); + }); + + t.test('allows enabling dot notation', function (st) { + st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' }); + st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } }); + + st.end(); + }); + + t.test('decode dot keys correctly', function (st) { + st.deepEqual( + qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: false, decodeDotInKeys: false }), + { 'name%2Eobj.first': 'John', 'name%2Eobj.last': 'Doe' }, + 'with allowDots false and decodeDotInKeys false' + ); + st.deepEqual( + qs.parse('name.obj.first=John&name.obj.last=Doe', { allowDots: true, decodeDotInKeys: false }), + { name: { obj: { first: 'John', last: 'Doe' } } }, + 'with allowDots false and decodeDotInKeys false' + ); + st.deepEqual( + qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: true, decodeDotInKeys: false }), + { 'name%2Eobj': { first: 'John', last: 'Doe' } }, + 'with allowDots true and decodeDotInKeys false' + ); + st.deepEqual( + qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: true, decodeDotInKeys: true }), + { 'name.obj': { first: 'John', last: 'Doe' } }, + 'with allowDots true and decodeDotInKeys true' + ); + + st.deepEqual( + qs.parse( + 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', + { allowDots: false, decodeDotInKeys: false } + ), + { 'name%2Eobj%2Esubobject.first%2Egodly%2Ename': 'John', 'name%2Eobj%2Esubobject.last': 'Doe' }, + 'with allowDots false and decodeDotInKeys false' + ); + st.deepEqual( + qs.parse( + 'name.obj.subobject.first.godly.name=John&name.obj.subobject.last=Doe', + { allowDots: true, decodeDotInKeys: false } + ), + { name: { obj: { subobject: { first: { godly: { name: 'John' } }, last: 'Doe' } } } }, + 'with allowDots true and decodeDotInKeys false' + ); + st.deepEqual( + qs.parse( + 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', + { allowDots: true, decodeDotInKeys: true } + ), + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + 'with allowDots true and decodeDotInKeys true' + ); + st.deepEqual( + qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe'), + { 'name%2Eobj.first': 'John', 'name%2Eobj.last': 'Doe' }, + 'with allowDots and decodeDotInKeys undefined' + ); + + st.end(); + }); + + t.test('should decode dot in key of object, and allow enabling dot notation when decodeDotInKeys is set to true and allowDots is undefined', function (st) { + st.deepEqual( + qs.parse( + 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', + { decodeDotInKeys: true } + ), + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + 'with allowDots undefined and decodeDotInKeys true' + ); + + st.end(); + }); + + t.test('should throw when decodeDotInKeys is not of type boolean', function (st) { + st['throws']( + function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 'foobar' }); }, + TypeError + ); + + st['throws']( + function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 0 }); }, + TypeError + ); + st['throws']( + function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: NaN }); }, + TypeError + ); + + st['throws']( + function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: null }); }, + TypeError + ); + + st.end(); + }); + + t.test('allows empty arrays in obj values', function (st) { + st.deepEqual(qs.parse('foo[]&bar=baz', { allowEmptyArrays: true }), { foo: [], bar: 'baz' }); + st.deepEqual(qs.parse('foo[]&bar=baz', { allowEmptyArrays: false }), { foo: [''], bar: 'baz' }); + + st.end(); + }); + + t.test('should throw when allowEmptyArrays is not of type boolean', function (st) { + st['throws']( + function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 'foobar' }); }, + TypeError + ); + + st['throws']( + function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 0 }); }, + TypeError + ); + st['throws']( + function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: NaN }); }, + TypeError + ); + + st['throws']( + function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: null }); }, + TypeError + ); + + st.end(); + }); + + t.test('allowEmptyArrays + strictNullHandling', function (st) { + st.deepEqual( + qs.parse('testEmptyArray[]', { strictNullHandling: true, allowEmptyArrays: true }), + { testEmptyArray: [] } + ); + + st.end(); + }); + + t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string'); + t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string'); + t.deepEqual( + qs.parse('a[b][c][d][e][f][g][h]=i'), + { a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } }, + 'defaults to a depth of 5' + ); + + t.test('only parses one level when depth = 1', function (st) { + st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } }); + st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } }); + st.end(); + }); + + t.test('uses original key when depth = 0', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { depth: 0 }), { 'a[0]': 'b', 'a[1]': 'c' }); + st.deepEqual(qs.parse('a[0][0]=b&a[0][1]=c&a[1]=d&e=2', { depth: 0 }), { 'a[0][0]': 'b', 'a[0][1]': 'c', 'a[1]': 'd', e: '2' }); + st.end(); + }); + + t.test('uses original key when depth = false', function (st) { + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { depth: false }), { 'a[0]': 'b', 'a[1]': 'c' }); + st.deepEqual(qs.parse('a[0][0]=b&a[0][1]=c&a[1]=d&e=2', { depth: false }), { 'a[0][0]': 'b', 'a[0][1]': 'c', 'a[1]': 'd', e: '2' }); + st.end(); + }); + + t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array'); + + t.test('parses an explicit array', function (st) { + st.deepEqual(qs.parse('a[]=b'), { a: ['b'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] }); + st.end(); + }); + + t.test('parses a mix of simple and explicit arrays', function (st) { + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a[1]=b&a=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); + + st.deepEqual(qs.parse('a=b&a[1]=c', { arrayLimit: 20 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c', { arrayLimit: 0 }), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); + + st.end(); + }); + + t.test('parses a nested array', function (st) { + st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } }); + st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } }); + st.end(); + }); + + t.test('allows to specify array indices', function (st) { + st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] }); + st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 20 }), { a: ['c'] }); + st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 0 }), { a: { 1: 'c' } }); + st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] }); + st.end(); + }); + + t.test('limits specific array indices to arrayLimit', function (st) { + st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } }); + + st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] }); + st.deepEqual(qs.parse('a[21]=a'), { a: { 21: 'a' } }); + st.end(); + }); + + t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number'); + + t.test('supports encoded = signs', function (st) { + st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' }); + st.end(); + }); + + t.test('is ok with url encoded strings', function (st) { + st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } }); + st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } }); + st.end(); + }); + + t.test('allows brackets in the value', function (st) { + st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' }); + st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' }); + st.end(); + }); + + t.test('allows empty values', function (st) { + st.deepEqual(qs.parse(''), {}); + st.deepEqual(qs.parse(null), {}); + st.deepEqual(qs.parse(undefined), {}); + st.end(); + }); + + t.test('transforms arrays to objects', function (st) { + st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', t: 'u' } }); + st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', x: 'y' } }); + st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } }); + st.end(); + }); + + t.test('transforms arrays to objects (dot notation)', function (st) { + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } }); + st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] }); + st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] }); + st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } }); + st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { 0: 'bar', bad: 'baz' } }); + st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } }); + st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); + st.end(); + }); + + t.test('correctly prunes undefined values when converting an array to an object', function (st) { + st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { 2: 'b', 99999999: 'c' } }); + st.end(); + }); + + t.test('supports malformed uri characters', function (st) { + st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null }); + st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' }); + st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' }); + st.end(); + }); + + t.test('doesn\'t produce empty keys', function (st) { + st.deepEqual(qs.parse('_r=1&'), { _r: '1' }); + st.end(); + }); + + t.test('cannot access Object prototype', function (st) { + qs.parse('constructor[prototype][bad]=bad'); + qs.parse('bad[constructor][prototype][bad]=bad'); + st.equal(typeof Object.prototype.bad, 'undefined'); + st.end(); + }); + + t.test('parses arrays of objects', function (st) { + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] }); + st.end(); + }); + + t.test('allows for empty strings in arrays', function (st) { + st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] }); + + st.deepEqual( + qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 20 + array indices: null then empty string works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]&a[]=c&a[]=', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', null, 'c', ''] }, + 'with arrayLimit 0 + array brackets: null then empty string works' + ); + + st.deepEqual( + qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true, arrayLimit: 20 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 20 + array indices: empty string then null works' + ); + st.deepEqual( + qs.parse('a[]=b&a[]=&a[]=c&a[]', { strictNullHandling: true, arrayLimit: 0 }), + { a: ['b', '', 'c', null] }, + 'with arrayLimit 0 + array brackets: empty string then null works' + ); + + st.deepEqual( + qs.parse('a[]=&a[]=b&a[]=c'), + { a: ['', 'b', 'c'] }, + 'array brackets: empty strings work' + ); + st.end(); + }); + + t.test('compacts sparse arrays', function (st) { + st.deepEqual(qs.parse('a[10]=1&a[2]=2', { arrayLimit: 20 }), { a: ['2', '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { arrayLimit: 20 }), { a: [{ b: [{ c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { arrayLimit: 20 }), { a: [[[{ c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { arrayLimit: 20 }), { a: [[[{ c: ['1'] }]]] }); + st.end(); + }); + + t.test('parses sparse arrays', function (st) { + /* eslint no-sparse-arrays: 0 */ + st.deepEqual(qs.parse('a[4]=1&a[1]=2', { allowSparse: true }), { a: [, '2', , , '1'] }); + st.deepEqual(qs.parse('a[1][b][2][c]=1', { allowSparse: true }), { a: [, { b: [, , { c: '1' }] }] }); + st.deepEqual(qs.parse('a[1][2][3][c]=1', { allowSparse: true }), { a: [, [, , [, , , { c: '1' }]]] }); + st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { allowSparse: true }), { a: [, [, , [, , , { c: [, '1'] }]]] }); + st.end(); + }); + + t.test('parses semi-parsed strings', function (st) { + st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } }); + st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } }); + st.end(); + }); + + t.test('parses buffers correctly', function (st) { + var b = SaferBuffer.from('test'); + st.deepEqual(qs.parse({ a: b }), { a: b }); + st.end(); + }); + + t.test('parses jquery-param strings', function (st) { + // readable = 'filter[0][]=int1&filter[0][]==&filter[0][]=77&filter[]=and&filter[2][]=int2&filter[2][]==&filter[2][]=8' + var encoded = 'filter%5B0%5D%5B%5D=int1&filter%5B0%5D%5B%5D=%3D&filter%5B0%5D%5B%5D=77&filter%5B%5D=and&filter%5B2%5D%5B%5D=int2&filter%5B2%5D%5B%5D=%3D&filter%5B2%5D%5B%5D=8'; + var expected = { filter: [['int1', '=', '77'], 'and', ['int2', '=', '8']] }; + st.deepEqual(qs.parse(encoded), expected); + st.end(); + }); + + t.test('continues parsing when no parent is found', function (st) { + st.deepEqual(qs.parse('[]=&a=b'), { 0: '', a: 'b' }); + st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { 0: null, a: 'b' }); + st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' }); + st.end(); + }); + + t.test('does not error when parsing a very long array', function (st) { + var str = 'a[]=a'; + while (Buffer.byteLength(str) < 128 * 1024) { + str = str + '&' + str; + } + + st.doesNotThrow(function () { + qs.parse(str); + }); + + st.end(); + }); + + t.test('should not throw when a native prototype has an enumerable property', function (st) { + st.intercept(Object.prototype, 'crash', { value: '' }); + st.intercept(Array.prototype, 'crash', { value: '' }); + + st.doesNotThrow(qs.parse.bind(null, 'a=b')); + st.deepEqual(qs.parse('a=b'), { a: 'b' }); + st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c')); + st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); + + st.end(); + }); + + t.test('parses a string with an alternative string delimiter', function (st) { + st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('parses a string with an alternative RegExp delimiter', function (st) { + st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not use non-splittable objects as delimiters', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding parameter limit', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' }); + st.end(); + }); + + t.test('allows setting the parameter limit to Infinity', function (st) { + st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('allows overriding array limit', function (st) { + st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } }); + st.deepEqual(qs.parse('a[0]=b', { arrayLimit: 0 }), { a: ['b'] }); + + st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } }); + st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: 0 }), { a: { '-1': 'b' } }); + + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: -1 }), { a: { 0: 'b', 1: 'c' } }); + st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } }); + + st.end(); + }); + + t.test('allows disabling array parsing', function (st) { + var indices = qs.parse('a[0]=b&a[1]=c', { parseArrays: false }); + st.deepEqual(indices, { a: { 0: 'b', 1: 'c' } }); + st.equal(Array.isArray(indices.a), false, 'parseArrays:false, indices case is not an array'); + + var emptyBrackets = qs.parse('a[]=b', { parseArrays: false }); + st.deepEqual(emptyBrackets, { a: { 0: 'b' } }); + st.equal(Array.isArray(emptyBrackets.a), false, 'parseArrays:false, empty brackets case is not an array'); + + st.end(); + }); + + t.test('allows for query string prefix', function (st) { + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('foo=bar', { ignoreQueryPrefix: true }), { foo: 'bar' }); + st.deepEqual(qs.parse('?foo=bar', { ignoreQueryPrefix: false }), { '?foo': 'bar' }); + + st.end(); + }); + + t.test('parses an object', function (st) { + var input = { + 'user[name]': { 'pop[bob]': 3 }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses string with comma as array divider', function (st) { + st.deepEqual(qs.parse('foo=bar,tee', { comma: true }), { foo: ['bar', 'tee'] }); + st.deepEqual(qs.parse('foo[bar]=coffee,tee', { comma: true }), { foo: { bar: ['coffee', 'tee'] } }); + st.deepEqual(qs.parse('foo=', { comma: true }), { foo: '' }); + st.deepEqual(qs.parse('foo', { comma: true }), { foo: '' }); + st.deepEqual(qs.parse('foo', { comma: true, strictNullHandling: true }), { foo: null }); + + // test cases inversed from from stringify tests + st.deepEqual(qs.parse('a[0]=c'), { a: ['c'] }); + st.deepEqual(qs.parse('a[]=c'), { a: ['c'] }); + st.deepEqual(qs.parse('a[]=c', { comma: true }), { a: ['c'] }); + + st.deepEqual(qs.parse('a[0]=c&a[1]=d'), { a: ['c', 'd'] }); + st.deepEqual(qs.parse('a[]=c&a[]=d'), { a: ['c', 'd'] }); + st.deepEqual(qs.parse('a=c,d', { comma: true }), { a: ['c', 'd'] }); + + st.end(); + }); + + t.test('parses values with comma as array divider', function (st) { + st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: false }), { foo: 'bar,tee' }); + st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: true }), { foo: ['bar', 'tee'] }); + st.end(); + }); + + t.test('use number decoder, parses string that has one number with comma option enabled', function (st) { + var decoder = function (str, defaultDecoder, charset, type) { + if (!isNaN(Number(str))) { + return parseFloat(str); + } + return defaultDecoder(str, defaultDecoder, charset, type); + }; + + st.deepEqual(qs.parse('foo=1', { comma: true, decoder: decoder }), { foo: 1 }); + st.deepEqual(qs.parse('foo=0', { comma: true, decoder: decoder }), { foo: 0 }); + + st.end(); + }); + + t.test('parses brackets holds array of arrays when having two parts of strings with comma as array divider', function (st) { + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=4,5,6', { comma: true }), { foo: [['1', '2', '3'], ['4', '5', '6']] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=', { comma: true }), { foo: [['1', '2', '3'], ''] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=,', { comma: true }), { foo: [['1', '2', '3'], ['', '']] }); + st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=a', { comma: true }), { foo: [['1', '2', '3'], 'a'] }); + + st.end(); + }); + + t.test('parses url-encoded brackets holds array of arrays when having two parts of strings with comma as array divider', function (st) { + st.deepEqual(qs.parse('foo%5B%5D=1,2,3&foo%5B%5D=4,5,6', { comma: true }), { foo: [['1', '2', '3'], ['4', '5', '6']] }); + st.deepEqual(qs.parse('foo%5B%5D=1,2,3&foo%5B%5D=', { comma: true }), { foo: [['1', '2', '3'], ''] }); + st.deepEqual(qs.parse('foo%5B%5D=1,2,3&foo%5B%5D=,', { comma: true }), { foo: [['1', '2', '3'], ['', '']] }); + st.deepEqual(qs.parse('foo%5B%5D=1,2,3&foo%5B%5D=a', { comma: true }), { foo: [['1', '2', '3'], 'a'] }); + + st.end(); + }); + + t.test('parses comma delimited array while having percent-encoded comma treated as normal text', function (st) { + st.deepEqual(qs.parse('foo=a%2Cb', { comma: true }), { foo: 'a,b' }); + st.deepEqual(qs.parse('foo=a%2C%20b,d', { comma: true }), { foo: ['a, b', 'd'] }); + st.deepEqual(qs.parse('foo=a%2C%20b,c%2C%20d', { comma: true }), { foo: ['a, b', 'c, d'] }); + + st.end(); + }); + + t.test('parses an object in dot notation', function (st) { + var input = { + 'user.name': { 'pop[bob]': 3 }, + 'user.email.': null + }; + + var expected = { + user: { + name: { 'pop[bob]': 3 }, + email: null + } + }; + + var result = qs.parse(input, { allowDots: true }); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('parses an object and not child values', function (st) { + var input = { + 'user[name]': { 'pop[bob]': { test: 3 } }, + 'user[email]': null + }; + + var expected = { + user: { + name: { 'pop[bob]': { test: 3 } }, + email: null + } + }; + + var result = qs.parse(input); + + st.deepEqual(result, expected); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var restore = mockProperty(global, 'Buffer', { 'delete': true }); + + var result = qs.parse('a=b&c=d'); + + restore(); + + st.deepEqual(result, { a: 'b', c: 'd' }); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + var parsed; + + st.doesNotThrow(function () { + parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + st.equal('bar' in parsed.foo, true); + st.equal('baz' in parsed.foo, true); + st.equal(parsed.foo.bar, 'baz'); + st.deepEqual(parsed.foo.baz, a); + st.end(); + }); + + t.test('does not crash when parsing deep objects', function (st) { + var parsed; + var str = 'foo'; + + for (var i = 0; i < 5000; i++) { + str += '[p]'; + } + + str += '=bar'; + + st.doesNotThrow(function () { + parsed = qs.parse(str, { depth: 5000 }); + }); + + st.equal('foo' in parsed, true, 'parsed has "foo" property'); + + var depth = 0; + var ref = parsed.foo; + while ((ref = ref.p)) { + depth += 1; + } + + st.equal(depth, 5000, 'parsed is 5000 properties deep'); + + st.end(); + }); + + t.test('parses null objects correctly', { skip: !Object.create }, function (st) { + var a = Object.create(null); + a.b = 'c'; + + st.deepEqual(qs.parse(a), { b: 'c' }); + var result = qs.parse({ a: a }); + st.equal('a' in result, true, 'result has "a" property'); + st.deepEqual(result.a, a); + st.end(); + }); + + t.test('parses dates correctly', function (st) { + var now = new Date(); + st.deepEqual(qs.parse({ a: now }), { a: now }); + st.end(); + }); + + t.test('parses regular expressions correctly', function (st) { + var re = /^test$/; + st.deepEqual(qs.parse({ a: re }), { a: re }); + st.end(); + }); + + t.test('does not allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: false }), {}); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: false }), {}); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: false }), + {}, + 'bare "toString" results in {}' + ); + + st.end(); + }); + + t.test('can allow overwriting prototype properties', function (st) { + st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }); + st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }); + + st.deepEqual( + qs.parse('toString', { allowPrototypes: true }), + { toString: '' }, + 'bare "toString" results in { toString: "" }' + ); + + st.end(); + }); + + t.test('does not crash when the global Object prototype is frozen', { skip: !hasPropertyDescriptors || !hasOverrideMistake }, function (st) { + // We can't actually freeze the global Object prototype as that will interfere with other tests, and once an object is frozen, it + // can't be unfrozen. Instead, we add a new non-writable property to simulate this. + st.teardown(mockProperty(Object.prototype, 'frozenProp', { value: 'foo', nonWritable: true, nonEnumerable: true })); + + st['throws']( + function () { + var obj = {}; + obj.frozenProp = 'bar'; + }, + // node < 6 has a different error message + /^TypeError: Cannot assign to read only property 'frozenProp' of (?:object '#'|#)/, + 'regular assignment of an inherited non-writable property throws' + ); + + var parsed; + st.doesNotThrow( + function () { + parsed = qs.parse('frozenProp', { allowPrototypes: false }); + }, + 'parsing a nonwritable Object.prototype property does not throw' + ); + + st.deepEqual(parsed, {}, 'bare "frozenProp" results in {}'); + + st.end(); + }); + + t.test('params starting with a closing bracket', function (st) { + st.deepEqual(qs.parse(']=toString'), { ']': 'toString' }); + st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' }); + st.deepEqual(qs.parse(']hello]=toString'), { ']hello]': 'toString' }); + st.end(); + }); + + t.test('params starting with a starting bracket', function (st) { + st.deepEqual(qs.parse('[=toString'), { '[': 'toString' }); + st.deepEqual(qs.parse('[[=toString'), { '[[': 'toString' }); + st.deepEqual(qs.parse('[hello[=toString'), { '[hello[': 'toString' }); + st.end(); + }); + + t.test('add keys to objects', function (st) { + st.deepEqual( + qs.parse('a[b]=c&a=d'), + { a: { b: 'c', d: true } }, + 'can add keys to objects' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString'), + { a: { b: 'c' } }, + 'can not overwrite prototype' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { allowPrototypes: true }), + { a: { b: 'c', toString: true } }, + 'can overwrite prototype with allowPrototypes true' + ); + + st.deepEqual( + qs.parse('a[b]=c&a=toString', { plainObjects: true }), + { __proto__: null, a: { __proto__: null, b: 'c', toString: true } }, + 'can overwrite prototype with plainObjects true' + ); + + st.end(); + }); + + t.test('dunder proto is ignored', function (st) { + var payload = 'categories[__proto__]=login&categories[__proto__]&categories[length]=42'; + var result = qs.parse(payload, { allowPrototypes: true }); + + st.deepEqual( + result, + { + categories: { + length: '42' + } + }, + 'silent [[Prototype]] payload' + ); + + var plainResult = qs.parse(payload, { allowPrototypes: true, plainObjects: true }); + + st.deepEqual( + plainResult, + { + __proto__: null, + categories: { + __proto__: null, + length: '42' + } + }, + 'silent [[Prototype]] payload: plain objects' + ); + + var query = qs.parse('categories[__proto__]=cats&categories[__proto__]=dogs&categories[some][json]=toInject', { allowPrototypes: true }); + + st.notOk(Array.isArray(query.categories), 'is not an array'); + st.notOk(query.categories instanceof Array, 'is not instanceof an array'); + st.deepEqual(query.categories, { some: { json: 'toInject' } }); + st.equal(JSON.stringify(query.categories), '{"some":{"json":"toInject"}}', 'stringifies as a non-array'); + + st.deepEqual( + qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true }), + { + foo: { + bar: 'stuffs' + } + }, + 'hidden values' + ); + + st.deepEqual( + qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true, plainObjects: true }), + { + __proto__: null, + foo: { + __proto__: null, + bar: 'stuffs' + } + }, + 'hidden values: plain objects' + ); + + st.end(); + }); + + t.test('can return null objects', { skip: !Object.create }, function (st) { + var expected = Object.create(null); + expected.a = Object.create(null); + expected.a.b = 'c'; + expected.a.hasOwnProperty = 'd'; + st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); + st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); + var expectedArray = Object.create(null); + expectedArray.a = Object.create(null); + expectedArray.a[0] = 'b'; + expectedArray.a.c = 'd'; + st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); + st.end(); + }); + + t.test('can parse with custom encoding', function (st) { + st.deepEqual(qs.parse('%8c%a7=%91%e5%8d%e3%95%7b', { + decoder: function (str) { + var reg = /%([0-9A-F]{2})/ig; + var result = []; + var parts = reg.exec(str); + while (parts) { + result.push(parseInt(parts[1], 16)); + parts = reg.exec(str); + } + return String(iconv.decode(SaferBuffer.from(result), 'shift_jis')); + } + }), { 県: '大阪府' }); + st.end(); + }); + + t.test('receives the default decoder as a second argument', function (st) { + st.plan(1); + qs.parse('a', { + decoder: function (str, defaultDecoder) { + st.equal(defaultDecoder, utils.decode); + } + }); + st.end(); + }); + + t.test('throws error with wrong decoder', function (st) { + st['throws'](function () { + qs.parse({}, { decoder: 'string' }); + }, new TypeError('Decoder has to be a function.')); + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.parse('a[b]=true', options); + st.deepEqual(options, {}); + st.end(); + }); + + t.test('throws if an invalid charset is specified', function (st) { + st['throws'](function () { + qs.parse('a=b', { charset: 'foobar' }); + }, new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined')); + st.end(); + }); + + t.test('parses an iso-8859-1 string if asked to', function (st) { + st.deepEqual(qs.parse('%A2=%BD', { charset: 'iso-8859-1' }), { '¢': '½' }); + st.end(); + }); + + var urlEncodedCheckmarkInUtf8 = '%E2%9C%93'; + var urlEncodedOSlashInUtf8 = '%C3%B8'; + var urlEncodedNumCheckmark = '%26%2310003%3B'; + var urlEncodedNumSmiley = '%26%239786%3B'; + + t.test('prefers an utf-8 charset specified by the utf8 sentinel to a default charset of iso-8859-1', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedCheckmarkInUtf8 + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'iso-8859-1' }), { ø: 'ø' }); + st.end(); + }); + + t.test('prefers an iso-8859-1 charset specified by the utf8 sentinel to a default charset of utf-8', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { 'ø': 'ø' }); + st.end(); + }); + + t.test('does not require the utf8 sentinel to be defined before the parameters whose decoding it affects', function (st) { + st.deepEqual(qs.parse('a=' + urlEncodedOSlashInUtf8 + '&utf8=' + urlEncodedNumCheckmark, { charsetSentinel: true, charset: 'utf-8' }), { a: 'ø' }); + st.end(); + }); + + t.test('should ignore an utf8 sentinel with an unknown value', function (st) { + st.deepEqual(qs.parse('utf8=foo&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { ø: 'ø' }); + st.end(); + }); + + t.test('uses the utf8 sentinel to switch to utf-8 when no default charset is given', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedCheckmarkInUtf8 + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { ø: 'ø' }); + st.end(); + }); + + t.test('uses the utf8 sentinel to switch to iso-8859-1 when no default charset is given', function (st) { + st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { 'ø': 'ø' }); + st.end(); + }); + + t.test('interprets numeric entities in iso-8859-1 when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'iso-8859-1', interpretNumericEntities: true }), { foo: '☺' }); + st.end(); + }); + + t.test('handles a custom decoder returning `null`, in the `iso-8859-1` charset, when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=&bar=' + urlEncodedNumSmiley, { + charset: 'iso-8859-1', + decoder: function (str, defaultDecoder, charset) { + return str ? defaultDecoder(str, defaultDecoder, charset) : null; + }, + interpretNumericEntities: true + }), { foo: null, bar: '☺' }); + st.end(); + }); + + t.test('does not interpret numeric entities in iso-8859-1 when `interpretNumericEntities` is absent', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'iso-8859-1' }), { foo: '☺' }); + st.end(); + }); + + t.test('does not interpret numeric entities when the charset is utf-8, even when `interpretNumericEntities`', function (st) { + st.deepEqual(qs.parse('foo=' + urlEncodedNumSmiley, { charset: 'utf-8', interpretNumericEntities: true }), { foo: '☺' }); + st.end(); + }); + + t.test('does not interpret %uXXXX syntax in iso-8859-1 mode', function (st) { + st.deepEqual(qs.parse('%u263A=%u263A', { charset: 'iso-8859-1' }), { '%u263A': '%u263A' }); + st.end(); + }); + + t.test('allows for decoding keys and values differently', function (st) { + var decoder = function (str, defaultDecoder, charset, type) { + if (type === 'key') { + return defaultDecoder(str, defaultDecoder, charset, type).toLowerCase(); + } + if (type === 'value') { + return defaultDecoder(str, defaultDecoder, charset, type).toUpperCase(); + } + throw 'this should never happen! type: ' + type; + }; + + st.deepEqual(qs.parse('KeY=vAlUe', { decoder: decoder }), { key: 'VALUE' }); + st.end(); + }); + + t.end(); +}); + +test('parses empty keys', function (t) { + emptyTestCases.forEach(function (testCase) { + t.test('skips empty string key with ' + testCase.input, function (st) { + st.deepEqual(qs.parse(testCase.input), testCase.noEmptyKeys); + + st.end(); + }); + }); +}); + +test('`duplicates` option', function (t) { + v.nonStrings.concat('not a valid option').forEach(function (invalidOption) { + if (typeof invalidOption !== 'undefined') { + t['throws']( + function () { qs.parse('', { duplicates: invalidOption }); }, + TypeError, + 'throws on invalid option: ' + inspect(invalidOption) + ); + } + }); + + t.deepEqual( + qs.parse('foo=bar&foo=baz'), + { foo: ['bar', 'baz'] }, + 'duplicates: default, combine' + ); + + t.deepEqual( + qs.parse('foo=bar&foo=baz', { duplicates: 'combine' }), + { foo: ['bar', 'baz'] }, + 'duplicates: combine' + ); + + t.deepEqual( + qs.parse('foo=bar&foo=baz', { duplicates: 'first' }), + { foo: 'bar' }, + 'duplicates: first' + ); + + t.deepEqual( + qs.parse('foo=bar&foo=baz', { duplicates: 'last' }), + { foo: 'baz' }, + 'duplicates: last' + ); + + t.end(); +}); + +test('qs strictDepth option - throw cases', function (t) { + t.test('throws an exception when depth exceeds the limit with strictDepth: true', function (st) { + st['throws']( + function () { + qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true }); + }, + RangeError, + 'Should throw RangeError' + ); + st.end(); + }); + + t.test('throws an exception for multiple nested arrays with strictDepth: true', function (st) { + st['throws']( + function () { + qs.parse('a[0][1][2][3][4]=b', { depth: 3, strictDepth: true }); + }, + RangeError, + 'Should throw RangeError' + ); + st.end(); + }); + + t.test('throws an exception for nested objects and arrays with strictDepth: true', function (st) { + st['throws']( + function () { + qs.parse('a[b][c][0][d][e]=f', { depth: 3, strictDepth: true }); + }, + RangeError, + 'Should throw RangeError' + ); + st.end(); + }); + + t.test('throws an exception for different types of values with strictDepth: true', function (st) { + st['throws']( + function () { + qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 3, strictDepth: true }); + }, + RangeError, + 'Should throw RangeError' + ); + st.end(); + }); + +}); + +test('qs strictDepth option - non-throw cases', function (t) { + t.test('when depth is 0 and strictDepth true, do not throw', function (st) { + st.doesNotThrow( + function () { + qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 0, strictDepth: true }); + }, + RangeError, + 'Should not throw RangeError' + ); + st.end(); + }); + + t.test('parses successfully when depth is within the limit with strictDepth: true', function (st) { + st.doesNotThrow( + function () { + var result = qs.parse('a[b]=c', { depth: 1, strictDepth: true }); + st.deepEqual(result, { a: { b: 'c' } }, 'Should parse correctly'); + } + ); + st.end(); + }); + + t.test('does not throw an exception when depth exceeds the limit with strictDepth: false', function (st) { + st.doesNotThrow( + function () { + var result = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); + st.deepEqual(result, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }, 'Should parse with depth limit'); + } + ); + st.end(); + }); + + t.test('parses successfully when depth is within the limit with strictDepth: false', function (st) { + st.doesNotThrow( + function () { + var result = qs.parse('a[b]=c', { depth: 1 }); + st.deepEqual(result, { a: { b: 'c' } }, 'Should parse correctly'); + } + ); + st.end(); + }); + + t.test('does not throw when depth is exactly at the limit with strictDepth: true', function (st) { + st.doesNotThrow( + function () { + var result = qs.parse('a[b][c]=d', { depth: 2, strictDepth: true }); + st.deepEqual(result, { a: { b: { c: 'd' } } }, 'Should parse correctly'); + } + ); + st.end(); + }); +}); diff --git a/live2d/node_modules/qs/test/stringify.js b/live2d/node_modules/qs/test/stringify.js new file mode 100644 index 0000000..12b1c71 --- /dev/null +++ b/live2d/node_modules/qs/test/stringify.js @@ -0,0 +1,1298 @@ +'use strict'; + +var test = require('tape'); +var qs = require('../'); +var utils = require('../lib/utils'); +var iconv = require('iconv-lite'); +var SaferBuffer = require('safer-buffer').Buffer; +var hasSymbols = require('has-symbols'); +var mockProperty = require('mock-property'); +var emptyTestCases = require('./empty-keys-cases').emptyTestCases; +var hasBigInt = typeof BigInt === 'function'; + +test('stringify()', function (t) { + t.test('stringifies a querystring object', function (st) { + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: 1 }), 'a=1'); + st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2'); + st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z'); + st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC'); + st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80'); + st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90'); + st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7'); + st.end(); + }); + + t.test('stringifies falsy values', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(null, { strictNullHandling: true }), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(0), ''); + st.end(); + }); + + t.test('stringifies symbols', { skip: !hasSymbols() }, function (st) { + st.equal(qs.stringify(Symbol.iterator), ''); + st.equal(qs.stringify([Symbol.iterator]), '0=Symbol%28Symbol.iterator%29'); + st.equal(qs.stringify({ a: Symbol.iterator }), 'a=Symbol%28Symbol.iterator%29'); + st.equal( + qs.stringify({ a: [Symbol.iterator] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[]=Symbol%28Symbol.iterator%29' + ); + st.end(); + }); + + t.test('stringifies bigints', { skip: !hasBigInt }, function (st) { + var three = BigInt(3); + var encodeWithN = function (value, defaultEncoder, charset) { + var result = defaultEncoder(value, defaultEncoder, charset); + return typeof value === 'bigint' ? result + 'n' : result; + }; + st.equal(qs.stringify(three), ''); + st.equal(qs.stringify([three]), '0=3'); + st.equal(qs.stringify([three], { encoder: encodeWithN }), '0=3n'); + st.equal(qs.stringify({ a: three }), 'a=3'); + st.equal(qs.stringify({ a: three }, { encoder: encodeWithN }), 'a=3n'); + st.equal( + qs.stringify({ a: [three] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[]=3' + ); + st.equal( + qs.stringify({ a: [three] }, { encodeValuesOnly: true, encoder: encodeWithN, arrayFormat: 'brackets' }), + 'a[]=3n' + ); + st.end(); + }); + + t.test('encodes dot in key of object when encodeDotInKeys and allowDots is provided', function (st) { + st.equal( + qs.stringify( + { 'name.obj': { first: 'John', last: 'Doe' } }, + { allowDots: false, encodeDotInKeys: false } + ), + 'name.obj%5Bfirst%5D=John&name.obj%5Blast%5D=Doe', + 'with allowDots false and encodeDotInKeys false' + ); + st.equal( + qs.stringify( + { 'name.obj': { first: 'John', last: 'Doe' } }, + { allowDots: true, encodeDotInKeys: false } + ), + 'name.obj.first=John&name.obj.last=Doe', + 'with allowDots true and encodeDotInKeys false' + ); + st.equal( + qs.stringify( + { 'name.obj': { first: 'John', last: 'Doe' } }, + { allowDots: false, encodeDotInKeys: true } + ), + 'name%252Eobj%5Bfirst%5D=John&name%252Eobj%5Blast%5D=Doe', + 'with allowDots false and encodeDotInKeys true' + ); + st.equal( + qs.stringify( + { 'name.obj': { first: 'John', last: 'Doe' } }, + { allowDots: true, encodeDotInKeys: true } + ), + 'name%252Eobj.first=John&name%252Eobj.last=Doe', + 'with allowDots true and encodeDotInKeys true' + ); + + st.equal( + qs.stringify( + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + { allowDots: false, encodeDotInKeys: false } + ), + 'name.obj.subobject%5Bfirst.godly.name%5D=John&name.obj.subobject%5Blast%5D=Doe', + 'with allowDots false and encodeDotInKeys false' + ); + st.equal( + qs.stringify( + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + { allowDots: true, encodeDotInKeys: false } + ), + 'name.obj.subobject.first.godly.name=John&name.obj.subobject.last=Doe', + 'with allowDots false and encodeDotInKeys false' + ); + st.equal( + qs.stringify( + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + { allowDots: false, encodeDotInKeys: true } + ), + 'name%252Eobj%252Esubobject%5Bfirst.godly.name%5D=John&name%252Eobj%252Esubobject%5Blast%5D=Doe', + 'with allowDots false and encodeDotInKeys true' + ); + st.equal( + qs.stringify( + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + { allowDots: true, encodeDotInKeys: true } + ), + 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', + 'with allowDots true and encodeDotInKeys true' + ); + + st.end(); + }); + + t.test('should encode dot in key of object, and automatically set allowDots to `true` when encodeDotInKeys is true and allowDots in undefined', function (st) { + st.equal( + qs.stringify( + { 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, + { encodeDotInKeys: true } + ), + 'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe', + 'with allowDots undefined and encodeDotInKeys true' + ); + st.end(); + }); + + t.test('should encode dot in key of object when encodeDotInKeys and allowDots is provided, and nothing else when encodeValuesOnly is provided', function (st) { + st.equal( + qs.stringify({ 'name.obj': { first: 'John', last: 'Doe' } }, { + encodeDotInKeys: true, allowDots: true, encodeValuesOnly: true + }), + 'name%2Eobj.first=John&name%2Eobj.last=Doe' + ); + + st.equal( + qs.stringify({ 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } }, { allowDots: true, encodeDotInKeys: true, encodeValuesOnly: true }), + 'name%2Eobj%2Esubobject.first%2Egodly%2Ename=John&name%2Eobj%2Esubobject.last=Doe' + ); + + st.end(); + }); + + t.test('throws when `commaRoundTrip` is not a boolean', function (st) { + st['throws']( + function () { qs.stringify({}, { commaRoundTrip: 'not a boolean' }); }, + TypeError, + 'throws when `commaRoundTrip` is not a boolean' + ); + + st.end(); + }); + + t.test('throws when `encodeDotInKeys` is not a boolean', function (st) { + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { encodeDotInKeys: 'foobar' }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { encodeDotInKeys: 0 }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { encodeDotInKeys: NaN }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { encodeDotInKeys: null }); }, + TypeError + ); + + st.end(); + }); + + t.test('adds query prefix', function (st) { + st.equal(qs.stringify({ a: 'b' }, { addQueryPrefix: true }), '?a=b'); + st.end(); + }); + + t.test('with query prefix, outputs blank string given an empty object', function (st) { + st.equal(qs.stringify({}, { addQueryPrefix: true }), ''); + st.end(); + }); + + t.test('stringifies nested falsy values', function (st) { + st.equal(qs.stringify({ a: { b: { c: null } } }), 'a%5Bb%5D%5Bc%5D='); + st.equal(qs.stringify({ a: { b: { c: null } } }, { strictNullHandling: true }), 'a%5Bb%5D%5Bc%5D'); + st.equal(qs.stringify({ a: { b: { c: false } } }), 'a%5Bb%5D%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies a nested object', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e'); + st.end(); + }); + + t.test('`allowDots` option: stringifies a nested object with dots notation', function (st) { + st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c'); + st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e'); + st.end(); + }); + + t.test('stringifies an array value', function (st) { + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'indices' }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'brackets' }), + 'a%5B%5D=b&a%5B%5D=c&a%5B%5D=d', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' }), + 'a=b%2Cc%2Cd', + 'comma => comma' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma', commaRoundTrip: true }), + 'a=b%2Cc%2Cd', + 'comma round trip => comma' + ); + st.equal( + qs.stringify({ a: ['b', 'c', 'd'] }), + 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d', + 'default => indices' + ); + st.end(); + }); + + t.test('`skipNulls` option', function (st) { + st.equal( + qs.stringify({ a: 'b', c: null }, { skipNulls: true }), + 'a=b', + 'omits nulls when asked' + ); + + st.equal( + qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), + 'a%5Bb%5D=c', + 'omits nested nulls when asked' + ); + + st.end(); + }); + + t.test('omits array indices when asked', function (st) { + st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d'); + + st.end(); + }); + + t.test('omits object key/value pair when value is empty array', function (st) { + st.equal(qs.stringify({ a: [], b: 'zz' }), 'b=zz'); + + st.end(); + }); + + t.test('should not omit object key/value pair when value is empty array and when asked', function (st) { + st.equal(qs.stringify({ a: [], b: 'zz' }), 'b=zz'); + st.equal(qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: false }), 'b=zz'); + st.equal(qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: true }), 'a[]&b=zz'); + + st.end(); + }); + + t.test('should throw when allowEmptyArrays is not of type boolean', function (st) { + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: 'foobar' }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: 0 }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: NaN }); }, + TypeError + ); + + st['throws']( + function () { qs.stringify({ a: [], b: 'zz' }, { allowEmptyArrays: null }); }, + TypeError + ); + + st.end(); + }); + + t.test('allowEmptyArrays + strictNullHandling', function (st) { + st.equal( + qs.stringify( + { testEmptyArray: [] }, + { strictNullHandling: true, allowEmptyArrays: true } + ), + 'testEmptyArray[]' + ); + + st.end(); + }); + + t.test('stringifies an array value with one item vs multiple items', function (st) { + st.test('non-array item', function (s2t) { + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c'); + s2t.equal(qs.stringify({ a: 'c' }, { encodeValuesOnly: true }), 'a=c'); + + s2t.end(); + }); + + st.test('array with a single item', function (s2t) { + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c'); + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true, arrayFormat: 'comma', commaRoundTrip: true }), 'a[]=c'); // so it parses back as an array + s2t.equal(qs.stringify({ a: ['c'] }, { encodeValuesOnly: true }), 'a[0]=c'); + + s2t.end(); + }); + + st.test('array with multiple items', function (s2t) { + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=c&a[1]=d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=c&a[]=d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c,d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true, arrayFormat: 'comma', commaRoundTrip: true }), 'a=c,d'); + s2t.equal(qs.stringify({ a: ['c', 'd'] }, { encodeValuesOnly: true }), 'a[0]=c&a[1]=d'); + + s2t.end(); + }); + + st.test('array with multiple items with a comma inside', function (s2t) { + s2t.equal(qs.stringify({ a: ['c,d', 'e'] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=c%2Cd,e'); + s2t.equal(qs.stringify({ a: ['c,d', 'e'] }, { arrayFormat: 'comma' }), 'a=c%2Cd%2Ce'); + + s2t.equal(qs.stringify({ a: ['c,d', 'e'] }, { encodeValuesOnly: true, arrayFormat: 'comma', commaRoundTrip: true }), 'a=c%2Cd,e'); + s2t.equal(qs.stringify({ a: ['c,d', 'e'] }, { arrayFormat: 'comma', commaRoundTrip: true }), 'a=c%2Cd%2Ce'); + + s2t.end(); + }); + + st.end(); + }); + + t.test('stringifies a nested array value', function (st) { + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[b][0]=c&a[b][1]=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[b][]=c&a[b][]=d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true, arrayFormat: 'comma' }), 'a[b]=c,d'); + st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { encodeValuesOnly: true }), 'a[b][0]=c&a[b][1]=d'); + st.end(); + }); + + t.test('stringifies comma and empty array values', function (st) { + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: false, arrayFormat: 'indices' }), 'a[0]=,&a[1]=&a[2]=c,d%'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: false, arrayFormat: 'brackets' }), 'a[]=,&a[]=&a[]=c,d%'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: false, arrayFormat: 'comma' }), 'a=,,,c,d%'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: false, arrayFormat: 'repeat' }), 'a=,&a=&a=c,d%'); + + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[0]=%2C&a[1]=&a[2]=c%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=%2C&a[]=&a[]=c%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=%2C,,c%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a=%2C&a=&a=c%2Cd%25'); + + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: false, arrayFormat: 'indices' }), 'a%5B0%5D=%2C&a%5B1%5D=&a%5B2%5D=c%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: false, arrayFormat: 'brackets' }), 'a%5B%5D=%2C&a%5B%5D=&a%5B%5D=c%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: false, arrayFormat: 'comma' }), 'a=%2C%2C%2Cc%2Cd%25'); + st.equal(qs.stringify({ a: [',', '', 'c,d%'] }, { encode: true, encodeValuesOnly: false, arrayFormat: 'repeat' }), 'a=%2C&a=&a=c%2Cd%25'); + + st.end(); + }); + + t.test('stringifies comma and empty non-array values', function (st) { + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'indices' }), 'a=,&b=&c=c,d%'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'brackets' }), 'a=,&b=&c=c,d%'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'comma' }), 'a=,&b=&c=c,d%'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: false, arrayFormat: 'repeat' }), 'a=,&b=&c=c,d%'); + + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: true, arrayFormat: 'indices' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: true, arrayFormat: 'comma' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a=%2C&b=&c=c%2Cd%25'); + + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: false, arrayFormat: 'indices' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: false, arrayFormat: 'brackets' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: false, arrayFormat: 'comma' }), 'a=%2C&b=&c=c%2Cd%25'); + st.equal(qs.stringify({ a: ',', b: '', c: 'c,d%' }, { encode: true, encodeValuesOnly: false, arrayFormat: 'repeat' }), 'a=%2C&b=&c=c%2Cd%25'); + + st.end(); + }); + + t.test('stringifies a nested array value with dots notation', function (st) { + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'indices' } + ), + 'a.b[0]=c&a.b[1]=d', + 'indices: stringifies with dots + indices' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'brackets' } + ), + 'a.b[]=c&a.b[]=d', + 'brackets: stringifies with dots + brackets' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true, arrayFormat: 'comma' } + ), + 'a.b=c,d', + 'comma: stringifies with dots + comma' + ); + st.equal( + qs.stringify( + { a: { b: ['c', 'd'] } }, + { allowDots: true, encodeValuesOnly: true } + ), + 'a.b[0]=c&a.b[1]=d', + 'default: stringifies with dots + indices' + ); + st.end(); + }); + + t.test('stringifies an object inside an array', function (st) { + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'indices', encodeValuesOnly: true }), + 'a[0][b]=c', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'repeat', encodeValuesOnly: true }), + 'a[b]=c', + 'repeat => repeat' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'brackets', encodeValuesOnly: true }), + 'a[][b]=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 'c' }] }, { encodeValuesOnly: true }), + 'a[0][b]=c', + 'default => indices' + ); + + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'indices', encodeValuesOnly: true }), + 'a[0][b][c][0]=1', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'repeat', encodeValuesOnly: true }), + 'a[b][c]=1', + 'repeat => repeat' + ); + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'brackets', encodeValuesOnly: true }), + 'a[][b][c][]=1', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: { c: [1] } }] }, { encodeValuesOnly: true }), + 'a[0][b][c][0]=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an array with mixed objects and primitives', function (st) { + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'indices => indices' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'a[][b]=1&a[]=2&a[]=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true, arrayFormat: 'comma' }), + '???', + 'brackets => brackets', + { skip: 'TODO: figure out what this should do' } + ); + st.equal( + qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encodeValuesOnly: true }), + 'a[0][b]=1&a[1]=2&a[2]=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('stringifies an object inside an array with dots notation', function (st) { + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b=c', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b=c', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: 'c' }] }, + { allowDots: true, encode: false } + ), + 'a[0].b=c', + 'default => indices' + ); + + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'indices' } + ), + 'a[0].b.c[0]=1', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false, arrayFormat: 'brackets' } + ), + 'a[].b.c[]=1', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: [{ b: { c: [1] } }] }, + { allowDots: true, encode: false } + ), + 'a[0].b.c[0]=1', + 'default => indices' + ); + + st.end(); + }); + + t.test('does not omit object keys when indices = false', function (st) { + st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when indices=true', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses indices notation for arrays when arrayFormat=indices', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c'); + st.end(); + }); + + t.test('uses repeat notation for arrays when arrayFormat=repeat', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c'); + st.end(); + }); + + t.test('uses brackets notation for arrays when arrayFormat=brackets', function (st) { + st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c'); + st.end(); + }); + + t.test('stringifies a complicated object', function (st) { + st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e'); + st.end(); + }); + + t.test('stringifies an empty value', function (st) { + st.equal(qs.stringify({ a: '' }), 'a='); + st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a'); + + st.equal(qs.stringify({ a: '', b: '' }), 'a=&b='); + st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b='); + + st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D='); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D'); + st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D='); + + st.end(); + }); + + t.test('stringifies an empty array in different arrayFormat', function (st) { + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false }), 'b[0]=&c=c'); + // arrayFormat default + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices' }), 'b[0]=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets' }), 'b[]=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat' }), 'b=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma' }), 'b=&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', commaRoundTrip: true }), 'b[]=&c=c'); + // with strictNullHandling + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices', strictNullHandling: true }), 'b[0]&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets', strictNullHandling: true }), 'b[]&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat', strictNullHandling: true }), 'b&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', strictNullHandling: true }), 'b&c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', strictNullHandling: true, commaRoundTrip: true }), 'b[]&c=c'); + // with skipNulls + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'indices', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'brackets', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'repeat', skipNulls: true }), 'c=c'); + st.equal(qs.stringify({ a: [], b: [null], c: 'c' }, { encode: false, arrayFormat: 'comma', skipNulls: true }), 'c=c'); + + st.end(); + }); + + t.test('stringifies a null object', { skip: !Object.create }, function (st) { + var obj = Object.create(null); + obj.a = 'b'; + st.equal(qs.stringify(obj), 'a=b'); + st.end(); + }); + + t.test('returns an empty string for invalid input', function (st) { + st.equal(qs.stringify(undefined), ''); + st.equal(qs.stringify(false), ''); + st.equal(qs.stringify(null), ''); + st.equal(qs.stringify(''), ''); + st.end(); + }); + + t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) { + var obj = { a: Object.create(null) }; + + obj.a.b = 'c'; + st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); + st.end(); + }); + + t.test('drops keys with a value of undefined', function (st) { + st.equal(qs.stringify({ a: undefined }), ''); + + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D'); + st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D='); + st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D='); + st.end(); + }); + + t.test('url encodes values', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.end(); + }); + + t.test('stringifies a date', function (st) { + var now = new Date(); + var str = 'a=' + encodeURIComponent(now.toISOString()); + st.equal(qs.stringify({ a: now }), str); + st.end(); + }); + + t.test('stringifies the weird object from qs', function (st) { + st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F'); + st.end(); + }); + + t.test('skips properties that are part of the object prototype', function (st) { + st.intercept(Object.prototype, 'crash', { value: 'test' }); + + st.equal(qs.stringify({ a: 'b' }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + + st.end(); + }); + + t.test('stringifies boolean values', function (st) { + st.equal(qs.stringify({ a: true }), 'a=true'); + st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true'); + st.equal(qs.stringify({ b: false }), 'b=false'); + st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false'); + st.end(); + }); + + t.test('stringifies buffer values', function (st) { + st.equal(qs.stringify({ a: SaferBuffer.from('test') }), 'a=test'); + st.equal(qs.stringify({ a: { b: SaferBuffer.from('test') } }), 'a%5Bb%5D=test'); + st.end(); + }); + + t.test('stringifies an object using an alternative delimiter', function (st) { + st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + st.end(); + }); + + t.test('does not blow up when Buffer global is missing', function (st) { + var restore = mockProperty(global, 'Buffer', { 'delete': true }); + + var result = qs.stringify({ a: 'b', c: 'd' }); + + restore(); + + st.equal(result, 'a=b&c=d'); + st.end(); + }); + + t.test('does not crash when parsing circular references', function (st) { + var a = {}; + a.b = a; + + st['throws']( + function () { qs.stringify({ 'foo[bar]': 'baz', 'foo[baz]': a }); }, + /RangeError: Cyclic object value/, + 'cyclic values throw' + ); + + var circular = { + a: 'value' + }; + circular.a = circular; + st['throws']( + function () { qs.stringify(circular); }, + /RangeError: Cyclic object value/, + 'cyclic values throw' + ); + + var arr = ['a']; + st.doesNotThrow( + function () { qs.stringify({ x: arr, y: arr }); }, + 'non-cyclic values do not throw' + ); + + st.end(); + }); + + t.test('non-circular duplicated references can still work', function (st) { + var hourOfDay = { + 'function': 'hour_of_day' + }; + + var p1 = { + 'function': 'gte', + arguments: [hourOfDay, 0] + }; + var p2 = { + 'function': 'lte', + arguments: [hourOfDay, 23] + }; + + st.equal( + qs.stringify({ filters: { $and: [p1, p2] } }, { encodeValuesOnly: true, arrayFormat: 'indices' }), + 'filters[$and][0][function]=gte&filters[$and][0][arguments][0][function]=hour_of_day&filters[$and][0][arguments][1]=0&filters[$and][1][function]=lte&filters[$and][1][arguments][0][function]=hour_of_day&filters[$and][1][arguments][1]=23' + ); + st.equal( + qs.stringify({ filters: { $and: [p1, p2] } }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), + 'filters[$and][][function]=gte&filters[$and][][arguments][][function]=hour_of_day&filters[$and][][arguments][]=0&filters[$and][][function]=lte&filters[$and][][arguments][][function]=hour_of_day&filters[$and][][arguments][]=23' + ); + st.equal( + qs.stringify({ filters: { $and: [p1, p2] } }, { encodeValuesOnly: true, arrayFormat: 'repeat' }), + 'filters[$and][function]=gte&filters[$and][arguments][function]=hour_of_day&filters[$and][arguments]=0&filters[$and][function]=lte&filters[$and][arguments][function]=hour_of_day&filters[$and][arguments]=23' + ); + + st.end(); + }); + + t.test('selects properties when filter=array', function (st) { + st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b'); + st.equal(qs.stringify({ a: 1 }, { filter: [] }), ''); + + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'indices' } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'indices => indices' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2], arrayFormat: 'brackets' } + ), + 'a%5Bb%5D%5B%5D=1&a%5Bb%5D%5B%5D=3', + 'brackets => brackets' + ); + st.equal( + qs.stringify( + { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, + { filter: ['a', 'b', 0, 2] } + ), + 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3', + 'default => indices' + ); + + st.end(); + }); + + t.test('supports custom representations when filter=function', function (st) { + var calls = 0; + var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } }; + var filterFunc = function (prefix, value) { + calls += 1; + if (calls === 1) { + st.equal(prefix, '', 'prefix is empty'); + st.equal(value, obj); + } else if (prefix === 'c') { + return void 0; + } else if (value instanceof Date) { + st.equal(prefix, 'e[f]'); + return value.getTime(); + } + return value; + }; + + st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000'); + st.equal(calls, 5); + st.end(); + }); + + t.test('can disable uri encoding', function (st) { + st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b'); + st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c'); + st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c'); + st.end(); + }); + + t.test('can sort the keys', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y'); + st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a'); + st.end(); + }); + + t.test('can sort the keys at depth 3 or more too', function (st) { + var sort = function (a, b) { + return a.localeCompare(b); + }; + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: sort, encode: false } + ), + 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb' + ); + st.equal( + qs.stringify( + { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' }, + { sort: null, encode: false } + ), + 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b' + ); + st.end(); + }); + + t.test('can stringify with custom encoding', function (st) { + st.equal(qs.stringify({ 県: '大阪府', '': '' }, { + encoder: function (str) { + if (str.length === 0) { + return ''; + } + var buf = iconv.encode(str, 'shiftjis'); + var result = []; + for (var i = 0; i < buf.length; ++i) { + result.push(buf.readUInt8(i).toString(16)); + } + return '%' + result.join('%'); + } + }), '%8c%a7=%91%e5%8d%e3%95%7b&='); + st.end(); + }); + + t.test('receives the default encoder as a second argument', function (st) { + st.plan(8); + + qs.stringify({ a: 1, b: new Date(), c: true, d: [1] }, { + encoder: function (str) { + st.match(typeof str, /^(?:string|number|boolean)$/); + return ''; + } + }); + + st.end(); + }); + + t.test('receives the default encoder as a second argument', function (st) { + st.plan(2); + + qs.stringify({ a: 1 }, { + encoder: function (str, defaultEncoder) { + st.equal(defaultEncoder, utils.encode); + } + }); + + st.end(); + }); + + t.test('throws error with wrong encoder', function (st) { + st['throws'](function () { + qs.stringify({}, { encoder: 'string' }); + }, new TypeError('Encoder has to be a function.')); + st.end(); + }); + + t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) { + st.equal(qs.stringify({ a: SaferBuffer.from([1]) }, { + encoder: function (buffer) { + if (typeof buffer === 'string') { + return buffer; + } + return String.fromCharCode(buffer.readUInt8(0) + 97); + } + }), 'a=b'); + + st.equal(qs.stringify({ a: SaferBuffer.from('a b') }, { + encoder: function (buffer) { + return buffer; + } + }), 'a=a b'); + st.end(); + }); + + t.test('serializeDate option', function (st) { + var date = new Date(); + st.equal( + qs.stringify({ a: date }), + 'a=' + date.toISOString().replace(/:/g, '%3A'), + 'default is toISOString' + ); + + var mutatedDate = new Date(); + mutatedDate.toISOString = function () { + throw new SyntaxError(); + }; + st['throws'](function () { + mutatedDate.toISOString(); + }, SyntaxError); + st.equal( + qs.stringify({ a: mutatedDate }), + 'a=' + Date.prototype.toISOString.call(mutatedDate).replace(/:/g, '%3A'), + 'toISOString works even when method is not locally present' + ); + + var specificDate = new Date(6); + st.equal( + qs.stringify( + { a: specificDate }, + { serializeDate: function (d) { return d.getTime() * 7; } } + ), + 'a=42', + 'custom serializeDate function called' + ); + + st.equal( + qs.stringify( + { a: [date] }, + { + serializeDate: function (d) { return d.getTime(); }, + arrayFormat: 'comma' + } + ), + 'a=' + date.getTime(), + 'works with arrayFormat comma' + ); + st.equal( + qs.stringify( + { a: [date] }, + { + serializeDate: function (d) { return d.getTime(); }, + arrayFormat: 'comma', + commaRoundTrip: true + } + ), + 'a%5B%5D=' + date.getTime(), + 'works with arrayFormat comma' + ); + + st.end(); + }); + + t.test('RFC 1738 serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC1738 }), 'a=b+c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC1738 }), 'a+b=c+d'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC1738 }), 'a+b=a+b'); + + st.equal(qs.stringify({ 'foo(ref)': 'bar' }, { format: qs.formats.RFC1738 }), 'foo(ref)=bar'); + + st.end(); + }); + + t.test('RFC 3986 spaces serialization', function (st) { + st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }, { format: qs.formats.RFC3986 }), 'a%20b=a%20b'); + + st.end(); + }); + + t.test('Backward compatibility to RFC 3986', function (st) { + st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); + st.equal(qs.stringify({ 'a b': SaferBuffer.from('a b') }), 'a%20b=a%20b'); + + st.end(); + }); + + t.test('Edge cases and unknown formats', function (st) { + ['UFO1234', false, 1234, null, {}, []].forEach(function (format) { + st['throws']( + function () { + qs.stringify({ a: 'b c' }, { format: format }); + }, + new TypeError('Unknown format option provided.') + ); + }); + st.end(); + }); + + t.test('encodeValuesOnly', function (st) { + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true, arrayFormat: 'indices' } + ), + 'a=b&c[0]=d&c[1]=e%3Df&f[0][0]=g&f[1][0]=h', + 'encodeValuesOnly + indices' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true, arrayFormat: 'brackets' } + ), + 'a=b&c[]=d&c[]=e%3Df&f[][]=g&f[][]=h', + 'encodeValuesOnly + brackets' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e=f'], f: [['g'], ['h']] }, + { encodeValuesOnly: true, arrayFormat: 'repeat' } + ), + 'a=b&c=d&c=e%3Df&f=g&f=h', + 'encodeValuesOnly + repeat' + ); + + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] }, + { arrayFormat: 'indices' } + ), + 'a=b&c%5B0%5D=d&c%5B1%5D=e&f%5B0%5D%5B0%5D=g&f%5B1%5D%5B0%5D=h', + 'no encodeValuesOnly + indices' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] }, + { arrayFormat: 'brackets' } + ), + 'a=b&c%5B%5D=d&c%5B%5D=e&f%5B%5D%5B%5D=g&f%5B%5D%5B%5D=h', + 'no encodeValuesOnly + brackets' + ); + st.equal( + qs.stringify( + { a: 'b', c: ['d', 'e'], f: [['g'], ['h']] }, + { arrayFormat: 'repeat' } + ), + 'a=b&c=d&c=e&f=g&f=h', + 'no encodeValuesOnly + repeat' + ); + + st.end(); + }); + + t.test('encodeValuesOnly - strictNullHandling', function (st) { + st.equal( + qs.stringify( + { a: { b: null } }, + { encodeValuesOnly: true, strictNullHandling: true } + ), + 'a[b]' + ); + st.end(); + }); + + t.test('throws if an invalid charset is specified', function (st) { + st['throws'](function () { + qs.stringify({ a: 'b' }, { charset: 'foobar' }); + }, new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined')); + st.end(); + }); + + t.test('respects a charset of iso-8859-1', function (st) { + st.equal(qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' }), '%E6=%E6'); + st.end(); + }); + + t.test('encodes unrepresentable chars as numeric entities in iso-8859-1 mode', function (st) { + st.equal(qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' }), 'a=%26%239786%3B'); + st.end(); + }); + + t.test('respects an explicit charset of utf-8 (the default)', function (st) { + st.equal(qs.stringify({ a: 'æ' }, { charset: 'utf-8' }), 'a=%C3%A6'); + st.end(); + }); + + t.test('`charsetSentinel` option', function (st) { + st.equal( + qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'utf-8' }), + 'utf8=%E2%9C%93&a=%C3%A6', + 'adds the right sentinel when instructed to and the charset is utf-8' + ); + + st.equal( + qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' }), + 'utf8=%26%2310003%3B&a=%E6', + 'adds the right sentinel when instructed to and the charset is iso-8859-1' + ); + + st.end(); + }); + + t.test('does not mutate the options argument', function (st) { + var options = {}; + qs.stringify({}, options); + st.deepEqual(options, {}); + st.end(); + }); + + t.test('strictNullHandling works with custom filter', function (st) { + var filter = function (prefix, value) { + return value; + }; + + var options = { strictNullHandling: true, filter: filter }; + st.equal(qs.stringify({ key: null }, options), 'key'); + st.end(); + }); + + t.test('strictNullHandling works with null serializeDate', function (st) { + var serializeDate = function () { + return null; + }; + var options = { strictNullHandling: true, serializeDate: serializeDate }; + var date = new Date(); + st.equal(qs.stringify({ key: date }, options), 'key'); + st.end(); + }); + + t.test('allows for encoding keys and values differently', function (st) { + var encoder = function (str, defaultEncoder, charset, type) { + if (type === 'key') { + return defaultEncoder(str, defaultEncoder, charset, type).toLowerCase(); + } + if (type === 'value') { + return defaultEncoder(str, defaultEncoder, charset, type).toUpperCase(); + } + throw 'this should never happen! type: ' + type; + }; + + st.deepEqual(qs.stringify({ KeY: 'vAlUe' }, { encoder: encoder }), 'key=VALUE'); + st.end(); + }); + + t.test('objects inside arrays', function (st) { + var obj = { a: { b: { c: 'd', e: 'f' } } }; + var withArray = { a: { b: [{ c: 'd', e: 'f' }] } }; + + st.equal(qs.stringify(obj, { encode: false }), 'a[b][c]=d&a[b][e]=f', 'no array, no arrayFormat'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'brackets' }), 'a[b][c]=d&a[b][e]=f', 'no array, bracket'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'indices' }), 'a[b][c]=d&a[b][e]=f', 'no array, indices'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'repeat' }), 'a[b][c]=d&a[b][e]=f', 'no array, repeat'); + st.equal(qs.stringify(obj, { encode: false, arrayFormat: 'comma' }), 'a[b][c]=d&a[b][e]=f', 'no array, comma'); + + st.equal(qs.stringify(withArray, { encode: false }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, no arrayFormat'); + st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'brackets' }), 'a[b][][c]=d&a[b][][e]=f', 'array, bracket'); + st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'indices' }), 'a[b][0][c]=d&a[b][0][e]=f', 'array, indices'); + st.equal(qs.stringify(withArray, { encode: false, arrayFormat: 'repeat' }), 'a[b][c]=d&a[b][e]=f', 'array, repeat'); + st.equal( + qs.stringify(withArray, { encode: false, arrayFormat: 'comma' }), + '???', + 'array, comma', + { skip: 'TODO: figure out what this should do' } + ); + + st.end(); + }); + + t.test('stringifies sparse arrays', function (st) { + /* eslint no-sparse-arrays: 0 */ + st.equal(qs.stringify({ a: [, '2', , , '1'] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[1]=2&a[4]=1'); + st.equal(qs.stringify({ a: [, '2', , , '1'] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[]=2&a[]=1'); + st.equal(qs.stringify({ a: [, '2', , , '1'] }, { encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a=2&a=1'); + + st.equal(qs.stringify({ a: [, { b: [, , { c: '1' }] }] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[1][b][2][c]=1'); + st.equal(qs.stringify({ a: [, { b: [, , { c: '1' }] }] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[][b][][c]=1'); + st.equal(qs.stringify({ a: [, { b: [, , { c: '1' }] }] }, { encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a[b][c]=1'); + + st.equal(qs.stringify({ a: [, [, , [, , , { c: '1' }]]] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[1][2][3][c]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: '1' }]]] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[][][][c]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: '1' }]]] }, { encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a[c]=1'); + + st.equal(qs.stringify({ a: [, [, , [, , , { c: [, '1'] }]]] }, { encodeValuesOnly: true, arrayFormat: 'indices' }), 'a[1][2][3][c][1]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: [, '1'] }]]] }, { encodeValuesOnly: true, arrayFormat: 'brackets' }), 'a[][][][c][]=1'); + st.equal(qs.stringify({ a: [, [, , [, , , { c: [, '1'] }]]] }, { encodeValuesOnly: true, arrayFormat: 'repeat' }), 'a[c]=1'); + + st.end(); + }); + + t.test('encodes a very long string', function (st) { + var chars = []; + var expected = []; + for (var i = 0; i < 5e3; i++) { + chars.push(' ' + i); + + expected.push('%20' + i); + } + + var obj = { + foo: chars.join('') + }; + + st.equal( + qs.stringify(obj, { arrayFormat: 'bracket', charset: 'utf-8' }), + 'foo=' + expected.join('') + ); + + st.end(); + }); + + t.end(); +}); + +test('stringifies empty keys', function (t) { + emptyTestCases.forEach(function (testCase) { + t.test('stringifies an object with empty string key with ' + testCase.input, function (st) { + st.deepEqual( + qs.stringify(testCase.withEmptyKeys, { encode: false, arrayFormat: 'indices' }), + testCase.stringifyOutput.indices, + 'test case: ' + testCase.input + ', indices' + ); + st.deepEqual( + qs.stringify(testCase.withEmptyKeys, { encode: false, arrayFormat: 'brackets' }), + testCase.stringifyOutput.brackets, + 'test case: ' + testCase.input + ', brackets' + ); + st.deepEqual( + qs.stringify(testCase.withEmptyKeys, { encode: false, arrayFormat: 'repeat' }), + testCase.stringifyOutput.repeat, + 'test case: ' + testCase.input + ', repeat' + ); + + st.end(); + }); + }); + + t.test('edge case with object/arrays', function (st) { + st.deepEqual(qs.stringify({ '': { '': [2, 3] } }, { encode: false }), '[][0]=2&[][1]=3'); + st.deepEqual(qs.stringify({ '': { '': [2, 3], a: 2 } }, { encode: false }), '[][0]=2&[][1]=3&[a]=2'); + st.deepEqual(qs.stringify({ '': { '': [2, 3] } }, { encode: false, arrayFormat: 'indices' }), '[][0]=2&[][1]=3'); + st.deepEqual(qs.stringify({ '': { '': [2, 3], a: 2 } }, { encode: false, arrayFormat: 'indices' }), '[][0]=2&[][1]=3&[a]=2'); + + st.end(); + }); +}); diff --git a/live2d/node_modules/qs/test/utils.js b/live2d/node_modules/qs/test/utils.js new file mode 100644 index 0000000..aa84dfd --- /dev/null +++ b/live2d/node_modules/qs/test/utils.js @@ -0,0 +1,136 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var SaferBuffer = require('safer-buffer').Buffer; +var forEach = require('for-each'); +var utils = require('../lib/utils'); + +test('merge()', function (t) { + t.deepEqual(utils.merge(null, true), [null, true], 'merges true into null'); + + t.deepEqual(utils.merge(null, [42]), [null, 42], 'merges null into an array'); + + t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key'); + + var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } }); + t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array'); + + var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } }); + t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array'); + + var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' }); + t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array'); + + var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] }); + t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] }); + + var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar'); + t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true }); + + t.test( + 'avoids invoking array setters unnecessarily', + { skip: typeof Object.defineProperty !== 'function' }, + function (st) { + var setCount = 0; + var getCount = 0; + var observed = []; + Object.defineProperty(observed, 0, { + get: function () { + getCount += 1; + return { bar: 'baz' }; + }, + set: function () { setCount += 1; } + }); + utils.merge(observed, [null]); + st.equal(setCount, 0); + st.equal(getCount, 1); + observed[0] = observed[0]; // eslint-disable-line no-self-assign + st.equal(setCount, 1); + st.equal(getCount, 2); + st.end(); + } + ); + + t.end(); +}); + +test('assign()', function (t) { + var target = { a: 1, b: 2 }; + var source = { b: 3, c: 4 }; + var result = utils.assign(target, source); + + t.equal(result, target, 'returns the target'); + t.deepEqual(target, { a: 1, b: 3, c: 4 }, 'target and source are merged'); + t.deepEqual(source, { b: 3, c: 4 }, 'source is untouched'); + + t.end(); +}); + +test('combine()', function (t) { + t.test('both arrays', function (st) { + var a = [1]; + var b = [2]; + var combined = utils.combine(a, b); + + st.deepEqual(a, [1], 'a is not mutated'); + st.deepEqual(b, [2], 'b is not mutated'); + st.notEqual(a, combined, 'a !== combined'); + st.notEqual(b, combined, 'b !== combined'); + st.deepEqual(combined, [1, 2], 'combined is a + b'); + + st.end(); + }); + + t.test('one array, one non-array', function (st) { + var aN = 1; + var a = [aN]; + var bN = 2; + var b = [bN]; + + var combinedAnB = utils.combine(aN, b); + st.deepEqual(b, [bN], 'b is not mutated'); + st.notEqual(aN, combinedAnB, 'aN + b !== aN'); + st.notEqual(a, combinedAnB, 'aN + b !== a'); + st.notEqual(bN, combinedAnB, 'aN + b !== bN'); + st.notEqual(b, combinedAnB, 'aN + b !== b'); + st.deepEqual([1, 2], combinedAnB, 'first argument is array-wrapped when not an array'); + + var combinedABn = utils.combine(a, bN); + st.deepEqual(a, [aN], 'a is not mutated'); + st.notEqual(aN, combinedABn, 'a + bN !== aN'); + st.notEqual(a, combinedABn, 'a + bN !== a'); + st.notEqual(bN, combinedABn, 'a + bN !== bN'); + st.notEqual(b, combinedABn, 'a + bN !== b'); + st.deepEqual([1, 2], combinedABn, 'second argument is array-wrapped when not an array'); + + st.end(); + }); + + t.test('neither is an array', function (st) { + var combined = utils.combine(1, 2); + st.notEqual(1, combined, '1 + 2 !== 1'); + st.notEqual(2, combined, '1 + 2 !== 2'); + st.deepEqual([1, 2], combined, 'both arguments are array-wrapped when not an array'); + + st.end(); + }); + + t.end(); +}); + +test('isBuffer()', function (t) { + forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) { + t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer'); + }); + + var fakeBuffer = { constructor: Buffer }; + t.equal(utils.isBuffer(fakeBuffer), false, 'fake buffer is not a buffer'); + + var saferBuffer = SaferBuffer.from('abc'); + t.equal(utils.isBuffer(saferBuffer), true, 'SaferBuffer instance is a buffer'); + + var buffer = Buffer.from && Buffer.alloc ? Buffer.from('abc') : new Buffer('abc'); + t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer'); + t.end(); +}); diff --git a/live2d/node_modules/semver/LICENSE b/live2d/node_modules/semver/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/live2d/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. diff --git a/live2d/node_modules/semver/README.md b/live2d/node_modules/semver/README.md new file mode 100644 index 0000000..2293a14 --- /dev/null +++ b/live2d/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/live2d/node_modules/semver/bin/semver.js b/live2d/node_modules/semver/bin/semver.js new file mode 100755 index 0000000..666034a --- /dev/null +++ b/live2d/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/live2d/node_modules/semver/package.json b/live2d/node_modules/semver/package.json new file mode 100644 index 0000000..6b970a6 --- /dev/null +++ b/live2d/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "6.3.1", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/live2d/node_modules/semver/range.bnf b/live2d/node_modules/semver/range.bnf new file mode 100644 index 0000000..d4c6ae0 --- /dev/null +++ b/live2d/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/live2d/node_modules/semver/semver.js b/live2d/node_modules/semver/semver.js new file mode 100644 index 0000000..39319c1 --- /dev/null +++ b/live2d/node_modules/semver/semver.js @@ -0,0 +1,1643 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var t = exports.tokens = {} +var R = 0 + +function tok (n) { + t[n] = R++ +} + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +tok('NUMERICIDENTIFIER') +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' +tok('NUMERICIDENTIFIERLOOSE') +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER') +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION') +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')' + +tok('MAINVERSIONLOOSE') +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER') +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +tok('PRERELEASEIDENTIFIERLOOSE') +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE') +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' + +tok('PRERELEASELOOSE') +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER') +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD') +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL') +tok('FULLPLAIN') +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + + src[t.PRERELEASE] + '?' + + src[t.BUILD] + '?' + +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +tok('LOOSEPLAIN') +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + + src[t.PRERELEASELOOSE] + '?' + + src[t.BUILD] + '?' + +tok('LOOSE') +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' + +tok('GTLT') +src[t.GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +tok('XRANGEIDENTIFIERLOOSE') +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +tok('XRANGEIDENTIFIER') +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' + +tok('XRANGEPLAIN') +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:' + src[t.PRERELEASE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGEPLAINLOOSE') +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[t.PRERELEASELOOSE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGE') +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' +tok('XRANGELOOSE') +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +tok('COERCE') +src[t.COERCE] = '(^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' +tok('COERCERTL') +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +tok('LONETILDE') +src[t.LONETILDE] = '(?:~>?)' + +tok('TILDETRIM') +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +tok('TILDE') +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' +tok('TILDELOOSE') +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +tok('LONECARET') +src[t.LONECARET] = '(?:\\^)' + +tok('CARETTRIM') +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +tok('CARET') +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' +tok('CARETLOOSE') +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +tok('COMPARATORLOOSE') +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' +tok('COMPARATOR') +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +tok('COMPARATORTRIM') +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +tok('HYPHENRANGE') +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAIN] + ')' + + '\\s*$' + +tok('HYPHENRANGELOOSE') +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +tok('STAR') +src[t.STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + var i = 0 + do { + var a = this.build[i] + var b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.compareBuild = compareBuild +function compareBuild (a, b, loose) { + var versionA = new SemVer(a, loose) + var versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + if (this.value === '') { + return true + } + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return ( + isSatisfiable(thisComparators, options) && + range.set.some(function (rangeComparators) { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) +} + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +function isSatisfiable (comparators, options) { + var result = true + var remainingComparators = comparators.slice() + var testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + pr + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + pr + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version, options) { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + var match = null + if (!options.rtl) { + match = version.match(safeRe[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next + while ((next = safeRe[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + safeRe[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(match[2] + + '.' + (match[3] || '0') + + '.' + (match[4] || '0'), options) +} diff --git a/live2d/node_modules/set-function-length/.eslintrc b/live2d/node_modules/set-function-length/.eslintrc new file mode 100644 index 0000000..7cff507 --- /dev/null +++ b/live2d/node_modules/set-function-length/.eslintrc @@ -0,0 +1,27 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic" + ], + }], + "no-extra-parens": "off", + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "multiline-comment-style": "off", + "no-empty-function": "off", + }, + }, + ], +} diff --git a/live2d/node_modules/set-function-length/.github/FUNDING.yml b/live2d/node_modules/set-function-length/.github/FUNDING.yml new file mode 100644 index 0000000..92feb6f --- /dev/null +++ b/live2d/node_modules/set-function-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-function-name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/live2d/node_modules/set-function-length/.nycrc b/live2d/node_modules/set-function-length/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/live2d/node_modules/set-function-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/set-function-length/CHANGELOG.md b/live2d/node_modules/set-function-length/CHANGELOG.md new file mode 100644 index 0000000..bac439d --- /dev/null +++ b/live2d/node_modules/set-function-length/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09 + +### Commits + +- [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb) +- [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb) +- [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa) +- [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4) +- [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434) +- [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d) + +## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06 + +### Commits + +- [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738) +- [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4) + +## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14 + +### Commits + +- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a) +- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a) +- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1) +- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a) +- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0) + +## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19 + +### Fixed + +- [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2) + +### Commits + +- [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18) + +## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13 + +### Commits + +- [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb) +- [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36) +- [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335) +- [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea) + +## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12 + +### Commits + +- [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e) +- [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0) + +## v1.0.0 - 2023-10-12 + +### Commits + +- Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f) +- Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722) +- npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8) +- Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da) diff --git a/live2d/node_modules/set-function-length/LICENSE b/live2d/node_modules/set-function-length/LICENSE new file mode 100644 index 0000000..0314929 --- /dev/null +++ b/live2d/node_modules/set-function-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and 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. diff --git a/live2d/node_modules/set-function-length/README.md b/live2d/node_modules/set-function-length/README.md new file mode 100644 index 0000000..15e3ac4 --- /dev/null +++ b/live2d/node_modules/set-function-length/README.md @@ -0,0 +1,56 @@ +# set-function-length [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Set a function’s length. + +Arguments: + - `fn`: the function + - `length`: the new length. Must be an integer between 0 and 2**32. + - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false. + +Returns `fn`. + +## Usage + +```javascript +var setFunctionLength = require('set-function-length'); +var assert = require('assert'); + +function zero() {} +function one(_) {} +function two(_, __) {} + +assert.equal(zero.length, 0); +assert.equal(one.length, 1); +assert.equal(two.length, 2); + +assert.equal(setFunctionLength(zero, 10), zero); +assert.equal(setFunctionLength(one, 11), one); +assert.equal(setFunctionLength(two, 12), two); + +assert.equal(zero.length, 10); +assert.equal(one.length, 11); +assert.equal(two.length, 12); +``` + +[package-url]: https://npmjs.org/package/set-function-length +[npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg +[deps-svg]: https://david-dm.org/ljharb/set-function-length.svg +[deps-url]: https://david-dm.org/ljharb/set-function-length +[dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-function-length.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-function-length +[codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length +[actions-url]: https://github.com/ljharb/set-function-length/actions diff --git a/live2d/node_modules/set-function-length/env.d.ts b/live2d/node_modules/set-function-length/env.d.ts new file mode 100644 index 0000000..970ea53 --- /dev/null +++ b/live2d/node_modules/set-function-length/env.d.ts @@ -0,0 +1,9 @@ +declare const env: { + __proto__: null, + boundFnsHaveConfigurableLengths: boolean; + boundFnsHaveWritableLengths: boolean; + functionsHaveConfigurableLengths: boolean; + functionsHaveWritableLengths: boolean; +}; + +export = env; \ No newline at end of file diff --git a/live2d/node_modules/set-function-length/env.js b/live2d/node_modules/set-function-length/env.js new file mode 100644 index 0000000..d9b0a29 --- /dev/null +++ b/live2d/node_modules/set-function-length/env.js @@ -0,0 +1,25 @@ +'use strict'; + +var gOPD = require('gopd'); +var bind = require('function-bind'); + +var unbound = gOPD && gOPD(function () {}, 'length'); +// @ts-expect-error ts(2555) TS is overly strict with .call +var bound = gOPD && gOPD(bind.call(function () {}), 'length'); + +var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable); + +var functionsHaveWritableLengths = !!(unbound && unbound.writable); + +var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable); + +var boundFnsHaveWritableLengths = !!(bound && bound.writable); + +/** @type {import('./env')} */ +module.exports = { + __proto__: null, + boundFnsHaveConfigurableLengths: boundFnsHaveConfigurableLengths, + boundFnsHaveWritableLengths: boundFnsHaveWritableLengths, + functionsHaveConfigurableLengths: functionsHaveConfigurableLengths, + functionsHaveWritableLengths: functionsHaveWritableLengths +}; diff --git a/live2d/node_modules/set-function-length/index.d.ts b/live2d/node_modules/set-function-length/index.d.ts new file mode 100644 index 0000000..0451ecd --- /dev/null +++ b/live2d/node_modules/set-function-length/index.d.ts @@ -0,0 +1,7 @@ +declare namespace setFunctionLength { + type Func = (...args: unknown[]) => unknown; +} + +declare function setFunctionLength(fn: T, length: number, loose?: boolean): T; + +export = setFunctionLength; \ No newline at end of file diff --git a/live2d/node_modules/set-function-length/index.js b/live2d/node_modules/set-function-length/index.js new file mode 100644 index 0000000..14ce74d --- /dev/null +++ b/live2d/node_modules/set-function-length/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); + +var $TypeError = require('es-errors/type'); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; diff --git a/live2d/node_modules/set-function-length/package.json b/live2d/node_modules/set-function-length/package.json new file mode 100644 index 0000000..f6b8881 --- /dev/null +++ b/live2d/node_modules/set-function-length/package.json @@ -0,0 +1,102 @@ +{ + "name": "set-function-length", + "version": "1.2.2", + "description": "Set a function's length property", + "main": "index.js", + "exports": { + ".": "./index.js", + "./env": "./env.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "directories": { + "test": "test" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-function-length.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "set", + "function", + "length", + "function.length" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-function-length/issues" + }, + "homepage": "https://github.com/ljharb/set-function-length#readme", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.1.1", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.7", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/live2d/node_modules/set-function-length/tsconfig.json b/live2d/node_modules/set-function-length/tsconfig.json new file mode 100644 index 0000000..d9a6668 --- /dev/null +++ b/live2d/node_modules/set-function-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/live2d/node_modules/side-channel/.editorconfig b/live2d/node_modules/side-channel/.editorconfig new file mode 100644 index 0000000..72e0eba --- /dev/null +++ b/live2d/node_modules/side-channel/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/live2d/node_modules/side-channel/.eslintrc b/live2d/node_modules/side-channel/.eslintrc new file mode 100644 index 0000000..93978e7 --- /dev/null +++ b/live2d/node_modules/side-channel/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-lines-per-function": 0, + "multiline-comment-style": 1, + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + }, +} diff --git a/live2d/node_modules/side-channel/.github/FUNDING.yml b/live2d/node_modules/side-channel/.github/FUNDING.yml new file mode 100644 index 0000000..2a94840 --- /dev/null +++ b/live2d/node_modules/side-channel/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/side-channel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/live2d/node_modules/side-channel/.nycrc b/live2d/node_modules/side-channel/.nycrc new file mode 100644 index 0000000..1826526 --- /dev/null +++ b/live2d/node_modules/side-channel/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/side-channel/CHANGELOG.md b/live2d/node_modules/side-channel/CHANGELOG.md new file mode 100644 index 0000000..25369c5 --- /dev/null +++ b/live2d/node_modules/side-channel/CHANGELOG.md @@ -0,0 +1,95 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29 + +### Commits + +- add types [`9beef66`](https://github.com/ljharb/side-channel/commit/9beef6643e6d717ea57bedabf86448123a7dd9e9) +- [meta] simplify `exports` [`4334cf9`](https://github.com/ljharb/side-channel/commit/4334cf9df654151504c383b62a2f9ebdc8d9d5ac) +- [Deps] update `call-bind` [`d6043c4`](https://github.com/ljharb/side-channel/commit/d6043c4d8f4d7be9037dd0f0419c7a2e0e39ec6a) +- [Dev Deps] update `tape` [`6aca376`](https://github.com/ljharb/side-channel/commit/6aca3761868dc8cd5ff7fd9799bf6b95e09a6eb0) + +## [v1.0.5](https://github.com/ljharb/side-channel/compare/v1.0.4...v1.0.5) - 2024-02-06 + +### Commits + +- [actions] reuse common workflows [`3d2e1ff`](https://github.com/ljharb/side-channel/commit/3d2e1ffd16dd6eaaf3e40ff57951f840d2d63c04) +- [meta] use `npmignore` to autogenerate an npmignore file [`04296ea`](https://github.com/ljharb/side-channel/commit/04296ea17d1544b0a5d20fd5bfb31aa4f6513eb9) +- [meta] add `.editorconfig`; add `eclint` [`130f0a6`](https://github.com/ljharb/side-channel/commit/130f0a6adbc04d385c7456a601d38344dce3d6a9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`d480c2f`](https://github.com/ljharb/side-channel/commit/d480c2fbe757489ae9b4275491ffbcc3ac4725e9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ecbe70e`](https://github.com/ljharb/side-channel/commit/ecbe70e53a418234081a77971fec1fdfae20c841) +- [actions] update rebase action [`75240b9`](https://github.com/ljharb/side-channel/commit/75240b9963b816e8846400d2287cb68f88c7fba7) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`ae8d281`](https://github.com/ljharb/side-channel/commit/ae8d281572430099109870fd9430d2ca3f320b8d) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`7125b88`](https://github.com/ljharb/side-channel/commit/7125b885fd0eacad4fee9b073b72d14065ece278) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`82577c9`](https://github.com/ljharb/side-channel/commit/82577c9796304519139a570f82a317211b5f3b86) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`550aadf`](https://github.com/ljharb/side-channel/commit/550aadf20475a6081fd70304cc54f77259a5c8a8) +- [Tests] increase coverage [`5130877`](https://github.com/ljharb/side-channel/commit/5130877a7b27c862e64e6d1c12a178b28808859d) +- [Deps] update `get-intrinsic`, `object-inspect` [`ba0194c`](https://github.com/ljharb/side-channel/commit/ba0194c505b1a8a0427be14cadd5b8a46d4d01b8) +- [meta] add missing `engines.node` [`985fd24`](https://github.com/ljharb/side-channel/commit/985fd249663cb06617a693a94fe08cad12f5cb70) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`40227a8`](https://github.com/ljharb/side-channel/commit/40227a87b01709ad2c0eebf87eb4223a800099b9) +- [Deps] update `get-intrinsic` [`a989b40`](https://github.com/ljharb/side-channel/commit/a989b4024958737ae7be9fbffdeff2078f33a0fd) +- [Deps] update `object-inspect` [`aec42d2`](https://github.com/ljharb/side-channel/commit/aec42d2ec541a31aaa02475692c87d489237d9a3) + +## [v1.0.4](https://github.com/ljharb/side-channel/compare/v1.0.3...v1.0.4) - 2020-12-29 + +### Commits + +- [Tests] migrate tests to Github Actions [`10909cb`](https://github.com/ljharb/side-channel/commit/10909cbf8ce9c0bf96f604cf13d7ffd5a22c2d40) +- [Refactor] Use a linked list rather than an array, and move accessed nodes to the beginning [`195613f`](https://github.com/ljharb/side-channel/commit/195613f28b5c1e6072ef0b61b5beebaf2b6a304e) +- [meta] do not publish github action workflow files [`290ec29`](https://github.com/ljharb/side-channel/commit/290ec29cd21a60585145b4a7237ec55228c52c27) +- [Tests] run `nyc` on all tests; use `tape` runner [`ea6d030`](https://github.com/ljharb/side-channel/commit/ea6d030ff3fe6be2eca39e859d644c51ecd88869) +- [actions] add "Allow Edits" workflow [`d464d8f`](https://github.com/ljharb/side-channel/commit/d464d8fe52b5eddf1504a0ed97f0941a90f32c15) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`02daca8`](https://github.com/ljharb/side-channel/commit/02daca87c6809821c97be468d1afa2f5ef447383) +- [Refactor] use `call-bind` and `get-intrinsic` instead of `es-abstract` [`e09d481`](https://github.com/ljharb/side-channel/commit/e09d481528452ebafa5cdeae1af665c35aa2deee) +- [Deps] update `object.assign` [`ee83aa8`](https://github.com/ljharb/side-channel/commit/ee83aa81df313b5e46319a63adb05cf0c179079a) +- [actions] update rebase action to use checkout v2 [`7726b0b`](https://github.com/ljharb/side-channel/commit/7726b0b058b632fccea709f58960871defaaa9d7) + +## [v1.0.3](https://github.com/ljharb/side-channel/compare/v1.0.2...v1.0.3) - 2020-08-23 + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`1f10561`](https://github.com/ljharb/side-channel/commit/1f105611ef3acf32dec8032ae5c0baa5e56bb868) +- [Deps] update `es-abstract`, `object-inspect` [`bc20159`](https://github.com/ljharb/side-channel/commit/bc201597949a505e37cef9eaf24c7010831e6f03) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`b9b2b22`](https://github.com/ljharb/side-channel/commit/b9b2b225f9e0ea72a6ec2b89348f0bd690bc9ed1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7055ab4`](https://github.com/ljharb/side-channel/commit/7055ab4de0860606efd2003674a74f1fe6ebc07e) +- [Dev Deps] update `auto-changelog`; add `aud` [`d278c37`](https://github.com/ljharb/side-channel/commit/d278c37d08227be4f84aa769fcd919e73feeba40) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`3bcf982`](https://github.com/ljharb/side-channel/commit/3bcf982faa122745b39c33ce83d32fdf003741c6) +- [Tests] only audit prod deps [`18d01c4`](https://github.com/ljharb/side-channel/commit/18d01c4015b82a3d75044c4d5ba7917b2eac01ec) +- [Deps] update `es-abstract` [`6ab096d`](https://github.com/ljharb/side-channel/commit/6ab096d9de2b482cf5e0717e34e212f5b2b9bc9a) +- [Dev Deps] update `tape` [`9dc174c`](https://github.com/ljharb/side-channel/commit/9dc174cc651dfd300b4b72da936a0a7eda5f9452) +- [Deps] update `es-abstract` [`431d0f0`](https://github.com/ljharb/side-channel/commit/431d0f0ff11fbd2ae6f3115582a356d3a1cfce82) +- [Deps] update `es-abstract` [`49869fd`](https://github.com/ljharb/side-channel/commit/49869fd323bf4453f0ba515c0fb265cf5ab7b932) +- [meta] Add package.json to package's exports [`77d9cdc`](https://github.com/ljharb/side-channel/commit/77d9cdceb2a9e47700074f2ae0c0a202e7dac0d4) + +## [v1.0.2](https://github.com/ljharb/side-channel/compare/v1.0.1...v1.0.2) - 2019-12-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`4a526df`](https://github.com/ljharb/side-channel/commit/4a526df44e4701566ed001ec78546193f818b082) +- [Deps] update `es-abstract` [`d4f6e62`](https://github.com/ljharb/side-channel/commit/d4f6e629b6fb93a07415db7f30d3c90fd7f264fe) + +## [v1.0.1](https://github.com/ljharb/side-channel/compare/v1.0.0...v1.0.1) - 2019-12-01 + +### Commits + +- [Fix] add missing "exports" [`d212907`](https://github.com/ljharb/side-channel/commit/d2129073abf0701a5343bf28aa2145617604dc2e) + +## v1.0.0 - 2019-12-01 + +### Commits + +- Initial implementation [`dbebd3a`](https://github.com/ljharb/side-channel/commit/dbebd3a4b5ed64242f9a6810efe7c4214cd8cde4) +- Initial tests [`73bdefe`](https://github.com/ljharb/side-channel/commit/73bdefe568c9076cf8c0b8719bc2141aec0e19b8) +- Initial commit [`43c03e1`](https://github.com/ljharb/side-channel/commit/43c03e1c2849ec50a87b7a5cd76238a62b0b8770) +- npm init [`5c090a7`](https://github.com/ljharb/side-channel/commit/5c090a765d66a5527d9889b89aeff78dee91348c) +- [meta] add `auto-changelog` [`a5c4e56`](https://github.com/ljharb/side-channel/commit/a5c4e5675ec02d5eb4d84b4243aeea2a1d38fbec) +- [actions] add automatic rebasing / merge commit blocking [`bab1683`](https://github.com/ljharb/side-channel/commit/bab1683d8f9754b086e94397699fdc645e0d7077) +- [meta] add `funding` field; create FUNDING.yml [`63d7aea`](https://github.com/ljharb/side-channel/commit/63d7aeaf34f5650650ae97ca4b9fae685bd0937c) +- [Tests] add `npm run lint` [`46a5a81`](https://github.com/ljharb/side-channel/commit/46a5a81705cd2664f83df232c01dbbf2ee952885) +- Only apps should have lockfiles [`8b16b03`](https://github.com/ljharb/side-channel/commit/8b16b0305f00895d90c4e2e5773c854cfea0e448) +- [meta] add `safe-publish-latest` [`2f098ef`](https://github.com/ljharb/side-channel/commit/2f098ef092a39399cfe548b19a1fc03c2fd2f490) diff --git a/live2d/node_modules/side-channel/LICENSE b/live2d/node_modules/side-channel/LICENSE new file mode 100644 index 0000000..3900dd7 --- /dev/null +++ b/live2d/node_modules/side-channel/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +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. diff --git a/live2d/node_modules/side-channel/README.md b/live2d/node_modules/side-channel/README.md new file mode 100644 index 0000000..7fa4f06 --- /dev/null +++ b/live2d/node_modules/side-channel/README.md @@ -0,0 +1,2 @@ +# side-channel +Store information about any JS value in a side channel. Uses WeakMap if available. diff --git a/live2d/node_modules/side-channel/index.d.ts b/live2d/node_modules/side-channel/index.d.ts new file mode 100644 index 0000000..7cb112b --- /dev/null +++ b/live2d/node_modules/side-channel/index.d.ts @@ -0,0 +1,27 @@ +declare namespace getSideChannel { + type Key = unknown; + type ListNode = { + key: Key; + next: ListNode; + value: T; + }; + type RootNode = { + key: object; + next: null | ListNode; + }; + function listGetNode(list: RootNode, key: ListNode['key']): ListNode | void; + function listGet(objects: RootNode, key: ListNode['key']): T | void; + function listSet(objects: RootNode, key: ListNode['key'], value: T): void; + function listHas(objects: RootNode, key: ListNode['key']): boolean; + + type Channel = { + assert: (key: Key) => void; + has: (key: Key) => boolean; + get: (key: Key) => T; + set: (key: Key, value: T) => void; + } +} + +declare function getSideChannel(): getSideChannel.Channel; + +export = getSideChannel; diff --git a/live2d/node_modules/side-channel/index.js b/live2d/node_modules/side-channel/index.js new file mode 100644 index 0000000..6b6926e --- /dev/null +++ b/live2d/node_modules/side-channel/index.js @@ -0,0 +1,129 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); +var inspect = require('object-inspect'); + +var $TypeError = require('es-errors/type'); +var $WeakMap = GetIntrinsic('%WeakMap%', true); +var $Map = GetIntrinsic('%Map%', true); + +var $weakMapGet = callBound('WeakMap.prototype.get', true); +var $weakMapSet = callBound('WeakMap.prototype.set', true); +var $weakMapHas = callBound('WeakMap.prototype.has', true); +var $mapGet = callBound('Map.prototype.get', true); +var $mapSet = callBound('Map.prototype.set', true); +var $mapHas = callBound('Map.prototype.has', true); + +/* +* This function traverses the list returning the node corresponding to the given key. +* +* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly. +*/ +/** @type {import('.').listGetNode} */ +var listGetNode = function (list, key) { // eslint-disable-line consistent-return + /** @type {typeof list | NonNullable<(typeof list)['next']>} */ + var prev = list; + /** @type {(typeof list)['next']} */ + var curr; + for (; (curr = prev.next) !== null; prev = curr) { + if (curr.key === key) { + prev.next = curr.next; + // eslint-disable-next-line no-extra-parens + curr.next = /** @type {NonNullable} */ (list.next); + list.next = curr; // eslint-disable-line no-param-reassign + return curr; + } + } +}; + +/** @type {import('.').listGet} */ +var listGet = function (objects, key) { + var node = listGetNode(objects, key); + return node && node.value; +}; +/** @type {import('.').listSet} */ +var listSet = function (objects, key, value) { + var node = listGetNode(objects, key); + if (node) { + node.value = value; + } else { + // Prepend the new node to the beginning of the list + objects.next = /** @type {import('.').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens + key: key, + next: objects.next, + value: value + }); + } +}; +/** @type {import('.').listHas} */ +var listHas = function (objects, key) { + return !!listGetNode(objects, key); +}; + +/** @type {import('.')} */ +module.exports = function getSideChannel() { + /** @type {WeakMap} */ var $wm; + /** @type {Map} */ var $m; + /** @type {import('.').RootNode} */ var $o; + + /** @type {import('.').Channel} */ + var channel = { + assert: function (key) { + if (!channel.has(key)) { + throw new $TypeError('Side channel does not contain ' + inspect(key)); + } + }, + get: function (key) { // eslint-disable-line consistent-return + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapGet($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapGet($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listGet($o, key); + } + } + }, + has: function (key) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if ($wm) { + return $weakMapHas($wm, key); + } + } else if ($Map) { + if ($m) { + return $mapHas($m, key); + } + } else { + if ($o) { // eslint-disable-line no-lonely-if + return listHas($o, key); + } + } + return false; + }, + set: function (key, value) { + if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { + if (!$wm) { + $wm = new $WeakMap(); + } + $weakMapSet($wm, key, value); + } else if ($Map) { + if (!$m) { + $m = new $Map(); + } + $mapSet($m, key, value); + } else { + if (!$o) { + // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head + $o = { key: {}, next: null }; + } + listSet($o, key, value); + } + } + }; + return channel; +}; diff --git a/live2d/node_modules/side-channel/package.json b/live2d/node_modules/side-channel/package.json new file mode 100644 index 0000000..02cffca --- /dev/null +++ b/live2d/node_modules/side-channel/package.json @@ -0,0 +1,84 @@ +{ + "name": "side-channel", + "version": "1.0.6", + "description": "Store information about any JS value in a side channel. Uses WeakMap if available.", + "main": "index.js", + "exports": { + "./package.json": "./package.json", + ".": "./index.js" + }, + "types": "./index.d.ts", + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/side-channel.git" + }, + "keywords": [ + "weakmap", + "map", + "side", + "channel", + "metadata" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/side-channel/issues" + }, + "homepage": "https://github.com/ljharb/side-channel#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.2", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/live2d/node_modules/side-channel/test/index.js b/live2d/node_modules/side-channel/test/index.js new file mode 100644 index 0000000..8da3200 --- /dev/null +++ b/live2d/node_modules/side-channel/test/index.js @@ -0,0 +1,83 @@ +'use strict'; + +var test = require('tape'); + +var getSideChannel = require('../'); + +test('export', function (t) { + t.equal(typeof getSideChannel, 'function', 'is a function'); + t.equal(getSideChannel.length, 0, 'takes no arguments'); + + var channel = getSideChannel(); + t.ok(channel, 'is truthy'); + t.equal(typeof channel, 'object', 'is an object'); + + t.end(); +}); + +test('assert', function (t) { + var channel = getSideChannel(); + t['throws']( + function () { channel.assert({}); }, + TypeError, + 'nonexistent value throws' + ); + + var o = {}; + channel.set(o, 'data'); + t.doesNotThrow(function () { channel.assert(o); }, 'existent value noops'); + + t.end(); +}); + +test('has', function (t) { + var channel = getSideChannel(); + /** @type {unknown[]} */ var o = []; + + t.equal(channel.has(o), false, 'nonexistent value yields false'); + + channel.set(o, 'foo'); + t.equal(channel.has(o), true, 'existent value yields true'); + + t.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + t.equal(channel.has('abc'), true, 'non object value that exists yields true'); + + t.end(); +}); + +test('get', function (t) { + var channel = getSideChannel(); + var o = {}; + t.equal(channel.get(o), undefined, 'nonexistent value yields undefined'); + + var data = {}; + channel.set(o, data); + t.equal(channel.get(o), data, '"get" yields data set by "set"'); + + t.end(); +}); + +test('set', function (t) { + var channel = getSideChannel(); + var o = function () {}; + t.equal(channel.get(o), undefined, 'value not set'); + + channel.set(o, 42); + t.equal(channel.get(o), 42, 'value was set'); + + channel.set(o, Infinity); + t.equal(channel.get(o), Infinity, 'value was set again'); + + var o2 = {}; + channel.set(o2, 17); + t.equal(channel.get(o), Infinity, 'o is not modified'); + t.equal(channel.get(o2), 17, 'o2 is set'); + + channel.set(o, 14); + t.equal(channel.get(o), 14, 'o is modified'); + t.equal(channel.get(o2), 17, 'o2 is not modified'); + + t.end(); +}); diff --git a/live2d/node_modules/side-channel/tsconfig.json b/live2d/node_modules/side-channel/tsconfig.json new file mode 100644 index 0000000..fdfa155 --- /dev/null +++ b/live2d/node_modules/side-channel/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/live2d/node_modules/strip-outer/index.js b/live2d/node_modules/strip-outer/index.js new file mode 100644 index 0000000..497186a --- /dev/null +++ b/live2d/node_modules/strip-outer/index.js @@ -0,0 +1,11 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); + +module.exports = function (str, sub) { + if (typeof str !== 'string' || typeof sub !== 'string') { + throw new TypeError(); + } + + sub = escapeStringRegexp(sub); + return str.replace(new RegExp('^' + sub + '|' + sub + '$', 'g'), ''); +}; diff --git a/live2d/node_modules/strip-outer/license b/live2d/node_modules/strip-outer/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/strip-outer/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/strip-outer/package.json b/live2d/node_modules/strip-outer/package.json new file mode 100644 index 0000000..f98d046 --- /dev/null +++ b/live2d/node_modules/strip-outer/package.json @@ -0,0 +1,44 @@ +{ + "name": "strip-outer", + "version": "1.0.1", + "description": "Strip a substring from the start/end of a string", + "license": "MIT", + "repository": "sindresorhus/strip-outer", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "outer", + "str", + "string", + "substring", + "start", + "end", + "wrap", + "leading", + "trailing", + "regex", + "regexp" + ], + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/live2d/node_modules/strip-outer/readme.md b/live2d/node_modules/strip-outer/readme.md new file mode 100644 index 0000000..4f4bee2 --- /dev/null +++ b/live2d/node_modules/strip-outer/readme.md @@ -0,0 +1,28 @@ +# strip-outer [![Build Status](https://travis-ci.org/sindresorhus/strip-outer.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-outer) + +> Strip a substring from the start/end of a string + + +## Install + +``` +$ npm install --save strip-outer +``` + + +## Usage + +```js +const stripOuter = require('strip-outer'); + +stripOuter('foobarfoo', 'foo'); +//=> 'bar' + +stripOuter('unicorncake', 'unicorn'); +//=> 'cake' +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/live2d/node_modules/trim-repeated/index.js b/live2d/node_modules/trim-repeated/index.js new file mode 100644 index 0000000..cb67a69 --- /dev/null +++ b/live2d/node_modules/trim-repeated/index.js @@ -0,0 +1,10 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); + +module.exports = function (str, target) { + if (typeof str !== 'string' || typeof target !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(new RegExp('(?:' + escapeStringRegexp(target) + '){2,}', 'g'), target); +}; diff --git a/live2d/node_modules/trim-repeated/license b/live2d/node_modules/trim-repeated/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/live2d/node_modules/trim-repeated/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/live2d/node_modules/trim-repeated/package.json b/live2d/node_modules/trim-repeated/package.json new file mode 100644 index 0000000..0526c06 --- /dev/null +++ b/live2d/node_modules/trim-repeated/package.json @@ -0,0 +1,41 @@ +{ + "name": "trim-repeated", + "version": "1.0.0", + "description": "Trim a consecutively repeated substring: foo--bar---baz → foo-bar-baz", + "license": "MIT", + "repository": "sindresorhus/trim-repeated", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "condense", + "collapse", + "compact", + "consecutive", + "repeated", + "string", + "str", + "trim", + "remove", + "strip", + "character", + "char" + ], + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "devDependencies": { + "ava": "0.0.4" + } +} diff --git a/live2d/node_modules/trim-repeated/readme.md b/live2d/node_modules/trim-repeated/readme.md new file mode 100644 index 0000000..7f5a7a7 --- /dev/null +++ b/live2d/node_modules/trim-repeated/readme.md @@ -0,0 +1,47 @@ +# trim-repeated [![Build Status](https://travis-ci.org/sindresorhus/trim-repeated.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-repeated) + +> Trim a consecutively repeated substring: `foo--bar---baz` → `foo-bar-baz` + + +## Install + +``` +$ npm install --save trim-repeated +``` + + +## Usage + +```js +var trimRepeated = require('trim-repeated'); + +trimRepeated('foo--bar---baz', '-'); +//=> 'foo-bar-baz' + +trimRepeated('foo@#@#baz', '@#'); +//=> 'foo@#baz' +``` + +### trimRepeated(input, target) + +#### input + +*Required* +Type: `string` + +#### target + +*Required* +Type: `string` + +Substring to trim. + + +## Related + +- [`condense-whitespace`](https://github.com/sindresorhus/condense-whitespace) - Remove leading, trailing and repeated whitespace from a string + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/live2d/node_modules/universalify/LICENSE b/live2d/node_modules/universalify/LICENSE new file mode 100644 index 0000000..514e84e --- /dev/null +++ b/live2d/node_modules/universalify/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2017, Ryan Zimmerman + +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. diff --git a/live2d/node_modules/universalify/README.md b/live2d/node_modules/universalify/README.md new file mode 100644 index 0000000..487067b --- /dev/null +++ b/live2d/node_modules/universalify/README.md @@ -0,0 +1,76 @@ +# universalify + +[![Travis branch](https://img.shields.io/travis/RyanZim/universalify/master.svg)](https://travis-ci.org/RyanZim/universalify) +![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/universalify/master.svg) +![npm](https://img.shields.io/npm/dm/universalify.svg) +![npm](https://img.shields.io/npm/l/universalify.svg) + +Make a callback- or promise-based function support both promises and callbacks. + +Uses the native promise implementation. + +## Installation + +```bash +npm install universalify +``` + +## API + +### `universalify.fromCallback(fn)` + +Takes a callback-based function to universalify, and returns the universalified function. + +Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with more than three arguments, and does not ensure that the callback is only called once. + +```js +function callbackFn (n, cb) { + setTimeout(() => cb(null, n), 15) +} + +const fn = universalify.fromCallback(callbackFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +### `universalify.fromPromise(fn)` + +Takes a promise-based function to universalify, and returns the universalified function. + +Function must return a valid JS promise. `universalify` does not ensure that a valid promise is returned. + +```js +function promiseFn (n) { + return new Promise(resolve => { + setTimeout(() => resolve(n), 15) + }) +} + +const fn = universalify.fromPromise(promiseFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +## License + +MIT diff --git a/live2d/node_modules/universalify/index.js b/live2d/node_modules/universalify/index.js new file mode 100644 index 0000000..0c9ba39 --- /dev/null +++ b/live2d/node_modules/universalify/index.js @@ -0,0 +1,25 @@ +'use strict' + +exports.fromCallback = function (fn) { + return Object.defineProperty(function () { + if (typeof arguments[arguments.length - 1] === 'function') fn.apply(this, arguments) + else { + return new Promise((resolve, reject) => { + arguments[arguments.length] = (err, res) => { + if (err) return reject(err) + resolve(res) + } + arguments.length++ + fn.apply(this, arguments) + }) + } + }, 'name', { value: fn.name }) +} + +exports.fromPromise = function (fn) { + return Object.defineProperty(function () { + const cb = arguments[arguments.length - 1] + if (typeof cb !== 'function') return fn.apply(this, arguments) + else fn.apply(this, arguments).then(r => cb(null, r), cb) + }, 'name', { value: fn.name }) +} diff --git a/live2d/node_modules/universalify/package.json b/live2d/node_modules/universalify/package.json new file mode 100644 index 0000000..321b192 --- /dev/null +++ b/live2d/node_modules/universalify/package.json @@ -0,0 +1,34 @@ +{ + "name": "universalify", + "version": "0.1.2", + "description": "Make a callback- or promise-based function support both promises and callbacks.", + "keywords": [ + "callback", + "native", + "promise" + ], + "homepage": "https://github.com/RyanZim/universalify#readme", + "bugs": "https://github.com/RyanZim/universalify/issues", + "license": "MIT", + "author": "Ryan Zimmerman ", + "files": [ + "index.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/RyanZim/universalify.git" + }, + "scripts": { + "test": "standard && nyc tape test/*.js | colortape" + }, + "devDependencies": { + "colortape": "^0.1.2", + "coveralls": "^3.0.1", + "nyc": "^10.2.0", + "standard": "^10.0.1", + "tape": "^4.6.3" + }, + "engines": { + "node": ">= 4.0.0" + } +} diff --git a/live2d/node_modules/url/.eslintignore b/live2d/node_modules/url/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/live2d/node_modules/url/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/live2d/node_modules/url/.eslintrc b/live2d/node_modules/url/.eslintrc new file mode 100644 index 0000000..a6acd57 --- /dev/null +++ b/live2d/node_modules/url/.eslintrc @@ -0,0 +1,38 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "eqeqeq": [2, "allow-null"], + "func-style": 0, + "id-length": 0, + "indent": [2, 2], + "max-depth": 0, + "max-lines": 0, + "max-lines-per-function": 0, + "max-statements": 0, + "max-statements-per-line": [2, { "max": 3 }], + "no-continue": 1, + "no-empty": 1, + "no-magic-numbers": 0, + "no-mixed-operators": 1, + "max-nested-callbacks": 0, + "no-param-reassign": 1, + "no-plusplus": 0, + "no-redeclare": 1, + "no-restricted-syntax": 1, + "no-script-url": 1, + "sort-keys": 0, + }, + + "overrides": [ + { + "files": "test/**/*", + "rules": { + "no-sequences": 1, + }, + }, + ], +} diff --git a/live2d/node_modules/url/.nycrc b/live2d/node_modules/url/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/live2d/node_modules/url/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/live2d/node_modules/url/LICENSE b/live2d/node_modules/url/LICENSE new file mode 100644 index 0000000..158af9f --- /dev/null +++ b/live2d/node_modules/url/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2014 Joyent, Inc. and other Node 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. diff --git a/live2d/node_modules/url/README.md b/live2d/node_modules/url/README.md new file mode 100644 index 0000000..8b35460 --- /dev/null +++ b/live2d/node_modules/url/README.md @@ -0,0 +1,108 @@ +# node-url + +[![Build Status](https://travis-ci.org/defunctzombie/node-url.svg?branch=master)](https://travis-ci.org/defunctzombie/node-url) + +This module has utilities for URL resolution and parsing meant to have feature parity with node.js core [url](http://nodejs.org/api/url.html) module. + +```js +var url = require('url'); +``` + +## api + +Parsed URL objects have some or all of the following fields, depending on +whether or not they exist in the URL string. Any parts that are not in the URL +string will not be in the parsed object. Examples are shown for the URL + +`'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'` + +* `href`: The full URL that was originally parsed. Both the protocol and host are lowercased. + + Example: `'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'` + +* `protocol`: The request protocol, lowercased. + + Example: `'http:'` + +* `host`: The full lowercased host portion of the URL, including port + information. + + Example: `'host.com:8080'` + +* `auth`: The authentication information portion of a URL. + + Example: `'user:pass'` + +* `hostname`: Just the lowercased hostname portion of the host. + + Example: `'host.com'` + +* `port`: The port number portion of the host. + + Example: `'8080'` + +* `pathname`: The path section of the URL, that comes after the host and + before the query, including the initial slash if present. + + Example: `'/p/a/t/h'` + +* `search`: The 'query string' portion of the URL, including the leading + question mark. + + Example: `'?query=string'` + +* `path`: Concatenation of `pathname` and `search`. + + Example: `'/p/a/t/h?query=string'` + +* `query`: Either the 'params' portion of the query string, or a + querystring-parsed object. + + Example: `'query=string'` or `{'query':'string'}` + +* `hash`: The 'fragment' portion of the URL including the pound-sign. + + Example: `'#hash'` + +The following methods are provided by the URL module: + +### url.parse(urlStr, [parseQueryString], [slashesDenoteHost]) + +Take a URL string, and return an object. + +Pass `true` as the second argument to also parse +the query string using the `querystring` module. +Defaults to `false`. + +Pass `true` as the third argument to treat `//foo/bar` as +`{ host: 'foo', pathname: '/bar' }` rather than +`{ pathname: '//foo/bar' }`. Defaults to `false`. + +### url.format(urlObj) + +Take a parsed URL object, and return a formatted URL string. + +* `href` will be ignored. +* `protocol` is treated the same with or without the trailing `:` (colon). + * The protocols `http`, `https`, `ftp`, `gopher`, `file` will be + postfixed with `://` (colon-slash-slash). + * All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will + be postfixed with `:` (colon) +* `auth` will be used if present. +* `hostname` will only be used if `host` is absent. +* `port` will only be used if `host` is absent. +* `host` will be used in place of `hostname` and `port` +* `pathname` is treated the same with or without the leading `/` (slash) +* `search` will be used in place of `query` +* `query` (object; see `querystring`) will only be used if `search` is absent. +* `search` is treated the same with or without the leading `?` (question mark) +* `hash` is treated the same with or without the leading `#` (pound sign, anchor) + +### url.resolve(from, to) + +Take a base URL, and a href URL, and resolve them as a browser would for +an anchor tag. Examples: + + url.resolve('/one/two/three', 'four') // '/one/two/four' + url.resolve('http://example.com/', '/one') // 'http://example.com/one' + url.resolve('http://example.com/one', '/two') // 'http://example.com/two' diff --git a/live2d/node_modules/url/package.json b/live2d/node_modules/url/package.json new file mode 100644 index 0000000..bea0a11 --- /dev/null +++ b/live2d/node_modules/url/package.json @@ -0,0 +1,42 @@ +{ + "name": "url", + "description": "The core `url` packaged standalone for use with Browserify.", + "version": "0.11.4", + "author": "defunctzombie", + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "main": "./url.js", + "keywords": [ + "parsing", + "url", + "analyze" + ], + "devDependencies": { + "@ljharb/eslint-config": "^21.1.1", + "acorn": "^8.12.1", + "aud": "^2.0.4", + "eslint": "=8.8.0", + "mocha": "^3.5.3", + "nyc": "^10.3.2", + "zuul": "^3.12.0" + }, + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "nyc mocha", + "test": "npm run tests-only", + "posttest": "aud --production", + "zuul": "zuul -- test/index.js", + "test-local": "zuul --local -- test/index.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/defunctzombie/node-url.git" + }, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } +} diff --git a/live2d/node_modules/url/test/index.js b/live2d/node_modules/url/test/index.js new file mode 100644 index 0000000..74b67a7 --- /dev/null +++ b/live2d/node_modules/url/test/index.js @@ -0,0 +1,2080 @@ +'use strict'; + +/* + * Copyright Joyent, Inc. and other Node 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. + */ + +var test = require('mocha').test; +var assert = require('assert'); +var nodeURL = require('url'); + +var url = require('../url'); + +/* + * URLs to parse, and expected data + * { url : parsed } + */ +var parseTests = { + '//some_path': { + href: '//some_path', + pathname: '//some_path', + path: '//some_path' + }, + + 'http:\\\\evil-phisher\\foo.html#h\\a\\s\\h': { + protocol: 'http:', + slashes: true, + host: 'evil-phisher', + hostname: 'evil-phisher', + pathname: '/foo.html', + path: '/foo.html', + hash: '#h%5Ca%5Cs%5Ch', + href: 'http://evil-phisher/foo.html#h%5Ca%5Cs%5Ch' + }, + + 'http:\\\\evil-phisher\\foo.html?json="\\"foo\\""#h\\a\\s\\h': { + protocol: 'http:', + slashes: true, + host: 'evil-phisher', + hostname: 'evil-phisher', + pathname: '/foo.html', + search: '?json=%22%5C%22foo%5C%22%22', + query: 'json=%22%5C%22foo%5C%22%22', + path: '/foo.html?json=%22%5C%22foo%5C%22%22', + hash: '#h%5Ca%5Cs%5Ch', + href: 'http://evil-phisher/foo.html?json=%22%5C%22foo%5C%22%22#h%5Ca%5Cs%5Ch' + }, + + 'http:\\\\evil-phisher\\foo.html#h\\a\\s\\h?blarg': { + protocol: 'http:', + slashes: true, + host: 'evil-phisher', + hostname: 'evil-phisher', + pathname: '/foo.html', + path: '/foo.html', + hash: '#h%5Ca%5Cs%5Ch?blarg', + href: 'http://evil-phisher/foo.html#h%5Ca%5Cs%5Ch?blarg' + }, + + 'http:\\\\evil-phisher\\foo.html': { + protocol: 'http:', + slashes: true, + host: 'evil-phisher', + hostname: 'evil-phisher', + pathname: '/foo.html', + path: '/foo.html', + href: 'http://evil-phisher/foo.html' + }, + + 'HTTP://www.example.com/': { + href: 'http://www.example.com/', + protocol: 'http:', + slashes: true, + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'HTTP://www.example.com': { + href: 'http://www.example.com/', + protocol: 'http:', + slashes: true, + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://www.ExAmPlE.com/': { + href: 'http://www.example.com/', + protocol: 'http:', + slashes: true, + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://user:pw@www.ExAmPlE.com/': { + href: 'http://user:pw@www.example.com/', + protocol: 'http:', + slashes: true, + auth: 'user:pw', + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://USER:PW@www.ExAmPlE.com/': { + href: 'http://USER:PW@www.example.com/', + protocol: 'http:', + slashes: true, + auth: 'USER:PW', + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://user@www.example.com/': { + href: 'http://user@www.example.com/', + protocol: 'http:', + slashes: true, + auth: 'user', + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://user%3Apw@www.example.com/': { + href: 'http://user:pw@www.example.com/', + protocol: 'http:', + slashes: true, + auth: 'user:pw', + host: 'www.example.com', + hostname: 'www.example.com', + pathname: '/', + path: '/' + }, + + 'http://x.com/path?that\'s#all, folks': { + href: 'http://x.com/path?that%27s#all,%20folks', + protocol: 'http:', + slashes: true, + host: 'x.com', + hostname: 'x.com', + search: '?that%27s', + query: 'that%27s', + pathname: '/path', + hash: '#all,%20folks', + path: '/path?that%27s' + }, + + 'HTTP://X.COM/Y': { + href: 'http://x.com/Y', + protocol: 'http:', + slashes: true, + host: 'x.com', + hostname: 'x.com', + pathname: '/Y', + path: '/Y' + }, + + /* + * + not an invalid host character + * per https://url.spec.whatwg.org/#host-parsing + */ + 'http://x.y.com+a/b/c': { + href: 'http://x.y.com+a/b/c', + protocol: 'http:', + slashes: true, + host: 'x.y.com+a', + hostname: 'x.y.com+a', + pathname: '/b/c', + path: '/b/c' + }, + + // an unexpected invalid char in the hostname. + 'HtTp://x.y.cOm;a/b/c?d=e#f gi': { + href: 'http://x.y.com/;a/b/c?d=e#f%20g%3Ch%3Ei', + protocol: 'http:', + slashes: true, + host: 'x.y.com', + hostname: 'x.y.com', + pathname: ';a/b/c', + search: '?d=e', + query: 'd=e', + hash: '#f%20g%3Ch%3Ei', + path: ';a/b/c?d=e' + }, + + // make sure that we don't accidentally lcast the path parts. + 'HtTp://x.y.cOm;A/b/c?d=e#f gi': { + href: 'http://x.y.com/;A/b/c?d=e#f%20g%3Ch%3Ei', + protocol: 'http:', + slashes: true, + host: 'x.y.com', + hostname: 'x.y.com', + pathname: ';A/b/c', + search: '?d=e', + query: 'd=e', + hash: '#f%20g%3Ch%3Ei', + path: ';A/b/c?d=e' + }, + + 'http://x...y...#p': { + href: 'http://x...y.../#p', + protocol: 'http:', + slashes: true, + host: 'x...y...', + hostname: 'x...y...', + hash: '#p', + pathname: '/', + path: '/' + }, + + 'http://x/p/"quoted"': { + href: 'http://x/p/%22quoted%22', + protocol: 'http:', + slashes: true, + host: 'x', + hostname: 'x', + pathname: '/p/%22quoted%22', + path: '/p/%22quoted%22' + }, + + ' Is a URL!': { + href: '%3Chttp://goo.corn/bread%3E%20Is%20a%20URL!', + pathname: '%3Chttp://goo.corn/bread%3E%20Is%20a%20URL!', + path: '%3Chttp://goo.corn/bread%3E%20Is%20a%20URL!' + }, + + 'http://www.narwhaljs.org/blog/categories?id=news': { + href: 'http://www.narwhaljs.org/blog/categories?id=news', + protocol: 'http:', + slashes: true, + host: 'www.narwhaljs.org', + hostname: 'www.narwhaljs.org', + search: '?id=news', + query: 'id=news', + pathname: '/blog/categories', + path: '/blog/categories?id=news' + }, + + 'http://mt0.google.com/vt/lyrs=m@114&hl=en&src=api&x=2&y=2&z=3&s=': { + href: 'http://mt0.google.com/vt/lyrs=m@114&hl=en&src=api&x=2&y=2&z=3&s=', + protocol: 'http:', + slashes: true, + host: 'mt0.google.com', + hostname: 'mt0.google.com', + pathname: '/vt/lyrs=m@114&hl=en&src=api&x=2&y=2&z=3&s=', + path: '/vt/lyrs=m@114&hl=en&src=api&x=2&y=2&z=3&s=' + }, + + 'http://mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': { + href: 'http://mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=', + protocol: 'http:', + slashes: true, + host: 'mt0.google.com', + hostname: 'mt0.google.com', + search: '???&hl=en&src=api&x=2&y=2&z=3&s=', + query: '??&hl=en&src=api&x=2&y=2&z=3&s=', + pathname: '/vt/lyrs=m@114', + path: '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=' + }, + + 'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': { + href: 'http://user:pass@mt0.google.com/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=', + protocol: 'http:', + slashes: true, + host: 'mt0.google.com', + auth: 'user:pass', + hostname: 'mt0.google.com', + search: '???&hl=en&src=api&x=2&y=2&z=3&s=', + query: '??&hl=en&src=api&x=2&y=2&z=3&s=', + pathname: '/vt/lyrs=m@114', + path: '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=' + }, + + 'file:///etc/passwd': { + href: 'file:///etc/passwd', + slashes: true, + protocol: 'file:', + pathname: '/etc/passwd', + hostname: '', + host: '', + path: '/etc/passwd' + }, + + 'file://localhost/etc/passwd': { + href: 'file://localhost/etc/passwd', + protocol: 'file:', + slashes: true, + pathname: '/etc/passwd', + hostname: 'localhost', + host: 'localhost', + path: '/etc/passwd' + }, + + 'file://foo/etc/passwd': { + href: 'file://foo/etc/passwd', + protocol: 'file:', + slashes: true, + pathname: '/etc/passwd', + hostname: 'foo', + host: 'foo', + path: '/etc/passwd' + }, + + 'file:///etc/node/': { + href: 'file:///etc/node/', + slashes: true, + protocol: 'file:', + pathname: '/etc/node/', + hostname: '', + host: '', + path: '/etc/node/' + }, + + 'file://localhost/etc/node/': { + href: 'file://localhost/etc/node/', + protocol: 'file:', + slashes: true, + pathname: '/etc/node/', + hostname: 'localhost', + host: 'localhost', + path: '/etc/node/' + }, + + 'file://foo/etc/node/': { + href: 'file://foo/etc/node/', + protocol: 'file:', + slashes: true, + pathname: '/etc/node/', + hostname: 'foo', + host: 'foo', + path: '/etc/node/' + }, + + 'http:/baz/../foo/bar': { + href: 'http:/baz/../foo/bar', + protocol: 'http:', + pathname: '/baz/../foo/bar', + path: '/baz/../foo/bar' + }, + + 'http://user:pass@example.com:8000/foo/bar?baz=quux#frag': { + href: 'http://user:pass@example.com:8000/foo/bar?baz=quux#frag', + protocol: 'http:', + slashes: true, + host: 'example.com:8000', + auth: 'user:pass', + port: '8000', + hostname: 'example.com', + hash: '#frag', + search: '?baz=quux', + query: 'baz=quux', + pathname: '/foo/bar', + path: '/foo/bar?baz=quux' + }, + + '//user:pass@example.com:8000/foo/bar?baz=quux#frag': { + href: '//user:pass@example.com:8000/foo/bar?baz=quux#frag', + slashes: true, + host: 'example.com:8000', + auth: 'user:pass', + port: '8000', + hostname: 'example.com', + hash: '#frag', + search: '?baz=quux', + query: 'baz=quux', + pathname: '/foo/bar', + path: '/foo/bar?baz=quux' + }, + + '/foo/bar?baz=quux#frag': { + href: '/foo/bar?baz=quux#frag', + hash: '#frag', + search: '?baz=quux', + query: 'baz=quux', + pathname: '/foo/bar', + path: '/foo/bar?baz=quux' + }, + + 'http:/foo/bar?baz=quux#frag': { + href: 'http:/foo/bar?baz=quux#frag', + protocol: 'http:', + hash: '#frag', + search: '?baz=quux', + query: 'baz=quux', + pathname: '/foo/bar', + path: '/foo/bar?baz=quux' + }, + + 'mailto:foo@bar.com?subject=hello': { + href: 'mailto:foo@bar.com?subject=hello', + protocol: 'mailto:', + host: 'bar.com', + auth: 'foo', + hostname: 'bar.com', + search: '?subject=hello', + query: 'subject=hello', + path: '?subject=hello' + }, + + 'javascript:alert(\'hello\');': { + href: 'javascript:alert(\'hello\');', + protocol: 'javascript:', + pathname: 'alert(\'hello\');', + path: 'alert(\'hello\');' + }, + + 'xmpp:isaacschlueter@jabber.org': { + href: 'xmpp:isaacschlueter@jabber.org', + protocol: 'xmpp:', + host: 'jabber.org', + auth: 'isaacschlueter', + hostname: 'jabber.org' + }, + + 'http://atpass:foo%40bar@127.0.0.1:8080/path?search=foo#bar': { + href: 'http://atpass:foo%40bar@127.0.0.1:8080/path?search=foo#bar', + protocol: 'http:', + slashes: true, + host: '127.0.0.1:8080', + auth: 'atpass:foo@bar', + hostname: '127.0.0.1', + port: '8080', + pathname: '/path', + search: '?search=foo', + query: 'search=foo', + hash: '#bar', + path: '/path?search=foo' + }, + + 'svn+ssh://foo/bar': { + href: 'svn+ssh://foo/bar', + host: 'foo', + hostname: 'foo', + protocol: 'svn+ssh:', + pathname: '/bar', + path: '/bar', + slashes: true + }, + + 'dash-test://foo/bar': { + href: 'dash-test://foo/bar', + host: 'foo', + hostname: 'foo', + protocol: 'dash-test:', + pathname: '/bar', + path: '/bar', + slashes: true + }, + + 'dash-test:foo/bar': { + href: 'dash-test:foo/bar', + host: 'foo', + hostname: 'foo', + protocol: 'dash-test:', + pathname: '/bar', + path: '/bar' + }, + + 'dot.test://foo/bar': { + href: 'dot.test://foo/bar', + host: 'foo', + hostname: 'foo', + protocol: 'dot.test:', + pathname: '/bar', + path: '/bar', + slashes: true + }, + + 'dot.test:foo/bar': { + href: 'dot.test:foo/bar', + host: 'foo', + hostname: 'foo', + protocol: 'dot.test:', + pathname: '/bar', + path: '/bar' + }, + + // IDNA tests + 'http://www.日本語.com/': { + href: 'http://www.xn--wgv71a119e.com/', + protocol: 'http:', + slashes: true, + host: 'www.xn--wgv71a119e.com', + hostname: 'www.xn--wgv71a119e.com', + pathname: '/', + path: '/' + }, + + 'http://example.Bücher.com/': { + href: 'http://example.xn--bcher-kva.com/', + protocol: 'http:', + slashes: true, + host: 'example.xn--bcher-kva.com', + hostname: 'example.xn--bcher-kva.com', + pathname: '/', + path: '/' + }, + + 'http://www.Äffchen.com/': { + href: 'http://www.xn--ffchen-9ta.com/', + protocol: 'http:', + slashes: true, + host: 'www.xn--ffchen-9ta.com', + hostname: 'www.xn--ffchen-9ta.com', + pathname: '/', + path: '/' + }, + + 'http://www.Äffchen.cOm;A/b/c?d=e#f gi': { + href: 'http://www.xn--ffchen-9ta.com/;A/b/c?d=e#f%20g%3Ch%3Ei', + protocol: 'http:', + slashes: true, + host: 'www.xn--ffchen-9ta.com', + hostname: 'www.xn--ffchen-9ta.com', + pathname: ';A/b/c', + search: '?d=e', + query: 'd=e', + hash: '#f%20g%3Ch%3Ei', + path: ';A/b/c?d=e' + }, + + 'http://SÉLIER.COM/': { + href: 'http://xn--slier-bsa.com/', + protocol: 'http:', + slashes: true, + host: 'xn--slier-bsa.com', + hostname: 'xn--slier-bsa.com', + pathname: '/', + path: '/' + }, + + 'http://ليهمابتكلموشعربي؟.ي؟/': { + href: 'http://xn--egbpdaj6bu4bxfgehfvwxn.xn--egb9f/', + protocol: 'http:', + slashes: true, + host: 'xn--egbpdaj6bu4bxfgehfvwxn.xn--egb9f', + hostname: 'xn--egbpdaj6bu4bxfgehfvwxn.xn--egb9f', + pathname: '/', + path: '/' + }, + + 'http://➡.ws/➡': { + href: 'http://xn--hgi.ws/➡', + protocol: 'http:', + slashes: true, + host: 'xn--hgi.ws', + hostname: 'xn--hgi.ws', + pathname: '/➡', + path: '/➡' + }, + + 'http://bucket_name.s3.amazonaws.com/image.jpg': { + protocol: 'http:', + slashes: true, + host: 'bucket_name.s3.amazonaws.com', + hostname: 'bucket_name.s3.amazonaws.com', + pathname: '/image.jpg', + href: 'http://bucket_name.s3.amazonaws.com/image.jpg', + path: '/image.jpg' + }, + + 'git+http://github.com/joyent/node.git': { + protocol: 'git+http:', + slashes: true, + host: 'github.com', + hostname: 'github.com', + pathname: '/joyent/node.git', + path: '/joyent/node.git', + href: 'git+http://github.com/joyent/node.git' + }, + + /* + * if local1@domain1 is uses as a relative URL it may + * be parse into auth@hostname, but here there is no + * way to make it work in url.parse, I add the test to be explicit + */ + 'local1@domain1': { + pathname: 'local1@domain1', + path: 'local1@domain1', + href: 'local1@domain1' + }, + + /* + * While this may seem counter-intuitive, a browser will parse + * as a path. + */ + 'www.example.com': { + href: 'www.example.com', + pathname: 'www.example.com', + path: 'www.example.com' + }, + + // ipv6 support + '[fe80::1]': { + href: '[fe80::1]', + pathname: '[fe80::1]', + path: '[fe80::1]' + }, + + 'coap://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]': { + protocol: 'coap:', + slashes: true, + host: '[fedc:ba98:7654:3210:fedc:ba98:7654:3210]', + hostname: 'fedc:ba98:7654:3210:fedc:ba98:7654:3210', + href: 'coap://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/', + pathname: '/', + path: '/' + }, + + 'coap://[1080:0:0:0:8:800:200C:417A]:61616/': { + protocol: 'coap:', + slashes: true, + host: '[1080:0:0:0:8:800:200c:417a]:61616', + port: '61616', + hostname: '1080:0:0:0:8:800:200c:417a', + href: 'coap://[1080:0:0:0:8:800:200c:417a]:61616/', + pathname: '/', + path: '/' + }, + + 'http://user:password@[3ffe:2a00:100:7031::1]:8080': { + protocol: 'http:', + slashes: true, + auth: 'user:password', + host: '[3ffe:2a00:100:7031::1]:8080', + port: '8080', + hostname: '3ffe:2a00:100:7031::1', + href: 'http://user:password@[3ffe:2a00:100:7031::1]:8080/', + pathname: '/', + path: '/' + }, + + 'coap://u:p@[::192.9.5.5]:61616/.well-known/r?n=Temperature': { + protocol: 'coap:', + slashes: true, + auth: 'u:p', + host: '[::192.9.5.5]:61616', + port: '61616', + hostname: '::192.9.5.5', + href: 'coap://u:p@[::192.9.5.5]:61616/.well-known/r?n=Temperature', + search: '?n=Temperature', + query: 'n=Temperature', + pathname: '/.well-known/r', + path: '/.well-known/r?n=Temperature' + }, + + // empty port + 'http://example.com:': { + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + href: 'http://example.com/', + pathname: '/', + path: '/' + }, + + 'http://example.com:/a/b.html': { + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + href: 'http://example.com/a/b.html', + pathname: '/a/b.html', + path: '/a/b.html' + }, + + 'http://example.com:?a=b': { + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + href: 'http://example.com/?a=b', + search: '?a=b', + query: 'a=b', + pathname: '/', + path: '/?a=b' + }, + + 'http://example.com:#abc': { + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + href: 'http://example.com/#abc', + hash: '#abc', + pathname: '/', + path: '/' + }, + + 'http://[fe80::1]:/a/b?a=b#abc': { + protocol: 'http:', + slashes: true, + host: '[fe80::1]', + hostname: 'fe80::1', + href: 'http://[fe80::1]/a/b?a=b#abc', + search: '?a=b', + query: 'a=b', + hash: '#abc', + pathname: '/a/b', + path: '/a/b?a=b' + }, + + 'http://-lovemonsterz.tumblr.com/rss': { + protocol: 'http:', + slashes: true, + host: '-lovemonsterz.tumblr.com', + hostname: '-lovemonsterz.tumblr.com', + href: 'http://-lovemonsterz.tumblr.com/rss', + pathname: '/rss', + path: '/rss' + }, + + 'http://-lovemonsterz.tumblr.com:80/rss': { + protocol: 'http:', + slashes: true, + port: '80', + host: '-lovemonsterz.tumblr.com:80', + hostname: '-lovemonsterz.tumblr.com', + href: 'http://-lovemonsterz.tumblr.com:80/rss', + pathname: '/rss', + path: '/rss' + }, + + 'http://user:pass@-lovemonsterz.tumblr.com/rss': { + protocol: 'http:', + slashes: true, + auth: 'user:pass', + host: '-lovemonsterz.tumblr.com', + hostname: '-lovemonsterz.tumblr.com', + href: 'http://user:pass@-lovemonsterz.tumblr.com/rss', + pathname: '/rss', + path: '/rss' + }, + + 'http://user:pass@-lovemonsterz.tumblr.com:80/rss': { + protocol: 'http:', + slashes: true, + auth: 'user:pass', + port: '80', + host: '-lovemonsterz.tumblr.com:80', + hostname: '-lovemonsterz.tumblr.com', + href: 'http://user:pass@-lovemonsterz.tumblr.com:80/rss', + pathname: '/rss', + path: '/rss' + }, + + 'http://_jabber._tcp.google.com/test': { + protocol: 'http:', + slashes: true, + host: '_jabber._tcp.google.com', + hostname: '_jabber._tcp.google.com', + href: 'http://_jabber._tcp.google.com/test', + pathname: '/test', + path: '/test' + }, + + 'http://user:pass@_jabber._tcp.google.com/test': { + protocol: 'http:', + slashes: true, + auth: 'user:pass', + host: '_jabber._tcp.google.com', + hostname: '_jabber._tcp.google.com', + href: 'http://user:pass@_jabber._tcp.google.com/test', + pathname: '/test', + path: '/test' + }, + + 'http://_jabber._tcp.google.com:80/test': { + protocol: 'http:', + slashes: true, + port: '80', + host: '_jabber._tcp.google.com:80', + hostname: '_jabber._tcp.google.com', + href: 'http://_jabber._tcp.google.com:80/test', + pathname: '/test', + path: '/test' + }, + + 'http://user:pass@_jabber._tcp.google.com:80/test': { + protocol: 'http:', + slashes: true, + auth: 'user:pass', + port: '80', + host: '_jabber._tcp.google.com:80', + hostname: '_jabber._tcp.google.com', + href: 'http://user:pass@_jabber._tcp.google.com:80/test', + pathname: '/test', + path: '/test' + }, + + 'http://x:1/\' <>"`/{}|\\^~`/': { + protocol: 'http:', + slashes: true, + host: 'x:1', + port: '1', + hostname: 'x', + pathname: '/%27%20%3C%3E%22%60/%7B%7D%7C/%5E~%60/', + path: '/%27%20%3C%3E%22%60/%7B%7D%7C/%5E~%60/', + href: 'http://x:1/%27%20%3C%3E%22%60/%7B%7D%7C/%5E~%60/' + }, + + 'http://a@b@c/': { + protocol: 'http:', + slashes: true, + auth: 'a@b', + host: 'c', + hostname: 'c', + href: 'http://a%40b@c/', + path: '/', + pathname: '/' + }, + + 'http://a@b?@c': { + protocol: 'http:', + slashes: true, + auth: 'a', + host: 'b', + hostname: 'b', + href: 'http://a@b/?@c', + path: '/?@c', + pathname: '/', + search: '?@c', + query: '@c' + }, + + 'http://a\r" \t\n<\'b:b@c\r\nd/e?f': { + protocol: 'http:', + slashes: true, + auth: 'a\r" \t\n<\'b:b', + host: 'c', + port: null, + hostname: 'c', + hash: null, + search: '?f', + query: 'f', + pathname: '%0D%0Ad/e', + path: '%0D%0Ad/e?f', + href: 'http://a%0D%22%20%09%0A%3C\'b:b@c/%0D%0Ad/e?f' + }, + + // git urls used by npm + 'git+ssh://git@github.com:npm/npm': { + protocol: 'git+ssh:', + slashes: true, + auth: 'git', + host: 'github.com', + port: null, + hostname: 'github.com', + hash: null, + search: null, + query: null, + pathname: '/:npm/npm', + path: '/:npm/npm', + href: 'git+ssh://git@github.com/:npm/npm' + } + +}; + +Object.keys(parseTests).forEach(function (u) { + test('parse(' + u + ')', function () { + var actual = url.parse(u); + var spaced = url.parse(' \t ' + u + '\n\t'); + var expected = parseTests[u]; + + Object.keys(actual).forEach(function (i) { + if (expected[i] === undefined && actual[i] === null) { + expected[i] = null; + } + }); + + assert.deepEqual(actual, expected); + assert.deepEqual(spaced, expected); + + var expected = parseTests[u].href, + actual = url.format(parseTests[u]); + + assert.equal(actual, expected, 'format(' + u + ') == ' + u + '\nactual:' + actual); + }); +}); + +var parseTestsWithQueryString = { + '/foo/bar?baz=quux#frag': { + href: '/foo/bar?baz=quux#frag', + hash: '#frag', + search: '?baz=quux', + query: { + baz: 'quux' + }, + pathname: '/foo/bar', + path: '/foo/bar?baz=quux' + }, + 'http://example.com': { + href: 'http://example.com/', + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + query: {}, + search: '', + pathname: '/', + path: '/' + }, + '/example': { + protocol: null, + slashes: null, + auth: null, + host: null, + port: null, + hostname: null, + hash: null, + search: '', + query: {}, + pathname: '/example', + path: '/example', + href: '/example' + }, + '/example?query=value': { + protocol: null, + slashes: null, + auth: null, + host: null, + port: null, + hostname: null, + hash: null, + search: '?query=value', + query: { query: 'value' }, + pathname: '/example', + path: '/example?query=value', + href: '/example?query=value' + } +}; + +Object.keys(parseTestsWithQueryString).forEach(function (u) { + test('parse(' + u + ')', function () { + var actual = url.parse(u, true); + var expected = parseTestsWithQueryString[u]; + for (var i in actual) { + if (actual[i] === null && expected[i] === undefined) { + expected[i] = null; + } + } + + assert.deepEqual(actual, expected); + }); +}); + +/* + * some extra formatting tests, just to verify + * that it'll format slightly wonky content to a valid url. + */ +var formatTests = { + 'http://example.com?': { + href: 'http://example.com/?', + protocol: 'http:', + slashes: true, + host: 'example.com', + hostname: 'example.com', + search: '?', + query: {}, + pathname: '/' + }, + 'http://example.com?foo=bar#frag': { + href: 'http://example.com/?foo=bar#frag', + protocol: 'http:', + host: 'example.com', + hostname: 'example.com', + hash: '#frag', + search: '?foo=bar', + query: 'foo=bar', + pathname: '/' + }, + 'http://example.com?foo=@bar#frag': { + href: 'http://example.com/?foo=@bar#frag', + protocol: 'http:', + host: 'example.com', + hostname: 'example.com', + hash: '#frag', + search: '?foo=@bar', + query: 'foo=@bar', + pathname: '/' + }, + 'http://example.com?foo=/bar/#frag': { + href: 'http://example.com/?foo=/bar/#frag', + protocol: 'http:', + host: 'example.com', + hostname: 'example.com', + hash: '#frag', + search: '?foo=/bar/', + query: 'foo=/bar/', + pathname: '/' + }, + 'http://example.com?foo=?bar/#frag': { + href: 'http://example.com/?foo=?bar/#frag', + protocol: 'http:', + host: 'example.com', + hostname: 'example.com', + hash: '#frag', + search: '?foo=?bar/', + query: 'foo=?bar/', + pathname: '/' + }, + 'http://example.com#frag=?bar/#frag': { + href: 'http://example.com/#frag=?bar/#frag', + protocol: 'http:', + host: 'example.com', + hostname: 'example.com', + hash: '#frag=?bar/#frag', + pathname: '/' + }, + 'http://google.com" onload="alert(42)/': { + href: 'http://google.com/%22%20onload=%22alert(42)/', + protocol: 'http:', + host: 'google.com', + pathname: '/%22%20onload=%22alert(42)/' + }, + 'http://a.com/a/b/c?s#h': { + href: 'http://a.com/a/b/c?s#h', + protocol: 'http', + host: 'a.com', + pathname: 'a/b/c', + hash: 'h', + search: 's' + }, + 'xmpp:isaacschlueter@jabber.org': { + href: 'xmpp:isaacschlueter@jabber.org', + protocol: 'xmpp:', + host: 'jabber.org', + auth: 'isaacschlueter', + hostname: 'jabber.org' + }, + 'http://atpass:foo%40bar@127.0.0.1/': { + href: 'http://atpass:foo%40bar@127.0.0.1/', + auth: 'atpass:foo@bar', + hostname: '127.0.0.1', + protocol: 'http:', + pathname: '/' + }, + 'http://atslash%2F%40:%2F%40@foo/': { + href: 'http://atslash%2F%40:%2F%40@foo/', + auth: 'atslash/@:/@', + hostname: 'foo', + protocol: 'http:', + pathname: '/' + }, + 'svn+ssh://foo/bar': { + href: 'svn+ssh://foo/bar', + hostname: 'foo', + protocol: 'svn+ssh:', + pathname: '/bar', + slashes: true + }, + 'dash-test://foo/bar': { + href: 'dash-test://foo/bar', + hostname: 'foo', + protocol: 'dash-test:', + pathname: '/bar', + slashes: true + }, + 'dash-test:foo/bar': { + href: 'dash-test:foo/bar', + hostname: 'foo', + protocol: 'dash-test:', + pathname: '/bar' + }, + 'dot.test://foo/bar': { + href: 'dot.test://foo/bar', + hostname: 'foo', + protocol: 'dot.test:', + pathname: '/bar', + slashes: true + }, + 'dot.test:foo/bar': { + href: 'dot.test:foo/bar', + hostname: 'foo', + protocol: 'dot.test:', + pathname: '/bar' + }, + // ipv6 support + 'coap:u:p@[::1]:61616/.well-known/r?n=Temperature': { + href: 'coap:u:p@[::1]:61616/.well-known/r?n=Temperature', + protocol: 'coap:', + auth: 'u:p', + hostname: '::1', + port: '61616', + pathname: '/.well-known/r', + search: 'n=Temperature' + }, + 'coap:[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:61616/s/stopButton': { + href: 'coap:[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:61616/s/stopButton', + protocol: 'coap', + host: '[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:61616', + pathname: '/s/stopButton' + }, + + /* + * encode context-specific delimiters in path and query, but do not touch + * other non-delimiter chars like `%`. + * + */ + + // `#`,`?` in path + '/path/to/%%23%3F+=&.txt?foo=theA1#bar': { + href: '/path/to/%%23%3F+=&.txt?foo=theA1#bar', + pathname: '/path/to/%#?+=&.txt', + query: { + foo: 'theA1' + }, + hash: '#bar' + }, + + // `#`,`?` in path + `#` in query + '/path/to/%%23%3F+=&.txt?foo=the%231#bar': { + href: '/path/to/%%23%3F+=&.txt?foo=the%231#bar', + pathname: '/path/to/%#?+=&.txt', + query: { + foo: 'the#1' + }, + hash: '#bar' + }, + + // `?` and `#` in path and search + 'http://ex.com/foo%3F100%m%23r?abc=the%231?&foo=bar#frag': { + href: 'http://ex.com/foo%3F100%m%23r?abc=the%231?&foo=bar#frag', + protocol: 'http:', + hostname: 'ex.com', + hash: '#frag', + search: '?abc=the#1?&foo=bar', + pathname: '/foo?100%m#r' + }, + + // `?` and `#` in search only + 'http://ex.com/fooA100%mBr?abc=the%231?&foo=bar#frag': { + href: 'http://ex.com/fooA100%mBr?abc=the%231?&foo=bar#frag', + protocol: 'http:', + hostname: 'ex.com', + hash: '#frag', + search: '?abc=the#1?&foo=bar', + pathname: '/fooA100%mBr' + }, + + // colons in keys + 'https://cdpn.io/test?custom%3Aid=12': { + href: 'https://cdpn.io/test?custom%3Aid=12', + protocol: 'https:', + hostname: 'cdpn.io', + hash: '', + search: '?custom%3Aid=12', + pathname: '/test', + query: { + 'custom:id': '12' + } + } +}; + +Object.keys(formatTests).forEach(function (u) { + test('format(' + u + ')', function () { + var expect = formatTests[u].href; + delete formatTests[u].href; + var actual = url.format(u); + var actualObj = url.format(formatTests[u]); + assert.equal(actual, expect, 'wonky format(' + u + ') == ' + expect + '\nactual:' + actual); + assert.equal(actualObj, expect, 'wonky format(' + JSON.stringify(formatTests[u]) + ') == ' + expect + '\nactual: ' + actualObj); + }); +}); + +/* + *[from, path, expected] + */ +var relativeTests = [ + [ + '/foo/bar/baz', 'quux', '/foo/bar/quux' + ], + [ + '/foo/bar/baz', 'quux/asdf', '/foo/bar/quux/asdf' + ], + [ + '/foo/bar/baz', 'quux/baz', '/foo/bar/quux/baz' + ], + [ + '/foo/bar/baz', '../quux/baz', '/foo/quux/baz' + ], + [ + '/foo/bar/baz', '/bar', '/bar' + ], + [ + '/foo/bar/baz/', 'quux', '/foo/bar/baz/quux' + ], + [ + '/foo/bar/baz/', 'quux/baz', '/foo/bar/baz/quux/baz' + ], + [ + '/foo/bar/baz', '../../../../../../../../quux/baz', '/quux/baz' + ], + [ + '/foo/bar/baz', '../../../../../../../quux/baz', '/quux/baz' + ], + [ + '/foo', '.', '/' + ], + [ + '/foo', '..', '/' + ], + [ + '/foo/', '.', '/foo/' + ], + [ + '/foo/', '..', '/' + ], + [ + '/foo/bar', '.', '/foo/' + ], + [ + '/foo/bar', '..', '/' + ], + [ + '/foo/bar/', '.', '/foo/bar/' + ], + [ + '/foo/bar/', '..', '/foo/' + ], + [ + 'foo/bar', '../../../baz', '../../baz' + ], + [ + 'foo/bar/', '../../../baz', '../baz' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', 'https:#hash2', 'https:///#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'https:/p/a/t/h?s#hash2', + 'https://p/a/t/h?s#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'https://u:p@h.com/p/a/t/h?s#hash2', + 'https://u:p@h.com/p/a/t/h?s#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'https:/a/b/c/d', + 'https://a/b/c/d' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'http:#hash2', + 'http://example.com/b//c//d;p?q#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'http:/p/a/t/h?s#hash2', + 'http://example.com/p/a/t/h?s#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'http://u:p@h.com/p/a/t/h?s#hash2', + 'http://u:p@h.com/p/a/t/h?s#hash2' + ], + [ + 'http://example.com/b//c//d;p?q#blarg', + 'http:/a/b/c/d', + 'http://example.com/a/b/c/d' + ], + [ + '/foo/bar/baz', '/../etc/passwd', '/etc/passwd' + ] +]; + +relativeTests.forEach(function (relativeTest) { + test('resolve(' + [relativeTest[0], relativeTest[1]] + ')', function () { + var a = url.resolve(relativeTest[0], relativeTest[1]), + e = relativeTest[2]; + assert.equal(a, e, 'resolve(' + [relativeTest[0], relativeTest[1]] + ') == ' + e + '\n actual=' + a); + }); +}); + +// https://github.com/joyent/node/issues/568 +[ + undefined, + null, + true, + false, + 0.0, + 0, + [], + {} +].forEach(function (val) { + test('parse(' + val + ')', function () { + assert['throws'](function () { url.parse(val); }, TypeError); + }); +}); + +/* + * + * Tests below taken from Chiron + * http://code.google.com/p/chironjs/source/browse/trunk/src/test/http/url.js + * + * Copyright (c) 2002-2008 Kris Kowal + * used with permission under MIT License + * + * Changes marked with @isaacs + */ + +var bases = [ + 'http://a/b/c/d;p?q', + 'http://a/b/c/d;p?q=1/2', + 'http://a/b/c/d;p=1/2?q', + 'fred:///s//a/b/c', + 'http:///s//a/b/c' +]; + +// [to, from, result] +var relativeTests2 = [ + // http://lists.w3.org/Archives/Public/uri/2004Feb/0114.html + [ + '../c', 'foo:a/b', 'foo:c' + ], + [ + 'foo:.', 'foo:a', 'foo:' + ], + [ + '/foo/../../../bar', 'zz:abc', 'zz:/bar' + ], + [ + '/foo/../bar', 'zz:abc', 'zz:/bar' + ], + // @isaacs Disagree. Not how web browsers resolve this. + [ + 'foo/../../../bar', 'zz:abc', 'zz:bar' + ], + // ['foo/../../../bar', 'zz:abc', 'zz:../../bar'], // @isaacs Added + [ + 'foo/../bar', 'zz:abc', 'zz:bar' + ], + [ + 'zz:.', 'zz:abc', 'zz:' + ], + [ + '/.', bases[0], 'http://a/' + ], + [ + '/.foo', bases[0], 'http://a/.foo' + ], + [ + '.foo', bases[0], 'http://a/b/c/.foo' + ], + + /* + * http://gbiv.com/protocols/uri/test/rel_examples1.html + * examples from RFC 2396 + */ + [ + 'g:h', bases[0], 'g:h' + ], + [ + 'g', bases[0], 'http://a/b/c/g' + ], + [ + './g', bases[0], 'http://a/b/c/g' + ], + [ + 'g/', bases[0], 'http://a/b/c/g/' + ], + [ + '/g', bases[0], 'http://a/g' + ], + [ + '//g', bases[0], 'http://g/' + ], + /* + * changed with RFC 2396bis + * ('?y', bases[0], 'http://a/b/c/d;p?y'], + */ + [ + '?y', bases[0], 'http://a/b/c/d;p?y' + ], + [ + 'g?y', bases[0], 'http://a/b/c/g?y' + ], + /* + * changed with RFC 2396bis + * ('#s', bases[0], CURRENT_DOC_URI + '#s'], + */ + [ + '#s', bases[0], 'http://a/b/c/d;p?q#s' + ], + [ + 'g#s', bases[0], 'http://a/b/c/g#s' + ], + [ + 'g?y#s', bases[0], 'http://a/b/c/g?y#s' + ], + [ + ';x', bases[0], 'http://a/b/c/;x' + ], + [ + 'g;x', bases[0], 'http://a/b/c/g;x' + ], + [ + 'g;x?y#s', bases[0], 'http://a/b/c/g;x?y#s' + ], + /* + * changed with RFC 2396bis + * ('', bases[0], CURRENT_DOC_URI], + */ + [ + '', bases[0], 'http://a/b/c/d;p?q' + ], + [ + '.', bases[0], 'http://a/b/c/' + ], + [ + './', bases[0], 'http://a/b/c/' + ], + [ + '..', bases[0], 'http://a/b/' + ], + [ + '../', bases[0], 'http://a/b/' + ], + [ + '../g', bases[0], 'http://a/b/g' + ], + [ + '../..', bases[0], 'http://a/' + ], + [ + '../../', bases[0], 'http://a/' + ], + [ + '../../g', bases[0], 'http://a/g' + ], + [ + '../../../g', bases[0], ('http://a/../g', 'http://a/g') + ], + [ + '../../../../g', bases[0], ('http://a/../../g', 'http://a/g') + ], + /* + * changed with RFC 2396bis + * ('/./g', bases[0], 'http://a/./g'], + */ + [ + '/./g', bases[0], 'http://a/g' + ], + /* + * changed with RFC 2396bis + * ('/../g', bases[0], 'http://a/../g'], + */ + [ + '/../g', bases[0], 'http://a/g' + ], + [ + 'g.', bases[0], 'http://a/b/c/g.' + ], + [ + '.g', bases[0], 'http://a/b/c/.g' + ], + [ + 'g..', bases[0], 'http://a/b/c/g..' + ], + [ + '..g', bases[0], 'http://a/b/c/..g' + ], + [ + './../g', bases[0], 'http://a/b/g' + ], + [ + './g/.', bases[0], 'http://a/b/c/g/' + ], + [ + 'g/./h', bases[0], 'http://a/b/c/g/h' + ], + [ + 'g/../h', bases[0], 'http://a/b/c/h' + ], + [ + 'g;x=1/./y', bases[0], 'http://a/b/c/g;x=1/y' + ], + [ + 'g;x=1/../y', bases[0], 'http://a/b/c/y' + ], + [ + 'g?y/./x', bases[0], 'http://a/b/c/g?y/./x' + ], + [ + 'g?y/../x', bases[0], 'http://a/b/c/g?y/../x' + ], + [ + 'g#s/./x', bases[0], 'http://a/b/c/g#s/./x' + ], + [ + 'g#s/../x', bases[0], 'http://a/b/c/g#s/../x' + ], + [ + 'http:g', bases[0], ('http:g', 'http://a/b/c/g') + ], + [ + 'http:', bases[0], ('http:', bases[0]) + ], + // not sure where this one originated + [ + '/a/b/c/./../../g', bases[0], 'http://a/a/g' + ], + + /* + * http://gbiv.com/protocols/uri/test/rel_examples2.html + * slashes in base URI's query args + */ + [ + 'g', bases[1], 'http://a/b/c/g' + ], + [ + './g', bases[1], 'http://a/b/c/g' + ], + [ + 'g/', bases[1], 'http://a/b/c/g/' + ], + [ + '/g', bases[1], 'http://a/g' + ], + [ + '//g', bases[1], 'http://g/' + ], + /* + * changed in RFC 2396bis + * ('?y', bases[1], 'http://a/b/c/?y'], + */ + [ + '?y', bases[1], 'http://a/b/c/d;p?y' + ], + [ + 'g?y', bases[1], 'http://a/b/c/g?y' + ], + [ + 'g?y/./x', bases[1], 'http://a/b/c/g?y/./x' + ], + [ + 'g?y/../x', bases[1], 'http://a/b/c/g?y/../x' + ], + [ + 'g#s', bases[1], 'http://a/b/c/g#s' + ], + [ + 'g#s/./x', bases[1], 'http://a/b/c/g#s/./x' + ], + [ + 'g#s/../x', bases[1], 'http://a/b/c/g#s/../x' + ], + [ + './', bases[1], 'http://a/b/c/' + ], + [ + '../', bases[1], 'http://a/b/' + ], + [ + '../g', bases[1], 'http://a/b/g' + ], + [ + '../../', bases[1], 'http://a/' + ], + [ + '../../g', bases[1], 'http://a/g' + ], + + /* + * http://gbiv.com/protocols/uri/test/rel_examples3.html + * slashes in path params + * all of these changed in RFC 2396bis + */ + [ + 'g', bases[2], 'http://a/b/c/d;p=1/g' + ], + [ + './g', bases[2], 'http://a/b/c/d;p=1/g' + ], + [ + 'g/', bases[2], 'http://a/b/c/d;p=1/g/' + ], + [ + 'g?y', bases[2], 'http://a/b/c/d;p=1/g?y' + ], + [ + ';x', bases[2], 'http://a/b/c/d;p=1/;x' + ], + [ + 'g;x', bases[2], 'http://a/b/c/d;p=1/g;x' + ], + [ + 'g;x=1/./y', bases[2], 'http://a/b/c/d;p=1/g;x=1/y' + ], + [ + 'g;x=1/../y', bases[2], 'http://a/b/c/d;p=1/y' + ], + [ + './', bases[2], 'http://a/b/c/d;p=1/' + ], + [ + '../', bases[2], 'http://a/b/c/' + ], + [ + '../g', bases[2], 'http://a/b/c/g' + ], + [ + '../../', bases[2], 'http://a/b/' + ], + [ + '../../g', bases[2], 'http://a/b/g' + ], + + /* + * http://gbiv.com/protocols/uri/test/rel_examples4.html + * double and triple slash, unknown scheme + */ + [ + 'g:h', bases[3], 'g:h' + ], + [ + 'g', bases[3], 'fred:///s//a/b/g' + ], + [ + './g', bases[3], 'fred:///s//a/b/g' + ], + [ + 'g/', bases[3], 'fred:///s//a/b/g/' + ], + [ + '/g', bases[3], 'fred:///g' + ], // may change to fred:///s//a/g + [ + '//g', bases[3], 'fred://g' + ], // may change to fred:///s//g + [ + '//g/x', bases[3], 'fred://g/x' + ], // may change to fred:///s//g/x + [ + '///g', bases[3], 'fred:///g' + ], + [ + './', bases[3], 'fred:///s//a/b/' + ], + [ + '../', bases[3], 'fred:///s//a/' + ], + [ + '../g', bases[3], 'fred:///s//a/g' + ], + + [ + '../../', bases[3], 'fred:///s//' + ], + [ + '../../g', bases[3], 'fred:///s//g' + ], + [ + '../../../g', bases[3], 'fred:///s/g' + ], + // may change to fred:///s//a/../../../g + [ + '../../../../g', bases[3], 'fred:///g' + ], + + /* + * http://gbiv.com/protocols/uri/test/rel_examples5.html + * double and triple slash, well-known scheme + */ + [ + 'g:h', bases[4], 'g:h' + ], + [ + 'g', bases[4], 'http:///s//a/b/g' + ], + [ + './g', bases[4], 'http:///s//a/b/g' + ], + [ + 'g/', bases[4], 'http:///s//a/b/g/' + ], + [ + '/g', bases[4], 'http:///g' + ], // may change to http:///s//a/g + [ + '//g', bases[4], 'http://g/' + ], // may change to http:///s//g + [ + '//g/x', bases[4], 'http://g/x' + ], // may change to http:///s//g/x + [ + '///g', bases[4], 'http:///g' + ], + [ + './', bases[4], 'http:///s//a/b/' + ], + [ + '../', bases[4], 'http:///s//a/' + ], + [ + '../g', bases[4], 'http:///s//a/g' + ], + [ + '../../', bases[4], 'http:///s//' + ], + [ + '../../g', bases[4], 'http:///s//g' + ], + // may change to http:///s//a/../../g + [ + '../../../g', bases[4], 'http:///s/g' + ], + // may change to http:///s//a/../../../g + [ + '../../../../g', bases[4], 'http:///g' + ], + + // from Dan Connelly's tests in http://www.w3.org/2000/10/swap/uripath.py + [ + 'bar:abc', 'foo:xyz', 'bar:abc' + ], + [ + '../abc', 'http://example/x/y/z', 'http://example/x/abc' + ], + [ + 'http://example/x/abc', 'http://example2/x/y/z', 'http://example/x/abc' + ], + [ + '../r', 'http://ex/x/y/z', 'http://ex/x/r' + ], + [ + 'q/r', 'http://ex/x/y', 'http://ex/x/q/r' + ], + [ + 'q/r#s', 'http://ex/x/y', 'http://ex/x/q/r#s' + ], + [ + 'q/r#s/t', 'http://ex/x/y', 'http://ex/x/q/r#s/t' + ], + [ + 'ftp://ex/x/q/r', 'http://ex/x/y', 'ftp://ex/x/q/r' + ], + [ + '', 'http://ex/x/y', 'http://ex/x/y' + ], + [ + '', 'http://ex/x/y/', 'http://ex/x/y/' + ], + [ + '', 'http://ex/x/y/pdq', 'http://ex/x/y/pdq' + ], + [ + 'z/', 'http://ex/x/y/', 'http://ex/x/y/z/' + ], + [ + '#Animal', + 'file:/swap/test/animal.rdf', + 'file:/swap/test/animal.rdf#Animal' + ], + [ + '../abc', 'file:/e/x/y/z', 'file:/e/x/abc' + ], + [ + '/example/x/abc', 'file:/example2/x/y/z', 'file:/example/x/abc' + ], + [ + '../r', 'file:/ex/x/y/z', 'file:/ex/x/r' + ], + [ + '/r', 'file:/ex/x/y/z', 'file:/r' + ], + [ + 'q/r', 'file:/ex/x/y', 'file:/ex/x/q/r' + ], + [ + 'q/r#s', 'file:/ex/x/y', 'file:/ex/x/q/r#s' + ], + [ + 'q/r#', 'file:/ex/x/y', 'file:/ex/x/q/r#' + ], + [ + 'q/r#s/t', 'file:/ex/x/y', 'file:/ex/x/q/r#s/t' + ], + [ + 'ftp://ex/x/q/r', 'file:/ex/x/y', 'ftp://ex/x/q/r' + ], + [ + '', 'file:/ex/x/y', 'file:/ex/x/y' + ], + [ + '', 'file:/ex/x/y/', 'file:/ex/x/y/' + ], + [ + '', 'file:/ex/x/y/pdq', 'file:/ex/x/y/pdq' + ], + [ + 'z/', 'file:/ex/x/y/', 'file:/ex/x/y/z/' + ], + [ + 'file://meetings.example.com/cal#m1', + 'file:/devel/WWW/2000/10/swap/test/reluri-1.n3', + 'file://meetings.example.com/cal#m1' + ], + [ + 'file://meetings.example.com/cal#m1', + 'file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3', + 'file://meetings.example.com/cal#m1' + ], + [ + './#blort', 'file:/some/dir/foo', 'file:/some/dir/#blort' + ], + [ + './#', 'file:/some/dir/foo', 'file:/some/dir/#' + ], + // Ryan Lee + [ + './', 'http://example/x/abc.efg', 'http://example/x/' + ], + + /* + * Graham Klyne's tests + * http://www.ninebynine.org/Software/HaskellUtils/Network/UriTest.xls + * 01-31 are from Connelly's cases + */ + + // 32-49 + [ + './q:r', 'http://ex/x/y', 'http://ex/x/q:r' + ], + [ + './p=q:r', 'http://ex/x/y', 'http://ex/x/p=q:r' + ], + [ + '?pp/rr', 'http://ex/x/y?pp/qq', 'http://ex/x/y?pp/rr' + ], + [ + 'y/z', 'http://ex/x/y?pp/qq', 'http://ex/x/y/z' + ], + [ + 'local/qual@domain.org#frag', + 'mailto:local', + 'mailto:local/qual@domain.org#frag' + ], + [ + 'more/qual2@domain2.org#frag', + 'mailto:local/qual1@domain1.org', + 'mailto:local/more/qual2@domain2.org#frag' + ], + [ + 'y?q', 'http://ex/x/y?q', 'http://ex/x/y?q' + ], + [ + '/x/y?q', 'http://ex?p', 'http://ex/x/y?q' + ], + [ + 'c/d', 'foo:a/b', 'foo:a/c/d' + ], + [ + '/c/d', 'foo:a/b', 'foo:/c/d' + ], + [ + '', 'foo:a/b?c#d', 'foo:a/b?c' + ], + [ + 'b/c', 'foo:a', 'foo:b/c' + ], + [ + '../b/c', 'foo:/a/y/z', 'foo:/a/b/c' + ], + [ + './b/c', 'foo:a', 'foo:b/c' + ], + [ + '/./b/c', 'foo:a', 'foo:/b/c' + ], + [ + '../../d', 'foo://a//b/c', 'foo://a/d' + ], + [ + '.', 'foo:a', 'foo:' + ], + [ + '..', 'foo:a', 'foo:' + ], + + /* + * 50-57[cf. TimBL comments -- + * http://lists.w3.org/Archives/Public/uri/2003Feb/0028.html, + * http://lists.w3.org/Archives/Public/uri/2003Jan/0008.html) + */ + [ + 'abc', 'http://example/x/y%2Fz', 'http://example/x/abc' + ], + [ + '../../x%2Fabc', 'http://example/a/x/y/z', 'http://example/a/x%2Fabc' + ], + [ + '../x%2Fabc', 'http://example/a/x/y%2Fz', 'http://example/a/x%2Fabc' + ], + [ + 'abc', 'http://example/x%2Fy/z', 'http://example/x%2Fy/abc' + ], + [ + 'q%3Ar', 'http://ex/x/y', 'http://ex/x/q%3Ar' + ], + [ + '/x%2Fabc', 'http://example/x/y%2Fz', 'http://example/x%2Fabc' + ], + [ + '/x%2Fabc', 'http://example/x/y/z', 'http://example/x%2Fabc' + ], + [ + '/x%2Fabc', 'http://example/x/y%2Fz', 'http://example/x%2Fabc' + ], + + // 70-77 + [ + 'local2@domain2', 'mailto:local1@domain1?query1', 'mailto:local2@domain2' + ], + [ + 'local2@domain2?query2', + 'mailto:local1@domain1', + 'mailto:local2@domain2?query2' + ], + [ + 'local2@domain2?query2', + 'mailto:local1@domain1?query1', + 'mailto:local2@domain2?query2' + ], + [ + '?query2', 'mailto:local@domain?query1', 'mailto:local@domain?query2' + ], + [ + 'local@domain?query2', 'mailto:?query1', 'mailto:local@domain?query2' + ], + [ + '?query2', 'mailto:local@domain?query1', 'mailto:local@domain?query2' + ], + [ + 'http://example/a/b?c/../d', 'foo:bar', 'http://example/a/b?c/../d' + ], + [ + 'http://example/a/b#c/../d', 'foo:bar', 'http://example/a/b#c/../d' + ], + + /* + * 82-88 + * @isaacs Disagree. Not how browsers do it. + * ['http:this', 'http://example.org/base/uri', 'http:this'], + * @isaacs Added + */ + [ + 'http:this', 'http://example.org/base/uri', 'http://example.org/base/this' + ], + [ + 'http:this', 'http:base', 'http:this' + ], + [ + './/g', 'f:/a', 'f://g' + ], + [ + 'b/c//d/e', 'f://example.org/base/a', 'f://example.org/base/b/c//d/e' + ], + [ + 'm2@example.ord/c2@example.org', + 'mid:m@example.ord/c@example.org', + 'mid:m@example.ord/m2@example.ord/c2@example.org' + ], + [ + 'mini1.xml', + 'file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/', + 'file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml' + ], + [ + '../b/c', 'foo:a/y/z', 'foo:a/b/c' + ], + + // changeing auth + [ + 'http://diff:auth@www.example.com', + 'http://asdf:qwer@www.example.com', + 'http://diff:auth@www.example.com/' + ] +]; + +relativeTests2.forEach(function (relativeTest) { + test('resolve(' + [relativeTest[1], relativeTest[0]] + ')', function () { + var a = url.resolve(relativeTest[1], relativeTest[0]), + e = relativeTest[2]; + assert.equal(a, e, 'resolve(' + [relativeTest[1], relativeTest[0]] + ') == ' + e + '\n actual=' + a); + }); +}); + +/* + * if format and parse are inverse operations then + * resolveObject(parse(x), y) == parse(resolve(x, y)) + */ + +// host and hostname are special, in this case a '' value is important +/* eslint no-unused-vars: 1 */ +var emptyIsImportant = { host: true, hostname: '' }; + +// format: [from, path, expected] +relativeTests.forEach(function (relativeTest) { + test('resolveObject(' + [relativeTest[0], relativeTest[1]] + ')', function () { + var actual = url.resolveObject(url.parse(relativeTest[0]), relativeTest[1]); + var expected = url.parse(relativeTest[2]); + + assert.deepEqual(actual, expected); + + expected = relativeTest[2]; + actual = url.format(actual); + + assert.equal(actual, expected, 'format(' + actual + ') == ' + expected + '\nactual:' + actual); + }); +}); + +test('format with querystring', function () { + var obj = { protocol: 'https:', host: 'google.com', pathname: 'test', query: { message: ['value1', 'value2'], 'custom:id': 12 } }; + + var actual = url.format(obj); + var expected = nodeURL.format(obj); + + assert.equal(actual, expected, 'format(' + actual + ') == ' + expected + '\nactual:' + actual); +}); + +/* + * format: [to, from, result] + * the test: ['.//g', 'f:/a', 'f://g'] is a fundamental problem + * url.parse('f:/a') does not have a host + * url.resolve('f:/a', './/g') does not have a host because you have moved + * down to the g directory. i.e. f: //g, however when this url is parsed + * f:// will indicate that the host is g which is not the case. + * it is unclear to me how to keep this information from being lost + * it may be that a pathname of ////g should collapse to /g but this seems + * to be a lot of work for an edge case. Right now I remove the test + */ +if (relativeTests2[181][0] === './/g' && relativeTests2[181][1] === 'f:/a' && relativeTests2[181][2] === 'f://g') { + relativeTests2.splice(181, 1); +} + +relativeTests2.forEach(function (relativeTest) { + test('resolveObject(' + [relativeTest[1], relativeTest[0]] + ')', function () { + var actual = url.resolveObject(url.parse(relativeTest[1]), relativeTest[0]), + expected = url.parse(relativeTest[2]); + + assert.deepEqual(actual, expected); + + var expected = relativeTest[2], + actual = url.format(actual); + + assert.equal(actual, expected, 'format(' + relativeTest[1] + ') == ' + expected + '\nactual:' + actual); + }); +}); diff --git a/live2d/node_modules/url/test/mocha.opts b/live2d/node_modules/url/test/mocha.opts new file mode 100644 index 0000000..9e2cb5e --- /dev/null +++ b/live2d/node_modules/url/test/mocha.opts @@ -0,0 +1,2 @@ +test/*.js +--recursive diff --git a/live2d/node_modules/url/url.js b/live2d/node_modules/url/url.js new file mode 100644 index 0000000..a2d65e1 --- /dev/null +++ b/live2d/node_modules/url/url.js @@ -0,0 +1,776 @@ +/* + * Copyright Joyent, Inc. and other Node 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. + */ + +'use strict'; + +var punycode = require('punycode/'); + +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} + +// Reference: RFC 3986, RFC 1808, RFC 2396 + +/* + * define these here so at least they only have to be + * compiled once on the first module load. + */ +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/, + + /* + * RFC 2396: characters reserved for delimiting URLs. + * We actually just auto-escape these. + */ + delims = [ + '<', '>', '"', '`', ' ', '\r', '\n', '\t' + ], + + // RFC 2396: characters not allowed for various reasons. + unwise = [ + '{', '}', '|', '\\', '^', '`' + ].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + /* + * Characters that are never ever allowed in a hostname. + * Note that any invalid chars are also handled, but these + * are the ones that are *expected* to be seen, so we fast-path + * them. + */ + nonHostChars = [ + '%', '/', '?', ';', '#' + ].concat(autoEscape), + hostEndingChars = [ + '/', '?', '#' + ], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + javascript: true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + javascript: true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + http: true, + https: true, + ftp: true, + gopher: true, + file: true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = require('qs'); + +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && typeof url === 'object' && url instanceof Url) { return url; } + + var u = new Url(); + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} + +Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) { + if (typeof url !== 'string') { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + /* + * Copy chrome, IE, opera backslash-handling behavior. + * Back slashes before the query string get converted to forward slashes + * See: https://code.google.com/p/chromium/issues/detail?id=25916 + */ + var queryIndex = url.indexOf('?'), + splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + /* + * trim before proceeding. + * This is to support parse stuff like " http://foo.com \n" + */ + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + /* + * figure out if it's got a host + * user@server is *always* interpreted as a hostname, and url + * resolution will treat //foo/bar as host=foo,path=bar because that's + * how the browser resolves relative URLs. + */ + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@/]+@[^@/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && (slashes || (proto && !slashedProtocol[proto]))) { + + /* + * there's a hostname. + * the first instance of /, ?, ;, or # ends the host. + * + * If there is an @ in the hostname, then non-host chars *are* allowed + * to the left of the last @ sign, unless some host-ending character + * comes *before* the @-sign. + * URLs are obnoxious. + * + * ex: + * http://a@b@c/ => user:a@b host:c + * http://a@b?@c => user:a host:c path:/?@c + */ + + /* + * v0.12 TODO(isaacs): This is not quite how Chrome does things. + * Review our test case against browsers more comprehensively. + */ + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { hostEnd = hec; } + } + + /* + * at this point, either we have an explicit point where the + * auth portion cannot go past, or the last @ char is the decider. + */ + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + /* + * atSign must be in auth portion. + * http://a@b/c@d => host:b auth:a path:/c@d + */ + atSign = rest.lastIndexOf('@', hostEnd); + } + + /* + * Now we have a portion which is definitely the auth. + * Pull that off. + */ + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { hostEnd = hec; } + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) { hostEnd = rest.length; } + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + /* + * we've indicated that there is a hostname, + * so even if it's empty, it has to be present. + */ + this.hostname = this.hostname || ''; + + /* + * if hostname begins with [ and ends with ] + * assume that it's an IPv6 address. + */ + var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) { continue; } + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + /* + * we replace non-ASCII char with a temporary placeholder + * we need this to make sure size of hostname is not + * broken by replacing non-ASCII by nothing + */ + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + /* + * IDNA Support: Returns a punycoded representation of "domain". + * It only converts parts of the domain name that + * have non-ASCII characters, i.e. it doesn't matter if + * you call it with a domain that already is ASCII-only. + */ + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + /* + * strip [ and ] from the hostname + * the host field still retains them, though + */ + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + /* + * now rest is set to the post-host stuff. + * chop off any delim chars. + */ + if (!unsafeProtocol[lowerProto]) { + + /* + * First, make 100% sure that any "autoEscape" chars get + * escaped, even if encodeURIComponent doesn't think they + * need to be. + */ + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) { continue; } + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) { this.pathname = rest; } + if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) { + this.pathname = '/'; + } + + // to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + /* + * ensure it's an object, and not a string url. + * If it's an obj, this is a no-op. + * this way, you can call url_format() on strings + * to clean up potentially wonky urls. + */ + if (typeof obj === 'string') { obj = urlParse(obj); } + if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); } + return obj.format(); +} + +Url.prototype.format = function () { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && typeof this.query === 'object' && Object.keys(this.query).length) { + query = querystring.stringify(this.query, { + arrayFormat: 'repeat', + addQueryPrefix: false + }); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; } + + /* + * only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + * unless they had them to begin with. + */ + if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; } + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; } + if (search && search.charAt(0) !== '?') { search = '?' + search; } + + pathname = pathname.replace(/[?#]/g, function (match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function (relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) { return relative; } + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function (relative) { + if (typeof relative === 'string') { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + /* + * hash is always overridden, no matter what. + * even href="" will remove it. + */ + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') { result[rkey] = relative[rkey]; } + } + + // urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) { + result.pathname = '/'; + result.path = result.pathname; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + /* + * if it's a known url protocol, then changing + * the protocol does weird things + * first, if it's not file:, then we MUST have a host, + * and if there was a path + * to begin with, then we MUST have a path. + * if it is file:, then the host is dropped, + * because that's known to be hostless. + * anything else is assumed to be absolute. + */ + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())) { } + if (!relative.host) { relative.host = ''; } + if (!relative.hostname) { relative.hostname = ''; } + if (relPath[0] !== '') { relPath.unshift(''); } + if (relPath.length < 2) { relPath.unshift(''); } + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/', + isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/', + mustEndAbs = isRelAbs || isSourceAbs || (result.host && relative.pathname), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + /* + * if the url is a non-slashed url, then relative + * links like ../.. should be able + * to crawl up to the hostname, as well. This is strange. + * result.protocol has already been set by now. + * Later on, put the first path part into the host field. + */ + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') { srcPath[0] = result.host; } else { srcPath.unshift(result.host); } + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') { relPath[0] = relative.host; } else { relPath.unshift(relative.host); } + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = relative.host || relative.host === '' ? relative.host : result.host; + result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + /* + * it's relative + * throw away the existing file, and take the new path instead. + */ + if (!srcPath) { srcPath = []; } + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (relative.search != null) { + /* + * just pull out the search. + * like href='?foo'. + * Put this after the other two cases because it simplifies the booleans + */ + if (psychotic) { + result.host = srcPath.shift(); + result.hostname = result.host; + /* + * occationaly the auth can get stuck only in host + * this especially happens in cases like + * url.resolveObject('mailto:local1@domain1', 'local2@domain2') + */ + var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.hostname = authInHost.shift(); + result.host = result.hostname; + } + } + result.search = relative.search; + result.query = relative.query; + // to support http.request + if (result.pathname !== null || result.search !== null) { + result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + /* + * no path at all. easy. + * we've already handled the other stuff above. + */ + result.pathname = null; + // to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + /* + * if a url ENDs in . or .., then it must get a trailing slash. + * however, if it ends in anything else non-slashy, + * then it must NOT get a trailing slash. + */ + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; + + /* + * strip single dots, resolve double dots to parent dir + * if the path tries to go above the root, `up` ends up > 0 + */ + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; + result.host = result.hostname; + /* + * occationaly the auth can get stuck only in host + * this especially happens in cases like + * url.resolveObject('mailto:local1@domain1', 'local2@domain2') + */ + var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.hostname = authInHost.shift(); + result.host = result.hostname; + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (srcPath.length > 0) { + result.pathname = srcPath.join('/'); + } else { + result.pathname = null; + result.path = null; + } + + // to support request.http + if (result.pathname !== null || result.search !== null) { + result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function () { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) { this.hostname = host; } +}; + +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; + +exports.Url = Url; diff --git a/live2d/node_modules/wrappy/LICENSE b/live2d/node_modules/wrappy/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/live2d/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +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. diff --git a/live2d/node_modules/wrappy/README.md b/live2d/node_modules/wrappy/README.md new file mode 100644 index 0000000..98eab25 --- /dev/null +++ b/live2d/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/live2d/node_modules/wrappy/package.json b/live2d/node_modules/wrappy/package.json new file mode 100644 index 0000000..1307520 --- /dev/null +++ b/live2d/node_modules/wrappy/package.json @@ -0,0 +1,29 @@ +{ + "name": "wrappy", + "version": "1.0.2", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "files": [ + "wrappy.js" + ], + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^2.3.1" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy" +} diff --git a/live2d/node_modules/wrappy/wrappy.js b/live2d/node_modules/wrappy/wrappy.js new file mode 100644 index 0000000..bb7e7d6 --- /dev/null +++ b/live2d/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/live2d/package-lock.json b/live2d/package-lock.json new file mode 100644 index 0000000..a458bf7 --- /dev/null +++ b/live2d/package-lock.json @@ -0,0 +1,882 @@ +{ + "name": "live2d", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "pixi-live2d-display": "^0.4.0" + } + }, + "node_modules/@pixi/constants": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-6.5.10.tgz", + "integrity": "sha512-PUF2Y9YISRu5eVrVVHhHCWpc/KmxQTg3UH8rIUs8UI9dCK41/wsPd3pEahzf7H47v7x1HCohVZcFO3XQc1bUDw==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/core": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-6.5.10.tgz", + "integrity": "sha512-Gdzp5ENypyglvsh5Gv3teUZnZnmizo4xOsL+QqmWALdFlJXJwLJMVhKVThV/q/095XR6i4Ou54oshn+m4EkuFw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/offscreencanvas": "^2019.6.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/pixijs" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/extensions": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/runner": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/ticker": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/display": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-6.5.10.tgz", + "integrity": "sha512-NxFdDDxlbH5fQkzGHraLGoTMucW9pVgXqQm13TSmkA3NWIi/SItHL4qT2SI8nmclT9Vid1VDEBCJFAbdeuQw1Q==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/extensions": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/extensions/-/extensions-6.5.10.tgz", + "integrity": "sha512-EIUGza+E+sCy3dupuIjvRK/WyVyfSzHb5XsxRaxNrPwvG1iIUIqNqZ3owLYCo4h17fJWrj/yXVufNNtUKQccWQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/loaders": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/loaders/-/loaders-6.5.10.tgz", + "integrity": "sha512-AuK7mXBmyVsDFL9DDFPB8sqP8fwQ2NOktvu98bQuJl0/p/UeK/0OAQnF3wcf3FeBv5YGXfNHL21c2DCisjKfTg==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/math": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-6.5.10.tgz", + "integrity": "sha512-fxeu7ykVbMGxGV2S3qRTupHToeo1hdWBm8ihyURn3BMqJZe2SkZEECPd5RyvIuuNUtjRnmhkZRnF3Jsz2S+L0g==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/runner": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/runner/-/runner-6.5.10.tgz", + "integrity": "sha512-4HiHp6diCmigJT/DSbnqQP62OfWKmZB7zPWMdV1AEdr4YT1QxzXAW1wHg7dkoEfyTHqZKl0tm/zcqKq/iH7tMA==", + "license": "MIT", + "peer": true + }, + "node_modules/@pixi/settings": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-6.5.10.tgz", + "integrity": "sha512-ypAS5L7pQ2Qb88yQK72bXtc7sD8OrtLWNXdZ/gnw5kwSWCFaOSoqhKqJCXrR5DQtN98+RQefwbEAmMvqobhFyw==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10" + } + }, + "node_modules/@pixi/sprite": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/sprite/-/sprite-6.5.10.tgz", + "integrity": "sha512-UiK+8LgM9XQ/SBDKjRgZ8WggdOSlFRXqiWjEZVmNkiyU8HvXeFzWPRhpc8RR1zDwAUhZWKtMhF8X/ba9m+z2lg==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/core": "6.5.10", + "@pixi/display": "6.5.10", + "@pixi/math": "6.5.10", + "@pixi/settings": "6.5.10", + "@pixi/utils": "6.5.10" + } + }, + "node_modules/@pixi/ticker": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/ticker/-/ticker-6.5.10.tgz", + "integrity": "sha512-UqX1XYtzqFSirmTOy8QAK4Ccg4KkIZztrBdRPKwFSOEiKAJoGDCSBmyQBo/9aYQKGObbNnrJ7Hxv3/ucg3/1GA==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "@pixi/extensions": "6.5.10", + "@pixi/settings": "6.5.10" + } + }, + "node_modules/@pixi/utils": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-6.5.10.tgz", + "integrity": "sha512-4f4qDMmAz9IoSAe08G2LAxUcEtG9jSdudfsMQT2MG+OpfToirboE6cNoO0KnLCvLzDVE/mfisiQ9uJbVA9Ssdw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/earcut": "^2.1.0", + "earcut": "^2.2.4", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + }, + "peerDependencies": { + "@pixi/constants": "6.5.10", + "@pixi/settings": "6.5.10" + } + }, + "node_modules/@types/earcut": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@types/earcut/-/earcut-2.1.4.tgz", + "integrity": "sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/offscreencanvas": { + "version": "2019.7.3", + "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", + "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", + "license": "MIT", + "peer": true + }, + "node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "license": "MIT", + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", + "license": "ISC", + "peer": true + }, + "node_modules/email-addresses": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", + "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==", + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eventemitter3": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", + "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==", + "license": "MIT", + "peer": true + }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "license": "MIT", + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "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-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gh-pages": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-4.0.0.tgz", + "integrity": "sha512-p8S0T3aGJc68MtwOcZusul5qPSNZCalap3NWbhRUZYu1YOdp+EjZ+4kPmRM8h3NNRdqw00yuevRjlkuSzCn7iQ==", + "license": "MIT", + "dependencies": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^8.1.0", + "globby": "^6.1.0" + }, + "bin": { + "gh-pages": "bin/gh-pages.js", + "gh-pages-clean": "bin/gh-pages-clean.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", + "peer": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "peer": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pixi-live2d-display": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/pixi-live2d-display/-/pixi-live2d-display-0.4.0.tgz", + "integrity": "sha512-xeYC6y4Y0Bxe9ksWNlGFZC1rII/MPrzPQK7t1c3ubA8RhkOISIqHJl38fNumXqhGEs+yItmgDOkFT+9dsyGDjA==", + "license": "MIT", + "dependencies": { + "gh-pages": "^4.0.0" + }, + "peerDependencies": { + "@pixi/core": "^6", + "@pixi/display": "^6", + "@pixi/loaders": "^6", + "@pixi/math": "^6", + "@pixi/sprite": "^6", + "@pixi/utils": "^6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "license": "MIT", + "peer": true + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "peer": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "license": "MIT", + "peer": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "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==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "license": "MIT", + "peer": true, + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/live2d/package.json b/live2d/package.json new file mode 100644 index 0000000..0cfcca6 --- /dev/null +++ b/live2d/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "pixi-live2d-display": "^0.4.0" + } +} diff --git a/live2d/waifu-tips.js b/live2d/waifu-tips.js index a05f560..f57c572 100644 --- a/live2d/waifu-tips.js +++ b/live2d/waifu-tips.js @@ -1,3 +1,7 @@ +import * as PIXI from "pixi.js"; +import { Live2DModel } from "pixi-live2d-display"; + +window.PIXI = PIXI; function ap_init() { $(".aplayer-body").addClass("my-hide"); ap.lrc.hide(); //初始化时隐藏歌词 @@ -192,7 +196,8 @@ function loadWidget() { } modelTexturesId = 0; // 材质ID } - loadModel(modelId, modelTexturesId); + // loadModel(modelId, modelTexturesId); + loadModelPixi(modelId, modelTexturesId); fetch(`${live2d_path}waifu-tips.json`) .then(response => response.json()) .then(registerEventListener); @@ -218,8 +223,39 @@ function loadWidget() { let modelId = localStorage.getItem("modelId"); if (!modelList) await loadModelList(); let index = (++modelId >= modelList.models.length) ? 0 : modelId; - loadModel(index, 0, modelList.messages[index]); + // loadModel(index, 0, modelList.messages[index]); + loadModelPixi(index, 0, modelList.messages[index]); } + + async function loadModelPixi(modelId, modelTexturesId, message) { + localStorage.setItem("modelId", modelId); + localStorage.setItem("modelTexturesId", modelTexturesId); + showMessage(message, 4000, 10); + const jsonpath = `${live2d_path}model/${target}/index.json`; + const element = document.getElementById(modelId); + const app = new PIXI.Application({ + view: element, + transparent: true, + }); + const model = await Live2DModel.from(jsonpath); + + app.stage.addChild(model); + + const parentWidth = element.width; + const parentHeight = element.height; + // Scale to fit the stage + const ratio = Math.min( + parentWidth / model.width, + parentHeight / model.height + ); + model.scale.set(ratio, ratio); + // Align bottom and center horizontally + + model.x = (parentWidth - model.width) / 2; + model.y = parentHeight - model.height; + + } + } function initWidget() {